From f490968edc999e8d18fa7174336942b9f010fd05 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 25 Jan 2000 23:33:38 -0500 Subject: [svn-r1947] Changed the test files prefix to use the h5_fixname() in test/libh5test.a. Makefile.in: Added test/ as one of the -I directories to search for header files. Needed because is used. t_file.c t_mpi.c testphdf5.c testphdf5.h: Added FILENAME to meet the assumption in h5test.h. (May use CLEANUP in the future.) Moved the prefix setting to the h5_fixname(). --- testpar/Makefile.in | 2 +- testpar/t_file.c | 10 ++++----- testpar/t_mpi.c | 8 +++---- testpar/testphdf5.c | 65 ++++++++++++++++++++++++++--------------------------- testpar/testphdf5.h | 1 + 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/testpar/Makefile.in b/testpar/Makefile.in index 4ead86d..840f39d 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -11,7 +11,7 @@ srcdir=@srcdir@ ## Add the include directory to the C preprocessor flags the the hdf5 library ## to the library list. -CPPFLAGS=-I. -I$(srcdir) -I../src -I$(top_srcdir)/src @CPPFLAGS@ +CPPFLAGS=-I. -I$(srcdir) -I../src -I$(top_srcdir)/src -I$(top_srcdir)/test @CPPFLAGS@ LIBHDF5=../src/libhdf5.la LIBH5TEST=../test/libh5test.la diff --git a/testpar/t_file.c b/testpar/t_file.c index 724edb4..d2b3d86 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -18,7 +18,7 @@ * sooner or later due to barrier mixed up. */ void -test_split_comm_access(char *filename[]) +test_split_comm_access(char *filename) { int mpi_size, mpi_rank; MPI_Comm comm; @@ -30,8 +30,8 @@ test_split_comm_access(char *filename[]) herr_t ret; /* generic return value */ if (verbose) - printf("Split Communicator access test on file %s %s\n", - filename[0], filename[1]); + printf("Split Communicator access test on file %s\n", + filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -60,7 +60,7 @@ test_split_comm_access(char *filename[]) VRFY((ret >= 0), ""); /* create the file collectively */ - fid=H5Fcreate(filename[color],H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl); + fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl); VRFY((fid >= 0), "H5Fcreate succeeded"); /* Release file-access template */ @@ -73,7 +73,7 @@ test_split_comm_access(char *filename[]) /* detele the test file */ if (sub_mpi_rank == 0){ - mrc = MPI_File_delete(filename[color], info); + mrc = MPI_File_delete(filename, info); VRFY((mrc==MPI_SUCCESS), ""); } } diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index dbcfada..85c7c9e 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -17,7 +17,7 @@ #define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */ void -test_mpio_overlap_writes(char *filename[]) +test_mpio_overlap_writes(char *filename) { int mpi_size, mpi_rank; MPI_Comm comm; @@ -38,7 +38,7 @@ test_mpio_overlap_writes(char *filename[]) if (verbose) printf("MPIO independent overlapping writes test on file %s\n", - filename[0]); + filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -59,7 +59,7 @@ test_mpio_overlap_writes(char *filename[]) if (color==0){ /* First n-1 processes (color==0) open a file and write it */ - mrc = MPI_File_open(comm, filename[0], MPI_MODE_CREATE|MPI_MODE_RDWR, + mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, info, &fh); VRFY((mrc==MPI_SUCCESS), ""); @@ -104,7 +104,7 @@ test_mpio_overlap_writes(char *filename[]) mrc = MPI_Barrier(MPI_COMM_WORLD); VRFY((mrc==MPI_SUCCESS), "Sync after writes"); - mrc = MPI_File_open(comm, filename[0], MPI_MODE_RDONLY, + mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, info, &fh); VRFY((mrc==MPI_SUCCESS), ""); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 18b4ad6..9199b69 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -14,28 +14,20 @@ int chunkdim1; int nerrors = 0; /* errors count */ int verbose = 0; /* verbose, default as no. */ -/* FilePrefix defines where the temporary parallel test files should be. */ -/* In a parallel system, filesystem suitable for compiling are unlikly */ -/* the right place for parallel I/O. There is no common used pathname */ -/* for the parallel file system. So, /tmp is used as the default. */ -#ifdef __PUMAGON__ -/* For the PFS of TFLOPS */ -char *fileprefix = "pfs:/pfs_grande/multi/tmp_1/"; -#else -char *fileprefix = "/tmp/"; -#endif -size_t fileprefixlen; /* file prefix length */ - herr_t (*old_func)(void*); /* previous error handler */ void *old_client_data; /* previous error handler arg.*/ /* other option flags */ int doread=1; /* read test */ int dowrite=1; /* write test */ -char *filenames[]={ "ParaEg1.h5f", - "ParaEg2.h5f", - "ParaEg3.h5f", - "ParaMdset.h5f" }; +/* FILENAME and filenames must have the same number of names */ +const char *FILENAME[5]={ + "ParaEg1", + "ParaEg2", + "ParaEg3", + "ParaMdset", + NULL}; +char filenames[5][200]; @@ -143,7 +135,7 @@ parse_options(int argc, char **argv) nerrors++; return(1); } - fileprefix = *argv; + paraprefix = *argv; break; case 'd': /* dimensizes */ if (--argc < 2){ @@ -195,23 +187,29 @@ parse_options(int argc, char **argv) return(1); } - /* compose the filenames if file prefix is defined */ - if (fileprefix != NULL) { - char *tmpptr; - int i; - - fileprefixlen = strlen(fileprefix); - i = sizeof(filenames)/sizeof(filenames[0]); - while (i-- > 0){ - tmpptr = filenames[i]; - filenames[i] = (char *)malloc (fileprefixlen + strlen(tmpptr) + 1); - if (!filenames[i]) { - printf("%s\n","memory allocation failed"); + /* compose the test filenames */ + { + int i, n; + hid_t plist; + + plist = H5Pcreate (H5P_FILE_ACCESS); + H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],plist,filenames[i],sizeof(filenames[i])) + == NULL){ + printf("h5_fixname failed\n"); nerrors++; + H5Pclose(plist); return(1); } - strcpy(filenames[i],fileprefix); - strcat(filenames[i],tmpptr); + H5Pclose(plist); + if (verbose){ + int i; + printf("Test filenames are:\n"); + for (i=0; i < n; i++) + printf(" %s\n", filenames[i]); } } @@ -241,10 +239,10 @@ main(int argc, char **argv) if (dowrite){ MPI_BANNER("testing MPIO independent overlapping writes..."); - test_mpio_overlap_writes(filenames); + test_mpio_overlap_writes(filenames[0]); MPI_BANNER("testing dataset using split communicators..."); - test_split_comm_access(filenames); + test_split_comm_access(filenames[0]); MPI_BANNER("testing dataset independent write..."); dataset_writeInd(filenames[0]); @@ -259,6 +257,7 @@ main(int argc, char **argv) multiple_dset_write(filenames[3]); } + if (doread){ MPI_BANNER("testing dataset independent read..."); dataset_readInd(filenames[0]); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 399f3b5..939cf19 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -6,6 +6,7 @@ #include #include #include +#include /* Define some handy debugging shorthands, routines, ... */ /* debugging tools */ -- cgit v0.12