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

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_File_iread_all
  2. MPIOI_File_iread_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_iread_all = PMPI_File_iread_all
  13 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  14 #pragma _HP_SECONDARY_DEF PMPI_File_iread_all MPI_File_iread_all
  15 #elif defined(HAVE_PRAGMA_CRI_DUP)
  16 #pragma _CRI duplicate MPI_File_iread_all as PMPI_File_iread_all
  17 /* end of weak pragmas */
  18 #elif defined(HAVE_WEAK_ATTRIBUTE)
  19 int MPI_File_iread_all(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
  20                        MPI_Request *request)
  21     __attribute__((weak,alias("PMPI_File_iread_all")));
  22 #endif
  23 
  24 /* Include mapping from MPI->PMPI */
  25 #define MPIO_BUILD_PROFILING
  26 #include "mpioprof.h"
  27 #endif
  28 
  29 #if HAVE_MPI_GREQUEST
  30 #include "mpiu_greq.h"
  31 #endif
  32 
  33 /*@
  34     MPI_File_iread_all - Nonblocking collective read using individual file pointer
  35 
  36 Input Parameters:
  37 . fh - file handle (handle)
  38 . count - number of elements in buffer (nonnegative integer)
  39 . datatype - datatype of each buffer element (handle)
  40 
  41 Output Parameters:
  42 . buf - initial address of buffer (choice)
  43 . request - request object (handle)
  44 
  45 .N fortran
  46 @*/
  47 int MPI_File_iread_all(MPI_File fh, void *buf, int count,
  48                        MPI_Datatype datatype, MPI_Request *request)
  49 {
  50     int error_code;
  51     static char myname[] = "MPI_FILE_IREAD_ALL";
  52 #ifdef MPI_hpux
  53     int fl_xmpi;
  54 
  55     HPMP_IO_START(fl_xmpi, BLKMPIFILEREADALL, TRDTBLOCK, fh, datatype, count);
  56 #endif /* MPI_hpux */
  57 
  58     error_code = MPIOI_File_iread_all(fh, (MPI_Offset)0,
  59                      ADIO_INDIVIDUAL, buf,
  60                      count, datatype, myname, request);
  61 
  62     /* --BEGIN ERROR HANDLING-- */
  63     if (error_code != MPI_SUCCESS) {
  64         error_code = MPIO_Err_return_file(fh, error_code);
  65     }
  66     /* --END ERROR HANDLING-- */
  67 
  68 #ifdef MPI_hpux
  69     HPMP_IO_END(fl_xmpi, fh, datatype, count);
  70 #endif /* MPI_hpux */
  71 
  72     return error_code;
  73 }
  74 
  75 /* Note: MPIOI_File_iread_all also used by MPI_File_iread_at_all */
  76 /* prevent multiple definitions of this routine */
  77 #ifdef MPIO_BUILD_PROFILING
  78 int MPIOI_File_iread_all(MPI_File fh,
  79             MPI_Offset offset,
  80             int file_ptr_type,
  81             void *buf,
  82             int count,
  83             MPI_Datatype datatype,
  84             char *myname,
  85             MPI_Request *request)
  86 {
  87     int error_code;
  88     MPI_Count datatype_size;
  89     ADIO_File adio_fh;
  90     void *xbuf=NULL, *e32_buf=NULL;
  91 
  92     ROMIO_THREAD_CS_ENTER();
  93 
  94     adio_fh = MPIO_File_resolve(fh);
  95 
  96     /* --BEGIN ERROR HANDLING-- */
  97     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
  98     MPIO_CHECK_COUNT(adio_fh, count, myname, error_code);
  99     MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code);
 100 
 101     if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) {
 102         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
 103                                           myname, __LINE__, MPI_ERR_ARG,
 104                                           "**iobadoffset", 0);
 105         error_code = MPIO_Err_return_file(adio_fh, error_code);
 106         goto fn_exit;
 107     }
 108     /* --END ERROR HANDLING-- */
 109 
 110     MPI_Type_size_x(datatype, &datatype_size);
 111 
 112     /* --BEGIN ERROR HANDLING-- */
 113     MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, myname, error_code);
 114     MPIO_CHECK_READABLE(adio_fh, myname, error_code);
 115     MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, myname, error_code);
 116     MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
 117     /* --END ERROR HANDLING-- */
 118 
 119     xbuf = buf;
 120     if (adio_fh->is_external32) {
 121         MPI_Aint e32_size = 0;
 122         error_code = MPIU_datatype_full_size(datatype, &e32_size);
 123         if (error_code != MPI_SUCCESS)
 124             goto fn_exit;
 125 
 126         e32_buf = ADIOI_Malloc(e32_size*count);
 127         xbuf = e32_buf;
 128     }
 129 
 130     ADIO_IreadStridedColl(adio_fh, xbuf, count, datatype, file_ptr_type,
 131                           offset, request, &error_code);
 132 
 133     /* --BEGIN ERROR HANDLING-- */
 134     if (error_code != MPI_SUCCESS)
 135     error_code = MPIO_Err_return_file(adio_fh, error_code);
 136     /* --END ERROR HANDLING-- */
 137 
 138     if (e32_buf != NULL) {
 139         error_code = MPIU_read_external32_conversion_fn(buf, datatype,
 140                                                         count, e32_buf);
 141         ADIOI_Free(e32_buf);
 142     }
 143 
 144 fn_exit:
 145     ROMIO_THREAD_CS_EXIT();
 146 
 147     return error_code;
 148 }
 149 #endif

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