This source file includes following definitions.
- MPI_File_write_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_write_shared = PMPI_File_write_shared
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPI_File_write_shared MPI_File_write_shared
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPI_File_write_shared as PMPI_File_write_shared
  18 
  19 #elif defined(HAVE_WEAK_ATTRIBUTE)
  20 int MPI_File_write_shared(MPI_File fh, const void *buf, int count, MPI_Datatype datatype,
  21                           MPI_Status *status) __attribute__((weak,alias("PMPI_File_write_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_write_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
  46                           MPI_Datatype datatype, MPI_Status *status)
  47 {
  48     int error_code, buftype_is_contig, filetype_is_contig;
  49     ADIO_Offset bufsize;
  50     static char myname[] = "MPI_FILE_READ_SHARED";
  51     MPI_Count datatype_size, incr;
  52     ADIO_Offset off, shared_fp;
  53     ADIO_File adio_fh;
  54     void *e32buf = NULL;
  55     const void *xbuf = NULL;
  56 
  57     ROMIO_THREAD_CS_ENTER();
  58 
  59     adio_fh = MPIO_File_resolve(fh);
  60 
  61     
  62     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
  63     MPIO_CHECK_COUNT(adio_fh, count, myname, error_code);
  64     MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code);
  65     
  66 
  67     MPI_Type_size_x(datatype, &datatype_size);
  68 
  69     
  70     MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
  71     
  72 
  73     if (count*datatype_size == 0) {
  74 #ifdef HAVE_STATUS_SET_BYTES
  75        MPIR_Status_set_bytes(status, datatype, 0);
  76 #endif
  77        error_code = MPI_SUCCESS;
  78        goto fn_exit;
  79     }
  80 
  81     
  82     MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, 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_create_code(MPI_SUCCESS, MPIR_ERR_FATAL,
  98                                           myname, __LINE__, MPI_ERR_INTERN, 
  99                                           "**iosharedfailed", 0);
 100         error_code = MPIO_Err_return_file(adio_fh, error_code);
 101         goto fn_exit;
 102     }
 103     
 104 
 105     xbuf = buf;
 106     if (adio_fh->is_external32) {
 107         error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf);
 108         if (error_code != MPI_SUCCESS) 
 109             goto fn_exit;
 110 
 111         xbuf = e32buf;
 112     }
 113 
 114     if (buftype_is_contig && filetype_is_contig)
 115     {
 116         
 117         bufsize = datatype_size * count;
 118         off = adio_fh->disp + adio_fh->etype_size * shared_fp;
 119 
 120         
 121 
 122 
 123 
 124         if ((adio_fh->atomicity) && (adio_fh->file_system != ADIO_NFS))
 125             ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize);
 126 
 127         ADIO_WriteContig(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET,
 128                      off, status, &error_code); 
 129 
 130         if ((adio_fh->atomicity) && (adio_fh->file_system != ADIO_NFS))
 131             ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize);
 132     }
 133     else
 134     {
 135         ADIO_WriteStrided(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET,
 136                          shared_fp, status, &error_code);
 137         
 138     }
 139 
 140     
 141     if (error_code != MPI_SUCCESS)
 142         error_code = MPIO_Err_return_file(adio_fh, error_code);
 143     
 144 
 145 fn_exit:
 146     if (e32buf != NULL) ADIOI_Free(e32buf);
 147     ROMIO_THREAD_CS_EXIT();
 148     return error_code;
 149 }