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"); \ 83 if (init_values !=
NULL){
96 memcpy(help, h,
sizeof(h));
129 MPI_Info mpiHints = MPI_INFO_NULL;
135 fprintf(stdout,
"\nhints passed to MPI_File_open() {\n");
137 fprintf(stdout,
"}\n");
140 fd = (
int *)malloc(
sizeof(
int));
142 ERR(
"malloc() failed");
146 mpiHints, fd),
"cannot create file");
149 if (mpiHints != MPI_INFO_NULL)
150 MPI_CHECK(MPI_Info_free(&mpiHints),
"cannot free file info");
152 #if defined(PNETCDF_VERSION_MAJOR) && (PNETCDF_VERSION_MAJOR > 1 || PNETCDF_VERSION_MINOR >= 2) 156 MPI_CHECK(ncmpi_get_file_info(*fd, &info_used),
157 "cannot inquire file info");
159 fprintf(stdout,
"\nhints returned from opened file {\n");
161 fprintf(stdout,
"}\n");
162 MPI_CHECK(MPI_Info_free(&info_used),
"cannot free file info");
176 MPI_Info mpiHints = MPI_INFO_NULL;
182 fprintf(stdout,
"\nhints passed to MPI_File_open() {\n");
184 fprintf(stdout,
"}\n");
187 fd = (
int *)malloc(
sizeof(
int));
189 ERR(
"malloc() failed");
193 mpiHints, fd),
"cannot open file");
196 if (mpiHints != MPI_INFO_NULL)
197 MPI_CHECK(MPI_Info_free(&mpiHints),
"cannot free file info");
199 #if defined(PNETCDF_VERSION_MAJOR) && (PNETCDF_VERSION_MAJOR > 1 || PNETCDF_VERSION_MINOR >= 2) 203 MPI_CHECK(ncmpi_get_file_info(*fd, &info_used),
204 "cannot inquire file info");
206 fprintf(stdout,
"\nhints returned from opened file {\n");
208 fprintf(stdout,
"}\n");
209 MPI_CHECK(MPI_Info_free(&info_used),
"cannot free file info");
221 signed char *bufferPtr = (
signed char *)buffer;
226 int segmentNum, transferNum;
234 if ((
int)(offset - segmentPosition) == 0) {
248 if (access ==
WRITE) {
256 (*(
int *)fd,
"segments_times_np",
257 NC_UNLIMITED, &dim_id[0]),
258 "cannot define data set dimensions");
260 (*(
int *)fd,
"number_of_transfers",
261 numTransfers, &dim_id[1]),
262 "cannot define data set dimensions");
264 (*(
int *)fd,
"transfer_size",
266 "cannot define data set dimensions");
268 (*(
int *)fd,
"data_var", NC_BYTE,
NUM_DIMS,
270 "cannot define data set variables");
272 "cannot close data set define mode");
276 (*(
int *)fd,
"data_var", &var_id),
277 "cannot retrieve data set variable");
282 "cannot enable independent data mode");
301 bufSize[2] = transferSize;
304 offsets[1] = transferNum;
308 if (access ==
WRITE) {
311 (*(
int *)fd, var_id, offsets, bufSize, bufferPtr),
312 "cannot write to data set");
315 (*(
int *)fd, var_id, offsets, bufSize, bufferPtr),
316 "cannot write to data set");
321 (*(
int *)fd, var_id, offsets, bufSize, bufferPtr),
322 "cannot read from data set");
325 (*(
int *)fd, var_id, offsets, bufSize, bufferPtr),
326 "cannot read from data set");
330 return (transferSize);
347 "cannot disable independent data mode");
349 NCMPI_CHECK(ncmpi_close(*(
int *)fd),
"cannot close file");
366 return (
char *)ncmpi_inq_libvers();
379 fd_mode |= NC_NOWRITE;
382 WARN(
"File write only not implemented in NCMPI");
388 WARN(
"File append not implemented in NCMPI");
391 fd_mode |= NC_CLOBBER;
394 WARN(
"Exclusive access not implemented in NCMPI");
397 WARN(
"File truncation not implemented in NCMPI");
400 WARN(
"O_DIRECT not implemented in NCMPI");
404 fd_mode |= NC_64BIT_OFFSET;
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)
void MPIIO_Delete(char *testFileName, aiori_mod_opt_t *module_options)
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)