34 #define NCMPI_CHECK(NCMPI_RETURN, MSG) do { \ 36 if (NCMPI_RETURN < 0) { \ 37 fprintf(stdout, "** error **\n"); \ 38 fprintf(stdout, "ERROR in %s (line %d): %s.\n", \ 39 __FILE__, __LINE__, MSG); \ 40 fprintf(stdout, "ERROR: %s.\n", ncmpi_strerror(NCMPI_RETURN)); \ 41 fprintf(stdout, "** exiting **\n"); \ 90 MPI_Info mpiHints = MPI_INFO_NULL;
95 fprintf(stdout,
"\nhints passed to MPI_File_open() {\n");
97 fprintf(stdout,
"}\n");
100 fd = (
int *)malloc(
sizeof(
int));
102 ERR(
"malloc() failed");
106 mpiHints, fd),
"cannot create file");
109 if (mpiHints != MPI_INFO_NULL)
110 MPI_CHECK(MPI_Info_free(&mpiHints),
"cannot free file info");
112 #if defined(PNETCDF_VERSION_MAJOR) && (PNETCDF_VERSION_MAJOR > 1 || PNETCDF_VERSION_MINOR >= 2) 116 MPI_CHECK(ncmpi_get_file_info(*fd, &info_used),
117 "cannot inquire file info");
119 fprintf(stdout,
"\nhints returned from opened file {\n");
121 fprintf(stdout,
"}\n");
122 MPI_CHECK(MPI_Info_free(&info_used),
"cannot free file info");
136 MPI_Info mpiHints = MPI_INFO_NULL;
141 fprintf(stdout,
"\nhints passed to MPI_File_open() {\n");
143 fprintf(stdout,
"}\n");
146 fd = (
int *)malloc(
sizeof(
int));
148 ERR(
"malloc() failed");
152 mpiHints, fd),
"cannot open file");
155 if (mpiHints != MPI_INFO_NULL)
156 MPI_CHECK(MPI_Info_free(&mpiHints),
"cannot free file info");
158 #if defined(PNETCDF_VERSION_MAJOR) && (PNETCDF_VERSION_MAJOR > 1 || PNETCDF_VERSION_MINOR >= 2) 162 MPI_CHECK(ncmpi_get_file_info(*fd, &info_used),
163 "cannot inquire file info");
165 fprintf(stdout,
"\nhints returned from opened file {\n");
167 fprintf(stdout,
"}\n");
168 MPI_CHECK(MPI_Info_free(&info_used),
"cannot free file info");
181 signed char *bufferPtr = (
signed char *)buffer;
182 static int firstReadCheck =
FALSE, startDataSet;
186 int segmentNum, transferNum;
196 if ((
int)(param->
offset - segmentPosition) == 0) {
204 if (firstReadCheck ==
TRUE) {
205 firstReadCheck =
FALSE;
207 firstReadCheck =
TRUE;
212 if (startDataSet ==
TRUE &&
214 if (access ==
WRITE) {
223 (*(
int *)fd,
"segments_times_np",
224 NC_UNLIMITED, &dim_id[0]),
225 "cannot define data set dimensions");
227 (*(
int *)fd,
"number_of_transfers",
228 numTransfers, &dim_id[1]),
229 "cannot define data set dimensions");
231 (*(
int *)fd,
"transfer_size",
233 "cannot define data set dimensions");
235 (*(
int *)fd,
"data_var", NC_BYTE,
NUM_DIMS,
237 "cannot define data set variables");
239 "cannot close data set define mode");
243 (*(
int *)fd,
"data_var", &var_id),
244 "cannot retrieve data set variable");
249 "cannot enable independent data mode");
253 startDataSet =
FALSE;
271 offset[1] = transferNum;
275 if (access ==
WRITE) {
278 (*(
int *)fd, var_id, offset, bufSize,
280 "cannot write to data set");
283 (*(
int *)fd, var_id, offset, bufSize,
285 "cannot write to data set");
290 (*(
int *)fd, var_id, offset, bufSize,
292 "cannot read from data set");
295 (*(
int *)fd, var_id, offset, bufSize,
297 "cannot read from data set");
319 "cannot disable independent data mode");
321 NCMPI_CHECK(ncmpi_close(*(
int *)fd),
"cannot close file");
338 return (
char *)ncmpi_inq_libvers();
351 fd_mode |= NC_NOWRITE;
354 fprintf(stdout,
"File write only not implemented in NCMPI\n");
360 fprintf(stdout,
"File append not implemented in NCMPI\n");
363 fd_mode |= NC_CLOBBER;
366 fprintf(stdout,
"Exclusive access not implemented in NCMPI\n");
369 fprintf(stdout,
"File truncation not implemented in NCMPI\n");
372 fprintf(stdout,
"O_DIRECT not implemented in NCMPI\n");
376 fd_mode |= NC_64BIT_OFFSET;
static char * NCMPI_GetVersion()
void ShowHints(MPI_Info *mpiHints)
IOR_offset_t transferSize
int aiori_posix_rmdir(const char *path, IOR_param_t *param)
static IOR_offset_t NCMPI_Xfer(int, void *, IOR_size_t *, IOR_offset_t, IOR_param_t *)
static int GetFileMode(IOR_param_t *)
int aiori_posix_mkdir(const char *path, mode_t mode, IOR_param_t *param)
static IOR_offset_t NCMPI_GetFileSize(IOR_param_t *, MPI_Comm, char *)
int aiori_posix_statfs(const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t *param)
#define MPI_CHECK(MPI_STATUS, MSG)
void MPIIO_Delete(char *testFileName, IOR_param_t *param)
int MPIIO_Access(const char *path, int mode, IOR_param_t *param)
static void * NCMPI_Create(char *, IOR_param_t *)
int aiori_posix_stat(const char *path, struct stat *buf, IOR_param_t *param)
static void NCMPI_Fsync(void *, IOR_param_t *)
void SetHints(MPI_Info *mpiHints, char *hintsFileName)
static void * NCMPI_Open(char *, IOR_param_t *)
#define NCMPI_CHECK(NCMPI_RETURN, MSG)
long long int IOR_offset_t
static void NCMPI_Delete(char *, IOR_param_t *)
static void NCMPI_Close(void *, IOR_param_t *)
IOR_offset_t MPIIO_GetFileSize(IOR_param_t *test, MPI_Comm testComm, char *testFileName)
static int NCMPI_Access(const char *, int, IOR_param_t *)