root/ompi/mca/io/romio321/romio/mpi-io/iwrite_all.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_File_iwrite_all
  2. MPIOI_File_iwrite_all

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /*
   3  *  (C) 2014 by Argonne National Laboratory.
   4  *      See COPYRIGHT in top-level directory.
   5  */
   6 
   7 #include "mpioimpl.h"
   8 
   9 #ifdef HAVE_WEAK_SYMBOLS
  10 
  11 #if defined(HAVE_PRAGMA_WEAK)
  12 #pragma weak MPI_File_iwrite_all = PMPI_File_iwrite_all
  13 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  14 #pragma _HP_SECONDARY_DEF PMPI_File_iwrite_all MPI_File_iwrite_all
  15 #elif defined(HAVE_PRAGMA_CRI_DUP)
  16 #pragma _CRI duplicate MPI_File_iwrite_all as PMPI_File_iwrite_all
  17 /* end of weak pragmas */
  18 #elif defined(HAVE_WEAK_ATTRIBUTE)
  19 int MPI_File_iwrite_all(MPI_File fh, const void *buf, int count, MPI_Datatype datatype,
  20                         MPI_Request *request)
  21     __attribute__((weak,alias("PMPI_File_iwrite_all")));
  22 #endif
  23 
  24 /* Include mapping from MPI->PMPI */
  25 #define MPIO_BUILD_PROFILING
  26 #include "mpioprof.h"
  27 #endif
  28 
  29 #ifdef HAVE_MPI_GREQUEST
  30 #include "mpiu_greq.h"
  31 #endif
  32 
  33 /*@
  34     MPI_File_iwrite_all - Nonblocking collective write using individual file pointer
  35 
  36 Input Parameters:
  37 . fh - file handle (handle)
  38 . buf - initial address of buffer (choice)
  39 . count - number of elements in buffer (nonnegative integer)
  40 . datatype - datatype of each buffer element (handle)
  41 
  42 Output Parameters:
  43 . request - request object (handle)
  44 
  45 .N fortran
  46 @*/
  47 int MPI_File_iwrite_all(MPI_File fh, ROMIO_CONST void *buf, int count,
  48                         MPI_Datatype datatype, MPI_Request *request)
  49 {
  50     int error_code;
  51     static char myname[] = "MPI_FILE_IWRITE_ALL";
  52 #ifdef MPI_hpux
  53     int fl_xmpi;
  54 
  55     HPMP_IO_START(fl_xmpi, BLKMPIFILEIWRITEALL, TRDTBLOCK, fh, datatype, count);
  56 #endif /* MPI_hpux */
  57 
  58     error_code = MPIOI_File_iwrite_all(fh, (MPI_Offset) 0,
  59                       ADIO_INDIVIDUAL, buf,
  60                       count, datatype, myname, request);
  61 
  62 #ifdef MPI_hpux
  63     HPMP_IO_END(fl_xmpi, fh, datatype, count);
  64 #endif /* MPI_hpux */
  65 
  66     return error_code;
  67 }
  68 
  69 /* Note: MPIOI_File_iwrite_all also used by MPI_File_iwrite_at_all */
  70 /* prevent multiple definitions of this routine */
  71 #ifdef MPIO_BUILD_PROFILING
  72 int MPIOI_File_iwrite_all(MPI_File fh,
  73             MPI_Offset offset,
  74             int file_ptr_type,
  75             const void *buf,
  76             int count,
  77             MPI_Datatype datatype,
  78             char *myname,
  79             MPI_Request *request)
  80 {
  81     int error_code;
  82     MPI_Count datatype_size;
  83     ADIO_File adio_fh;
  84     void *e32buf=NULL;
  85     const void *xbuf=NULL;
  86 
  87     ROMIO_THREAD_CS_ENTER();
  88 
  89     adio_fh = MPIO_File_resolve(fh);
  90 
  91     /* --BEGIN ERROR HANDLING-- */
  92     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
  93     MPIO_CHECK_COUNT(adio_fh, count, myname, error_code);
  94     MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code);
  95 
  96     if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0)
  97     {
  98         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
  99                           myname, __LINE__, MPI_ERR_ARG,
 100                           "**iobadoffset", 0);
 101         error_code = MPIO_Err_return_file(adio_fh, error_code);
 102         goto fn_exit;
 103     }
 104     /* --END ERROR HANDLING-- */
 105 
 106     MPI_Type_size_x(datatype, &datatype_size);
 107 
 108     /* --BEGIN ERROR HANDLING-- */
 109     MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, myname, error_code);
 110     MPIO_CHECK_WRITABLE(adio_fh, myname, error_code);
 111     MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code);
 112     MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
 113     /* --END ERROR HANDLING-- */
 114 
 115     xbuf = buf;
 116     if (adio_fh->is_external32) {
 117         error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf);
 118         if (error_code != MPI_SUCCESS)
 119             goto fn_exit;
 120 
 121         xbuf = e32buf;
 122     }
 123 
 124     ADIO_IwriteStridedColl(adio_fh, xbuf, count, datatype, file_ptr_type,
 125                            offset, request, &error_code);
 126 
 127     /* --BEGIN ERROR HANDLING-- */
 128     if (error_code != MPI_SUCCESS)
 129     error_code = MPIO_Err_return_file(adio_fh, error_code);
 130     /* --END ERROR HANDLING-- */
 131 
 132 fn_exit:
 133     if (e32buf != NULL) ADIOI_Free(e32buf);
 134     ROMIO_THREAD_CS_EXIT();
 135 
 136     return error_code;
 137 }
 138 #endif

/* [<][>][^][v][top][bottom][index][help] */