This source file includes following definitions.
- MPI_File_set_view
   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_set_view = PMPI_File_set_view
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPI_File_set_view MPI_File_set_view
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPI_File_set_view as PMPI_File_set_view
  18 
  19 #elif defined(HAVE_WEAK_ATTRIBUTE)
  20 int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype,
  21                       const char *datarep, MPI_Info info) __attribute__((weak,alias("PMPI_File_set_view")));
  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 int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
  43                       MPI_Datatype filetype, ROMIO_CONST char *datarep, MPI_Info info)
  44 {
  45     int error_code;
  46     MPI_Count filetype_size, etype_size;
  47     static char myname[] = "MPI_FILE_SET_VIEW";
  48     ADIO_Offset shared_fp, byte_off;
  49     ADIO_File adio_fh;
  50 
  51     ROMIO_THREAD_CS_ENTER();
  52 
  53     adio_fh = MPIO_File_resolve(fh);
  54 
  55     
  56     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
  57 
  58     if ((disp < 0) && (disp != MPI_DISPLACEMENT_CURRENT))
  59     {
  60         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
  61                                           myname, __LINE__, MPI_ERR_ARG, 
  62                                           "**iobaddisp", 0);
  63         error_code = MPIO_Err_return_file(adio_fh, error_code);
  64         goto fn_exit;
  65     }
  66 
  67     
  68     if (etype == MPI_DATATYPE_NULL) {
  69         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
  70                                           myname, __LINE__, MPI_ERR_ARG,
  71                                           "**ioetype", 0);
  72         error_code = MPIO_Err_return_file(adio_fh, error_code);
  73         goto fn_exit;
  74     }
  75     MPIO_DATATYPE_ISCOMMITTED(etype, error_code);
  76     if (error_code != MPI_SUCCESS) {
  77         error_code = MPIO_Err_return_file(adio_fh, error_code);
  78         goto fn_exit;
  79     }
  80 
  81     if (filetype == MPI_DATATYPE_NULL) {
  82         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
  83                                           myname, __LINE__, MPI_ERR_ARG,
  84                                           "**iofiletype", 0);
  85         error_code = MPIO_Err_return_file(adio_fh, error_code);
  86         goto fn_exit;
  87     }
  88     MPIO_DATATYPE_ISCOMMITTED(filetype, error_code);
  89     if (error_code != MPI_SUCCESS) {
  90         error_code = MPIO_Err_return_file(adio_fh, error_code);
  91         goto fn_exit;
  92     }
  93 
  94     if ((adio_fh->access_mode & MPI_MODE_SEQUENTIAL) &&
  95         (disp != MPI_DISPLACEMENT_CURRENT))
  96     {
  97         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
  98                                           myname, __LINE__, MPI_ERR_ARG, 
  99                                           "**iodispifseq", 0);
 100         error_code = MPIO_Err_return_file(adio_fh, error_code);
 101         goto fn_exit;
 102     }
 103 
 104     if ((disp == MPI_DISPLACEMENT_CURRENT) &&
 105         !(adio_fh->access_mode & MPI_MODE_SEQUENTIAL))
 106     {
 107         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
 108                                           myname, __LINE__, MPI_ERR_ARG, 
 109                                           "**iodispifseq", 0);
 110         error_code = MPIO_Err_return_file(adio_fh, error_code);
 111         goto fn_exit;
 112     }
 113     MPIO_CHECK_INFO_ALL(info, error_code, adio_fh->comm);
 114     
 115 
 116     MPI_Type_size_x(filetype, &filetype_size);
 117     MPI_Type_size_x(etype, &etype_size);
 118 
 119     
 120     if (etype_size != 0 && filetype_size % etype_size != 0)
 121     {
 122         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
 123                                           myname, __LINE__, MPI_ERR_ARG,
 124                                           "**iofiletype", 0);
 125         error_code = MPIO_Err_return_file(adio_fh, error_code);
 126         goto fn_exit;
 127     }
 128 
 129     if ((datarep == NULL) || (strcmp(datarep, "native") &&
 130             strcmp(datarep, "NATIVE") &&
 131             strcmp(datarep, "external32") &&
 132             strcmp(datarep, "EXTERNAL32") &&
 133             strcmp(datarep, "internal") &&
 134             strcmp(datarep, "INTERNAL")) )
 135     {
 136         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
 137                                           myname, __LINE__,
 138                                           MPI_ERR_UNSUPPORTED_DATAREP, 
 139                                           "**unsupporteddatarep",0);
 140         error_code = MPIO_Err_return_file(adio_fh, error_code);
 141         goto fn_exit;
 142     }
 143     
 144 
 145     if (disp == MPI_DISPLACEMENT_CURRENT) {
 146         MPI_Barrier(adio_fh->comm);
 147         ADIO_Get_shared_fp(adio_fh, 0, &shared_fp, &error_code);
 148         
 149 
 150         MPI_Barrier(adio_fh->comm);
 151         ADIOI_Get_byte_offset(adio_fh, shared_fp, &byte_off);
 152         
 153 
 154         disp = byte_off;
 155     }
 156 
 157     ADIO_Set_view(adio_fh, disp, etype, filetype, info, &error_code);
 158 
 159     
 160     if (error_code != MPI_SUCCESS) {
 161         error_code = MPIO_Err_return_file(adio_fh, error_code);
 162         goto fn_exit;
 163     }
 164     
 165 
 166     
 167     if (ADIO_Feature(adio_fh, ADIO_SHARED_FP) &&
 168         (adio_fh->shared_fp_fd != ADIO_FILE_NULL))
 169     {
 170         
 171 
 172 
 173 
 174 
 175 
 176 
 177 
 178 
 179         ADIO_Set_shared_fp(adio_fh, 0, &error_code);
 180         
 181         if (error_code != MPI_SUCCESS)
 182             error_code = MPIO_Err_return_file(adio_fh, error_code);
 183         
 184     }
 185 
 186     if (ADIO_Feature(adio_fh, ADIO_SHARED_FP))
 187     {
 188         MPI_Barrier(adio_fh->comm); 
 189     }
 190     if (strcmp(datarep, "external32") && strcmp(datarep, "EXTERNAL32"))
 191         adio_fh->is_external32 = 0;
 192     else
 193         adio_fh->is_external32 = 1;
 194 
 195 fn_exit:
 196     ROMIO_THREAD_CS_EXIT();
 197 
 198     return error_code;
 199 fn_fail:
 200         
 201         error_code = MPIO_Err_return_file(fh, error_code);
 202         goto fn_exit;
 203         
 204 }