48 #if H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 49 #define HDF5_CHECK(HDF5_RETURN, MSG) do { \ 50 char resultString[1024]; \ 52 if (HDF5_RETURN < 0) { \ 53 fprintf(stdout, "** error **\n"); \ 54 fprintf(stdout, "ERROR in %s (line %d): %s.\n", \ 55 __FILE__, __LINE__, MSG); \ 56 strcpy(resultString, H5Eget_major((H5E_major_t)HDF5_RETURN)); \ 57 if (strcmp(resultString, "Invalid major error number") != 0) \ 58 fprintf(stdout, "HDF5 %s\n", resultString); \ 59 strcpy(resultString, H5Eget_minor((H5E_minor_t)HDF5_RETURN)); \ 60 if (strcmp(resultString, "Invalid minor error number") != 0) \ 61 fprintf(stdout, "%s\n", resultString); \ 62 fprintf(stdout, "** exiting **\n"); \ 67 #define HDF5_CHECK(HDF5_RETURN, MSG) do { \ 69 if (HDF5_RETURN < 0) { \ 70 fprintf(stdout, "** error **\n"); \ 71 fprintf(stdout, "ERROR in %s (line %d): %s.\n", \ 72 __FILE__, __LINE__, MSG); \ 77 fprintf(stdout, "** exiting **\n"); \ 138 hid_t accessPropList, createPropList;
144 unsigned fd_mode = (unsigned)0;
147 MPI_Info mpiHints = MPI_INFO_NULL;
149 fd = (hid_t *) malloc(
sizeof(hid_t));
151 ERR(
"malloc() failed");
164 fd_mode |= H5F_ACC_RDONLY;
167 fprintf(stdout,
"File write only not implemented in HDF5\n");
170 fd_mode |= H5F_ACC_RDWR;
173 fprintf(stdout,
"File append not implemented in HDF5\n");
176 fd_mode |= H5F_ACC_CREAT;
179 fd_mode |= H5F_ACC_EXCL;
182 fd_mode |= H5F_ACC_TRUNC;
185 fprintf(stdout,
"O_DIRECT not implemented in HDF5\n");
189 createPropList = H5Pcreate(H5P_FILE_CREATE);
190 HDF5_CHECK(createPropList,
"cannot create file creation property list");
193 (createPropList,
sizeof(hsize_t),
sizeof(hsize_t)),
194 "cannot set property list properly");
197 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
198 HDF5_CHECK(accessPropList,
"cannot create file access property list");
205 comm = MPI_COMM_SELF;
219 fprintf(stdout,
"\nhints passed to access property list {\n");
221 fprintf(stdout,
"}\n");
223 HDF5_CHECK(H5Pset_fapl_mpio(accessPropList, comm, mpiHints),
224 "cannot set file access property list");
229 "cannot set alignment");
231 #ifdef HAVE_H5PSET_ALL_COLL_METADATA_OPS 232 if (param->collective_md) {
235 HDF5_CHECK(H5Pset_all_coll_metadata_ops(accessPropList, 1),
236 "cannot set collective md read");
237 HDF5_CHECK(H5Pset_coll_metadata_write(accessPropList, 1),
238 "cannot set collective md write");
244 *fd = H5Fcreate(testFileName, fd_mode,
245 createPropList, accessPropList);
248 *fd = H5Fopen(testFileName, fd_mode, accessPropList);
256 WARN(
"showHints not working for HDF5");
259 MPI_Info mpiHintsCheck = MPI_INFO_NULL;
261 apl = H5Fget_access_plist(*fd);
262 HDF5_CHECK(H5Pget_fapl_mpio(apl, &comm, &mpiHintsCheck),
263 "cannot get info object through HDF5");
266 "\nhints returned from opened file (HDF5) {\n");
268 fprintf(stdout,
"}\n");
272 (*fd, apl, (
void **)&fd_mpiio),
273 "cannot get MPIIO file handle");
274 if (mpiHintsCheck != MPI_INFO_NULL)
275 MPI_Info_free(&mpiHintsCheck);
277 (*fd_mpiio, &mpiHintsCheck),
278 "cannot get info object through MPIIO");
280 "\nhints returned from opened file (MPIIO) {\n");
282 fprintf(stdout,
"}\n");
283 if (mpiHintsCheck != MPI_INFO_NULL)
284 MPI_Info_free(&mpiHintsCheck);
295 "cannot close creation property list");
297 "cannot close access property list");
306 "cannot set collective data transfer mode");
310 "cannot set independent data transfer mode");
314 memStart[0] = (hsize_t) 0;
315 memCount[0] = (hsize_t) 1;
324 memStart, memStride, memCount,
325 memBlock),
"cannot create hyperslab");
346 if (mpiHints != MPI_INFO_NULL)
347 MPI_Info_free(&mpiHints);
358 static int firstReadCheck =
FALSE, startNewDataSet;
367 if (firstReadCheck ==
TRUE) {
368 firstReadCheck =
FALSE;
370 firstReadCheck =
TRUE;
391 startNewDataSet =
TRUE;
393 startNewDataSet =
FALSE;
398 if (startNewDataSet ==
TRUE) {
403 "cannot close file data space");
411 startNewDataSet =
FALSE;
415 if (access ==
WRITE) {
419 "cannot write to data set");
424 "cannot read from data set");
446 "cannot close file data space");
448 "cannot close memory data space");
450 " cannot close transfer property list");
452 HDF5_CHECK(H5Fclose(*(hid_t *) fd),
"cannot close file");
469 static char version[1024] = {0};
470 if(version[0])
return version;
472 unsigned major, minor, release;
473 if (H5get_libversion(&major, &minor, &release) < 0) {
474 WARN(
"cannot get HDF5 library version");
476 sprintf(version,
"%u.%u.%u", major, minor, release);
478 #ifndef H5_HAVE_PARALLEL 479 strcat(version,
" (Serial)");
481 strcat(version,
" (Parallel)");
506 hsStart[0] = (hsize_t) ((offset % param->
blockSize)
511 (hsize_t) ((offset % segmentSize) /
sizeof(
IOR_size_t));
513 hsCount[0] = (hsize_t) 1;
521 hsStart, hsStride, hsCount, hsBlock),
522 "cannot select hyperslab");
532 hid_t dataSetPropList;
534 static int dataSetSuffix = 0;
550 sprintf(dataSetName,
"%s-%04d.%04d",
"Dataset", dataSetID,
555 dataSetPropList = H5Pcreate(H5P_DATASET_CREATE);
557 #if defined (H5_VERS_MAJOR) && defined (H5_VERS_MINOR) 559 #if (H5_VERS_MAJOR > 0 && H5_VERS_MINOR > 5) 562 fprintf(stdout,
"\nusing 'no fill' option\n");
565 H5D_FILL_TIME_NEVER),
566 "cannot set fill time for property list");
570 sprintf(errorString,
"'no fill' option not available in %s",
575 WARN(
"unable to determine HDF5 version for 'no fill' usage");
578 H5Dcreate(*(hid_t *) fd, dataSetName, H5T_NATIVE_LLONG,
582 dataSet = H5Dopen(*(hid_t *) fd, dataSetName);
static int HDF5_Access(const char *, int, IOR_param_t *)
IOR_offset_t setAlignment
void ShowHints(MPI_Info *mpiHints)
static void * HDF5_Create(char *, IOR_param_t *)
static void * HDF5_Open(char *, IOR_param_t *)
static void HDF5_Fsync(void *, IOR_param_t *)
static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, IOR_offset_t, IOR_param_t *)
IOR_offset_t transferSize
int aiori_posix_rmdir(const char *path, IOR_param_t *param)
#define HDF5_CHECK(HDF5_RETURN, MSG)
int aiori_posix_mkdir(const char *path, mode_t mode, IOR_param_t *param)
static IOR_offset_t HDF5_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)
static hid_t xferPropList
void MPIIO_Delete(char *testFileName, IOR_param_t *param)
static IOR_offset_t SeekOffset(void *, IOR_offset_t, IOR_param_t *)
int MPIIO_Access(const char *path, int mode, IOR_param_t *param)
static char * HDF5_GetVersion()
static void HDF5_Delete(char *, IOR_param_t *)
int aiori_posix_stat(const char *path, struct stat *buf, IOR_param_t *param)
static void HDF5_Close(void *, IOR_param_t *)
void SetHints(MPI_Info *mpiHints, char *hintsFileName)
long long int IOR_offset_t
static void SetupDataSet(void *, IOR_param_t *)
IOR_offset_t MPIIO_GetFileSize(IOR_param_t *test, MPI_Comm testComm, char *testFileName)