summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2004-08-24 00:08:35 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2004-08-24 00:08:35 (GMT)
commit91d35f09f8c7c23dd143e6704a9531e47c137b00 (patch)
tree26a89855c29960fc02fef884416dd8d069c29717 /testpar
parent6bedc7a7294c3bb726a3157ac9d305b4ceae9dc6 (diff)
downloadhdf5-91d35f09f8c7c23dd143e6704a9531e47c137b00.zip
hdf5-91d35f09f8c7c23dd143e6704a9531e47c137b00.tar.gz
hdf5-91d35f09f8c7c23dd143e6704a9531e47c137b00.tar.bz2
[svn-r9142] Purpose:
Code cleanup. Removed bunch of old options (r,w,v,i,b,e) that are no longer valid or useful after adopting the general test interface. Moved the test of sizeof MPI_Offset into the test routine itself. Platforms tested: Eirene and Sol using pp mode.
Diffstat (limited to 'testpar')
-rw-r--r--testpar/t_mdset.c3
-rw-r--r--testpar/t_mpi.c95
-rw-r--r--testpar/testphdf5.c94
3 files changed, 94 insertions, 98 deletions
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index ab59527..e437b22 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -302,6 +302,9 @@ void big_dataset(void)
MPI_Comm_rank (MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size (MPI_COMM_WORLD, &mpi_size);
+ /* Verify MPI_Offset can handle larger than 2GB sizes */
+ VRFY((sizeof(MPI_Offset)>4), "sizeof(MPI_Offset)>4");
+
filename = (char *) GetTestParameters();
fapl = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type, use_gpfs);
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index 2d5da66..62aba13 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -37,14 +37,10 @@ int nerrors = 0;
hid_t fapl; /* file access property list */
/* protocols */
-static void test_mpio_overlap_writes(char *filename);
-static void test_mpio_gb_file(char *filename);
-static int parse_options(int argc, char **argv);
-static void usage(void);
#define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */
-void
+int
test_mpio_overlap_writes(char *filename)
{
int mpi_size, mpi_rank;
@@ -53,7 +49,7 @@ test_mpio_overlap_writes(char *filename)
int color, mrc;
MPI_File fh;
int i;
- int vrfyerrs;
+ int vrfyerrs, nerrs;
unsigned char buf[4093]; /* use some prime number for size */
int bufsize = sizeof(buf);
MPI_Offset stride;
@@ -65,6 +61,7 @@ test_mpio_overlap_writes(char *filename)
printf("MPIO independent overlapping writes test on file %s\n",
filename);
+ nerrs = 0;
/* set up MPI parameters */
MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
@@ -74,7 +71,7 @@ test_mpio_overlap_writes(char *filename)
if (MAINPROCESS)
printf("Need at least 2 processes to run MPIO test.\n");
printf(" -SKIP- \n");
- return;
+ return 0;
}
/* splits processes 0 to n-2 into one comm. and the last one into another */
@@ -153,6 +150,8 @@ test_mpio_overlap_writes(char *filename)
}
if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
printf("proc %d: [more errors ...]\n", mpi_rank);
+
+ nerrs += vrfyerrs;
}
/* close file and free the communicator */
@@ -168,6 +167,7 @@ test_mpio_overlap_writes(char *filename)
*/
mrc = MPI_Barrier(MPI_COMM_WORLD);
VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
+ return (nerrs);
}
@@ -186,7 +186,7 @@ test_mpio_overlap_writes(char *filename)
* Then reads the file back in by reverse order, that is process 0
* reads the data of process n-1 and vice versa.
*/
-void
+int
test_mpio_gb_file(char *filename)
{
int mpi_size, mpi_rank;
@@ -196,6 +196,7 @@ test_mpio_gb_file(char *filename)
int i, j, n;
int vrfyerrs;
int writerrs; /* write errors */
+ int nerrs;
int ntimes; /* how many times */
char *buf = NULL;
char expected;
@@ -204,7 +205,7 @@ test_mpio_gb_file(char *filename)
MPI_Status mpi_stat;
int is_signed, sizeof_mpi_offset;
-
+ nerrs = 0;
/* set up MPI parameters */
MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
@@ -217,6 +218,10 @@ test_mpio_gb_file(char *filename)
is_signed = ((MPI_Offset)(mpi_off - 1)) < 0;
sizeof_mpi_offset = (int)(sizeof(MPI_Offset));
+ /*
+ * Verify the sizeof MPI_Offset and correctness of handling multiple GB
+ * sizes.
+ */
if (MAINPROCESS){ /* only process 0 needs to check it*/
printf("MPI_Offset is %s %d bytes integeral type\n",
is_signed ? "signed" : "unsigned", (int)sizeof(MPI_Offset));
@@ -263,7 +268,9 @@ test_mpio_gb_file(char *filename)
}
}
- /*================================*/
+ /*
+ * Verify if we can write to a file of multiple GB sizes.
+ */
if (VERBOSE_MED)
printf("MPIO GB file test %s\n", filename);
@@ -317,10 +324,13 @@ test_mpio_gb_file(char *filename)
mrc = MPI_Barrier(MPI_COMM_WORLD);
VRFY((mrc==MPI_SUCCESS), "Sync after writes");
+ /*
+ * Verify if we can read the multiple GB file just created.
+ */
/* open it again to verify the data written */
/* but only if there was no write errors */
printf("MPIO GB file read test %s\n", filename);
- if (writerrs){
+ if (errors_sum(writerrs)>0){
printf("proc %d: Skip read test due to previous write errors\n",
mpi_rank);
goto finish;
@@ -350,6 +360,7 @@ test_mpio_gb_file(char *filename)
if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
printf("proc %d: [more errors ...]\n", mpi_rank);
+ nerrs += vrfyerrs;
}
}
@@ -368,6 +379,7 @@ test_mpio_gb_file(char *filename)
finish:
if (buf)
HDfree(buf);
+ return (nerrs);
}
@@ -406,7 +418,7 @@ int test_mpio_1wMr(char *filename, int special_request)
unsigned char writedata[DIMSIZE], readdata[DIMSIZE];
unsigned char expect_val;
int i, irank;
- int nerrors = 0; /* number of errors */
+ int nerrs = 0; /* number of errors */
int atomicity;
MPI_Offset mpi_off;
MPI_Status mpi_stat;
@@ -562,7 +574,7 @@ if (special_request & USEFSYNC){
PRINTID;
printf("read data[%d:%d] got %02x, expect %02x\n", irank, i,
readdata[i], expect_val);
- nerrors++;
+ nerrs++;
}
}
@@ -570,18 +582,11 @@ if (special_request & USEFSYNC){
if (VERBOSE_HI){
PRINTID;
- printf("%d data errors detected\n", nerrors);
- }
-
- {
- int temp;
- MPI_Reduce(&nerrors, &temp, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
- if (mpi_rank == 0 && temp > 0)
- nerrors = temp;
+ printf("%d data errors detected\n", nerrs);
}
mpi_err = MPI_Barrier(MPI_COMM_WORLD);
- return nerrors;
+ return nerrs;
}
@@ -659,6 +664,16 @@ usage(void)
printf("\n");
}
+/*
+ * return the sum of all errors.
+ */
+int errors_sum(nerrs)
+{
+ int temp;
+ MPI_Allreduce(&nerrs, &temp, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+ return(temp);
+}
+
int
main(int argc, char **argv)
@@ -671,7 +686,6 @@ main(int argc, char **argv)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
H5open();
- TestInit(argv[0], NULL, parse_options);
if (parse_options(argc, argv) != 0){
if (MAINPROCESS)
usage();
@@ -692,28 +706,47 @@ main(int argc, char **argv)
MPI_BANNER("MPIO 1 write Many read test...");
ret_code = test_mpio_1wMr(filenames[0], USENONE);
- if (mpi_rank==0 && ret_code > 0)
+ ret_code = errors_sum(ret_code);
+ if (mpi_rank==0 && ret_code > 0){
printf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
+ }
/* test atomicity and file sync in high verbose mode only */
/* since they often hang when broken and PHDF5 does not use them. */
- if (VERBOSE_HI){
+ if (VERBOSE_HI){
MPI_BANNER("MPIO 1 write Many read test with atomicity...");
ret_code = test_mpio_1wMr(filenames[0], USEATOM);
- if (mpi_rank==0 && ret_code > 0)
+ ret_code = errors_sum(ret_code);
+ if (mpi_rank==0 && ret_code > 0){
printf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
+ }
MPI_BANNER("MPIO 1 write Many read test with file sync...");
ret_code = test_mpio_1wMr(filenames[0], USEFSYNC);
- if (mpi_rank==0 && ret_code > 0)
+ ret_code = errors_sum(ret_code);
+ if (mpi_rank==0 && ret_code > 0){
printf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
+ }
}
MPI_BANNER("MPIO File size range test...");
- test_mpio_gb_file(filenames[0]);
+ ret_code = test_mpio_gb_file(filenames[0]);
+ ret_code = errors_sum(ret_code);
+ if (mpi_rank==0 && ret_code > 0){
+ printf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
+ }
MPI_BANNER("MPIO independent overlapping writes...");
- test_mpio_overlap_writes(filenames[0]);
+ ret_code = test_mpio_overlap_writes(filenames[0]);
+ ret_code = errors_sum(ret_code);
+ if (mpi_rank==0 && ret_code > 0){
+ printf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
+ }
finish:
/* make sure all processes are finished before final report, cleanup
@@ -737,7 +770,7 @@ finish:
/* MPI_Finalize must be called AFTER H5close which may use MPI calls */
MPI_Finalize();
- /* always return 0 as this test is informational only. */
- return(0);
+ /* cannot just return (nerrors) because exit code is limited to 1byte */
+ return(nerrors!=0);
}
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 0a99b02..f5f2c6a 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -37,11 +37,6 @@ H5E_auto_t old_func; /* previous error handler */
void *old_client_data; /* previous error handler arg.*/
/* other option flags */
-int doread=1; /* read test */
-int dowrite=1; /* write test */
-int docompact=1; /* compact dataset test */
-int doindependent=1; /* independent test */
-unsigned dobig=0; /* "big" dataset tests */
/* FILENAME and filenames must have the same number of names */
const char *FILENAME[14]={
@@ -119,25 +114,18 @@ int MPI_Init(int *argc, char ***argv)
static void
usage(void)
{
- printf(" [-r] [-w] [-v<verbosity>] [-m<n_datasets>] [-n<n_groups>] "
+ printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] "
"[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
- printf("\t-r\t\tno read test\n");
- printf("\t-w\t\tno write test\n");
printf("\t-m<n_datasets>"
"\tset number of datasets for the multiple dataset test\n");
printf("\t-n<n_groups>"
"\tset number of groups for the multiple group test\n");
- printf("\t-o\t\tno compact dataset test\n");
- printf("\t-i\t\tno independent read test\n");
- printf("\t-b\t\trun big dataset test\n");
- printf("\t-v<verbosity>\tset verbose level (0-9,l,m,h)\n");
printf("\t-f <prefix>\tfilename prefix\n");
- printf("\t-s\t\tuse Split-file together with MPIO\n");
+ printf("\t-2\t\tuse Split-file together with MPIO\n");
printf("\t-p\t\tuse combo MPI-POSIX driver\n");
- printf("\t-d <dim0> <dim1>\tdataset dimensions\n");
- printf("\t-c <dim0> <dim1>\tdataset chunk dimensions\n");
- printf("\tDefault: do write then read with dimensions %dx%d\n",
+ printf("\t-d <dim0> <dim1>\tdataset dimensions. Defaults (%d,%d)\n",
DIM0, DIM1);
+ printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n");
printf("\n");
}
@@ -162,10 +150,6 @@ parse_options(int argc, char **argv)
break;
}else{
switch(*(*argv+1)){
- case 'r': doread = 0;
- break;
- case 'w': dowrite = 0;
- break;
case 'm': ndatasets = atoi((*argv+1)+1);
if (ndatasets < 0){
nerrors++;
@@ -178,17 +162,6 @@ parse_options(int argc, char **argv)
return(1);
}
break;
- case 'o': docompact = 0;
- break;
- case 'i': doindependent = 0;
- break;
- case 'b': dobig = 1;
- break;
- case 'v': if (*((*argv+1)+1))
- ParseTestVerbosity((*argv+1)+1);
- else
- SetTestVerbosity(VERBO_MED);
- break;
case 'f': if (--argc < 1) {
nerrors++;
return(1);
@@ -202,7 +175,7 @@ parse_options(int argc, char **argv)
case 'p': /* Use the MPI-POSIX driver access */
facc_type = FACC_MPIPOSIX;
break;
- case 's': /* Use the split-file driver with MPIO access */
+ case '2': /* Use the split-file driver with MPIO access */
/* Can use $HDF5_METAPREFIX to define the */
/* meta-file-prefix. */
facc_type = FACC_MPIO | FACC_SPLIT;
@@ -230,7 +203,8 @@ parse_options(int argc, char **argv)
break;
case 'h': /* print help message--return with nerrors set */
return(1);
- default: nerrors++;
+ default: printf("Illegal option(%s)\n", *argv);
+ nerrors++;
return(1);
}
}
@@ -443,7 +417,6 @@ int main(int argc, char **argv)
AddTest("fillvalue", dataset_fillvalue, NULL,
"dataset fill value", filenames[8]);
-
if(mpi_size > 64) {
if(MAINPROCESS) {
printf("Collective chunk IO tests haven't been tested \n");
@@ -455,13 +428,13 @@ int main(int argc, char **argv)
}
else {
AddTest("coll_chunked1", coll_chunk1,NULL,
- "simple collective chunk io",filenames[9]);
+ "simple collective chunk io",filenames[9]);
AddTest("coll_chunked2", coll_chunk2,NULL,
- "noncontiguous collective chunk io",filenames[10]);
+ "noncontiguous collective chunk io",filenames[10]);
AddTest("coll_chunked3", coll_chunk3,NULL,
- "multi-chunk collective chunk io",filenames[11]);
+ "multi-chunk collective chunk io",filenames[11]);
AddTest("coll_chunked4", coll_chunk4,NULL,
- "collective to independent chunk io",filenames[12]);
+ "collective to independent chunk io",filenames[12]);
}
/* Display testing information */
@@ -488,42 +461,33 @@ int main(int argc, char **argv)
"===================================\n");
}
- /* Argument requests */
- if (dobig && sizeof(MPI_Offset)>4){
- SetTest("bigdataset", ONLYTEST);
- }
-
/* Perform requested testing */
PerformTests();
+finish:
+ /* make sure all processes are finished before final report, cleanup
+ * and exit.
+ */
+ MPI_Barrier(MPI_COMM_WORLD);
+
/* Display test summary, if requested */
- if (GetTestSummary())
+ if (MAINPROCESS && GetTestSummary())
TestSummary();
/* Clean up test files, if allowed */
if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
- TestCleanup();
+ h5_cleanup(FILENAME, fapl);
+ else
+ /* h5_cleanup would have closed fapl. Now must do it explicitedly */
+ H5Pclose(fapl);
nerrors += GetTestNumErrs();
-
- if (!(dowrite || doread || ndatasets || ngroups || docompact || doindependent || dobig )){
- usage();
- nerrors++;
- }
-
-finish:
- /* make sure all processes are finished before final report, cleanup
- * and exit.
- */
- MPI_Barrier(MPI_COMM_WORLD);
-
/* Gather errors from all processes */
{
int temp;
- MPI_Reduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD);
- if(mpi_rank==0)
- nerrors=temp;
+ MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
+ nerrors=temp;
}
if (MAINPROCESS){ /* only process 0 reports */
@@ -534,17 +498,13 @@ finish:
printf("PHDF5 tests finished with no errors\n");
printf("===================================\n");
}
- if (dowrite)
- h5_cleanup(FILENAME, fapl);
- else
- /* h5_cleanup would have closed fapl. Now must do it explicitedly */
- H5Pclose(fapl);
-
/* close HDF5 library */
H5close();
/* MPI_Finalize must be called AFTER H5close which may use MPI calls */
MPI_Finalize();
- return(nerrors);
+
+ /* cannot just return (nerrors) because exit code is limited to 1byte */
+ return(nerrors!=0);
}