diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-17 21:43:07 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-17 21:43:07 (GMT) |
commit | 40d2ecb45f317bf2a91fbf937e8cc11c45d9898b (patch) | |
tree | 4669d7a1324976383eff561a9f32458fe043a902 | |
parent | 264f76847ea696d02465e31c8ced62ca43a11458 (diff) | |
download | hdf5-40d2ecb45f317bf2a91fbf937e8cc11c45d9898b.zip hdf5-40d2ecb45f317bf2a91fbf937e8cc11c45d9898b.tar.gz hdf5-40d2ecb45f317bf2a91fbf937e8cc11c45d9898b.tar.bz2 |
[svn-r20119] Description:
Clean up MPI resource leaks in parallel tests, along with a bunch of
compiler warnings.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.6 (amazon) in debug mode
Mac OS X/32 10.6.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
-rw-r--r-- | src/H5trace.c | 4 | ||||
-rw-r--r-- | testpar/t_file.c | 6 | ||||
-rw-r--r-- | testpar/t_shapesame.c | 349 | ||||
-rw-r--r-- | tools/h5diff/ph5diff_main.c | 200 | ||||
-rwxr-xr-x | tools/h5diff/testph5diff.sh | 3 |
5 files changed, 282 insertions, 280 deletions
diff --git a/src/H5trace.c b/src/H5trace.c index 8e645af..67a85c5 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1974,6 +1974,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "H5T_ORDER_VAX"); break; + case H5T_ORDER_MIXED: + fprintf(out, "H5T_ORDER_MIXED"); + break; + case H5T_ORDER_NONE: fprintf(out, "H5T_ORDER_NONE"); break; diff --git a/testpar/t_file.c b/testpar/t_file.c index ff983a9..5cd3e9d 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -44,7 +44,7 @@ test_split_comm_access(void) herr_t ret; /* generic return value */ const char *filename; - filename = GetTestParameters(); + filename = (const char *)GetTestParameters(); if (VERBOSE_MED) printf("Split Communicator access test on file %s\n", filename); @@ -53,7 +53,7 @@ test_split_comm_access(void) MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); is_old = mpi_rank%2; - mrc = MPI_Comm_split (MPI_COMM_WORLD, is_old, mpi_rank, &comm); + mrc = MPI_Comm_split(MPI_COMM_WORLD, is_old, mpi_rank, &comm); VRFY((mrc==MPI_SUCCESS), ""); MPI_Comm_size(comm,&newprocs); MPI_Comm_rank(comm,&newrank); @@ -89,6 +89,8 @@ test_split_comm_access(void) /*VRFY((mrc==MPI_SUCCESS), ""); */ } } + mrc = MPI_Comm_free(&comm); + VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free succeeded"); mrc = MPI_Barrier(MPI_COMM_WORLD); VRFY((mrc==MPI_SUCCESS), "final MPI_Barrier succeeded"); } diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 3f8006f..a62e4f9 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -121,12 +121,13 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, const char *filename; hbool_t use_gpfs = FALSE; /* Use GPFS hints */ hbool_t mis_match = FALSE; - int i, j, k, l, n; + int i, j, k, l; + size_t n; int mrc; int mpi_size = -1; int mpi_rank = -1; - int start_index; - int stop_index; + 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 * small_ds_buf_0 = NULL; @@ -139,7 +140,6 @@ contig_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; - uint32_t * ptr_2; MPI_Comm mpi_comm = MPI_COMM_NULL; MPI_Info mpi_info = MPI_INFO_NULL; hid_t fid; /* HDF5 file ID */ @@ -308,8 +308,8 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* setup dims: */ - dims[0] = (int)(mpi_size + 1); - dims[1] = dims[2] = dims[3] = dims[4] = edge_size; + dims[0] = (hsize_t)(mpi_size + 1); + dims[1] = dims[2] = dims[3] = dims[4] = (hsize_t)edge_size; /* Create small ds dataspaces */ @@ -397,7 +397,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, chunk_dims[0] = 1; } chunk_dims[1] = chunk_dims[2] = - chunk_dims[3] = chunk_dims[4] = chunk_edge_size; + chunk_dims[3] = chunk_dims[4] = (hsize_t)chunk_edge_size; small_ds_dcpl_id = H5Pcreate(H5P_DATASET_CREATE); VRFY((ret != FAIL), "H5Pcreate() small_ds_dcpl_id succeeded"); @@ -443,17 +443,17 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } /* setup selection to write initial data to the small and large data sets */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } /* setup selections for writing initial data to the small data set */ @@ -475,7 +475,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, if ( MAINPROCESS ) { /* add an additional slice to the selections */ - start[0] = mpi_size; + start[0] = (hsize_t)mpi_size; ret = H5Sselect_hyperslab(mem_small_ds_sid, H5S_SELECT_OR, @@ -543,7 +543,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* setup selections for writing initial data to the large data set */ - start[0] = mpi_rank; + start[0] = (hsize_t)mpi_rank; ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_SET, @@ -583,7 +583,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, if ( MAINPROCESS ) { /* add an additional slice to the selections */ - start[0] = mpi_size; + start[0] = (hsize_t)mpi_size; ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_OR, @@ -677,7 +677,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -685,7 +685,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -755,10 +755,10 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * large_rank > small_rank by the assertions at the head * of this function. Thus no need for another inner loop. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; ret = H5Sselect_hyperslab(file_large_ds_sid, @@ -796,20 +796,20 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, file_large_ds_sid, xfer_plist, small_ds_slice_buf); - VRFY((ret >= 0), "H5Sread() slice from large ds succeeded."); + VRFY((ret >= 0), "H5Dread() slice from large ds succeeded."); /* verify that expected data is retrieved */ mis_match = FALSE; ptr_1 = small_ds_slice_buf; - expected_value = + expected_value = (uint32_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); + (l * edge_size)); - for ( n = 0; n < (int)small_ds_slice_size; n++ ) { + for ( n = 0; n < small_ds_slice_size; n++ ) { if ( *ptr_1 != expected_value ) { @@ -844,17 +844,17 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * data (and only the correct data) is read. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(file_small_ds_sid, @@ -881,7 +881,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -889,7 +889,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -955,10 +955,10 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * by the assertions at the head of this function. Thus no * need for another inner loop. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; ret = H5Sselect_hyperslab(mem_large_ds_sid, @@ -996,25 +996,24 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, file_small_ds_sid, xfer_plist, large_ds_buf_1); - VRFY((ret >= 0), "H5Sread() slice from small ds succeeded."); + VRFY((ret >= 0), "H5Dread() slice from small ds succeeded."); /* verify that the expected data and only the * expected data was read. */ ptr_1 = large_ds_buf_1; - expected_value = mpi_rank * small_ds_slice_size; - start_index = + expected_value = (uint32_t)((size_t)mpi_rank * small_ds_slice_size); + start_index = (size_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); - stop_index = start_index + (int)small_ds_slice_size - 1; + (l * edge_size)); + stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index <= (int)large_ds_size ); + HDassert( stop_index <= large_ds_size ); - for ( n = 0; n < (int)large_ds_size; n++ ) { + for ( n = 0; n < large_ds_size; n++ ) { if ( ( n >= start_index ) && ( n <= stop_index ) ) { @@ -1066,17 +1065,17 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * the memory and file selections. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(file_small_ds_sid, @@ -1102,7 +1101,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -1110,7 +1109,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -1199,10 +1198,10 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* select the portion of the in memory large cube from which we * are going to write data. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; ret = H5Sselect_hyperslab(mem_large_ds_sid, @@ -1260,20 +1259,19 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, mis_match = FALSE; ptr_1 = small_ds_buf_1; - expected_value = + expected_value = (uint32_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); + (l * edge_size)); - start_index = mpi_rank * small_ds_slice_size; + start_index = (size_t)mpi_rank * small_ds_slice_size; stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index <= (int)small_ds_size ); + HDassert( stop_index <= small_ds_size ); - for ( n = 0; n < (int)small_ds_size; n++ ) { + for ( n = 0; n < small_ds_size; n++ ) { if ( ( n >= start_index ) && ( n <= stop_index ) ) { @@ -1325,17 +1323,17 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* select the slice of the in memory small data set associated with * the process's mpi rank. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(mem_small_ds_sid, @@ -1354,7 +1352,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -1362,7 +1360,7 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -1443,10 +1441,10 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, /* select the portion of the in memory large cube to which we * are going to write data. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; ret = H5Sselect_hyperslab(file_large_ds_sid, @@ -1510,20 +1508,18 @@ contig_hyperslab_dr_pio_test__run_test(const int test_num, * expected data was read. */ ptr_1 = large_ds_buf_1; - expected_value = (uint32_t)(mpi_rank) * small_ds_slice_size; - + expected_value = (uint32_t)((size_t)mpi_rank * small_ds_slice_size); - start_index = (i * edge_size * edge_size * edge_size * edge_size) + + start_index = (size_t)((i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); - stop_index = start_index + (int)small_ds_slice_size - 1; + (l * edge_size)); + stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index < (int)large_ds_size ); + HDassert( stop_index < large_ds_size ); - for ( n = 0; n < (int)large_ds_size; n++ ) { + for ( n = 0; n < large_ds_size; n++ ) { if ( ( n >= start_index ) && ( n <= stop_index ) ) { @@ -1986,14 +1982,14 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( * pre-C99 compilers again. */ - base_count = edge_size / (checker_edge_size * 2); + base_count = (hsize_t)(edge_size / (checker_edge_size * 2)); if ( (edge_size % (checker_edge_size * 2)) > 0 ) { base_count++; } - offset_count = (edge_size - checker_edge_size) / (checker_edge_size * 2); + offset_count = (hsize_t)((edge_size - checker_edge_size) / (checker_edge_size * 2)); if ( ((edge_size - checker_edge_size) % (checker_edge_size * 2)) > 0 ) { @@ -2019,7 +2015,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( while ( i < sel_offset ) { start[i] = sel_start[i]; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; block[i] = 1; @@ -2028,8 +2024,8 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( while ( i < test_max_rank ) { - stride[i] = 2 * checker_edge_size; - block[i] = checker_edge_size; + stride[i] = (hsize_t)(2 * checker_edge_size); + block[i] = (hsize_t)checker_edge_size; i++; } @@ -2045,7 +2041,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[0] = checker_edge_size; + start[0] = (hsize_t)checker_edge_size; count[0] = offset_count; } @@ -2062,7 +2058,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[1] = checker_edge_size; + start[1] = (hsize_t)checker_edge_size; count[1] = offset_count; } @@ -2079,7 +2075,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[2] = checker_edge_size; + start[2] = (hsize_t)checker_edge_size; count[2] = offset_count; } @@ -2096,7 +2092,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[3] = checker_edge_size; + start[3] = (hsize_t)checker_edge_size; count[3] = offset_count; } @@ -2113,7 +2109,7 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( } else { - start[4] = checker_edge_size; + start[4] = (hsize_t)checker_edge_size; count[4] = offset_count; } @@ -2218,9 +2214,9 @@ checker_board_hyperslab_dr_pio_test__select_checker_board( for ( i = 0; i < test_max_rank; i++ ) { start[i] = 0; - stride[i] = edge_size; + stride[i] = (hsize_t)edge_size; count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_AND, @@ -2497,10 +2493,11 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, hbool_t use_gpfs = FALSE; /* Use GPFS hints */ hbool_t data_ok = FALSE; hbool_t mis_match = FALSE; - int i, j, k, l, n; + int i, j, k, l; + size_t u; int mrc; - int start_index; - int stop_index; + size_t start_index; + size_t stop_index; int small_ds_offset; int large_ds_offset; const int test_max_rank = 5; /* must update code if this changes */ @@ -2515,7 +2512,6 @@ 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; - uint32_t * ptr_2; int mpi_rank; int mpi_size; MPI_Comm mpi_comm = MPI_COMM_NULL; @@ -2692,8 +2688,8 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* setup dims: */ - dims[0] = (int)(mpi_size + 1); - dims[1] = dims[2] = dims[3] = dims[4] = edge_size; + dims[0] = (hsize_t)(mpi_size + 1); + dims[1] = dims[2] = dims[3] = dims[4] = (hsize_t)edge_size; /* Create small ds dataspaces */ @@ -2790,7 +2786,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, } chunk_dims[1] = chunk_dims[2] = - chunk_dims[3] = chunk_dims[4] = chunk_edge_size; + chunk_dims[3] = chunk_dims[4] = (hsize_t)chunk_edge_size; small_ds_dcpl_id = H5Pcreate(H5P_DATASET_CREATE); VRFY((ret != FAIL), "H5Pcreate() small_ds_dcpl_id succeeded"); @@ -2836,17 +2832,17 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* setup selection to write initial data to the small and large data sets */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } /* setup selections for writing initial data to the small data set */ @@ -2868,7 +2864,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, if ( MAINPROCESS ) { /* add an additional slice to the selections */ - start[0] = mpi_size; + start[0] = (hsize_t)mpi_size; ret = H5Sselect_hyperslab(mem_small_ds_sid, H5S_SELECT_OR, @@ -2935,7 +2931,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, /* setup selections for writing initial data to the large data set */ - start[0] = mpi_rank; + start[0] = (hsize_t)mpi_rank; ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_SET, @@ -2975,7 +2971,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, if ( MAINPROCESS ) { /* add an additional slice to the selections */ - start[0] = mpi_size; + start[0] = (hsize_t)mpi_size; ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_OR, @@ -3067,7 +3063,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, */ sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0; - sel_start[small_ds_offset] = mpi_rank; + sel_start[small_ds_offset] = (hsize_t)mpi_rank; checker_board_hyperslab_dr_pio_test__select_checker_board(mpi_rank, small_ds_slice_sid, @@ -3097,7 +3093,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -3105,7 +3101,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -3172,10 +3168,10 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, * large_rank > small_rank by the assertions at the head * of this function. Thus no need for another inner loop. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; HDassert( ( start[0] == 0 ) || ( 0 < small_ds_offset + 1 ) ); @@ -3220,7 +3216,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, file_large_ds_sid_0, xfer_plist, small_ds_slice_buf); - VRFY((ret >= 0), "H5Sread() slice from large ds succeeded."); + 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", @@ -3268,7 +3264,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, */ sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0; - sel_start[small_ds_offset] = mpi_rank; + sel_start[small_ds_offset] = (hsize_t)mpi_rank; checker_board_hyperslab_dr_pio_test__select_checker_board(mpi_rank, file_small_ds_sid_0, @@ -3295,7 +3291,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -3303,7 +3299,7 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -3369,10 +3365,10 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, * by the assertions at the head of this function. Thus no * need for another inner loop. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; HDassert( ( start[0] == 0 ) || ( 0 < small_ds_offset + 1 ) ); @@ -3417,24 +3413,25 @@ checker_board_hyperslab_dr_pio_test__run_test(const int test_num, file_small_ds_sid_0, xfer_plist, large_ds_buf_1); - VRFY((ret >= 0), "H5Sread() slice from small ds succeeded."); + VRFY((ret >= 0), "H5Dread() slice from small ds succeeded."); /* verify that the expected data and only the * expected data was read. */ data_ok = TRUE; ptr_1 = large_ds_buf_1; - expected_value = mpi_rank * small_ds_slice_size; - start_index = + expected_value = (uint32_t)((size_t)mpi_rank * small_ds_slice_size); + start_index = (size_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); - stop_index = start_index + (int)small_ds_slice_size - 1; + (l * edge_size)); + stop_index = start_index + small_ds_slice_size - 1; #if CHECKER_BOARD_HYPERSLAB_DR_PIO_TEST__RUN_TEST__DEBUG { -int m; +int m, n; + HDfprintf(stdout, "%s:%d: expected_value = %d.\n", fcnName, mpi_rank, expected_value); HDfprintf(stdout, "%s:%d: start/stop index = %d/%d.\n", @@ -3455,11 +3452,10 @@ int m; } #endif - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index <= (int)large_ds_size ); + HDassert( stop_index <= large_ds_size ); - for ( n = 0; n < (int)start_index; n++ ) { + for ( u = 0; u < start_index; u++ ) { if ( *ptr_1 != 0 ) { @@ -3491,7 +3487,7 @@ int m; ptr_1 = large_ds_buf_1 + stop_index + 1; - for ( n = stop_index + 1; n < large_ds_size; n++ ) { + for ( u = stop_index + 1; u < large_ds_size; u++ ) { if ( *ptr_1 != 0 ) { @@ -3533,17 +3529,17 @@ int m; * the memory and file selections. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(file_small_ds_sid_0, @@ -3564,7 +3560,7 @@ int m; sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0; - sel_start[small_ds_offset] = mpi_rank; + sel_start[small_ds_offset] = (hsize_t)mpi_rank; checker_board_hyperslab_dr_pio_test__select_checker_board(mpi_rank, file_small_ds_sid_1, @@ -3581,7 +3577,7 @@ int m; for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -3589,7 +3585,7 @@ int m; } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -3678,10 +3674,10 @@ int m; /* select the portion of the in memory large cube from which we * are going to write data. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; HDassert( ( start[0] == 0 ) || ( 0 < small_ds_offset + 1 ) ); @@ -3747,35 +3743,34 @@ int m; /* verify that expected data is retrieved */ mis_match = FALSE; - ptr_1 = small_ds_buf_1; - expected_value = + expected_value = (uint32_t)( (i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); + (l * edge_size)); - start_index = mpi_rank * small_ds_slice_size; + start_index = (size_t)mpi_rank * small_ds_slice_size; stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index <= (int)small_ds_size ); + HDassert( stop_index <= small_ds_size ); data_ok = TRUE; - for ( n = 0; n < start_index; n++ ) { + ptr_1 = small_ds_buf_1; + for ( u = 0; u < start_index; u++, ptr_1++ ) { - if ( *(ptr_1 + n) != 0 ) { + if ( *ptr_1 != 0 ) { data_ok = FALSE; - *(ptr_1 + n) = 0; + *ptr_1 = 0; } } data_ok &= checker_board_hyperslab_dr_pio_test__verify_data ( - ptr_1 + start_index, + small_ds_buf_1 + start_index, small_rank - 1, edge_size, checker_edge_size, @@ -3784,12 +3779,13 @@ int m; ); - for ( n = stop_index; n < small_ds_size; n++ ) { + ptr_1 = small_ds_buf_1; + for ( u = stop_index; u < small_ds_size; u++, ptr_1++ ) { - if ( *(ptr_1 + n) != 0 ) { + if ( *ptr_1 != 0 ) { data_ok = FALSE; - *(ptr_1 + n) = 0; + *ptr_1 = 0; } } @@ -3819,17 +3815,17 @@ int m; * and file selections. */ - start[0] = mpi_rank; - stride[0] = 2 * (mpi_size + 1); + start[0] = (hsize_t)mpi_rank; + stride[0] = (hsize_t)(2 * (mpi_size + 1)); count[0] = 1; block[0] = 1; for ( i = 1; i < large_rank; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } ret = H5Sselect_hyperslab(file_large_ds_sid_0, @@ -3853,7 +3849,7 @@ int m; */ sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0; - sel_start[small_ds_offset] = mpi_rank; + sel_start[small_ds_offset] = (hsize_t)mpi_rank; checker_board_hyperslab_dr_pio_test__select_checker_board(mpi_rank, mem_small_ds_sid, @@ -3870,7 +3866,7 @@ int m; for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) { start[i] = 0; - stride[i] = 2 * edge_size; + stride[i] = (hsize_t)(2 * edge_size); count[i] = 1; if ( (PAR_SS_DR_MAX_RANK - i) > (small_rank - 1) ) { @@ -3878,7 +3874,7 @@ int m; } else { - block[i] = edge_size; + block[i] = (hsize_t)edge_size; } } @@ -3959,10 +3955,10 @@ int m; /* select the portion of the in memory large cube to which we * are going to write data. */ - start[0] = i; - start[1] = j; - start[2] = k; - start[3] = l; + start[0] = (hsize_t)i; + start[1] = (hsize_t)j; + start[2] = (hsize_t)k; + start[3] = (hsize_t)l; start[4] = 0; HDassert( ( start[0] == 0 ) || ( 0 < small_ds_offset + 1 ) ); @@ -4032,37 +4028,35 @@ int m; /* verify that the expected data and only the * expected data was read. */ - ptr_1 = large_ds_buf_1; - expected_value = (uint32_t)(mpi_rank) * small_ds_slice_size; + expected_value = (uint32_t)((size_t)mpi_rank * small_ds_slice_size); - - start_index = (i * edge_size * edge_size * edge_size * edge_size) + + start_index = (size_t)((i * edge_size * edge_size * edge_size * edge_size) + (j * edge_size * edge_size * edge_size) + (k * edge_size * edge_size) + - (l * edge_size); - stop_index = start_index + (int)small_ds_slice_size - 1; + (l * edge_size)); + stop_index = start_index + small_ds_slice_size - 1; - HDassert( 0 <= start_index ); HDassert( start_index < stop_index ); - HDassert( stop_index < (int)large_ds_size ); + HDassert( stop_index < large_ds_size ); mis_match = FALSE; data_ok = TRUE; - for ( n = 0; n < start_index; n++ ) { + ptr_1 = large_ds_buf_1; + for ( u = 0; u < start_index; u++, ptr_1++ ) { - if ( *(ptr_1 + n) != 0 ) { + if ( *ptr_1 != 0 ) { data_ok = FALSE; - *(ptr_1 + n) = 0; + *ptr_1 = 0; } } data_ok &= checker_board_hyperslab_dr_pio_test__verify_data ( - ptr_1 + start_index, + large_ds_buf_1 + start_index, small_rank - 1, edge_size, checker_edge_size, @@ -4071,12 +4065,13 @@ int m; ); - for ( n = stop_index; n < small_ds_size; n++ ) { + ptr_1 = large_ds_buf_1; + for ( u = stop_index; u < small_ds_size; u++, ptr_1++ ) { - if ( *(ptr_1 + n) != 0 ) { + if ( *ptr_1 != 0 ) { data_ok = FALSE; - *(ptr_1 + n) = 0; + *ptr_1 = 0; } } diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c index f6b0dba..bac1086 100644 --- a/tools/h5diff/ph5diff_main.c +++ b/tools/h5diff/ph5diff_main.c @@ -87,31 +87,34 @@ int main(int argc, const char *argv[]) h5diff(fname1, fname2, objname1, objname2, &options); print_info(&options); + } + /* Parallel h5diff */ + else { - MPI_Finalize(); + /* Have the manager process the command-line */ + if(nID == 0) + { + parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); - return 0; - } + h5diff(fname1, fname2, objname1, objname2, &options); - /* Have the manager process the command-line */ - if(nID == 0) - { - parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); + MPI_Barrier(MPI_COMM_WORLD); - h5diff(fname1, fname2, objname1, objname2, &options); + print_info(&options); + print_manager_output(); + } + /* All other tasks become workers and wait for assignments. */ + else { + ph5diff_worker(nID); - MPI_Barrier(MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); + } /* end else */ - print_info(&options); - print_manager_output(); + } /* end else */ - MPI_Finalize(); + MPI_Finalize(); - return 0; - } - /* All other tasks become workers and wait for assignments. */ - else - ph5diff_worker(nID); + return 0; } /*------------------------------------------------------------------------- @@ -141,107 +144,104 @@ ph5diff_worker(int nID) int i; MPI_Status Status; - MPI_Comm_rank(MPI_COMM_WORLD, &nID); outBuffOffset = 0; MPI_Recv(filenames, MAX_FILENAME*2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); if(Status.MPI_TAG == MPI_TAG_PARALLEL) { - /* disable error reporting */ - H5E_BEGIN_TRY - { - /* Open the files */ - if ((file1_id = H5Fopen (filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - { - printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[0]); - MPI_Abort(MPI_COMM_WORLD, 0); - } - if ((file2_id = H5Fopen (filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + /* disable error reporting */ + H5E_BEGIN_TRY { - printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[1]); - MPI_Abort(MPI_COMM_WORLD, 0); + /* Open the files */ + if ((file1_id = H5Fopen (filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + { + printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[0]); + MPI_Abort(MPI_COMM_WORLD, 0); + } + if ((file2_id = H5Fopen (filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + { + printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[1]); + MPI_Abort(MPI_COMM_WORLD, 0); + } + /* enable error reporting */ } - /* enable error reporting */ - } - H5E_END_TRY; + H5E_END_TRY; - while(1) - { - MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); - - if(Status.MPI_TAG == MPI_TAG_ARGS) + while(1) { - /*Recv parameters for diff from manager task */ - MPI_Recv(&args, sizeof(args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status); - /*Do the diff */ - diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.options), args.type); - diffs.not_cmp = args.options.not_cmp; - - /*If print buffer has something in it, request print token.*/ - if(outBuffOffset>0) - { - MPI_Send(NULL, 0, MPI_BYTE, 0, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD); - /*Wait for print token. */ - MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status); - - /*When get token, send all of our output to the manager task and then return the token */ - for(i=0; i<outBuffOffset; i+=PRINT_DATA_MAX_SIZE) - MPI_Send(outBuff+i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); - - - /* An overflow file exists, so we send it's output to the manager too and then delete it */ - if(overflow_file) - { - int tmp; - memset(out_data, 0, PRINT_DATA_MAX_SIZE); - i=0; + MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); - rewind(overflow_file); - while((tmp = getc(overflow_file)) >= 0) + if(Status.MPI_TAG == MPI_TAG_ARGS) { - *(out_data + i++) = (char)tmp; - if(i==PRINT_DATA_MAX_SIZE) + /*Recv parameters for diff from manager task */ + MPI_Recv(&args, sizeof(args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status); + /*Do the diff */ + diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.options), args.type); + diffs.not_cmp = args.options.not_cmp; + + /*If print buffer has something in it, request print token.*/ + if(outBuffOffset>0) { - MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); - i=0; - memset(out_data, 0, PRINT_DATA_MAX_SIZE); + MPI_Send(NULL, 0, MPI_BYTE, 0, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD); + /*Wait for print token. */ + MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status); + + /*When get token, send all of our output to the manager task and then return the token */ + for(i=0; i<outBuffOffset; i+=PRINT_DATA_MAX_SIZE) + MPI_Send(outBuff+i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); + + + /* An overflow file exists, so we send it's output to the manager too and then delete it */ + if(overflow_file) + { + int tmp; + + memset(out_data, 0, PRINT_DATA_MAX_SIZE); + i=0; + + rewind(overflow_file); + while((tmp = getc(overflow_file)) >= 0) + { + *(out_data + i++) = (char)tmp; + if(i==PRINT_DATA_MAX_SIZE) + { + MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); + i=0; + memset(out_data, 0, PRINT_DATA_MAX_SIZE); + } + } + + if(i>0) + MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); + + fclose(overflow_file); + overflow_file = NULL; + } + + fflush(stdout); + memset(outBuff, 0, OUTBUFF_SIZE); + outBuffOffset = 0; + + MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD); } + else + MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_DONE, MPI_COMM_WORLD); } - - if(i>0) - MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); - - fclose(overflow_file); - overflow_file = NULL; + else if(Status.MPI_TAG == MPI_TAG_END) + { + MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status); + /* printf("exiting..., task: %d\n", nID); + fflush(stdout);*/ + break; + } + else + { + printf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG); + MPI_Abort(MPI_COMM_WORLD, 0); } - fflush(stdout); - memset(outBuff, 0, OUTBUFF_SIZE); - outBuffOffset = 0; - - MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD); - } - else - MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_DONE, MPI_COMM_WORLD); - } - else if(Status.MPI_TAG == MPI_TAG_END) - { - MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status); - /* printf("exiting..., task: %d\n", nID); - fflush(stdout);*/ - break; - } - else - { - printf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG); - MPI_Abort(MPI_COMM_WORLD, 0); } - - } } - - MPI_Barrier(MPI_COMM_WORLD); - MPI_Finalize(); } diff --git a/tools/h5diff/testph5diff.sh b/tools/h5diff/testph5diff.sh index 0734d21..c619ab5 100755 --- a/tools/h5diff/testph5diff.sh +++ b/tools/h5diff/testph5diff.sh @@ -54,7 +54,8 @@ TOOLTEST() { ############################################################################## ############################################################################## -# testphdf5 test using the MPI-POSIX VFL driver +# Invoke the regular h5diff testing script, with the -p parameter to indicate +# that it should run the parallel version of the tests TOOLTEST -p # no need to print any message since this is just a shell to invoke |