diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2007-05-23 15:47:44 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2007-05-23 15:47:44 (GMT) |
commit | 3efa9c8b05acd0383362d0162014ef05dd3279c2 (patch) | |
tree | 2966e4cf1a345078ba495c55d7fd5e0bf9afc1ae | |
parent | 6ea2260ea7ce7b016f5797ae9ee99f79e86502b2 (diff) | |
download | hdf5-3efa9c8b05acd0383362d0162014ef05dd3279c2.zip hdf5-3efa9c8b05acd0383362d0162014ef05dd3279c2.tar.gz hdf5-3efa9c8b05acd0383362d0162014ef05dd3279c2.tar.bz2 |
[svn-r13801] Output improvement.
Added a header message showing the purpose and explanation that the test is
for inoformation and always exits 0.
Also added a summary at the end.
Some other cosmetic changes (moved couple function code up, added some more
printf, fflush statements.)
Tested platform:
kagiso.
-rw-r--r-- | testpar/t_posix_compliant.c | 114 |
1 files changed, 69 insertions, 45 deletions
diff --git a/testpar/t_posix_compliant.c b/testpar/t_posix_compliant.c index c9b32d4..a4b8a86 100644 --- a/testpar/t_posix_compliant.c +++ b/testpar/t_posix_compliant.c @@ -57,6 +57,7 @@ static char* testfile = NULL; static int err_flag = 0; static int max_err_print = 5; +int nmismatches = 0; /* warnings encountered */ /* globals needed for getopt * Although they *should* be defined in unistd.h */ @@ -435,6 +436,7 @@ static int allwrite_allread_interlaced(int numprocs, int rank, int write_size) } } + nmismatches += counter; mpio_result = MPI_File_close(&fh); CHECK_SUCCESS(mpio_result); @@ -556,6 +558,7 @@ static int allwrite_allread_overlap(int numprocs, int rank, int write_size) } } + nmismatches += counter; mpio_result = MPI_File_close(&fh); CHECK_SUCCESS(mpio_result); HDfree(writebuf); @@ -677,6 +680,62 @@ static int onewrite_allread_interlaced(int numprocs, int rank, int write_size) } +static int find_writesize(int rank, int numprocs, int size) +{ + /* Largest number in the file */ + int tmp = (size-1)*numprocs; + int x = 0; + int write_size = 0; + + /* Find largest multiple not greater than tmp */ + while(x <= tmp) + { + if( (rank == 0) || (rank == 1) ) + x+=2; + else + x += (rank+1); + + write_size++; + } + + return write_size; +} + +static void vrfy_elements(int* a, int* b, int size, int rank) +{ + int i, counter = 0; + + for(i=0; i<size; i++) + { + if(a[i] != b[i]) + { + if( (rank == 0) && (counter == 0)) + printf("\n"); + if(counter++ < max_err_print) + fprintf(stderr, "Arrays do not match! Prcoess %d, element %d: [%d, %d]\n", rank, i, a[i], b[i]); + else if(counter++ == max_err_print+1) + fprintf(stderr, "Printed %d errors. Omitting the rest\n", max_err_print); + err_flag = -1; + } + } + nmismatches += counter; + fflush(stderr); + fflush(stdout); +} + +/* print an explanation message by MAIN (0) process. + */ +header_msg(void) +{ + printf( +"Purpose:\n" +"This tests if the file system is posix compliant when POSIX and MPI IO APIs\n" +"are used. This is for information only and always exits with 0 even when\n" +"non-compliance errors are encounter. This is to prevent this test from\n" +"aborting the remaining parallel HDF5 tests unnecessarily.\n\n" + ); +} + int main(int argc, char* argv[]) { @@ -692,6 +751,8 @@ int main(int argc, char* argv[]) MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); + if (rank == 0) + header_msg(); while((opt = getopt(argc, argv, optstring)) != -1) { switch(opt) @@ -749,7 +810,9 @@ int main(int argc, char* argv[]) testfile = strdup(TESTFNAME); } } - printf("Proc %d: testfile=%s\n", rank, testfile); + printf("Process %d: testfile=%s\n", rank, testfile); + fflush(stdout); + MPI_Barrier(MPI_COMM_WORLD); if(write_size == 0) { @@ -847,52 +910,13 @@ int main(int argc, char* argv[]) done: if (testfile) HDfree(testfile); + if (rank == 0){ + printf("\nSummary:\n"); + fflush(stdout); + } MPI_Barrier(MPI_COMM_WORLD); + printf("Process %d: encountered %d mismatches.\n", rank, nmismatches); MPI_Finalize(); return 0; } - - - -static int find_writesize(int rank, int numprocs, int size) -{ - /* Largest number in the file */ - int tmp = (size-1)*numprocs; - int x = 0; - int write_size = 0; - - /* Find largest multiple not greater than tmp */ - while(x <= tmp) - { - if( (rank == 0) || (rank == 1) ) - x+=2; - else - x += (rank+1); - - write_size++; - } - - return write_size; -} - -static void vrfy_elements(int* a, int* b, int size, int rank) -{ - int i, counter = 0; - - for(i=0; i<size; i++) - { - if(a[i] != b[i]) - { - if( (rank == 0) && (counter == 0)) - printf("\n"); - if(counter++ < max_err_print) - fprintf(stderr, "Arrays do not match! Prcoess %d, element %d: [%d, %d]\n", rank, i, a[i], b[i]); - else if(counter++ == max_err_print+1) - fprintf(stderr, "Printed %d errors. Omitting the rest\n", max_err_print); - err_flag = -1; - } - } - fflush(stderr); - fflush(stdout); -} |