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

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_File_read_all_begin
  2. MPIOI_File_read_all_begin

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

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