diff options
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_mpi.c | 68 | ||||
-rw-r--r-- | testpar/testphdf5.h | 22 |
2 files changed, 68 insertions, 22 deletions
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index f5f362a..7f4eef1 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -19,8 +19,8 @@ const char *FILENAME[2]={ "MPItest", NULL}; char filenames[2][200]; -int nerrors; -int verbose; +int nerrors = 0; +int verbose = 0; hid_t fapl; /* file access property list */ #define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */ @@ -38,6 +38,7 @@ test_mpio_overlap_writes(char *filename) hid_t acc_tpl; /* File access properties */ herr_t ret; /* generic return value */ int i; + int vrfyerrs; char buf[4093]; /* use some prime number for size */ int bufsize = sizeof(buf); int stride; @@ -125,13 +126,17 @@ test_mpio_overlap_writes(char *filename) mrc = MPI_File_read_at(fh, mpi_off, buf, stride, MPI_BYTE, &mpi_stat); VRFY((mrc==MPI_SUCCESS), ""); + vrfyerrs=0; for (i=0; i<stride; i++){ char expected; expected = (mpi_off+i) & 0x7f; - if (buf[i] != expected) - printf("proc %d: found data error at [%ld], expect %d, got %d\n", - mpi_rank, mpi_off+i, expected, buf[i]); + if ((buf[i] != expected) && + (vrfyerrs++ < MAX_ERR_REPORT || verbose)) + printf("proc %d: found data error at [%ld], expect %d, got %d\n", + mpi_rank, mpi_off+i, expected, buf[i]); } + if (vrfyerrs > MAX_ERR_REPORT && !verbose) + printf("proc %d: [more errors ...]\n", mpi_rank); } /* close file and free the communicator */ @@ -156,6 +161,8 @@ test_mpio_overlap_writes(char *filename) #define FOUR_GB_LESS1 4294967295L /* 2**32 - 1 */ /* * Verify that MPI_Offset exceeding 2**31 can be computed correctly. + * Print any failure as information only, not as an error so that this + * won't abort the remaining test or other separated tests. */ void test_mpio_offset() @@ -174,8 +181,8 @@ test_mpio_offset() /* verify correctness of assigning 2GB sizes */ mpi_off = 2 * 1024 * (MPI_Offset)MB; - VRFY((mpi_off>0), "2GB OFFSET assignment no overflow"); - VRFY((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed"); + INFO((mpi_off>0), "2GB OFFSET assignment no overflow"); + INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed"); /* verify correctness of increasing from below 2 GB to above 2GB */ mpi_off = TWO_GB_LESS1; @@ -183,15 +190,15 @@ test_mpio_offset() mpi_off_old = mpi_off; mpi_off = mpi_off + 1; /* no overflow */ - VRFY((mpi_off>0), "2GB OFFSET increment no overflow"); + INFO((mpi_off>0), "2GB OFFSET increment no overflow"); /* correct inc. */ - VRFY((mpi_off-1)==mpi_off_old, "2GB OFFSET increment succeed"); + INFO((mpi_off-1)==mpi_off_old, "2GB OFFSET increment succeed"); } /* verify correctness of assigning 4GB sizes */ mpi_off = 4 * 1024 * (MPI_Offset)MB; - VRFY((mpi_off>0), "4GB OFFSET assignment no overflow"); - VRFY((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed"); + INFO((mpi_off>0), "4GB OFFSET assignment no overflow"); + INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed"); /* verify correctness of increasing from below 4 GB to above 4 GB */ mpi_off = FOUR_GB_LESS1; @@ -199,9 +206,9 @@ test_mpio_offset() mpi_off_old = mpi_off; mpi_off = mpi_off + 1; /* no overflow */ - VRFY((mpi_off>0), "4GB OFFSET increment no overflow"); + INFO((mpi_off>0), "4GB OFFSET increment no overflow"); /* correct inc. */ - VRFY((mpi_off-1)==mpi_off_old, "4GB OFFSET increment succeed"); + INFO((mpi_off-1)==mpi_off_old, "4GB OFFSET increment succeed"); } } @@ -226,6 +233,8 @@ test_mpio_gb_file(char *filename) hid_t acc_tpl; /* File access properties */ herr_t ret; /* generic return value */ int i, j, n; + int vrfyerrs; + int writerrs; /* write errors */ int ntimes; /* how many times */ char *buf; char expected; @@ -260,6 +269,7 @@ test_mpio_gb_file(char *filename) * some data around the 2 and 4 GB boundaries. That should cover * potential integer overflow and filesystem size limits. */ + writerrs = 0; for (n=2; n <= 4; n+=2){ ntimes = GB/MB*n/mpi_size + 1; for (i=ntimes-2; i <= ntimes; i++){ @@ -274,7 +284,9 @@ test_mpio_gb_file(char *filename) printf("proc %d: writing %d bytes at offset %lld\n", mpi_rank, MB, mpi_off); mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); - VRFY((mrc==MPI_SUCCESS), ""); + INFO((mrc==MPI_SUCCESS), ""); + if (mrc!=MPI_SUCCESS) + writerrs++; } } @@ -286,11 +298,16 @@ test_mpio_gb_file(char *filename) VRFY((mrc==MPI_SUCCESS), "Sync after writes"); /* 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){ + printf("proc %d: Skip read test due to previous write errors\n", + mpi_rank); + return; + } mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); VRFY((mrc==MPI_SUCCESS), ""); - printf("MPIO GB file read test %s\n", filename); - /* Only read back parts of the file that have been written. */ for (n=2; n <= 4; n+=2){ ntimes = GB/MB*n/mpi_size + 1; @@ -300,12 +317,18 @@ test_mpio_gb_file(char *filename) printf("proc %d: read from mpi_off=%016llx, %lld\n", mpi_rank, mpi_off, mpi_off); mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); - VRFY((mrc==MPI_SUCCESS), ""); + INFO((mrc==MPI_SUCCESS), ""); expected = i*mpi_size + (mpi_size - mpi_rank - 1); - for (j=0; j<MB; j++) - if (*(buf+j) != expected) - printf("proc %d: found data error at [%ld+%d], expect %d, got %d\n", - mpi_rank, mpi_off, j, expected, *(buf+j)); + vrfyerrs=0; + for (j=0; j<MB; j++){ + if ((*(buf+j) != expected) && + (vrfyerrs++ < MAX_ERR_REPORT || verbose)) + printf("proc %d: found data error at [%ld+%d], expect %d, got %d\n", + mpi_rank, mpi_off, j, expected, *(buf+j)); + } + if (vrfyerrs > MAX_ERR_REPORT && !verbose) + printf("proc %d: [more errors ...]\n", mpi_rank); + } } @@ -434,6 +457,7 @@ finish: } MPI_Finalize(); h5_cleanup(FILENAME, fapl); - return(nerrors); + /* always return 0 as this test is informational only. */ + return(0); } diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index b73a1f9..7d24ea0 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -35,6 +35,26 @@ H5Eclear(); \ } while(0) +/* + * Checking for information purpose. + * If val is false, print mesg; else nothing. + * Either case, no error setting. + */ +#define INFO(val, mesg) do { \ + if (val) { \ + if (*mesg != '\0'){ \ + MESG(mesg); \ + } \ + } \ + else{ \ + printf("Proc %d: ", mpi_rank); \ + printf("*** PHDF5 Assertion failed (%s) at line %4d in %s\n", \ + mesg, (int)__LINE__, __FILE__); \ + fflush(stdout); \ + } \ + H5Eclear(); \ +} while(0) + #define MPI_BANNER(mesg)\ {printf("--------------------------------\n");\ printf("Proc %d: ", mpi_rank); \ @@ -59,6 +79,8 @@ #define BYCOL 2 /* divide into blocks of columns */ #define ZROW 3 /* same as BYCOL except process 0 gets 0 rows */ #define ZCOL 4 /* same as BYCOL except process 0 gets 0 columns */ +#define MAX_ERR_REPORT 10 /* Maximum number of errors reported */ + /* dataset data type. Int's can be easily octo dumped. */ |