diff options
-rw-r--r-- | testpar/t_cache.c | 3 | ||||
-rw-r--r-- | testpar/t_posix_compliant.c | 728 | ||||
-rw-r--r-- | testpar/t_shapesame.c | 858 |
3 files changed, 797 insertions, 792 deletions
diff --git a/testpar/t_cache.c b/testpar/t_cache.c index ce944f5..9d170a7 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -49,6 +49,9 @@ hid_t noblock_dxpl_id=(-1); #define NFILENAME 2 #define PARATESTFILE filenames[0] const char *FILENAME[NFILENAME]={"CacheTestDummy", NULL}; +#ifndef PATH_MAX +#define PATH_MAX 512 +#endif /* !PATH_MAX */ char filenames[NFILENAME][PATH_MAX]; hid_t fapl; /* file access property list */ diff --git a/testpar/t_posix_compliant.c b/testpar/t_posix_compliant.c index 960f4c8..5ea089d 100644 --- a/testpar/t_posix_compliant.c +++ b/testpar/t_posix_compliant.c @@ -26,8 +26,8 @@ * * * TODO: - * Add corresponding posix i/o tests for each MPI i/o test. Currently, not all of the - * MPI IO tests are implemented using fwrite/fread. + * Add corresponding posix i/o tests for each MPI i/o test. Currently, not all of the + * MPI IO tests are implemented using fwrite/fread. * * Leon Arber * larber@ncsa.uiuc.edu @@ -40,7 +40,9 @@ * mpiexec -np 3 ./t_posix_compliant */ +#ifdef H5_HAVE_UNISTD_H #include <unistd.h> +#endif #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -48,16 +50,16 @@ #ifndef STANDALONE #include "h5test.h" #else -#define HDmalloc(sz) malloc(sz) -#define HDfree(p) free(p) -#define getenv_all(comm, root, name) getenv(name) +#define HDmalloc(sz) malloc(sz) +#define HDfree(p) free(p) +#define getenv_all(comm, root, name) getenv(name) #endif -#define TESTFNAME "posix_test" /* test file name */ +#define TESTFNAME "posix_test" /* test file name */ -static char* testfile = NULL; -static int err_flag = 0; -static int max_err_print = 5; -int nmismatches = 0; /* warnings encountered */ +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 */ @@ -65,27 +67,27 @@ extern char *optarg; extern int optind, opterr; -#define CHECK_SUCCESS(res) \ -{ \ - char err_got[MPI_MAX_ERROR_STRING]; \ - int err_len; \ - if(res != MPI_SUCCESS) \ - { \ - MPI_Error_string(res, err_got, &err_len); \ - fprintf(stderr, "Line %d, Error: %s\n", __LINE__, err_got); \ - MPI_Abort(MPI_COMM_WORLD, -2); \ - } \ +#define CHECK_SUCCESS(res) \ +{ \ + char err_got[MPI_MAX_ERROR_STRING]; \ + int err_len; \ + if(res != MPI_SUCCESS) \ + { \ + MPI_Error_string(res, err_got, &err_len); \ + fprintf(stderr, "Line %d, Error: %s\n", __LINE__, err_got); \ + MPI_Abort(MPI_COMM_WORLD, -2); \ + } \ } -#define PRINT_RESULT() \ -{ \ - int err_result; \ - MPI_Reduce(&err_flag, &err_result, 1, MPI_INT, MPI_MIN, 0, MPI_COMM_WORLD); \ - if( (rank == 0) && (err_result == 0) ) \ - printf("PASSED\n"); \ - fflush(stdout); \ - fflush(stderr); \ - err_flag = 0; \ +#define PRINT_RESULT() \ +{ \ + int err_result; \ + MPI_Reduce(&err_flag, &err_result, 1, MPI_INT, MPI_MIN, 0, MPI_COMM_WORLD); \ + if( (rank == 0) && (err_result == 0) ) \ + printf("PASSED\n"); \ + fflush(stdout); \ + fflush(stderr); \ + err_flag = 0; \ } static void vrfy_elements(int* a, int* b, int size, int rank); @@ -98,21 +100,21 @@ static int find_writesize(int rank, int numprocs, int write_size); static int allwrite_allread_blocks(int numprocs, int rank, int write_size) { - MPI_File fh = MPI_FILE_NULL; - int mpio_result; - int amode, i; - MPI_Offset offset = rank*write_size*sizeof(int); - MPI_Status Status; + MPI_File fh = MPI_FILE_NULL; + int mpio_result; + int amode, i; + MPI_Offset offset = rank*write_size*sizeof(int); + MPI_Status Status; int* writebuf = (int*)malloc(write_size*sizeof(int)); int* readbuf = (int*)malloc (write_size*sizeof(int)); for(i=0; i<write_size; i++) - writebuf[i] = i; + writebuf[i] = i; amode = MPI_MODE_CREATE | MPI_MODE_RDWR | MPI_MODE_DELETE_ON_CLOSE; mpio_result = MPI_File_open(MPI_COMM_WORLD, testfile, amode, - MPI_INFO_NULL, &fh); + MPI_INFO_NULL, &fh); CHECK_SUCCESS(mpio_result); mpio_result = MPI_File_write_at(fh, offset, writebuf, write_size, MPI_INT, &Status); @@ -138,41 +140,41 @@ static int allwrite_allread_blocks(int numprocs, int rank, int write_size) static int posix_allwrite_allread_blocks(int numprocs, int rank, int write_size) { - int ret; - int i; - int offset = rank*write_size*sizeof(int); + int ret; + int i; + int offset = rank*write_size*sizeof(int); int* writebuf = (int*)malloc(write_size*sizeof(int)); int* readbuf = (int*)malloc (write_size*sizeof(int)); - FILE* file = NULL; + FILE* file = NULL; for(i=0; i<write_size; i++) - writebuf[i] = i; + writebuf[i] = i; if(rank==0) - file = fopen(testfile, "w+"); + file = fopen(testfile, "w+"); MPI_Barrier(MPI_COMM_WORLD); if(rank != 0) - file = fopen(testfile, "r+"); + file = fopen(testfile, "r+"); if(file == NULL) { - fprintf(stderr, "Could not create testfile\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + fprintf(stderr, "Could not create testfile\n"); + MPI_Abort(MPI_COMM_WORLD, 1); } ret = fseek(file, offset, SEEK_SET); if(ret == -1) { - perror("fseek"); - MPI_Abort(MPI_COMM_WORLD, 1); + perror("fseek"); + MPI_Abort(MPI_COMM_WORLD, 1); } ret = fwrite(writebuf, sizeof(int), write_size, file); if(ret != write_size) { - perror("fwrite"); - MPI_Abort(MPI_COMM_WORLD, 1); + perror("fwrite"); + MPI_Abort(MPI_COMM_WORLD, 1); } MPI_Barrier(MPI_COMM_WORLD); @@ -182,17 +184,17 @@ static int posix_allwrite_allread_blocks(int numprocs, int rank, int write_size) ret = fseek(file, offset, SEEK_SET); if(ret == -1) { - perror("fseek"); - MPI_Abort(MPI_COMM_WORLD, 1); + perror("fseek"); + MPI_Abort(MPI_COMM_WORLD, 1); } ret = fread(readbuf, sizeof(int), write_size, file); if( (ret == 0) && feof(file)) - printf("Process %d: Error. Prematurely reached end of file\n", rank); + printf("Process %d: Error. Prematurely reached end of file\n", rank); else if( (ret != write_size) && ferror(file)) { - perror("Error encountered in fread"); - MPI_Abort(MPI_COMM_WORLD, 1); + perror("Error encountered in fread"); + MPI_Abort(MPI_COMM_WORLD, 1); } vrfy_elements(writebuf, readbuf, write_size, rank); @@ -201,7 +203,7 @@ static int posix_allwrite_allread_blocks(int numprocs, int rank, int write_size) MPI_Barrier(MPI_COMM_WORLD); if(rank == 0) - unlink(testfile); + unlink(testfile); HDfree(writebuf); HDfree(readbuf); @@ -211,47 +213,47 @@ static int posix_allwrite_allread_blocks(int numprocs, int rank, int write_size) static int posix_onewrite_allread_blocks(int numprocs, int rank, int write_size) { - int ret; - int i; - int offset = rank*write_size*sizeof(int); + int ret; + int i; + int offset = rank*write_size*sizeof(int); int* writebuf = (int*)malloc(write_size*sizeof(int)); int* readbuf = (int*)malloc (write_size*sizeof(int)); - FILE* file = NULL; + FILE* file = NULL; for(i=0; i<write_size; i++) - writebuf[i] = i; + writebuf[i] = i; if(rank==0) - file = fopen(testfile, "w+"); + file = fopen(testfile, "w+"); MPI_Barrier(MPI_COMM_WORLD); if(rank != 0) - file = fopen(testfile, "r+"); + file = fopen(testfile, "r+"); if(file == NULL) { - fprintf(stderr, "Could not create testfile\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + fprintf(stderr, "Could not create testfile\n"); + MPI_Abort(MPI_COMM_WORLD, 1); } if(rank == 0) { - for(offset = 0; offset<numprocs*write_size*sizeof(int); offset+=(write_size*sizeof(int))) - { - ret = fseek(file, offset, SEEK_SET); - if(ret == -1) - { - perror("fseek"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - - ret = fwrite(writebuf, sizeof(int), write_size, file); - if(ret != write_size) - { - perror("fwrite"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } + for(offset = 0; offset<numprocs*write_size*sizeof(int); offset+=(write_size*sizeof(int))) + { + ret = fseek(file, offset, SEEK_SET); + if(ret == -1) + { + perror("fseek"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + + ret = fwrite(writebuf, sizeof(int), write_size, file); + if(ret != write_size) + { + perror("fwrite"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } } MPI_Barrier(MPI_COMM_WORLD); @@ -261,17 +263,17 @@ static int posix_onewrite_allread_blocks(int numprocs, int rank, int write_size) ret = fseek(file, offset, SEEK_SET); if(ret == -1) { - perror("fseek"); - MPI_Abort(MPI_COMM_WORLD, 1); + perror("fseek"); + MPI_Abort(MPI_COMM_WORLD, 1); } ret = fread(readbuf, sizeof(int), write_size, file); if( (ret == 0) && feof(file)) - printf("Process %d: Error. Prematurely reached end of file\n", rank); + printf("Process %d: Error. Prematurely reached end of file\n", rank); else if( (ret != write_size) && ferror(file)) { - perror("Error encountered in fread"); - MPI_Abort(MPI_COMM_WORLD, 1); + perror("Error encountered in fread"); + MPI_Abort(MPI_COMM_WORLD, 1); } vrfy_elements(writebuf, readbuf, write_size, rank); @@ -280,7 +282,7 @@ static int posix_onewrite_allread_blocks(int numprocs, int rank, int write_size) MPI_Barrier(MPI_COMM_WORLD); if(rank == 0) - unlink(testfile); + unlink(testfile); HDfree(writebuf); HDfree(readbuf); @@ -290,48 +292,48 @@ static int posix_onewrite_allread_blocks(int numprocs, int rank, int write_size) static int posix_onewrite_allread_interlaced(int numprocs, int rank, int write_size) { - int ret; - int i, fill, index; - int offset = rank*write_size*sizeof(int); + int ret; + int i, fill, index; + int offset = rank*write_size*sizeof(int); int* writebuf = (int*)malloc(write_size*sizeof(int)); int* readbuf = (int*)malloc (write_size*sizeof(int)); - FILE* file = NULL; + FILE* file = NULL; if(rank==0) - file = fopen(testfile, "w+"); + file = fopen(testfile, "w+"); MPI_Barrier(MPI_COMM_WORLD); if(rank != 0) - file = fopen(testfile, "r+"); + file = fopen(testfile, "r+"); if(file == NULL) { - fprintf(stderr, "Could not create testfile\n"); - MPI_Abort(MPI_COMM_WORLD, 1); + fprintf(stderr, "Could not create testfile\n"); + MPI_Abort(MPI_COMM_WORLD, 1); } if(rank == 0) { - for(offset = 0; offset<numprocs*write_size*sizeof(int); offset+=(numprocs*sizeof(int))) - { - ret = fseek(file, offset, SEEK_SET); - if(ret == -1) - { - perror("fseek"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - fill = offset / (numprocs*sizeof(int)); - for(i=0; i<numprocs; i++) - writebuf[i] = fill; - - - ret = fwrite(writebuf, sizeof(int), numprocs, file); - if(ret != numprocs) - { - perror("fwrite"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - } + for(offset = 0; offset<numprocs*write_size*sizeof(int); offset+=(numprocs*sizeof(int))) + { + ret = fseek(file, offset, SEEK_SET); + if(ret == -1) + { + perror("fseek"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + fill = offset / (numprocs*sizeof(int)); + for(i=0; i<numprocs; i++) + writebuf[i] = fill; + + + ret = fwrite(writebuf, sizeof(int), numprocs, file); + if(ret != numprocs) + { + perror("fwrite"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + } } MPI_Barrier(MPI_COMM_WORLD); @@ -340,27 +342,27 @@ static int posix_onewrite_allread_interlaced(int numprocs, int rank, int write_s for(offset = rank*sizeof(int); offset<numprocs*write_size*sizeof(int); offset+=(numprocs*sizeof(int))) { - ret = fseek(file, offset, SEEK_SET); - if(ret == -1) - { - perror("fseek"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - ret = fread(readbuf+index, sizeof(int), 1, file); - if( (ret == 0) && feof(file)) - printf("Process %d: Error. Prematurely reached end of file\n", rank); - else if( (ret != 1) && ferror(file)) - { - perror("Error encountered in fread"); - MPI_Abort(MPI_COMM_WORLD, 1); - } - - index++; + ret = fseek(file, offset, SEEK_SET); + if(ret == -1) + { + perror("fseek"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + ret = fread(readbuf+index, sizeof(int), 1, file); + if( (ret == 0) && feof(file)) + printf("Process %d: Error. Prematurely reached end of file\n", rank); + else if( (ret != 1) && ferror(file)) + { + perror("Error encountered in fread"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + index++; } for(i=0; i<write_size; i++) - writebuf[i] = i; + writebuf[i] = i; vrfy_elements(writebuf, readbuf, write_size, rank); @@ -368,7 +370,7 @@ static int posix_onewrite_allread_interlaced(int numprocs, int rank, int write_s MPI_Barrier(MPI_COMM_WORLD); if(rank == 0) - unlink(testfile); + unlink(testfile); HDfree(writebuf); HDfree(readbuf); @@ -382,17 +384,17 @@ static int posix_onewrite_allread_interlaced(int numprocs, int rank, int write_s static int allwrite_allread_interlaced(int numprocs, int rank, int write_size) { - MPI_File fh = MPI_FILE_NULL; - int mpio_result; - int amode, i, counter = 0; + MPI_File fh = MPI_FILE_NULL; + int mpio_result; + int amode, i, counter = 0; MPI_Datatype filetype; - MPI_Status Status; + MPI_Status Status; int* writebuf = (int*)malloc(write_size*sizeof(int)); - int* readbuf = (int*) malloc(numprocs*sizeof(int)); - int offset=0; + int* readbuf = (int*) malloc(numprocs*sizeof(int)); + int offset=0; for(i=0; i<write_size; i++) - writebuf[i] = i; + writebuf[i] = i; amode = MPI_MODE_CREATE | MPI_MODE_RDWR | MPI_MODE_DELETE_ON_CLOSE; @@ -418,23 +420,23 @@ static int allwrite_allread_interlaced(int numprocs, int rank, int write_size) for(offset = 0; offset<(write_size*numprocs*sizeof(int)); offset+=(numprocs*sizeof(int))) { - mpio_result = MPI_File_read_at(fh, offset, readbuf, numprocs, MPI_INT, &Status); - CHECK_SUCCESS(mpio_result); - - for(i=0; i<numprocs; i++) - { - if(writebuf[offset/(numprocs*sizeof(int))] != readbuf[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, writebuf[offset/(numprocs*sizeof(int))], readbuf[i]); - else if(counter++ == max_err_print+1) - fprintf(stderr, "Printed %d errors. Omitting the rest\n", max_err_print); - err_flag = -1; - } - - } + mpio_result = MPI_File_read_at(fh, offset, readbuf, numprocs, MPI_INT, &Status); + CHECK_SUCCESS(mpio_result); + + for(i=0; i<numprocs; i++) + { + if(writebuf[offset/(numprocs*sizeof(int))] != readbuf[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, writebuf[offset/(numprocs*sizeof(int))], readbuf[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; mpio_result = MPI_File_close(&fh); @@ -449,10 +451,10 @@ static int allwrite_allread_interlaced(int numprocs, int rank, int write_size) /* Overlapping pattern works as follows (this test requires at least 2 procs: * Writes: - * Task 0: 0 2 4 6 etc... - * Task 1: 1 3 5 7 etc... - * Task 2: 0 3 6 etc.. - * Task 3: 0 4 8 etc... + * Task 0: 0 2 4 6 etc... + * Task 1: 1 3 5 7 etc... + * Task 2: 0 3 6 etc.. + * Task 3: 0 4 8 etc... * * The above describes only the pattern of the elements being written. The actual * number of elements written is going to be: @@ -464,11 +466,11 @@ static int allwrite_allread_interlaced(int numprocs, int rank, int write_size) * * So, if there are 5 tasks with write_size=4, the resulting pattern of writes is: * - * Task 0: 0 2 4 6 8 10 12 14 + * Task 0: 0 2 4 6 8 10 12 14 * Task 1: 1 3 5 7 9 11 13 15 - * Task 2: 0 3 6 9 12 15 - * Task 3: 0 4 8 12 - * Task 4: 0 5 10 15 + * Task 2: 0 3 6 9 12 15 + * Task 3: 0 4 8 12 + * Task 4: 0 5 10 15 * * * @@ -481,34 +483,34 @@ static int allwrite_allread_interlaced(int numprocs, int rank, int write_size) static int allwrite_allread_overlap(int numprocs, int rank, int write_size) { - MPI_File fh = MPI_FILE_NULL; - int mpio_result; - int amode, i, counter = 0; + MPI_File fh = MPI_FILE_NULL; + int mpio_result; + int amode, i, counter = 0; MPI_Datatype filetype; - MPI_Status Status; - int* writebuf = (int*) malloc(write_size*(numprocs-1)*sizeof(int)); /* An upper bound...not all the elements will be written */ - int* readbuf = (int*) malloc(write_size*(numprocs-1)*sizeof(int)); + MPI_Status Status; + int* writebuf = (int*) malloc(write_size*(numprocs-1)*sizeof(int)); /* An upper bound...not all the elements will be written */ + int* readbuf = (int*) malloc(write_size*(numprocs-1)*sizeof(int)); if(numprocs < 2) { - fprintf(stderr, "The allwrite_allread_overlap test requires at least 2 procs\n"); - return -1; + fprintf(stderr, "The allwrite_allread_overlap test requires at least 2 procs\n"); + return -1; } if(rank == 0) { - for(i=0; i<write_size*(numprocs-1); i++) - writebuf[i] = 2*i; + for(i=0; i<write_size*(numprocs-1); i++) + writebuf[i] = 2*i; } else if(rank == 1) { - for(i=0; i<write_size*(numprocs-1); i++) - writebuf[i] = (2*i)+1; + for(i=0; i<write_size*(numprocs-1); i++) + writebuf[i] = (2*i)+1; } else { - for(i=0; i<write_size*(numprocs-1); i++) - writebuf[i] = (rank+1)*i; + for(i=0; i<write_size*(numprocs-1); i++) + writebuf[i] = (rank+1)*i; } amode = MPI_MODE_CREATE | MPI_MODE_RDWR | MPI_MODE_DELETE_ON_CLOSE; @@ -516,24 +518,24 @@ static int allwrite_allread_overlap(int numprocs, int rank, int write_size) CHECK_SUCCESS(mpio_result); if( (rank == 0) || (rank == 1) ) - mpio_result = MPI_Type_vector(write_size*(numprocs-1), 1, 2, MPI_INT, &filetype); + mpio_result = MPI_Type_vector(write_size*(numprocs-1), 1, 2, MPI_INT, &filetype); else - mpio_result = MPI_Type_vector(write_size*(numprocs-1), 1, rank+1, MPI_INT, &filetype); + mpio_result = MPI_Type_vector(write_size*(numprocs-1), 1, rank+1, MPI_INT, &filetype); CHECK_SUCCESS(mpio_result); mpio_result = MPI_Type_commit(&filetype); CHECK_SUCCESS(mpio_result); if( rank == 1) - mpio_result = MPI_File_set_view(fh, sizeof(int), MPI_INT, filetype, "native", MPI_INFO_NULL); + mpio_result = MPI_File_set_view(fh, sizeof(int), MPI_INT, filetype, "native", MPI_INFO_NULL); else - mpio_result = MPI_File_set_view(fh, 0, MPI_INT, filetype, "native", MPI_INFO_NULL); + mpio_result = MPI_File_set_view(fh, 0, MPI_INT, filetype, "native", MPI_INFO_NULL); CHECK_SUCCESS(mpio_result); if( rank == (numprocs - 1)) - mpio_result = MPI_File_write(fh, writebuf, write_size, MPI_INT, &Status); + mpio_result = MPI_File_write(fh, writebuf, write_size, MPI_INT, &Status); else - mpio_result = MPI_File_write(fh, writebuf, find_writesize(rank, numprocs, write_size), MPI_INT, &Status); + mpio_result = MPI_File_write(fh, writebuf, find_writesize(rank, numprocs, write_size), MPI_INT, &Status); CHECK_SUCCESS(mpio_result); @@ -546,16 +548,16 @@ static int allwrite_allread_overlap(int numprocs, int rank, int write_size) for(i=0; i<write_size*(numprocs-1); i++) { - if(i != readbuf[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, i, readbuf[i]); - else if(counter++ == max_err_print+1) - fprintf(stderr, "Printed %d errors. Omitting the rest\n", max_err_print); - err_flag = -1; - } + if(i != readbuf[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, i, readbuf[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; @@ -575,30 +577,30 @@ static int allwrite_allread_overlap(int numprocs, int rank, int write_size) */ static int onewrite_allread_blocks(int numprocs, int rank, int write_size) { - MPI_File fh = MPI_FILE_NULL; - int mpio_result; - int amode, i; - MPI_Status Status; + MPI_File fh = MPI_FILE_NULL; + int mpio_result; + int amode, i; + MPI_Status Status; int* writebuf = (int*)malloc(write_size*sizeof(int)); int* readbuf = (int*)malloc (write_size*sizeof(int)); for(i=0; i<write_size; i++) - writebuf[i] = i; + writebuf[i] = i; amode = MPI_MODE_CREATE | MPI_MODE_RDWR | MPI_MODE_DELETE_ON_CLOSE; mpio_result = MPI_File_open(MPI_COMM_WORLD, testfile, amode, - MPI_INFO_NULL, &fh); + MPI_INFO_NULL, &fh); CHECK_SUCCESS(mpio_result); /* A random process writes out all the data */ if(rank == (rand() % numprocs)) { - for(i=0; i<numprocs; i++) - { - mpio_result = MPI_File_write_at(fh, write_size*i*sizeof(int), writebuf, write_size, MPI_INT, &Status); - CHECK_SUCCESS(mpio_result); - } + for(i=0; i<numprocs; i++) + { + mpio_result = MPI_File_write_at(fh, write_size*i*sizeof(int), writebuf, write_size, MPI_INT, &Status); + CHECK_SUCCESS(mpio_result); + } } MPI_Barrier(MPI_COMM_WORLD); @@ -625,12 +627,12 @@ static int onewrite_allread_blocks(int numprocs, int rank, int write_size) * Each proc reads out 0 1 2 3 starting at displacement i */ static int onewrite_allread_interlaced(int numprocs, int rank, int write_size) { - MPI_File fh = MPI_FILE_NULL; - int mpio_result; - int amode, i; + MPI_File fh = MPI_FILE_NULL; + int mpio_result; + int amode, i; MPI_Datatype filetype; - MPI_Status Status; - int* writebuf = (int*) malloc(numprocs*write_size*sizeof(int)); /* Upper bound, not all used */ + MPI_Status Status; + int* writebuf = (int*) malloc(numprocs*write_size*sizeof(int)); /* Upper bound, not all used */ int* readbuf = (int*)malloc (write_size*sizeof(int)); @@ -647,15 +649,15 @@ static int onewrite_allread_interlaced(int numprocs, int rank, int write_size) if(rank == (rand() % numprocs)) { - for(i=0; i<write_size; i++) - { - int j; - for(j=0; j<numprocs; j++) - writebuf[j] = i; - - mpio_result = MPI_File_write_at(fh, i*numprocs*sizeof(int), writebuf, numprocs, MPI_INT, &Status); - CHECK_SUCCESS(mpio_result); - } + for(i=0; i<write_size; i++) + { + int j; + for(j=0; j<numprocs; j++) + writebuf[j] = i; + + mpio_result = MPI_File_write_at(fh, i*numprocs*sizeof(int), writebuf, numprocs, MPI_INT, &Status); + CHECK_SUCCESS(mpio_result); + } } MPI_Barrier(MPI_COMM_WORLD); @@ -667,7 +669,7 @@ static int onewrite_allread_interlaced(int numprocs, int rank, int write_size) CHECK_SUCCESS(mpio_result); for(i=0; i<write_size; i++) - writebuf[i] = i; + writebuf[i] = i; vrfy_elements(writebuf, readbuf, write_size, rank); @@ -690,12 +692,12 @@ static int find_writesize(int rank, int numprocs, int size) /* Find largest multiple not greater than tmp */ while(x <= tmp) { - if( (rank == 0) || (rank == 1) ) - x+=2; - else - x += (rank+1); + if( (rank == 0) || (rank == 1) ) + x+=2; + else + x += (rank+1); - write_size++; + write_size++; } return write_size; @@ -708,16 +710,16 @@ vrfy_elements(int* a, int* b, int size, int rank) 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; - } + 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); @@ -744,7 +746,7 @@ main(int argc, char* argv[]) int numprocs, rank, opt, mpi_tests=1, posix_tests=1; int lb, ub, inc; - int write_size = 0; + int write_size = 0; char optstring[] = "h x m p: s: v:"; char *prefix; @@ -755,63 +757,63 @@ main(int argc, char* argv[]) MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank == 0) - header_msg(); + header_msg(); while((opt = getopt(argc, argv, optstring)) != -1) { - switch(opt) - { - case 'h': - if(rank == 0) - printf("Usage: %s [options]\n" - "-h prints this help message\n" - "-x run the posix i/o tests ONLY (default: posix and MPI)\n" - "-m run the mpi i/o tests ONLY (default: posix and MPI)\n" - "-s size Run the test for the specific size. Default is 1024, 4096, 16384, ..., 1048576\n" - "-p path specifies path for test file. Default is current directory\n" - "-v num Specifies number of unmatching entries to print (default 10, pass -1 for all)\n", argv[0]); - goto done; - case 'x': - mpi_tests = 0; - posix_tests = 1; - break; - case 'm': - mpi_tests = 1; - posix_tests = 0; - break; - case 'p': - /* need 2 extra--1 for the / and 1 for the terminating NULL. */ - testfile = (char*) HDmalloc(strlen(optarg) + 2 + strlen(TESTFNAME)); - strcpy(testfile, optarg); - /* Append a / just in case they didn't end their path with one */ - strcat(testfile, "/" TESTFNAME); - break; - case 's': - write_size = atoi(optarg); - break; - case 'v': - max_err_print = atoi(optarg); - break; - } + switch(opt) + { + case 'h': + if(rank == 0) + printf("Usage: %s [options]\n" + "-h prints this help message\n" + "-x run the posix i/o tests ONLY (default: posix and MPI)\n" + "-m run the mpi i/o tests ONLY (default: posix and MPI)\n" + "-s size Run the test for the specific size. Default is 1024, 4096, 16384, ..., 1048576\n" + "-p path specifies path for test file. Default is current directory\n" + "-v num Specifies number of unmatching entries to print (default 10, pass -1 for all)\n", argv[0]); + goto done; + case 'x': + mpi_tests = 0; + posix_tests = 1; + break; + case 'm': + mpi_tests = 1; + posix_tests = 0; + break; + case 'p': + /* need 2 extra--1 for the / and 1 for the terminating NULL. */ + testfile = (char*) HDmalloc(strlen(optarg) + 2 + strlen(TESTFNAME)); + strcpy(testfile, optarg); + /* Append a / just in case they didn't end their path with one */ + strcat(testfile, "/" TESTFNAME); + break; + case 's': + write_size = atoi(optarg); + break; + case 'v': + max_err_print = atoi(optarg); + break; + } } if( (optind < argc) && (rank == 0)) - fprintf(stderr, "Unkown command-line argument passed. Continuing anyway...\n"); + fprintf(stderr, "Unkown command-line argument passed. Continuing anyway...\n"); if (!testfile){ - /* Try environment variable if not given as option. */ - prefix = getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX"); - if (prefix) - { - /* need 2 extra--1 for the / and 1 for the terminating NULL. */ - testfile = (char*) HDmalloc(strlen(prefix) + 2 + strlen(TESTFNAME)); - strcpy(testfile, prefix); - /* Append a / just in case they didn't end their path with one */ - strcat(testfile, "/" TESTFNAME); - } - else - { - testfile = strdup(TESTFNAME); - } + /* Try environment variable if not given as option. */ + prefix = getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX"); + if (prefix) + { + /* need 2 extra--1 for the / and 1 for the terminating NULL. */ + testfile = (char*) HDmalloc(strlen(prefix) + 2 + strlen(TESTFNAME)); + strcpy(testfile, prefix); + /* Append a / just in case they didn't end their path with one */ + strcat(testfile, "/" TESTFNAME); + } + else + { + testfile = strdup(TESTFNAME); + } } printf("Process %d: testfile=%s\n", rank, testfile); fflush(stdout); @@ -819,18 +821,18 @@ main(int argc, char* argv[]) if(write_size == 0) { - lb = 16*numprocs*sizeof(int); - /* 1MB MPIO-IO overlapping is failing in copper. Lower it now pending - permenant fix for copper.*/ - /* ub = 1024*1024;*/ - ub = lb*128; - inc = 4; + lb = 16*numprocs*sizeof(int); + /* 1MB MPIO-IO overlapping is failing in copper. Lower it now pending + permenant fix for copper.*/ + /* ub = 1024*1024;*/ + ub = lb*128; + inc = 4; } else { - lb = write_size; - ub = write_size+1; - inc = 2; + lb = write_size; + ub = write_size+1; + inc = 2; } #ifndef STANDALONE @@ -840,69 +842,69 @@ main(int argc, char* argv[]) for(write_size = lb; write_size <= ub; write_size*=inc) { - if(rank == 0) - printf("\nTesting size %d\n", write_size); - - if(mpi_tests) - { - if(rank == 0) - printf("Testing allwrite_allread_blocks with MPI IO\t\t"); fflush(stdout); - allwrite_allread_blocks(numprocs, rank, write_size/(numprocs*sizeof(int))); - PRINT_RESULT(); - MPI_Barrier(MPI_COMM_WORLD); - - if(rank == 0) - printf("Testing allwrite_allread_interlaced with MPI IO\t\t"); fflush(stdout); - allwrite_allread_interlaced(numprocs, rank, write_size/(numprocs*sizeof(int))); - PRINT_RESULT(); - MPI_Barrier(MPI_COMM_WORLD); - - if(rank == 0) - printf("Testing allwrite_allread_overlap with MPI IO\t\t"); fflush(stdout); - allwrite_allread_overlap(numprocs, rank, write_size); - PRINT_RESULT(); - MPI_Barrier(MPI_COMM_WORLD); - - if(rank == 0) - printf("Testing onewrite_allread_blocks with MPI IO\t\t"); fflush(stdout); - onewrite_allread_blocks(numprocs, rank, write_size/(numprocs*sizeof(int))); - PRINT_RESULT(); - MPI_Barrier(MPI_COMM_WORLD); - - if(rank == 0) - printf("Testing onewrite_allread_interlaced with MPI IO\t\t"); fflush(stdout); - onewrite_allread_interlaced(numprocs, rank, write_size/(numprocs*sizeof(int))); - PRINT_RESULT(); - MPI_Barrier(MPI_COMM_WORLD); - } - - if(posix_tests) - { - if(rank == 0) - printf("Testing allwrite_allread_blocks with POSIX IO\t\t"); fflush(stdout); - posix_allwrite_allread_blocks(numprocs, rank, write_size/(numprocs*sizeof(int))); - PRINT_RESULT(); - MPI_Barrier(MPI_COMM_WORLD); - - if(rank == 0) - printf("Testing onewrite_allread_blocks with POSIX IO\t\t"); fflush(stdout); - posix_onewrite_allread_blocks(numprocs, rank, write_size/(numprocs*sizeof(int))); - PRINT_RESULT(); - MPI_Barrier(MPI_COMM_WORLD); - - if(rank == 0) - printf("Testing onewrite_allread_interlaced with POSIX IO\t"); fflush(stdout); - posix_onewrite_allread_interlaced(numprocs, rank, write_size/(numprocs*sizeof(int))); - PRINT_RESULT(); - MPI_Barrier(MPI_COMM_WORLD); - - /* if(rank == 0) - printf("Testing allwrite_allread_overlap with POSIX IO\t\t"); fflush(stdout); - posix_allwrite_allread_overlap(numprocs, rank, write_size); - PRINT_RESULT(); - MPI_Barrier(MPI_COMM_WORLD); + if(rank == 0) + printf("\nTesting size %d\n", write_size); + + if(mpi_tests) + { + if(rank == 0) + printf("Testing allwrite_allread_blocks with MPI IO\t\t"); fflush(stdout); + allwrite_allread_blocks(numprocs, rank, write_size/(numprocs*sizeof(int))); + PRINT_RESULT(); + MPI_Barrier(MPI_COMM_WORLD); + + if(rank == 0) + printf("Testing allwrite_allread_interlaced with MPI IO\t\t"); fflush(stdout); + allwrite_allread_interlaced(numprocs, rank, write_size/(numprocs*sizeof(int))); + PRINT_RESULT(); + MPI_Barrier(MPI_COMM_WORLD); + + if(rank == 0) + printf("Testing allwrite_allread_overlap with MPI IO\t\t"); fflush(stdout); + allwrite_allread_overlap(numprocs, rank, write_size); + PRINT_RESULT(); + MPI_Barrier(MPI_COMM_WORLD); + + if(rank == 0) + printf("Testing onewrite_allread_blocks with MPI IO\t\t"); fflush(stdout); + onewrite_allread_blocks(numprocs, rank, write_size/(numprocs*sizeof(int))); + PRINT_RESULT(); + MPI_Barrier(MPI_COMM_WORLD); + + if(rank == 0) + printf("Testing onewrite_allread_interlaced with MPI IO\t\t"); fflush(stdout); + onewrite_allread_interlaced(numprocs, rank, write_size/(numprocs*sizeof(int))); + PRINT_RESULT(); + MPI_Barrier(MPI_COMM_WORLD); + } + + if(posix_tests) + { + if(rank == 0) + printf("Testing allwrite_allread_blocks with POSIX IO\t\t"); fflush(stdout); + posix_allwrite_allread_blocks(numprocs, rank, write_size/(numprocs*sizeof(int))); + PRINT_RESULT(); + MPI_Barrier(MPI_COMM_WORLD); + + if(rank == 0) + printf("Testing onewrite_allread_blocks with POSIX IO\t\t"); fflush(stdout); + posix_onewrite_allread_blocks(numprocs, rank, write_size/(numprocs*sizeof(int))); + PRINT_RESULT(); + MPI_Barrier(MPI_COMM_WORLD); + + if(rank == 0) + printf("Testing onewrite_allread_interlaced with POSIX IO\t"); fflush(stdout); + posix_onewrite_allread_interlaced(numprocs, rank, write_size/(numprocs*sizeof(int))); + PRINT_RESULT(); + MPI_Barrier(MPI_COMM_WORLD); + + /* if(rank == 0) + printf("Testing allwrite_allread_overlap with POSIX IO\t\t"); fflush(stdout); + posix_allwrite_allread_overlap(numprocs, rank, write_size); + PRINT_RESULT(); + MPI_Barrier(MPI_COMM_WORLD); */ - } + } } #ifndef STANDALONE @@ -912,10 +914,10 @@ main(int argc, char* argv[]) done: if (testfile) - HDfree(testfile); + HDfree(testfile); if (rank == 0){ - printf("\nSummary:\n"); - fflush(stdout); + printf("\nSummary:\n"); + fflush(stdout); } MPI_Barrier(MPI_COMM_WORLD); printf("Process %d: encountered %d mismatches.\n", rank, nmismatches); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index a62e4f9..459fcf8 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -39,29 +39,29 @@ #ifdef H5_HAVE_GETTIMEOFDAY -#define START_TIMER(time_tests, start_time, vrfy_msg) \ - { \ - int result; \ - if ( time_tests ) { \ - result = HDgettimeofday(&(start_time), NULL); \ - VRFY( (result == 0), (vrfy_msg)); \ - } \ - } - -#define STOP_TIMER_AND_UPDATE(time_tests, end_time, vrfy_msg, times) \ - { \ - int result; \ - long long delta_usecs; \ - if ( time_tests ) { \ - result = HDgettimeofday(&(end_time), NULL); \ - VRFY( (result == 0), (vrfy_msg)); \ - delta_usecs = \ - (1000000 * (timeval_b.tv_sec - timeval_a.tv_sec)) + \ - (timeval_b.tv_usec - timeval_a.tv_usec); \ - HDassert( delta_usecs >= 0L ); \ - (times) += delta_usecs; \ - } \ - } +#define START_TIMER(time_tests, start_time, vrfy_msg) \ + { \ + int result; \ + if ( time_tests ) { \ + result = HDgettimeofday(&(start_time), NULL); \ + VRFY( (result == 0), (vrfy_msg)); \ + } \ + } + +#define STOP_TIMER_AND_UPDATE(time_tests, end_time, vrfy_msg, times) \ + { \ + int result; \ + long long delta_usecs; \ + if ( time_tests ) { \ + result = HDgettimeofday(&(end_time), NULL); \ + VRFY( (result == 0), (vrfy_msg)); \ + delta_usecs = \ + (1000000 * (timeval_b.tv_sec - timeval_a.tv_sec)) + \ + (timeval_b.tv_usec - timeval_a.tv_usec); \ + HDassert( delta_usecs >= 0L ); \ + (times) += delta_usecs; \ + } \ + } #else /* H5_HAVE_GETTIMEOFDAY */ @@ -78,31 +78,31 @@ * the chunked dataset case. */ -#define SHAPE_SAME_TEST_ALIGNMENT ((hsize_t)(4 * 1024 * 1024)) +#define SHAPE_SAME_TEST_ALIGNMENT ((hsize_t)(4 * 1024 * 1024)) /*------------------------------------------------------------------------- - * Function: contig_hyperslab_dr_pio_test__run_test() + * Function: contig_hyperslab_dr_pio_test__run_test() * - * Purpose: Test I/O to/from hyperslab selections of different rank in - * the parallel. + * Purpose: Test I/O to/from hyperslab selections of different rank in + * the parallel. * - * Return: void + * Return: void * - * Programmer: JRM -- 9/18/09 + * Programmer: JRM -- 9/18/09 * * Modifications: * - * JRM -- 9/16/10 - * Added express_test parameter. Use it to control whether - * we set up the chunks so that no chunk is shared between - * processes, and also whether we set an alignment when we - * create the test file. + * JRM -- 9/16/10 + * Added express_test parameter. Use it to control whether + * we set up the chunks so that no chunk is shared between + * processes, and also whether we set an alignment when we + * create the test file. * *------------------------------------------------------------------------- */ -#define PAR_SS_DR_MAX_RANK 5 +#define PAR_SS_DR_MAX_RANK 5 #define CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG 0 static void @@ -119,17 +119,17 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, const char *fcnName = "contig_hyperslab_dr_pio_test__run_test()"; #endif /* CONTIG_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG */ const char *filename; - hbool_t use_gpfs = FALSE; /* Use GPFS hints */ - hbool_t mis_match = FALSE; - int i, j, k, l; - size_t n; + hbool_t use_gpfs = FALSE; /* Use GPFS hints */ + hbool_t mis_match = FALSE; + int i, j, k, l; + size_t n; int mrc; - int mpi_size = -1; + int mpi_size = -1; int mpi_rank = -1; size_t start_index; size_t stop_index; const int test_max_rank = 5; /* must update code if this changes */ - uint32_t expected_value; + uint32_t expected_value; uint32_t * small_ds_buf_0 = NULL; uint32_t * small_ds_buf_1 = NULL; uint32_t * small_ds_buf_2 = NULL; @@ -141,22 +141,22 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, uint32_t * ptr_0; uint32_t * ptr_1; MPI_Comm mpi_comm = MPI_COMM_NULL; - MPI_Info mpi_info = MPI_INFO_NULL; - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist = H5P_DEFAULT; + MPI_Info mpi_info = MPI_INFO_NULL; + hid_t fid; /* HDF5 file ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist = H5P_DEFAULT; hid_t full_mem_small_ds_sid; hid_t full_file_small_ds_sid; hid_t mem_small_ds_sid; hid_t file_small_ds_sid; - hid_t small_ds_slice_sid; + hid_t small_ds_slice_sid; hid_t full_mem_large_ds_sid; hid_t full_file_large_ds_sid; hid_t mem_large_ds_sid; hid_t file_large_ds_sid; hid_t file_large_ds_process_slice_sid; hid_t mem_large_ds_process_slice_sid; - hid_t large_ds_slice_sid; + hid_t large_ds_slice_sid; hid_t small_ds_dcpl_id = H5P_DEFAULT; hid_t large_ds_dcpl_id = H5P_DEFAULT; hid_t small_dataset; /* Dataset ID */ @@ -176,7 +176,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, hsize_t * count_ptr = NULL; hsize_t * block_ptr = NULL; htri_t check; /* Shape comparison return value */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ HDassert( edge_size >= 6 ); HDassert( edge_size >= chunk_edge_size ); @@ -228,7 +228,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, VRFY((small_ds_buf_2 != NULL), "malloc of small_ds_buf_2 succeeded"); small_ds_slice_buf = - (uint32_t *)HDmalloc(sizeof(uint32_t) * small_ds_slice_size); + (uint32_t *)HDmalloc(sizeof(uint32_t) * small_ds_slice_size); VRFY((small_ds_slice_buf != NULL), "malloc of small_ds_slice_buf succeeded"); large_ds_buf_0 = (uint32_t *)HDmalloc(sizeof(uint32_t) * large_ds_size); @@ -241,7 +241,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, VRFY((large_ds_buf_2 != NULL), "malloc of large_ds_buf_2 succeeded"); large_ds_slice_buf = - (uint32_t *)HDmalloc(sizeof(uint32_t) * large_ds_slice_size); + (uint32_t *)HDmalloc(sizeof(uint32_t) * large_ds_slice_size); VRFY((large_ds_slice_buf != NULL), "malloc of large_ds_slice_buf succeeded"); /* initialize the buffers */ @@ -323,7 +323,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, mem_small_ds_sid = H5Screate_simple(small_rank, dims, NULL); VRFY((mem_small_ds_sid != 0), - "H5Screate_simple() mem_small_ds_sid succeeded"); + "H5Screate_simple() mem_small_ds_sid succeeded"); file_small_ds_sid = H5Screate_simple(small_rank, dims, NULL); VRFY((file_small_ds_sid != 0), @@ -372,7 +372,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, if ( chunk_edge_size > 0 ) { /* Under Lustre (and perhaps other parallel file systems?) we get - * locking delays when two or more processes attempt to access the + * locking delays when two or more processes attempt to access the * same file system block. * * To minimize this problem, I have changed chunk_dims[0] @@ -804,7 +804,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, mis_match = FALSE; ptr_1 = small_ds_slice_buf; expected_value = (uint32_t)( - (i * edge_size * edge_size * edge_size * edge_size) + + (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + (l * edge_size)); @@ -1260,7 +1260,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, ptr_1 = small_ds_buf_1; expected_value = (uint32_t)( - (i * edge_size * edge_size * edge_size * edge_size) + + (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + (l * edge_size)); @@ -1435,7 +1435,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, file_large_ds_process_slice_sid, xfer_plist, large_ds_buf_2); - VRFY((ret != FAIL), "H5Dwrite() to zero large ds suceeded"); + VRFY((ret != FAIL), "H5Dwrite() to zero large ds suceeded"); /* select the portion of the in memory large cube to which we @@ -1453,7 +1453,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, stride_ptr, count_ptr, block_ptr); - VRFY((ret != FAIL), + VRFY((ret != FAIL), "H5Sselect_hyperslab() target large ds slice succeeded"); @@ -1464,7 +1464,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, */ check = H5S_select_shape_same_test(mem_small_ds_sid, file_large_ds_sid); - VRFY((check == TRUE), "H5S_select_shape_same_test passed"); + VRFY((check == TRUE), "H5S_select_shape_same_test passed"); /* write the small data set slice from memory to the @@ -1486,7 +1486,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, file_large_ds_sid, xfer_plist, small_ds_buf_0); - VRFY((ret != FAIL), + VRFY((ret != FAIL), "H5Dwrite of small ds slice to large ds succeeded"); @@ -1629,28 +1629,28 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /*------------------------------------------------------------------------- - * Function: contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) + * Function: contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) * - * Purpose: Test I/O to/from hyperslab selections of different rank in - * the parallel case. + * Purpose: Test I/O to/from hyperslab selections of different rank in + * the parallel case. * - * Return: void + * Return: void * - * Programmer: JRM -- 9/18/09 + * Programmer: JRM -- 9/18/09 * * Modifications: * - * Modified function to take a sample of the run times - * of the different tests, and skip some of them if - * run times are too long. + * Modified function to take a sample of the run times + * of the different tests, and skip some of them if + * run times are too long. * - * We need to do this because Lustre runns very slowly - * if two or more processes are banging on the same - * block of memory. - * JRM -- 9/10/10 + * We need to do this because Lustre runns very slowly + * if two or more processes are banging on the same + * block of memory. + * JRM -- 9/10/10 * Break this one big test into 4 smaller tests according * to {independent,collective}x{contigous,chunked} datasets. - * AKC -- 2010/01/14 + * AKC -- 2010/01/14 * *------------------------------------------------------------------------- */ @@ -1658,34 +1658,34 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, void contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) { - int test_num = 0; - int edge_size = 10; - int chunk_edge_size = 0; - int small_rank; - int large_rank; - int skips[4] = {0, 0, 0, 0}; - int skip_counters[4] = {0, 0, 0, 0}; - int tests_skiped[4] = {0, 0, 0, 0}; - int mpi_result; - hid_t dset_type = H5T_NATIVE_UINT; + int test_num = 0; + int edge_size = 10; + int chunk_edge_size = 0; + int small_rank; + int large_rank; + int skips[4] = {0, 0, 0, 0}; + int skip_counters[4] = {0, 0, 0, 0}; + int tests_skiped[4] = {0, 0, 0, 0}; + int mpi_result; + hid_t dset_type = H5T_NATIVE_UINT; #ifdef H5_HAVE_GETTIMEOFDAY - hbool_t time_tests = TRUE; - hbool_t display_skips = FALSE; - int local_express_test; - int express_test; - int i; - int samples = 0; - int sample_size = 1; - int mpi_size = -1; + hbool_t time_tests = TRUE; + hbool_t display_skips = FALSE; + int local_express_test; + int express_test; + int i; + int samples = 0; + int sample_size = 1; + int mpi_size = -1; int mpi_rank = -1; - int local_skips[4]; - const int ind_contig_idx = 0; - const int col_contig_idx = 1; - const int ind_chunked_idx = 2; - const int col_chunked_idx = 3; - const int test_types = 4; + int local_skips[4]; + const int ind_contig_idx = 0; + const int col_contig_idx = 1; + const int ind_chunked_idx = 2; + const int col_chunked_idx = 3; + const int test_types = 4; long long max_test_time = 3000000; /* for one test */ - long long sample_times[4] = {0, 0, 0, 0}; + long long sample_times[4] = {0, 0, 0, 0}; struct timeval timeval_a; struct timeval timeval_b; #endif /* H5_HAVE_GETTIMEOFDAY */ @@ -1706,15 +1706,15 @@ contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) for ( large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++ ) { for ( small_rank = 2; small_rank < large_rank; small_rank++ ) { - switch(sstest_type){ - case IND_CONTIG: - /* contiguous data set, independent I/O */ + switch(sstest_type){ + case IND_CONTIG: + /* contiguous data set, independent I/O */ chunk_edge_size = 0; if ( skip_counters[ind_contig_idx] < skips[ind_contig_idx] ) { skip_counters[ind_contig_idx]++; tests_skiped[ind_contig_idx]++; - printf("Test skipped\n"); + printf("Test skipped\n"); } else { skip_counters[ind_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(0) succeeds."); @@ -1731,17 +1731,17 @@ contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) sample_times[col_contig_idx]); } test_num++; - break; - /* end of case IND_CONTIG */ + break; + /* end of case IND_CONTIG */ - case COL_CONTIG: - /* contiguous data set, collective I/O */ + case COL_CONTIG: + /* contiguous data set, collective I/O */ chunk_edge_size = 0; if ( skip_counters[col_contig_idx] < skips[col_contig_idx] ) { skip_counters[col_contig_idx]++; tests_skiped[col_contig_idx]++; - printf("Test skipped\n"); + printf("Test skipped\n"); } else { skip_counters[col_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(2) succeeds."); @@ -1758,17 +1758,17 @@ contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) sample_times[ind_contig_idx]); } test_num++; - break; - /* end of case COL_CONTIG */ + break; + /* end of case COL_CONTIG */ - case IND_CHUNKED: - /* chunked data set, independent I/O */ + case IND_CHUNKED: + /* chunked data set, independent I/O */ chunk_edge_size = 5; if ( skip_counters[ind_chunked_idx] < skips[ind_chunked_idx] ) { skip_counters[ind_chunked_idx]++; tests_skiped[ind_chunked_idx]++; - printf("Test skipped\n"); + printf("Test skipped\n"); } else { skip_counters[ind_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(4) succeeds."); @@ -1785,17 +1785,17 @@ contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) sample_times[col_chunked_idx]); } test_num++; - break; - /* end of case IND_CHUNKED */ + break; + /* end of case IND_CHUNKED */ - case COL_CHUNKED: - /* chunked data set, collective I/O */ + case COL_CHUNKED: + /* chunked data set, collective I/O */ chunk_edge_size = 5; if ( skip_counters[col_chunked_idx] < skips[col_chunked_idx] ) { skip_counters[col_chunked_idx]++; tests_skiped[col_chunked_idx]++; - printf("Test skipped\n"); + printf("Test skipped\n"); } else { skip_counters[col_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(6) succeeds."); @@ -1812,9 +1812,9 @@ contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) sample_times[ind_chunked_idx]); } test_num++; - break; - /* end of case COL_CHUNKED */ - } /* end of switch(sstest_type) */ + break; + /* end of case COL_CHUNKED */ + } /* end of switch(sstest_type) */ #ifdef H5_HAVE_GETTIMEOFDAY if ( time_tests ) { @@ -1895,23 +1895,23 @@ contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) /**************************************************************** ** ** checker_board_hyperslab_dr_pio_test__select_checker_board(): -** Given a data space of tgt_rank, and dimensions: +** Given a data space of tgt_rank, and dimensions: ** -** (mpi_size + 1), edge_size, ... , edge_size +** (mpi_size + 1), edge_size, ... , edge_size ** -** edge_size, and a checker_edge_size, select a checker -** board selection of a sel_rank (sel_rank < tgt_rank) -** dimensional slice through the data space parallel to the +** edge_size, and a checker_edge_size, select a checker +** board selection of a sel_rank (sel_rank < tgt_rank) +** dimensional slice through the data space parallel to the ** sel_rank fastest changing indicies, with origin (in the -** higher indicies) as indicated by the start array. +** higher indicies) as indicated by the start array. ** -** Note that this function, like all its relatives, is -** hard coded to presume a maximum data space rank of 5. -** While this maximum is declared as a constant, increasing -** it will require extensive coding in addition to changing +** Note that this function, like all its relatives, is +** hard coded to presume a maximum data space rank of 5. +** While this maximum is declared as a constant, increasing +** it will require extensive coding in addition to changing ** the value of the constant. ** -** JRM -- 10/8/09 +** JRM -- 10/8/09 ** ****************************************************************/ @@ -1928,22 +1928,22 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( hsize_t sel_start[]) { #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG - const char * fcnName = - "checker_board_hyperslab_dr_pio_test__select_checker_board():"; + const char * fcnName = + "checker_board_hyperslab_dr_pio_test__select_checker_board():"; #endif - hbool_t first_selection = TRUE; + hbool_t first_selection = TRUE; int i, j, k, l, m; - int n_cube_offset; - int sel_offset; - const int test_max_rank = PAR_SS_DR_MAX_RANK; /* must update code if */ + int n_cube_offset; + int sel_offset; + const int test_max_rank = PAR_SS_DR_MAX_RANK; /* must update code if */ /* this changes */ - hsize_t base_count; + hsize_t base_count; hsize_t offset_count; - hsize_t start[PAR_SS_DR_MAX_RANK]; - hsize_t stride[PAR_SS_DR_MAX_RANK]; - hsize_t count[PAR_SS_DR_MAX_RANK]; - hsize_t block[PAR_SS_DR_MAX_RANK]; - herr_t ret; /* Generic return value */ + hsize_t start[PAR_SS_DR_MAX_RANK]; + hsize_t stride[PAR_SS_DR_MAX_RANK]; + hsize_t count[PAR_SS_DR_MAX_RANK]; + hsize_t block[PAR_SS_DR_MAX_RANK]; + herr_t ret; /* Generic return value */ HDassert( edge_size >= 6 ); HDassert( 0 < checker_edge_size ); @@ -2239,55 +2239,55 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( ** ** checker_board_hyperslab_dr_pio_test__verify_data(): ** -** Examine the supplied buffer to see if it contains the -** expected data. Return TRUE if it does, and FALSE +** Examine the supplied buffer to see if it contains the +** expected data. Return TRUE if it does, and FALSE ** otherwise. ** -** The supplied buffer is presumed to this process's slice -** of the target data set. Each such slice will be an -** n-cube of rank (rank -1) and the supplied edge_size with -** origin (mpi_rank, 0, ... , 0) in the target data set. +** The supplied buffer is presumed to this process's slice +** of the target data set. Each such slice will be an +** n-cube of rank (rank -1) and the supplied edge_size with +** origin (mpi_rank, 0, ... , 0) in the target data set. ** -** Further, the buffer is presumed to be the result of reading -** or writing a checker board selection of an m (1 <= m < +** Further, the buffer is presumed to be the result of reading +** or writing a checker board selection of an m (1 <= m < ** rank) dimensional slice through this processes slice -** of the target data set. Also, this slice must be parallel -** to the fastest changing indicies. +** of the target data set. Also, this slice must be parallel +** to the fastest changing indicies. ** -** It is further presumed that the buffer was zeroed before -** the read/write, and that the full target data set (i.e. -** the buffer/data set for all processes) was initialized +** It is further presumed that the buffer was zeroed before +** the read/write, and that the full target data set (i.e. +** the buffer/data set for all processes) was initialized ** with the natural numbers listed in order from the origin -** along the fastest changing axis. +** along the fastest changing axis. ** ** Thus for a 20x10x10 dataset, the value stored in location -** (x, y, z) (assuming that z is the fastest changing index -** and x the slowest) is assumed to be: +** (x, y, z) (assuming that z is the fastest changing index +** and x the slowest) is assumed to be: ** -** (10 * 10 * x) + (10 * y) + z +** (10 * 10 * x) + (10 * y) + z ** -** Further, supposing that this is process 10, this process's -** slice of the dataset would be a 10 x 10 2-cube with origin -** (10, 0, 0) in the data set, and would be initialize (prior -** to the checkerboard selection) as follows: +** Further, supposing that this is process 10, this process's +** slice of the dataset would be a 10 x 10 2-cube with origin +** (10, 0, 0) in the data set, and would be initialize (prior +** to the checkerboard selection) as follows: ** -** 1000, 1001, 1002, ... 1008, 1009 -** 1010, 1011, 1012, ... 1018, 1019 -** . . . . . -** . . . . . -** . . . . . -** 1090, 1091, 1092, ... 1098, 1099 +** 1000, 1001, 1002, ... 1008, 1009 +** 1010, 1011, 1012, ... 1018, 1019 +** . . . . . +** . . . . . +** . . . . . +** 1090, 1091, 1092, ... 1098, 1099 ** -** In the case of a read from the processors slice of another -** data set of different rank, the values expected will have -** to be adjusted accordingly. This is done via the -** first_expected_val parameter. +** In the case of a read from the processors slice of another +** data set of different rank, the values expected will have +** to be adjusted accordingly. This is done via the +** first_expected_val parameter. ** -** Finally, the function presumes that the first element -** of the buffer resides either at the origin of either -** a selected or an unselected checker. (Translation: -** if partial checkers appear in the buffer, they will -** intersect the edges of the n-cube oposite the origin.) +** Finally, the function presumes that the first element +** of the buffer resides either at the origin of either +** a selected or an unselected checker. (Translation: +** if partial checkers appear in the buffer, they will +** intersect the edges of the n-cube oposite the origin.) ** ****************************************************************/ @@ -2302,8 +2302,8 @@ checker_board_hyperslab_dr_pio_test__verify_data(uint32_t * buf_ptr, hbool_t buf_starts_in_checker) { #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__VERIFY_DATA__DEBUG - const char * fcnName = - "checker_board_hyperslab_dr_pio_test__verify_data():"; + const char * fcnName = + "checker_board_hyperslab_dr_pio_test__verify_data():"; #endif hbool_t good_data = TRUE; hbool_t in_checker; @@ -2324,7 +2324,7 @@ checker_board_hyperslab_dr_pio_test__verify_data(uint32_t * buf_ptr, #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__VERIFY_DATA__DEBUG - int mpi_rank; + int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); HDfprintf(stdout, "%s mpi_rank = %d.\n", fcnName, mpi_rank); @@ -2452,27 +2452,27 @@ checker_board_hyperslab_dr_pio_test__verify_data(uint32_t * buf_ptr, /*------------------------------------------------------------------------- - * Function: checker_board_hyperslab_dr_pio_test__run_test() + * Function: checker_board_hyperslab_dr_pio_test__run_test() * - * Purpose: Test I/O to/from checkerboard selections of hyperslabs of - * different rank in the parallel. + * Purpose: Test I/O to/from checkerboard selections of hyperslabs of + * different rank in the parallel. * - * Return: void + * Return: void * - * Programmer: JRM -- 10/10/09 + * Programmer: JRM -- 10/10/09 * * Modifications: * - * JRM -- 9/16/10 - * Added the express_test parameter. Use it to control - * whether we set an alignment, and whether we allocate - * chunks such that no two processes will normally touch - * the same chunk. + * JRM -- 9/16/10 + * Added the express_test parameter. Use it to control + * whether we set an alignment, and whether we allocate + * chunks such that no two processes will normally touch + * the same chunk. * *------------------------------------------------------------------------- */ -#define PAR_SS_DR_MAX_RANK 5 +#define PAR_SS_DR_MAX_RANK 5 #define CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG 0 static void @@ -2490,18 +2490,18 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, const char *fcnName = "checker_board_hyperslab_dr_pio_test__run_test()"; #endif /* CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG */ const char *filename; - hbool_t use_gpfs = FALSE; /* Use GPFS hints */ - hbool_t data_ok = FALSE; - hbool_t mis_match = FALSE; - int i, j, k, l; + hbool_t use_gpfs = FALSE; /* Use GPFS hints */ + hbool_t data_ok = FALSE; + hbool_t mis_match = FALSE; + int i, j, k, l; size_t u; int mrc; size_t start_index; size_t stop_index; - int small_ds_offset; + int small_ds_offset; int large_ds_offset; const int test_max_rank = 5; /* must update code if this changes */ - uint32_t expected_value; + uint32_t expected_value; uint32_t * small_ds_buf_0 = NULL; uint32_t * small_ds_buf_1 = NULL; uint32_t * small_ds_buf_2 = NULL; @@ -2512,19 +2512,19 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, uint32_t * large_ds_slice_buf = NULL; uint32_t * ptr_0; uint32_t * ptr_1; - int mpi_rank; - int mpi_size; + int mpi_rank; + int mpi_size; MPI_Comm mpi_comm = MPI_COMM_NULL; - MPI_Info mpi_info = MPI_INFO_NULL; - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist = H5P_DEFAULT; + MPI_Info mpi_info = MPI_INFO_NULL; + hid_t fid; /* HDF5 file ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist = H5P_DEFAULT; hid_t full_mem_small_ds_sid; hid_t full_file_small_ds_sid; hid_t mem_small_ds_sid; hid_t file_small_ds_sid_0; hid_t file_small_ds_sid_1; - hid_t small_ds_slice_sid; + hid_t small_ds_slice_sid; hid_t full_mem_large_ds_sid; hid_t full_file_large_ds_sid; hid_t mem_large_ds_sid; @@ -2532,7 +2532,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, hid_t file_large_ds_sid_1; hid_t file_large_ds_process_slice_sid; hid_t mem_large_ds_process_slice_sid; - hid_t large_ds_slice_sid; + hid_t large_ds_slice_sid; hid_t small_ds_dcpl_id = H5P_DEFAULT; hid_t large_ds_dcpl_id = H5P_DEFAULT; hid_t small_dataset; /* Dataset ID */ @@ -2549,7 +2549,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, hsize_t block[PAR_SS_DR_MAX_RANK]; hsize_t sel_start[PAR_SS_DR_MAX_RANK]; htri_t check; /* Shape comparison return value */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ HDassert( edge_size >= 6 ); HDassert( edge_size >= chunk_edge_size ); @@ -2604,7 +2604,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, VRFY((small_ds_buf_2 != NULL), "malloc of small_ds_buf_2 succeeded"); small_ds_slice_buf = - (uint32_t *)HDmalloc(sizeof(uint32_t) * small_ds_slice_size); + (uint32_t *)HDmalloc(sizeof(uint32_t) * small_ds_slice_size); VRFY((small_ds_slice_buf != NULL), "malloc of small_ds_slice_buf succeeded"); large_ds_buf_0 = (uint32_t *)HDmalloc(sizeof(uint32_t) * large_ds_size); @@ -2617,7 +2617,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, VRFY((large_ds_buf_2 != NULL), "malloc of large_ds_buf_2 succeeded"); large_ds_slice_buf = - (uint32_t *)HDmalloc(sizeof(uint32_t) * large_ds_slice_size); + (uint32_t *)HDmalloc(sizeof(uint32_t) * large_ds_slice_size); VRFY((large_ds_slice_buf != NULL), "malloc of large_ds_slice_buf succeeded"); /* initialize the buffers */ @@ -2703,7 +2703,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, mem_small_ds_sid = H5Screate_simple(small_rank, dims, NULL); VRFY((mem_small_ds_sid != 0), - "H5Screate_simple() mem_small_ds_sid succeeded"); + "H5Screate_simple() mem_small_ds_sid succeeded"); file_small_ds_sid_0 = H5Screate_simple(small_rank, dims, NULL); VRFY((file_small_ds_sid_0 != 0), @@ -2760,7 +2760,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, if ( chunk_edge_size > 0 ) { /* Under Lustre (and perhaps other parallel file systems?) we get - * locking delays when two or more processes attempt to access the + * locking delays when two or more processes attempt to access the * same file system block. * * To minimize this problem, I have changed chunk_dims[0] @@ -3081,7 +3081,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, fcnName, mpi_rank); ptr_0 = small_ds_slice_buf; for ( i = 0; i < (int)small_ds_slice_size; i++ ) { - HDfprintf(stdout, "%d ", (int)(*ptr_0)); + HDfprintf(stdout, "%d ", (int)(*ptr_0)); ptr_0++; } HDfprintf(stdout, "\n"); @@ -3219,14 +3219,14 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, VRFY((ret >= 0), "H5Dread() slice from large ds succeeded."); #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG - HDfprintf(stdout, "%s:%d: H5Dread() returns.\n", + HDfprintf(stdout, "%s:%d: H5Dread() returns.\n", fcnName, mpi_rank); #endif /* verify that expected data is retrieved */ expected_value = (uint32_t) - ((i * edge_size * edge_size * edge_size * edge_size) + + ((i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + (l * edge_size)); @@ -3430,11 +3430,11 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG { -int m, n; +int m, n; - HDfprintf(stdout, "%s:%d: expected_value = %d.\n", + HDfprintf(stdout, "%s:%d: expected_value = %d.\n", fcnName, mpi_rank, expected_value); - HDfprintf(stdout, "%s:%d: start/stop index = %d/%d.\n", + HDfprintf(stdout, "%s:%d: start/stop index = %d/%d.\n", fcnName, mpi_rank, start_index, stop_index); n = 0; for ( m = 0; m < large_ds_size; m ++ ) { @@ -3459,8 +3459,8 @@ int m, n; if ( *ptr_1 != 0 ) { - data_ok = FALSE; - } + data_ok = FALSE; + } /* zero out the value for the next pass */ *ptr_1 = 0; @@ -3491,8 +3491,8 @@ int m, n; if ( *ptr_1 != 0 ) { - data_ok = FALSE; - } + data_ok = FALSE; + } /* zero out the value for the next pass */ *ptr_1 = 0; @@ -3745,7 +3745,7 @@ int m, n; mis_match = FALSE; expected_value = (uint32_t)( - (i * edge_size * edge_size * edge_size * edge_size) + + (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + (l * edge_size)); @@ -3949,7 +3949,7 @@ int m, n; file_large_ds_sid_0, xfer_plist, large_ds_buf_2); - VRFY((ret != FAIL), "H5Dwrite() to zero large ds suceeded"); + VRFY((ret != FAIL), "H5Dwrite() to zero large ds suceeded"); /* select the portion of the in memory large cube to which we @@ -3986,7 +3986,7 @@ int m, n; */ check = H5S_select_shape_same_test(mem_small_ds_sid, file_large_ds_sid_1); - VRFY((check == TRUE), "H5S_select_shape_same_test passed"); + VRFY((check == TRUE), "H5S_select_shape_same_test passed"); /* write the small data set slice from memory to the @@ -4007,7 +4007,7 @@ int m, n; file_large_ds_sid_1, xfer_plist, small_ds_buf_0); - VRFY((ret != FAIL), + VRFY((ret != FAIL), "H5Dwrite of small ds slice to large ds succeeded"); @@ -4167,28 +4167,28 @@ int m, n; /*------------------------------------------------------------------------- - * Function: checker_board_hyperslab_dr_pio_test() + * Function: checker_board_hyperslab_dr_pio_test() * - * Purpose: Test I/O to/from hyperslab selections of different rank in - * the parallel case. + * Purpose: Test I/O to/from hyperslab selections of different rank in + * the parallel case. * - * Return: void + * Return: void * - * Programmer: JRM -- 9/18/09 + * Programmer: JRM -- 9/18/09 * * Modifications: * - * Modified function to take a sample of the run times - * of the different tests, and skip some of them if - * run times are too long. + * Modified function to take a sample of the run times + * of the different tests, and skip some of them if + * run times are too long. * - * We need to do this because Lustre runns very slowly - * if two or more processes are banging on the same - * block of memory. - * JRM -- 9/10/10 - * Break this one big test into 4 smaller tests according - * to {independent,collective}x{contigous,chunked} datasets. - * AKC -- 2010/01/17 + * We need to do this because Lustre runns very slowly + * if two or more processes are banging on the same + * block of memory. + * JRM -- 9/10/10 + * Break this one big test into 4 smaller tests according + * to {independent,collective}x{contigous,chunked} datasets. + * AKC -- 2010/01/17 * *------------------------------------------------------------------------- */ @@ -4196,20 +4196,20 @@ int m, n; void checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) { - int test_num = 0; - int edge_size = 10; + int test_num = 0; + int edge_size = 10; int checker_edge_size = 3; - int chunk_edge_size = 0; - int small_rank = 3; - int large_rank = 4; + int chunk_edge_size = 0; + int small_rank = 3; + int large_rank = 4; int skips[4] = {0, 0, 0, 0}; int skip_counters[4] = {0, 0, 0, 0}; int tests_skiped[4] = {0, 0, 0, 0}; - int mpi_result; - hid_t dset_type = H5T_NATIVE_UINT; + int mpi_result; + hid_t dset_type = H5T_NATIVE_UINT; #ifdef H5_HAVE_GETTIMEOFDAY hbool_t time_tests = TRUE; - hbool_t display_skips = FALSE; + hbool_t display_skips = FALSE; int local_express_test; int express_test; int i; @@ -4256,15 +4256,15 @@ checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) for ( large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++ ) { for ( small_rank = 2; small_rank < large_rank; small_rank++ ) { - switch(sstest_type){ - case IND_CONTIG: + switch(sstest_type){ + case IND_CONTIG: /* contiguous data set, independent I/O */ chunk_edge_size = 0; if ( skip_counters[ind_contig_idx] < skips[ind_contig_idx] ) { skip_counters[ind_contig_idx]++; tests_skiped[ind_contig_idx]++; - printf("Test skipped\n"); + printf("Test skipped\n"); } else { skip_counters[ind_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(0) succeeds."); @@ -4284,17 +4284,17 @@ checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) } test_num++; - break; - /* end of case IND_CONTIG */ + break; + /* end of case IND_CONTIG */ - case COL_CONTIG: + case COL_CONTIG: /* contiguous data set, collective I/O */ chunk_edge_size = 0; if ( skip_counters[col_contig_idx] < skips[col_contig_idx] ) { skip_counters[col_contig_idx]++; tests_skiped[col_contig_idx]++; - printf("Test skipped\n"); + printf("Test skipped\n"); } else { skip_counters[col_contig_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(2) succeeds."); @@ -4314,17 +4314,17 @@ checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) } test_num++; - break; - /* end of case COL_CONTIG */ + break; + /* end of case COL_CONTIG */ - case IND_CHUNKED: + case IND_CHUNKED: /* chunked data set, independent I/O */ chunk_edge_size = 5; if ( skip_counters[ind_chunked_idx] < skips[ind_chunked_idx] ) { skip_counters[ind_chunked_idx]++; tests_skiped[ind_chunked_idx]++; - printf("Test skipped\n"); + printf("Test skipped\n"); } else { skip_counters[ind_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(4) succeeds."); @@ -4344,17 +4344,17 @@ checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) } test_num++; - break; - /* end of case IND_CHUNKED */ + break; + /* end of case IND_CHUNKED */ - case COL_CHUNKED: + case COL_CHUNKED: /* chunked data set, collective I/O */ chunk_edge_size = 5; if ( skip_counters[col_chunked_idx] < skips[col_chunked_idx] ) { skip_counters[col_chunked_idx]++; tests_skiped[col_chunked_idx]++; - printf("Test skipped\n"); + printf("Test skipped\n"); } else { skip_counters[col_chunked_idx] = 0; START_TIMER(time_tests, timeval_a, "HDgettimeofday(6) succeeds."); @@ -4374,9 +4374,9 @@ checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type) } test_num++; - break; - /* end of case COL_CHUNKED */ - } /* end of switch(sstest_type) */ + break; + /* end of case COL_CHUNKED */ + } /* end of switch(sstest_type) */ #ifdef H5_HAVE_GETTIMEOFDAY if ( time_tests ) { @@ -4469,15 +4469,15 @@ int dim0; int dim1; int chunkdim0; int chunkdim1; -int nerrors = 0; /* errors count */ -int ndatasets = 300; /* number of datasets to create*/ +int nerrors = 0; /* errors count */ +int ndatasets = 300; /* number of datasets to create*/ int ngroups = 512; /* number of groups to create in root * group. */ -int facc_type = FACC_MPIO; /*Test file access type */ +int facc_type = FACC_MPIO; /*Test file access type */ int dxfer_coll_type = DXFER_COLLECTIVE_IO; -H5E_auto2_t old_func; /* previous error handler */ -void *old_client_data; /* previous error handler arg.*/ +H5E_auto2_t old_func; /* previous error handler */ +void *old_client_data; /* previous error handler arg.*/ /* other option flags */ @@ -4489,10 +4489,10 @@ void *old_client_data; /* previous error handler arg.*/ #define NFILENAME 2 #define PARATESTFILE filenames[0] const char *FILENAME[NFILENAME]={ - "ShapeSameTest", - NULL}; -char filenames[NFILENAME][PATH_MAX]; -hid_t fapl; /* file access property list */ + "ShapeSameTest", + NULL}; +char filenames[NFILENAME][PATH_MAX]; +hid_t fapl; /* file access property list */ #ifdef USE_PAUSE /* pause the process for a moment to allow debugger to attach if desired. */ @@ -4505,7 +4505,7 @@ void pause_proc(void) { int pid; - h5_stat_t statbuf; + h5_stat_t statbuf; char greenlight[] = "go"; int maxloop = 10; int loops = 0; @@ -4522,15 +4522,15 @@ void pause_proc(void) MPI_Get_processor_name(mpi_name, &mpi_namelen); if (MAINPROCESS) - while ((stat(greenlight, &statbuf) == -1) && loops < maxloop){ - if (!loops++){ - printf("Proc %d (%*s, %d): to debug, attach %d\n", - mpi_rank, mpi_namelen, mpi_name, pid, pid); - } - printf("waiting(%ds) for file %s ...\n", time_int, greenlight); - fflush(stdout); - sleep(time_int); - } + while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){ + if (!loops++){ + printf("Proc %d (%*s, %d): to debug, attach %d\n", + mpi_rank, mpi_namelen, mpi_name, pid, pid); + } + printf("waiting(%ds) for file %s ...\n", time_int, greenlight); + fflush(stdout); + sleep(time_int); + } MPI_Barrier(MPI_COMM_WORLD); } @@ -4542,7 +4542,7 @@ int MPI_Init(int *argc, char ***argv) pause_proc(); return (ret_code); } -#endif /* USE_PAUSE */ +#endif /* USE_PAUSE */ /* @@ -4552,16 +4552,16 @@ static void usage(void) { printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] " - "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n"); + "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n"); printf("\t-m<n_datasets>" - "\tset number of datasets for the multiple dataset test\n"); + "\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-f <prefix>\tfilename prefix\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 <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n", - ROW_FACTOR, COL_FACTOR); + ROW_FACTOR, COL_FACTOR); printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); printf("\n"); } @@ -4573,7 +4573,7 @@ usage(void) static int parse_options(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -4584,110 +4584,110 @@ parse_options(int argc, char **argv) chunkdim1 = (dim1+9)/10; while (--argc){ - if (**(++argv) != '-'){ - break; - }else{ - switch(*(*argv+1)){ - case 'm': ndatasets = atoi((*argv+1)+1); - if (ndatasets < 0){ - nerrors++; - return(1); - } - break; - case 'n': ngroups = atoi((*argv+1)+1); - if (ngroups < 0){ + if (**(++argv) != '-'){ + break; + }else{ + switch(*(*argv+1)){ + case 'm': ndatasets = atoi((*argv+1)+1); + if (ndatasets < 0){ + nerrors++; + return(1); + } + break; + case 'n': ngroups = atoi((*argv+1)+1); + if (ngroups < 0){ nerrors++; return(1); - } + } break; - case 'f': if (--argc < 1) { - nerrors++; - return(1); - } - if (**(++argv) == '-') { - nerrors++; - return(1); - } - paraprefix = *argv; - break; - case 'p': /* Use the MPI-POSIX driver access */ - facc_type = FACC_MPIPOSIX; - break; - case 'i': /* Collective MPI-IO access with independent IO */ - dxfer_coll_type = DXFER_INDEPENDENT_IO; - break; - 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; - break; - case 'd': /* dimensizes */ - if (--argc < 2){ - nerrors++; - return(1); - } - dim0 = atoi(*(++argv))*mpi_size; - argc--; - dim1 = atoi(*(++argv))*mpi_size; - /* set default chunkdim sizes too */ - chunkdim0 = (dim0+9)/10; - chunkdim1 = (dim1+9)/10; - break; - case 'c': /* chunk dimensions */ - if (--argc < 2){ - nerrors++; - return(1); - } - chunkdim0 = atoi(*(++argv)); - argc--; - chunkdim1 = atoi(*(++argv)); - break; - case 'h': /* print help message--return with nerrors set */ - return(1); - default: printf("Illegal option(%s)\n", *argv); - nerrors++; - return(1); - } - } + case 'f': if (--argc < 1) { + nerrors++; + return(1); + } + if (**(++argv) == '-') { + nerrors++; + return(1); + } + paraprefix = *argv; + break; + case 'p': /* Use the MPI-POSIX driver access */ + facc_type = FACC_MPIPOSIX; + break; + case 'i': /* Collective MPI-IO access with independent IO */ + dxfer_coll_type = DXFER_INDEPENDENT_IO; + break; + 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; + break; + case 'd': /* dimensizes */ + if (--argc < 2){ + nerrors++; + return(1); + } + dim0 = atoi(*(++argv))*mpi_size; + argc--; + dim1 = atoi(*(++argv))*mpi_size; + /* set default chunkdim sizes too */ + chunkdim0 = (dim0+9)/10; + chunkdim1 = (dim1+9)/10; + break; + case 'c': /* chunk dimensions */ + if (--argc < 2){ + nerrors++; + return(1); + } + chunkdim0 = atoi(*(++argv)); + argc--; + chunkdim1 = atoi(*(++argv)); + break; + case 'h': /* print help message--return with nerrors set */ + return(1); + default: printf("Illegal option(%s)\n", *argv); + nerrors++; + return(1); + } + } } /*while*/ /* check validity of dimension and chunk sizes */ if (dim0 <= 0 || dim1 <= 0){ - printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); - nerrors++; - return(1); + printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); + nerrors++; + return(1); } if (chunkdim0 <= 0 || chunkdim1 <= 0){ - printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); - nerrors++; - return(1); + printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); + nerrors++; + return(1); } /* Make sure datasets can be divided into equal portions by the processes */ if ((dim0 % mpi_size) || (dim1 % mpi_size)){ - if (MAINPROCESS) - printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", - dim0, dim1, mpi_size); - nerrors++; - return(1); + if (MAINPROCESS) + printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", + dim0, dim1, mpi_size); + nerrors++; + return(1); } /* compose the test filenames */ { - int i, n; - - n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ - - for (i=0; i < n; i++) - if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) - == NULL){ - printf("h5_fixname failed\n"); - nerrors++; - return(1); - } - printf("Test filenames are:\n"); - for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); + int i, n; + + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) + == NULL){ + printf("h5_fixname failed\n"); + nerrors++; + return(1); + } + printf("Test filenames are:\n"); + for (i=0; i < n; i++) + printf(" %s\n", filenames[i]); } return(0); @@ -4703,7 +4703,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, { hid_t ret_pl = -1; herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ + int mpi_rank; /* mpi variables */ /* need the rank for error checking macros */ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -4712,39 +4712,39 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); if (l_facc_type == FACC_DEFAULT) - return (ret_pl); + return (ret_pl); if (l_facc_type == FACC_MPIO){ - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); - return(ret_pl); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(ret_pl, comm, info); + VRFY((ret >= 0), ""); + return(ret_pl); } if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return(ret_pl); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((mpio_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(mpio_pl, comm, info); + VRFY((ret >= 0), ""); + + /* setup file access template */ + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); + H5Pclose(mpio_pl); + return(ret_pl); } if (l_facc_type == FACC_MPIPOSIX) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpiposix(ret_pl, comm, use_gpfs); - VRFY((ret >= 0), "H5Pset_fapl_mpiposix succeeded"); - return(ret_pl); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpiposix(ret_pl, comm, use_gpfs); + VRFY((ret >= 0), "H5Pset_fapl_mpiposix succeeded"); + return(ret_pl); } /* unknown file access types */ @@ -4812,7 +4812,7 @@ sschecker4(void) int main(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ H5Ptest_param_t ndsets_params, ngroups_params; H5Ptest_param_t collngroups_params; H5Ptest_param_t io_mode_confusion_params; @@ -4830,9 +4830,9 @@ int main(int argc, char **argv) dim1 = COL_FACTOR*mpi_size; if (MAINPROCESS){ - printf("===================================\n"); - printf("Shape Same Tests Start\n"); - printf("===================================\n"); + printf("===================================\n"); + printf("Shape Same Tests Start\n"); + printf("===================================\n"); } /* Attempt to turn off atexit post processing so that in case errors @@ -4841,7 +4841,7 @@ int main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); + printf("Failed to turn off atexit processing. Continue.\n", mpi_rank); }; H5open(); h5_show_hostname(); @@ -4851,23 +4851,23 @@ int main(int argc, char **argv) /* Shape Same tests using contigous hyperslab */ AddTest("sscontig1", sscontig1, NULL, - "Shape Same, contigous hyperslab, ind IO, contig datasets", PARATESTFILE); + "Shape Same, contigous hyperslab, ind IO, contig datasets", PARATESTFILE); AddTest("sscontig2", sscontig2, NULL, - "Shape Same, contigous hyperslab, col IO, contig datasets", PARATESTFILE); + "Shape Same, contigous hyperslab, col IO, contig datasets", PARATESTFILE); AddTest("sscontig3", sscontig3, NULL, - "Shape Same, contigous hyperslab, ind IO, chunked datasets", PARATESTFILE); + "Shape Same, contigous hyperslab, ind IO, chunked datasets", PARATESTFILE); AddTest("sscontig4", sscontig4, NULL, - "Shape Same, contigous hyperslab, col IO, chunked datasets", PARATESTFILE); + "Shape Same, contigous hyperslab, col IO, chunked datasets", PARATESTFILE); /* Shape Same tests using checker board hyperslab */ AddTest("sschecker1", sschecker1, NULL, - "Shape Same, checker hyperslab, ind IO, contig datasets", PARATESTFILE); + "Shape Same, checker hyperslab, ind IO, contig datasets", PARATESTFILE); AddTest("sschecker2", sschecker2, NULL, - "Shape Same, checker hyperslab, col IO, contig datasets", PARATESTFILE); + "Shape Same, checker hyperslab, col IO, contig datasets", PARATESTFILE); AddTest("sschecker3", sschecker3, NULL, - "Shape Same, checker hyperslab, ind IO, chunked datasets", PARATESTFILE); + "Shape Same, checker hyperslab, ind IO, chunked datasets", PARATESTFILE); AddTest("sschecker4", sschecker4, NULL, - "Shape Same, checker hyperslab, col IO, chunked datasets", PARATESTFILE); + "Shape Same, checker hyperslab, col IO, chunked datasets", PARATESTFILE); /* Display testing information */ TestInfo(argv[0]); @@ -4880,15 +4880,15 @@ int main(int argc, char **argv) TestParseCmdLine(argc, argv); if (facc_type == FACC_MPIPOSIX && MAINPROCESS){ - printf("===================================\n" - " Using MPIPOSIX driver\n" - "===================================\n"); + printf("===================================\n" + " Using MPIPOSIX driver\n" + "===================================\n"); } if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){ - printf("===================================\n" - " Using Independent I/O with file set view to replace collective I/O \n" - "===================================\n"); + printf("===================================\n" + " Using Independent I/O with file set view to replace collective I/O \n" + "===================================\n"); } @@ -4913,16 +4913,16 @@ int main(int argc, char **argv) { int temp; MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); - nerrors=temp; + nerrors=temp; } - if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); - if (nerrors) - printf("***PHDF5 tests detected %d errors***\n", nerrors); - else - printf("PHDF5 tests finished with no errors\n"); - printf("===================================\n"); + if (MAINPROCESS){ /* only process 0 reports */ + printf("===================================\n"); + if (nerrors) + printf("***PHDF5 tests detected %d errors***\n", nerrors); + else + printf("PHDF5 tests finished with no errors\n"); + printf("===================================\n"); } /* close HDF5 library */ H5close(); |