From 144b1294921aa9ed8dd29e17f3e5c97a3fb66568 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Sep 2011 09:25:19 -0500 Subject: [svn-r21365] Related files to files from HDF5-33 review - all changes ran correctly in trunk. Changes have been tested in cmake branch. #ifdef around include and Tested: local linux --- perform/benchpar.c | 8 ++-- perform/mpi-perf.c | 13 +++++- perform/perf.c | 113 +++++++++++++++++++++++++++++------------------------ 3 files changed, 77 insertions(+), 57 deletions(-) diff --git a/perform/benchpar.c b/perform/benchpar.c index 035e9d6..bf75d77 100644 --- a/perform/benchpar.c +++ b/perform/benchpar.c @@ -13,7 +13,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifdef H5_HAVE_UNISTD_H #include +#endif #include #include #include @@ -115,13 +117,13 @@ static hid_t create_fapl(MPI_Comm comm, MPI_Info info, int acc_type ) /* set parallel access with communicator, using MPI-I/O driver */ if (acc_type == FACC_MPIO) { - ret = H5Pset_fapl_mpio(fapl, comm, info); + ret = H5Pset_fapl_mpio(fapl, comm, info); assert(ret>=0); } /* end if */ /* set parallel access with communicator, using MPI-posix driver */ if (acc_type == FACC_MPIPOSIX) { - ret = H5Pset_fapl_mpiposix(fapl, comm, use_gpfs); + ret = H5Pset_fapl_mpiposix(fapl, comm, use_gpfs); assert(ret>=0); } /* end if */ @@ -312,7 +314,7 @@ int main(int argc, char *argv[]) char *login; /* Pointer to login name */ /* Get the login name for this user */ - login=getlogin(); + login=HDgetlogin(); if(login==NULL) login=DEFAULT_USERNAME; diff --git a/perform/mpi-perf.c b/perform/mpi-perf.c index c0fe794..a09d672 100644 --- a/perform/mpi-perf.c +++ b/perform/mpi-perf.c @@ -55,10 +55,19 @@ #include #include #include +#ifdef H5_HAVE_UNISTD_H #include +#endif #include #include -#include +#if defined(H5_TIME_WITH_SYS_TIME) +# include +# include +#elif defined(H5_HAVE_SYS_TIME_H) +# include +#else +# include +#endif #include #ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ # include @@ -299,7 +308,7 @@ die_jar_jar_die: #if H5_HAVE_SETENV /* no setenv or unsetenv */ /* clear the environment variable if it was set earlier */ - if (opt_pvfstab_set){ + if (opt_pvfstab_set){ unsetenv("PVFSTAB_FILE"); } #endif diff --git a/perform/perf.c b/perform/perf.c index 92b85bc..f006afb 100644 --- a/perform/perf.c +++ b/perform/perf.c @@ -28,10 +28,19 @@ #include #include #include +#ifdef H5_HAVE_UNISTD_H #include +#endif #include #include -#include +#if defined(H5_TIME_WITH_SYS_TIME) +# include +# include +#elif defined(H5_HAVE_SYS_TIME_H) +# include +#else +# include +#endif #include #ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ # include @@ -45,30 +54,30 @@ #define H5FATAL 1 #define VRFY(val, mesg, fatal) do { \ if (!val) { \ - printf("Proc %d: ", mynod); \ + printf("Proc %d: ", mynod); \ printf("*** Assertion failed (%s) at line %4d in %s\n", \ - mesg, (int)__LINE__, __FILE__); \ - if (fatal){ \ - fflush(stdout); \ - goto die_jar_jar_die; \ - } \ + mesg, (int)__LINE__, __FILE__); \ + if (fatal){ \ + fflush(stdout); \ + goto die_jar_jar_die; \ + } \ } \ } while(0) #define RANK 1 -hsize_t dims[RANK]; /* dataset dim sizes */ +hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t block[RANK], stride[RANK], count[RANK]; hssize_t start[RANK]; hid_t fid; /* HDF5 file ID */ -hid_t acc_tpl; /* File access templates */ -hid_t sid; /* Dataspace ID */ -hid_t file_dataspace; /* File dataspace ID */ -hid_t mem_dataspace; /* memory dataspace ID */ -hid_t dataset; /* Dataset ID */ -hsize_t opt_alignment = 1; -hsize_t opt_threshold = 1; -int opt_split_vfd = 0; -char *meta_ext, *raw_ext; /* holds the meta and raw file extension if */ - /* opt_split_vfd is set */ +hid_t acc_tpl; /* File access templates */ +hid_t sid; /* Dataspace ID */ +hid_t file_dataspace; /* File dataspace ID */ +hid_t mem_dataspace; /* memory dataspace ID */ +hid_t dataset; /* Dataset ID */ +hsize_t opt_alignment = 1; +hsize_t opt_threshold = 1; +int opt_split_vfd = 0; +char *meta_ext, *raw_ext; /* holds the meta and raw file extension if */ + /* opt_split_vfd is set */ /* DEFAULT VALUES FOR OPTIONS */ @@ -105,7 +114,7 @@ int main(int argc, char **argv) MPI_File fh; MPI_Status status; int nchars; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* startup MPI and determine the rank of this process */ MPI_Init(&argc,&argv); @@ -155,38 +164,38 @@ int main(int argc, char **argv) /* setup file access template with parallel IO access. */ if (opt_split_vfd){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment*opt_threshold != 1){ - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } - - /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); - ret = H5Pclose(mpio_pl); - VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment*opt_threshold != 1){ + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } + + /* setup file access template */ + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); + ret = H5Pclose(mpio_pl); + VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); }else{ - /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment*opt_threshold != 1){ - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } + /* setup file access template */ + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment*opt_threshold != 1){ + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } } /* create the parallel file */ @@ -198,7 +207,7 @@ int main(int argc, char **argv) sid = H5Screate_simple(RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL); dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL); /* create the memory dataspace and the file dataspace */ @@ -366,7 +375,7 @@ die_jar_jar_die: #if H5_HAVE_SETENV /* no setenv or unsetenv */ /* clear the environment variable if it was set earlier */ - if (opt_pvfstab_set){ + if (opt_pvfstab_set){ unsetenv("PVFSTAB_FILE"); } #endif -- cgit v0.12