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"); \ 106 if (init_values !=
NULL){
113 *init_backend_options =
o;
116 {0,
"hdf5.collectiveMetadata",
"Use collectiveMetadata (available since HDF5-1.10.0)",
OPTION_FLAG,
'd', & o->
collective_md},
120 memcpy(help, h,
sizeof(h));
168 hid_t accessPropList, createPropList;
174 unsigned fd_mode = (unsigned)0;
177 MPI_Info mpiHints = MPI_INFO_NULL;
179 fd = (hid_t *) malloc(
sizeof(hid_t));
181 ERR(
"malloc() failed");
194 fd_mode |= H5F_ACC_RDONLY;
197 fprintf(stdout,
"File write only not implemented in HDF5\n");
200 fd_mode |= H5F_ACC_RDWR;
203 fprintf(stdout,
"File append not implemented in HDF5\n");
206 fd_mode |= H5F_ACC_CREAT;
209 fd_mode |= H5F_ACC_EXCL;
212 fd_mode |= H5F_ACC_TRUNC;
215 fprintf(stdout,
"O_DIRECT not implemented in HDF5\n");
219 createPropList = H5Pcreate(H5P_FILE_CREATE);
220 HDF5_CHECK(createPropList,
"cannot create file creation property list");
223 (createPropList,
sizeof(hsize_t),
sizeof(hsize_t)),
224 "cannot set property list properly");
227 accessPropList = H5Pcreate(H5P_FILE_ACCESS);
228 HDF5_CHECK(accessPropList,
"cannot create file access property list");
235 comm = MPI_COMM_SELF;
249 fprintf(stdout,
"\nhints passed to access property list {\n");
251 fprintf(stdout,
"}\n");
253 HDF5_CHECK(H5Pset_fapl_mpio(accessPropList, comm, mpiHints),
254 "cannot set file access property list");
259 "cannot set alignment");
261 #ifdef HAVE_H5PSET_ALL_COLL_METADATA_OPS 266 HDF5_CHECK(H5Pset_all_coll_metadata_ops(accessPropList, 1),
267 "cannot set collective md read");
268 HDF5_CHECK(H5Pset_coll_metadata_write(accessPropList, 1),
269 "cannot set collective md write");
276 *fd = H5Fcreate(testFileName, fd_mode,
277 createPropList, accessPropList);
280 *fd = H5Fopen(testFileName, fd_mode, accessPropList);
289 WARN(
"showHints not working for HDF5");
292 MPI_Info mpiHintsCheck = MPI_INFO_NULL;
294 apl = H5Fget_access_plist(*fd);
295 HDF5_CHECK(H5Pget_fapl_mpio(apl, &comm, &mpiHintsCheck),
296 "cannot get info object through HDF5");
299 "\nhints returned from opened file (HDF5) {\n");
301 fprintf(stdout,
"}\n");
305 (*fd, apl, (
void **)&fd_mpiio),
306 "cannot get MPIIO file handle");
307 if (mpiHintsCheck != MPI_INFO_NULL)
308 MPI_Info_free(&mpiHintsCheck);
310 (*fd_mpiio, &mpiHintsCheck),
311 "cannot get info object through MPIIO");
313 "\nhints returned from opened file (MPIIO) {\n");
315 fprintf(stdout,
"}\n");
316 if (mpiHintsCheck != MPI_INFO_NULL)
317 MPI_Info_free(&mpiHintsCheck);
328 "cannot close creation property list");
330 "cannot close access property list");
339 "cannot set collective data transfer mode");
343 "cannot set independent data transfer mode");
347 memStart[0] = (hsize_t) 0;
348 memCount[0] = (hsize_t) 1;
357 memStart, memStride, memCount,
358 memBlock),
"cannot create hyperslab");
379 if (mpiHints != MPI_INFO_NULL)
380 MPI_Info_free(&mpiHints);
391 static int firstReadCheck =
FALSE, startNewDataSet;
400 if (firstReadCheck ==
TRUE) {
401 firstReadCheck =
FALSE;
403 firstReadCheck =
TRUE;
424 startNewDataSet =
TRUE;
426 startNewDataSet =
FALSE;
434 if (startNewDataSet ==
TRUE) {
439 "cannot close file data space");
447 startNewDataSet =
FALSE;
451 if (access ==
WRITE) {
455 "cannot write to data set");
460 "cannot read from data set");
484 "cannot close file data space");
486 "cannot close memory data space");
488 " cannot close transfer property list");
490 HDF5_CHECK(H5Fclose(*(hid_t *) fd),
"cannot close file");
510 static char version[1024] = {0};
511 if(version[0])
return version;
513 unsigned major, minor, release;
514 if (H5get_libversion(&major, &minor, &release) < 0) {
515 WARN(
"cannot get HDF5 library version");
517 sprintf(version,
"%u.%u.%u", major, minor, release);
519 #ifndef H5_HAVE_PARALLEL 520 strcat(version,
" (Serial)");
522 strcat(version,
" (Parallel)");
547 hsStart[0] = (hsize_t) ((offset % param->
blockSize)
552 (hsize_t) ((offset % segmentSize) /
sizeof(
IOR_size_t));
554 hsCount[0] = (hsize_t) 1;
562 hsStart, hsStride, hsCount, hsBlock),
563 "cannot select hyperslab");
573 hid_t dataSetPropList;
575 static int dataSetSuffix = 0;
591 sprintf(dataSetName,
"%s-%04d.%04d",
"Dataset", dataSetID,
596 dataSetPropList = H5Pcreate(H5P_DATASET_CREATE);
598 #if defined (H5_VERS_MAJOR) && defined (H5_VERS_MINOR) 600 #if (H5_VERS_MAJOR > 0 && H5_VERS_MINOR > 5) 603 fprintf(stdout,
"\nusing 'no fill' option\n");
606 H5D_FILL_TIME_NEVER),
607 "cannot set fill time for property list");
611 sprintf(errorString,
"'no fill' option not available in %s",
616 WARN(
"unable to determine HDF5 version for 'no fill' usage");
619 H5Dcreate(*(hid_t *) fd, dataSetName, H5T_NATIVE_LLONG,
623 dataSet = H5Dopen(*(hid_t *) fd, dataSetName);
static option_help * HDF5_options(void **init_backend_options, void *init_values)
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 struct cephfs_options o
static void SetupDataSet(void *, IOR_param_t *)
IOR_offset_t MPIIO_GetFileSize(IOR_param_t *test, MPI_Comm testComm, char *testFileName)