summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2000-10-20 06:19:21 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2000-10-20 06:19:21 (GMT)
commitb3e4cd6e974e9a9debe24bd248bbe599bfd6c230 (patch)
treeac06eff6212bd09e801c53f023ef2a4c49f45fa1
parent114ac60d1b210884bc96c4189ba4641f7844ef8c (diff)
downloadhdf5-b3e4cd6e974e9a9debe24bd248bbe599bfd6c230.zip
hdf5-b3e4cd6e974e9a9debe24bd248bbe599bfd6c230.tar.gz
hdf5-b3e4cd6e974e9a9debe24bd248bbe599bfd6c230.tar.bz2
[svn-r2710] Purpose:
Features, kind of. Description: Separated the MPI features test into its own independent program so that it can be tested on its own without too much HDF5 stuff involved. Added automatic removal of temporary test files after the tests completed. Reduced the size of the dataset dimensions to avoid tripping the SGI MPI problems of running out of internal mpi type entries. Platforms tested: O2K -64
-rw-r--r--testpar/Makefile.in16
-rw-r--r--testpar/t_mpi.c121
-rw-r--r--testpar/testphdf5.c27
-rw-r--r--testpar/testphdf5.h4
4 files changed, 145 insertions, 23 deletions
diff --git a/testpar/Makefile.in b/testpar/Makefile.in
index 840f39d..d8428f8 100644
--- a/testpar/Makefile.in
+++ b/testpar/Makefile.in
@@ -19,22 +19,28 @@ LIBH5TEST=../test/libh5test.la
RUNTEST=$(RUNPARALLEL)
## These are our main targets
-TEST_PROGS=testphdf5
+TEST_PROGS=t_mpi testphdf5
## Temporary files
MOSTLYCLEAN=ParaEg[123].h5f
DISTCLEAN=go
## Test source files
-TEST_SRC=testphdf5.c t_dset.c t_file.c t_mpi.c t_mdset.c
+TEST_PHDF5_SRC=testphdf5.c t_dset.c t_file.c t_mdset.c
+TEST_PHDF5_OBJ=$(TEST_PHDF5_SRC:.c=.lo)
+TEST_SRC=t_mpi.c $(TEST_PHDF5_SRC)
TEST_OBJ=$(TEST_SRC:.c=.lo)
TEST_HDR=testphdf5.h
## How to build the tests... They all depend on the hdf5 library
$(TEST_PROGS): $(LIBHDF5) $(LIBH5TEST)
-testphdf5: $(TEST_OBJ)
- @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(TEST_OBJ) $(LIBH5TEST) $(LIBHDF5) $(LDFLAGS) $(LIBS)
-
$(TEST_OBJ): $(TEST_HDR)
+
+t_mpi: t_mpi.lo
+ @$(LT_LINK_EXE) $(CFLAGS) -o $@ t_mpi.lo $(LIBH5TEST) $(LIBHDF5) $(LDFLAGS) $(LIBS)
+
+testphdf5: $(TEST_PHDF5_OBJ)
+ @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(TEST_PHDF5_OBJ) $(LIBH5TEST) $(LIBHDF5) $(LDFLAGS) $(LIBS)
+
@CONCLUDE@
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index 85c7c9e..5c7a88b 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -14,6 +14,15 @@
#include <testphdf5.h>
+/* FILENAME and filenames must have the same number of names */
+const char *FILENAME[2]={
+ "MPItest",
+ NULL};
+char filenames[2][200];
+int nerrors;
+int verbose;
+hid_t fapl; /* file access property list */
+
#define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */
void
@@ -140,3 +149,115 @@ test_mpio_overlap_writes(char *filename)
VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
}
+
+/*
+ * parse the command line options
+ */
+int
+parse_options(int argc, char **argv)
+{
+ while (--argc){
+ if (**(++argv) != '-'){
+ break;
+ }else{
+ switch(*(*argv+1)){
+ case 'v': verbose = 1;
+ break;
+ case 'f': if (--argc < 1) {
+ nerrors++;
+ return(1);
+ }
+ if (**(++argv) == '-') {
+ nerrors++;
+ return(1);
+ }
+ paraprefix = *argv;
+ break;
+ case 'h': /* print help message--return with nerrors set */
+ return(1);
+ default: nerrors++;
+ return(1);
+ }
+ }
+ } /*while*/
+
+ /* 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++;
+ return(1);
+ }
+ H5Pclose(plist);
+ printf("Test filenames are:\n");
+ for (i=0; i < n; i++)
+ printf(" %s\n", filenames[i]);
+ }
+
+ return(0);
+}
+
+
+/*
+ * Show command usage
+ */
+void
+usage(void)
+{
+ printf("Usage: t_mpi [-v] [-f <prefix>]\n");
+ printf("\t-v\t\tverbose on\n");
+ printf("\t-f <prefix>\tfilename prefix\n");
+ printf("\n");
+}
+
+
+main(int argc, char **argv)
+{
+ int mpi_size, mpi_rank; /* mpi variables */
+
+ MPI_Init(&argc, &argv);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+
+ if (MAINPROCESS){
+ printf("===================================\n");
+ printf("MPI functionality tests\n");
+ printf("===================================\n");
+ }
+ fapl = H5Pcreate (H5P_FILE_ACCESS);
+ H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
+
+ if (parse_options(argc, argv) != 0){
+ if (MAINPROCESS)
+ usage();
+ goto finish;
+ }
+
+ MPI_BANNER("MPIO independent overlapping writes...");
+ test_mpio_overlap_writes(filenames[0]);
+
+finish:
+ if (MAINPROCESS){ /* only process 0 reports */
+ printf("===================================\n");
+ if (nerrors){
+ printf("***MPI tests detected %d errors***\n", nerrors);
+ }
+ else{
+ printf("MPI tests finished with no errors\n");
+ }
+ printf("===================================\n");
+ }
+ MPI_Finalize();
+ h5_cleanup(FILENAME, fapl);
+ return(nerrors);
+}
+
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 22907f8..77f2653 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -29,6 +29,7 @@ const char *FILENAME[5]={
"ParaMdset",
NULL};
char filenames[5][200];
+hid_t fapl; /* file access property list */
@@ -254,27 +255,19 @@ parse_options(int argc, char **argv)
/* 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]))
+ if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
== NULL){
printf("h5_fixname failed\n");
nerrors++;
- H5Pclose(plist);
return(1);
}
- H5Pclose(plist);
- if (verbose){
- int i;
- printf("Test filenames are:\n");
- for (i=0; i < n; i++)
- printf(" %s\n", filenames[i]);
- }
+ printf("Test filenames are:\n");
+ for (i=0; i < n; i++)
+ printf(" %s\n", filenames[i]);
}
return(0);
@@ -294,6 +287,8 @@ main(int argc, char **argv)
printf("PHDF5 TESTS START\n");
printf("===================================\n");
}
+ fapl = H5Pcreate (H5P_FILE_ACCESS);
+ H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
if (parse_options(argc, argv) != 0){
if (MAINPROCESS)
@@ -302,9 +297,6 @@ main(int argc, char **argv)
}
if (dowrite){
- MPI_BANNER("MPIO independent overlapping writes...");
- test_mpio_overlap_writes(filenames[0]);
-
MPI_BANNER("dataset using split communicators...");
test_split_comm_access(filenames[0]);
@@ -360,7 +352,10 @@ finish:
printf("===================================\n");
}
MPI_Finalize();
-
+ if (dowrite)
+ h5_cleanup(FILENAME, fapl);
+ else
+ H5Pclose(fapl);
return(nerrors);
}
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index 9c89408..b246f6a 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -47,8 +47,8 @@
/* End of Define some handy debugging shorthands, routines, ... */
/* Constants definitions */
-#define DIM0 1024 /* Default dataset sizes. */
-#define DIM1 1280 /* Values are from a monitor pixel sizes */
+#define DIM0 600 /* Default dataset sizes. */
+#define DIM1 800 /* Values are from a monitor pixel sizes */
#define RANK 2
#define DATASETNAME1 "Data1"
#define DATASETNAME2 "Data2"