From 87bed2c75284cfb13a1e88f34e48103d6614eedc Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Wed, 1 Oct 2014 17:02:41 -0500 Subject: [svn-r25651] Fix for: HDFFV-8715 HDF5_PARAPREFIX is ignored in parallel dense attribute and performance tests. tested on Jam w/ parallel. --- perform/perf.c | 25 +++++++++++++++++++++++-- testpar/t_dset.c | 7 ++++++- testpar/testphdf5.c | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/perform/perf.c b/perform/perf.c index f006afb..b7898ff 100644 --- a/perform/perf.c +++ b/perform/perf.c @@ -46,6 +46,9 @@ # include #endif +#ifndef HDF5_PARAPREFIX +# define HDF5_PARAPREFIX "" +#endif /* !HDF5_PARAPREFIX */ /* Macro definitions */ /* Verify: @@ -114,6 +117,8 @@ int main(int argc, char **argv) MPI_File fh; MPI_Status status; int nchars; + const char *prefix; + char *fullname=NULL; herr_t ret; /* Generic return value */ /* startup MPI and determine the rank of this process */ @@ -126,6 +131,20 @@ int main(int argc, char **argv) if (mynod == 0) printf("# Using hdf5-io calls.\n"); + /* create filename with correct prefix using HDF5_PARAPREFIX */ + prefix = HDgetenv("HDF5_PARAPREFIX"); + +#ifdef HDF5_PARAPREFIX + if (!prefix) + prefix = HDF5_PARAPREFIX; +#endif /* HDF5_PARAPREFIX */ + fullname = (char*) malloc(strlen(prefix) + strlen(opt_file) + 2); + if (strlen(prefix) > 0) + { + strcpy(fullname, prefix); + strcat(fullname, "/"); + } + strcat(fullname, opt_file); /* kindof a weird hack- if the location of the pvfstab file was * specified on the command line, then spit out this location into @@ -199,7 +218,7 @@ int main(int argc, char **argv) } /* create the parallel file */ - fid = H5Fcreate(opt_file, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); + fid = H5Fcreate(fullname, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL); /* define a contiquous dataset of opt_iter*nprocs*opt_block chars */ @@ -261,7 +280,7 @@ int main(int argc, char **argv) MPI_Barrier(MPI_COMM_WORLD); /* reopen the file for reading */ - fid=H5Fopen(opt_file,H5F_ACC_RDONLY,acc_tpl); + fid=H5Fopen(fullname,H5F_ACC_RDONLY,acc_tpl); VRFY((fid >= 0), "", H5FATAL); /* open the dataset */ @@ -382,6 +401,8 @@ die_jar_jar_die: free(tmp); if (opt_correct) free(tmp2); + if(fullname) free(fullname); + MPI_Finalize(); return(0); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 2bc3b09..281b1c0 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -4365,6 +4365,11 @@ test_dense_attr(void) hid_t atFileSpace, atid; hsize_t atDims[1] = {10000}; herr_t status; + const char *filename; + + /* get filename */ + filename = (const char *)GetTestParameters(); + HDassert( filename != NULL ); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -4376,7 +4381,7 @@ test_dense_attr(void) VRFY((status >= 0), "H5Pset_libver_bounds succeeded"); status = H5Pset_fapl_mpio(fpid, MPI_COMM_WORLD, MPI_INFO_NULL); VRFY((status >= 0), "H5Pset_fapl_mpio succeeded"); - fid = H5Fcreate("ph5Dense.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fpid); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fpid); VRFY((fid > 0), "H5Fcreate succeeded"); status = H5Pclose(fpid); VRFY((status >= 0), "H5Pclose succeeded"); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index df6257f..c55e2de 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -528,7 +528,7 @@ int main(int argc, char **argv) } AddTest("denseattr", test_dense_attr, NULL, - "Store Dense Attributes", NULL); + "Store Dense Attributes", PARATESTFILE); /* Display testing information */ -- cgit v0.12