34 #define NCMPI_CHECK(NCMPI_RETURN, MSG) do { \ 35 int _NCMPI_RETURN = (NCMPI_RETURN); \ 37 if (_NCMPI_RETURN != NC_NOERR) { \ 38 fprintf(stdout, "** error **\n"); \ 39 fprintf(stdout, "ERROR in %s (line %d): %s.\n", \ 40 __FILE__, __LINE__, MSG); \ 41 fprintf(stdout, "ERROR: %s.\n", ncmpi_strerror(_NCMPI_RETURN)); \ 42 fprintf(stdout, "** exiting **\n"); \ 83 if (init_values !=
NULL){
99 memcpy(help, h,
sizeof(h));
132 MPI_Info mpiHints = MPI_INFO_NULL;
138 fprintf(stdout,
"\nhints passed to MPI_File_open() {\n");
140 fprintf(stdout,
"}\n");
143 fd = (
int *)malloc(
sizeof(
int));
145 ERR(
"malloc() failed");
149 mpiHints, fd),
"cannot create file");
152 if (mpiHints != MPI_INFO_NULL)
153 MPI_CHECK(MPI_Info_free(&mpiHints),
"cannot free file info");
155 #if defined(PNETCDF_VERSION_MAJOR) && (PNETCDF_VERSION_MAJOR > 1 || PNETCDF_VERSION_MINOR >= 2) 159 NCMPI_CHECK(ncmpi_get_file_info(*fd, &info_used),
"cannot inquire file info");
161 fprintf(stdout,
"\nhints returned from opened file {\n");
163 fprintf(stdout,
"}\n");
164 MPI_CHECK(MPI_Info_free(&info_used),
"cannot free file info");
178 MPI_Info mpiHints = MPI_INFO_NULL;
184 fprintf(stdout,
"\nhints passed to MPI_File_open() {\n");
186 fprintf(stdout,
"}\n");
189 fd = (
int *)malloc(
sizeof(
int));
191 ERR(
"malloc() failed");
195 mpiHints, fd),
"cannot open file");
198 if (mpiHints != MPI_INFO_NULL)
199 MPI_CHECK(MPI_Info_free(&mpiHints),
"cannot free file info");
201 #if defined(PNETCDF_VERSION_MAJOR) && (PNETCDF_VERSION_MAJOR > 1 || PNETCDF_VERSION_MINOR >= 2) 205 MPI_CHECK(ncmpi_get_file_info(*fd, &info_used),
206 "cannot inquire file info");
208 fprintf(stdout,
"\nhints returned from opened file {\n");
210 fprintf(stdout,
"}\n");
211 MPI_CHECK(MPI_Info_free(&info_used),
"cannot free file info");
223 signed char *bufferPtr = (
signed char *)buffer;
228 int segmentNum, transferNum;
236 if ((
int)(offset - segmentPosition) == 0) {
250 if (access ==
WRITE) {
258 (*(
int *)fd,
"segments_times_np",
259 NC_UNLIMITED, &dim_id[0]),
260 "cannot define data set dimensions");
262 (*(
int *)fd,
"number_of_transfers",
263 numTransfers, &dim_id[1]),
264 "cannot define data set dimensions");
266 (*(
int *)fd,
"transfer_size",
268 "cannot define data set dimensions");
270 (*(
int *)fd,
"data_var", NC_BYTE,
NUM_DIMS,
272 "cannot define data set variables");
274 "cannot close data set define mode");
278 (*(
int *)fd,
"data_var", &var_id),
279 "cannot retrieve data set variable");
284 "cannot enable independent data mode");
303 bufSize[2] = transferSize;
306 offsets[1] = transferNum;
310 if (access ==
WRITE) {
313 (*(
int *)fd, var_id, offsets, bufSize, bufferPtr),
314 "cannot write to data set");
317 (*(
int *)fd, var_id, offsets, bufSize, bufferPtr),
318 "cannot write to data set");
323 (*(
int *)fd, var_id, offsets, bufSize, bufferPtr),
324 "cannot read from data set");
327 (*(
int *)fd, var_id, offsets, bufSize, bufferPtr),
328 "cannot read from data set");
332 return (transferSize);
340 NCMPI_CHECK(ncmpi_sync(*(
int *)fd),
"cannot sync file");
348 NCMPI_CHECK(ncmpi_close(*(
int *)fd),
"cannot close file");
357 NCMPI_CHECK(ncmpi_delete(testFileName, MPI_INFO_NULL),
"cannot delete file");
365 return (
char *)ncmpi_inq_libvers();
378 fd_mode |= NC_NOWRITE;
381 WARN(
"File write only not implemented in NCMPI");
387 WARN(
"File append not implemented in NCMPI");
390 fd_mode |= NC_CLOBBER;
393 WARN(
"Exclusive access not implemented in NCMPI");
396 fd_mode |= NC_CLOBBER;
399 WARN(
"O_DIRECT not implemented in NCMPI");
403 fd_mode |= NC_64BIT_DATA;
static char * NCMPI_GetVersion()
void ShowHints(MPI_Info *mpiHints)
struct benchmark_options o
static aiori_fd_t * NCMPI_Create(char *, int iorflags, aiori_mod_opt_t *)
static void NCMPI_Delete(char *, aiori_mod_opt_t *)
static aiori_xfer_hint_t * hints
IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t *module_options, char *testFileName)
#define MPI_CHECK(MPI_STATUS, MSG)
int aiori_posix_stat(const char *path, struct stat *buf, aiori_mod_opt_t *module_options)
static aiori_fd_t * NCMPI_Open(char *, int iorflags, aiori_mod_opt_t *)
int MPIIO_Access(const char *path, int mode, aiori_mod_opt_t *module_options)
void MPIIO_xfer_hints(aiori_xfer_hint_t *params)
static void NCMPI_Fsync(aiori_fd_t *, aiori_mod_opt_t *)
static void NCMPI_Close(aiori_fd_t *, aiori_mod_opt_t *)
IOR_offset_t transferSize
int aiori_posix_rmdir(const char *path, aiori_mod_opt_t *module_options)
static option_help * NCMPI_options(aiori_mod_opt_t **init_backend_options, aiori_mod_opt_t *init_values)
static IOR_offset_t NCMPI_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *)
int aiori_posix_mkdir(const char *path, mode_t mode, aiori_mod_opt_t *module_options)
static int GetFileMode(int flags)
int aiori_posix_statfs(const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t *module_options)
void SetHints(MPI_Info *mpiHints, char *hintsFileName)
static IOR_offset_t NCMPI_GetFileSize(aiori_mod_opt_t *, char *)
static int NCMPI_Access(const char *, int, aiori_mod_opt_t *)
#define NCMPI_CHECK(NCMPI_RETURN, MSG)
long long int IOR_offset_t
static void NCMPI_xfer_hints(aiori_xfer_hint_t *params)