This source file includes following definitions.
- MPI_File_read_shared
   1 
   2 
   3 
   4 
   5 
   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_shared = PMPI_File_read_shared
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPI_File_read_shared MPI_File_read_shared
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPI_File_read_shared as PMPI_File_read_shared
  18 
  19 #elif defined(HAVE_WEAK_ATTRIBUTE)
  20 int MPI_File_read_shared(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
  21                          MPI_Status *status) __attribute__((weak,alias("PMPI_File_read_shared")));
  22 #endif
  23 
  24 
  25 #define MPIO_BUILD_PROFILING
  26 #include "mpioprof.h"
  27 #endif
  28 
  29 
  30 
  31 
  32 
  33 
  34 
  35 
  36 
  37 
  38 
  39 
  40 
  41 
  42 
  43 
  44 
  45 int MPI_File_read_shared(MPI_File fh, void *buf, int count,
  46                          MPI_Datatype datatype, MPI_Status *status)
  47 {
  48     int error_code, buftype_is_contig, filetype_is_contig;
  49     static char myname[] = "MPI_FILE_READ_SHARED";
  50     MPI_Count datatype_size;
  51     ADIO_Offset off, shared_fp, incr, bufsize;
  52     ADIO_File adio_fh;
  53     void *xbuf=NULL, *e32_buf=NULL;
  54 
  55     ROMIO_THREAD_CS_ENTER();
  56 
  57     adio_fh = MPIO_File_resolve(fh);
  58 
  59     
  60     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
  61     MPIO_CHECK_COUNT(adio_fh, count, myname, error_code);
  62     MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code);
  63     
  64 
  65     MPI_Type_size_x(datatype, &datatype_size);
  66 
  67     
  68     MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
  69     
  70 
  71     if (count*datatype_size == 0)
  72     {
  73 #ifdef HAVE_STATUS_SET_BYTES
  74         MPIR_Status_set_bytes(status, datatype, 0);
  75 #endif
  76         error_code = MPI_SUCCESS;
  77         goto fn_exit;
  78     }
  79 
  80     
  81     MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, myname, error_code);
  82     MPIO_CHECK_READABLE(adio_fh, myname, error_code);
  83     MPIO_CHECK_FS_SUPPORTS_SHARED(adio_fh, myname, error_code);
  84     
  85 
  86     ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
  87     ADIOI_Datatype_iscontig(adio_fh->filetype, &filetype_is_contig);
  88 
  89     ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code);
  90 
  91     incr = (count*datatype_size)/adio_fh->etype_size;
  92 
  93     ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code);
  94     
  95     if (error_code != MPI_SUCCESS)
  96     {
  97         error_code = MPIO_Err_return_file(adio_fh, error_code);
  98         goto fn_exit;
  99     }
 100     
 101 
 102     xbuf = buf;
 103     if (adio_fh->is_external32)
 104     {
 105         MPI_Aint e32_size = 0;
 106         error_code = MPIU_datatype_full_size(datatype, &e32_size);
 107         if (error_code != MPI_SUCCESS)
 108             goto fn_exit;
 109 
 110         e32_buf = ADIOI_Malloc(e32_size*count);
 111         xbuf = e32_buf;
 112     }
 113 
 114     
 115     if (buftype_is_contig && filetype_is_contig)
 116     {
 117         
 118         bufsize = datatype_size * count;
 119         off = adio_fh->disp + adio_fh->etype_size * shared_fp;
 120 
 121         
 122 
 123 
 124 
 125         if ((adio_fh->atomicity) && (adio_fh->file_system != ADIO_NFS))
 126             ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize);
 127 
 128         ADIO_ReadContig(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET,
 129                         off, status, &error_code); 
 130 
 131         if ((adio_fh->atomicity) && (adio_fh->file_system != ADIO_NFS))
 132             ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize);
 133     }
 134     else
 135     {
 136         ADIO_ReadStrided(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET,
 137                           shared_fp, status, &error_code);
 138         
 139     }
 140 
 141     
 142     if (error_code != MPI_SUCCESS)
 143         error_code = MPIO_Err_return_file(adio_fh, error_code);
 144     
 145 
 146     if (e32_buf != NULL) {
 147         error_code = MPIU_read_external32_conversion_fn(buf, datatype,
 148                 count, e32_buf);
 149         ADIOI_Free(e32_buf);
 150     }
 151 fn_exit:
 152     ROMIO_THREAD_CS_EXIT();
 153 
 154     return error_code;
 155 }