48 #if H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 49 #define HDF5_CHECK(HDF5_RETURN, MSG) do { \ 50 char resultString[1024]; \ 51 herr_t _HDF5_RETURN = (HDF5_RETURN); \ 53 if (_HDF5_RETURN < 0) { \ 54 fprintf(stdout, "** error **\n"); \ 55 fprintf(stdout, "ERROR in %s (line %d): %s.\n", \ 56 __FILE__, __LINE__, MSG); \ 57 strcpy(resultString, H5Eget_major((H5E_major_t)_HDF5_RETURN)); \ 58 if (strcmp(resultString, "Invalid major error number") != 0) \ 59 fprintf(stdout, "HDF5 %s\n", resultString); \ 60 strcpy(resultString, H5Eget_minor((H5E_minor_t)_HDF5_RETURN)); \ 61 if (strcmp(resultString, "Invalid minor error number") != 0) \ 62 fprintf(stdout, "%s\n", resultString); \ 63 fprintf(stdout, "** exiting **\n"); \ 68 #define HDF5_CHECK(HDF5_RETURN, MSG) do { \ 70 if (HDF5_RETURN < 0) { \ 71 fprintf(stdout, "** error **\n"); \ 72 fprintf(stdout, "ERROR in %s (line %d): %s.\n", \ 73 __FILE__, __LINE__, MSG); \ 78 fprintf(stdout, "** exiting **\n"); \ 120 if (init_values !=
NULL){
138 {0,
"hdf5.collectiveMetadata",
"Use collectiveMetadata (available since HDF5-1.10.0)",
OPTION_FLAG,
'd', & o->
collective_md},
141 {0,
"hdf5.noFill",
"No fill in HDF5 file creation",
OPTION_FLAG,
'd', & o->
noFill},
142 {0,
"hdf5.chunkSize",
"Chunk size (in terms of dataset elements) to use for I/O",
OPTION_FLAG,
'd', & o->
chunk_size},
146 memcpy(help, h,
sizeof(h));
201 ERR(
"alignment must be non-negative integer");
203 ERR(
"individual data sets not implemented");
212 return HDF5_Open(testFileName, flags, param);
221 hid_t accessPropList, createPropList;
227 unsigned fd_mode = (unsigned)0;
230 MPI_Info mpiHints = MPI_INFO_NULL;
238 fd_mode |= H5F_ACC_RDONLY;
241 fd_mode |= H5F_ACC_RDWR;
244 fprintf(stdout,
"File append not implemented in HDF5\n");
247 fd_mode |= H5F_ACC_CREAT;
250 fd_mode |= H5F_ACC_EXCL;
253 fd_mode |= H5F_ACC_TRUNC;
256 fprintf(stdout,
"O_DIRECT not implemented in HDF5\n");
260 createPropList = H5Pcreate(H5P_FILE_CREATE);
261 HDF5_CHECK(createPropList,
"cannot create file creation property list");
264 (createPropList,
sizeof(hsize_t),
sizeof(hsize_t)),
265 "cannot set property list properly");
268 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
269 HDF5_CHECK(accessPropList,
"cannot create file access property list");
276 comm = MPI_COMM_SELF;
290 fprintf(stdout,
"\nhints passed to access property list {\n");
292 fprintf(stdout,
"}\n");
295 HDF5_CHECK(H5Pset_fapl_mpio(accessPropList, comm, mpiHints),
296 "cannot set file access property list");
300 "cannot set alignment");
302 #ifdef HAVE_H5PSET_ALL_COLL_METADATA_OPS 306 HDF5_CHECK(H5Pset_all_coll_metadata_ops(accessPropList, 1),
307 "cannot set collective md read");
308 HDF5_CHECK(H5Pset_coll_metadata_write(accessPropList, 1),
309 "cannot set collective md write");
315 if (flags & IOR_CREAT) {
316 fd->
fd = H5Fcreate(testFileName, H5F_ACC_TRUNC, createPropList, accessPropList);
319 fd->
fd = H5Fopen(testFileName, fd_mode, accessPropList);
327 HDF5_CHECK(H5Fget_vfd_handle(fd->
fd, accessPropList, (
void **) &fd_mpiio),
"cannot get file handle");
329 MPI_CHECK(MPI_File_get_info(*fd_mpiio, &info_used),
"cannot get file info");
332 fprintf(stdout,
"\nhints returned from opened file {\n");
334 fprintf(stdout,
"}\n");
336 MPI_CHECK(MPI_Info_free(&info_used),
"cannot free file info");
344 "cannot close creation property list");
346 "cannot close access property list");
355 "cannot set collective data transfer mode");
359 "cannot set independent data transfer mode");
363 memStart[0] = (hsize_t) 0;
364 memCount[0] = (hsize_t) 1;
373 memStart, memStride, memCount,
374 memBlock),
"cannot create hyperslab");
395 if (mpiHints != MPI_INFO_NULL)
396 MPI_Info_free(&mpiHints);
433 if ((
IOR_offset_t) ((offset - segmentPosition) % segmentSize) ==
454 "cannot close file data space");
466 if (access ==
WRITE) {
470 "cannot write to data set");
475 "cannot read from data set");
486 HDF5_CHECK(H5Fflush(fd->
fd, H5F_SCOPE_LOCAL),
"cannot flush file to disk");
501 "cannot close file data space");
503 "cannot close memory data space");
505 " cannot close transfer property list");
516 #ifdef HAVE_H5FDELETE 517 hid_t accessPropList;
518 MPI_Comm comm = MPI_COMM_SELF;
519 MPI_Info mpiHints = MPI_INFO_NULL;
525 #ifdef HAVE_H5FDELETE 527 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
528 HDF5_CHECK(accessPropList,
"cannot create file access property list");
530 HDF5_CHECK(H5Pset_fapl_mpio(accessPropList, comm, mpiHints),
531 "cannot set file access property list");
533 HDF5_CHECK(H5Fdelete(testFileName, accessPropList),
534 "cannot delete file");
537 "cannot close access property list");
550 static char version[1024] = {0};
551 if(version[0])
return version;
553 unsigned major, minor, release;
554 if (H5get_libversion(&major, &minor, &release) < 0) {
555 WARN(
"cannot get HDF5 library version");
557 sprintf(version,
"%u.%u.%u", major, minor, release);
559 #ifndef H5_HAVE_PARALLEL 560 strcat(version,
" (Serial)");
562 strcat(version,
" (Parallel)");
591 hsStart[0] = (hsize_t) ((offset % segmentSize) /
sizeof(
IOR_size_t));
593 hsCount[0] = (hsize_t) 1;
599 "cannot select hyperslab");
611 hid_t dataSetPropList;
613 static int dataSetSuffix = 0;
628 sprintf(dataSetName,
"%s-%04d.%04d",
"Dataset", dataSetID,
635 dataSetPropList = H5Pcreate(H5P_DATASET_CREATE);
644 HDF5_CHECK(H5Pset_chunk(dataSetPropList, NUM_DIMS, chunk_dims),
645 "cannot set chunk size");
650 fprintf(stdout,
"\nusing 'no fill' option\n");
653 H5D_FILL_TIME_NEVER),
654 "cannot set fill time for property list");
656 fd->
dataSet = H5Dcreate(fd->
fd, dataSetName, H5T_NATIVE_LLONG, fd->
dataSpace, dataSetPropList);
659 fd->
dataSet = H5Dopen(*(hid_t *) fd, dataSetName);
660 HDF5_CHECK(fd->dataSet,
"cannot open data set");
671 #ifdef HAVE_H5PGET_VOL_ID 672 hid_t vol_id, accessPropList;
679 #ifdef HAVE_H5PGET_VOL_ID 681 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
682 HDF5_CHECK(accessPropList,
"cannot create file access property list");
683 HDF5_CHECK(H5Pget_vol_id(accessPropList, &vol_id),
"cannot get vol id");
684 HDF5_CHECK(H5Pclose(accessPropList),
"cannot close access property list");
686 if(vol_id == H5VL_NATIVE)
689 #ifdef HAVE_H5PGET_VOL_ID 692 WARN(
"getfilesize not supported with current VOL connector!");
697 HDF5_CHECK(H5VLclose(vol_id),
"cannot close VOL ID");
707 #ifdef HAVE_H5PGET_VOL_ID 708 hid_t vol_id, accessPropList;
711 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
712 HDF5_CHECK(accessPropList,
"cannot create file access property list");
713 HDF5_CHECK(H5Pget_vol_id(accessPropList, &vol_id),
"cannot get vol id");
714 HDF5_CHECK(H5Pclose(accessPropList),
"cannot close access property list");
716 if(vol_id == H5VL_NATIVE)
719 #ifdef HAVE_H5PGET_VOL_ID 722 WARN(
"statfs not supported by current VOL connector!");
727 HDF5_CHECK(H5VLclose(vol_id),
"cannot close VOL ID");
736 #ifdef HAVE_H5PGET_VOL_ID 737 hid_t vol_id, accessPropList;
740 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
741 HDF5_CHECK(accessPropList,
"cannot create file access property list");
742 HDF5_CHECK(H5Pget_vol_id(accessPropList, &vol_id),
"cannot get vol id");
743 HDF5_CHECK(H5Pclose(accessPropList),
"cannot close access property list");
745 if(vol_id == H5VL_NATIVE)
748 #ifdef HAVE_H5PGET_VOL_ID 751 WARN(
"mkdir not supported by current VOL connector!");
756 HDF5_CHECK(H5VLclose(vol_id),
"cannot close VOL ID");
765 #ifdef HAVE_H5PGET_VOL_ID 766 hid_t vol_id, accessPropList;
769 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
770 HDF5_CHECK(accessPropList,
"cannot create file access property list");
771 HDF5_CHECK(H5Pget_vol_id(accessPropList, &vol_id),
"cannot get vol id");
772 HDF5_CHECK(H5Pclose(accessPropList),
"cannot close access property list");
774 if(vol_id == H5VL_NATIVE)
777 #ifdef HAVE_H5PGET_VOL_ID 780 WARN(
"rmdir not supported by current VOL connector!");
785 HDF5_CHECK(H5VLclose(vol_id),
"cannot close VOL ID");
793 htri_t accessible = -1;
794 hid_t accessPropList;
795 MPI_Comm comm = MPI_COMM_SELF;
796 MPI_Info mpiHints = MPI_INFO_NULL;
802 #ifdef HAVE_H5FIS_ACCESSIBLE 804 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
805 HDF5_CHECK(accessPropList,
"cannot create file access property list");
807 HDF5_CHECK(H5Pset_fapl_mpio(accessPropList, comm, mpiHints),
808 "cannot set file access property list");
811 accessible = H5Fis_accessible(path, accessPropList);
817 "cannot close access property list");
828 #ifdef HAVE_H5PGET_VOL_ID 829 hid_t vol_id, accessPropList;
832 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
833 HDF5_CHECK(accessPropList,
"cannot create file access property list");
834 HDF5_CHECK(H5Pget_vol_id(accessPropList, &vol_id),
"cannot get vol id");
835 HDF5_CHECK(H5Pclose(accessPropList),
"cannot close access property list");
837 if(vol_id == H5VL_NATIVE)
840 #ifdef HAVE_H5PGET_VOL_ID 843 WARN(
"stat not supported by current VOL connector!");
848 HDF5_CHECK(H5VLclose(vol_id),
"cannot close VOL ID");
static aiori_fd_t * HDF5_Create(char *, int flags, aiori_mod_opt_t *)
static void HDF5_init_xfer_options(aiori_xfer_hint_t *params)
void ShowHints(MPI_Info *mpiHints)
static void HDF5_Close(aiori_fd_t *, aiori_mod_opt_t *)
static int HDF5_MkDir(const char *, mode_t, aiori_mod_opt_t *)
static void SetupDataSet(aiori_h5fd_t *, int flags, aiori_mod_opt_t *)
struct benchmark_options o
#define HDF5_CHECK(HDF5_RETURN, MSG)
IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t *module_options, char *testFileName)
IOR_offset_t setAlignment
#define MPI_CHECK(MPI_STATUS, MSG)
int aiori_posix_stat(const char *path, struct stat *buf, aiori_mod_opt_t *module_options)
static aiori_xfer_hint_t * hints
static option_help * HDF5_options(aiori_mod_opt_t **init_backend_options, aiori_mod_opt_t *init_values)
static int HDF5_RmDir(const char *, aiori_mod_opt_t *)
static int HDF5_Access(const char *, int, aiori_mod_opt_t *)
static int HDF5_Stat(const char *, struct stat *, aiori_mod_opt_t *)
int MPIIO_Access(const char *path, int mode, aiori_mod_opt_t *module_options)
static option_help options[]
static void HDF5_Fsync(aiori_fd_t *, aiori_mod_opt_t *)
static int HDF5_check_params(aiori_mod_opt_t *options)
void MPIIO_xfer_hints(aiori_xfer_hint_t *params)
IOR_offset_t transferSize
static void HDF5_Finalize(aiori_mod_opt_t *)
static void HDF5_Delete(char *, aiori_mod_opt_t *)
static char * HDF5_GetVersion()
int aiori_posix_rmdir(const char *path, aiori_mod_opt_t *module_options)
static aiori_fd_t * HDF5_Open(char *, int flags, aiori_mod_opt_t *)
int aiori_posix_mkdir(const char *path, mode_t mode, aiori_mod_opt_t *module_options)
static IOR_offset_t HDF5_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *)
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 int HDF5_StatFS(const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *)
void MPIIO_Delete(char *testFileName, aiori_mod_opt_t *module_options)
static IOR_offset_t HDF5_GetFileSize(aiori_mod_opt_t *, char *)
long long int IOR_offset_t
void * safeMalloc(uint64_t size)
static IOR_offset_t SeekOffset(void *, IOR_offset_t, aiori_mod_opt_t *)