diff options
author | kmu <kmu@hdfgroup.org> | 2020-01-27 15:01:32 (GMT) |
---|---|---|
committer | kmu <kmu@hdfgroup.org> | 2020-01-27 15:01:32 (GMT) |
commit | 5163a7e1cf75edecc2d9e198a68ef00e8c124d00 (patch) | |
tree | 899b937df8ea59b756e7aab654f11ad014f75f01 /testpar | |
parent | f3a4e8164f99d733e6804acddfe1b3b0dfe63634 (diff) | |
download | hdf5-5163a7e1cf75edecc2d9e198a68ef00e8c124d00.zip hdf5-5163a7e1cf75edecc2d9e198a68ef00e8c124d00.tar.gz hdf5-5163a7e1cf75edecc2d9e198a68ef00e8c124d00.tar.bz2 |
fix Wredundant-decls, Wswitch-default, Wdeclaration-after-statement, Wsign-compare, Wmisleading-indentation, Wshadow
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_2Gio.c | 69 | ||||
-rw-r--r-- | testpar/t_bigio.c | 45 | ||||
-rw-r--r-- | testpar/t_chunk_alloc.c | 20 | ||||
-rw-r--r-- | testpar/t_coll_chunk.c | 12 | ||||
-rw-r--r-- | testpar/t_mdset.c | 8 | ||||
-rw-r--r-- | testpar/t_prestart.c | 9 | ||||
-rw-r--r-- | testpar/t_shapesame.c | 7 | ||||
-rw-r--r-- | testpar/t_span_tree.c | 4 |
8 files changed, 106 insertions, 68 deletions
diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index 977a154..28f5f47 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -562,7 +562,17 @@ static int MpioTest2G( MPI_Comm comm ) hid_t plist_id; /* property list identifier */ hid_t filespace; /* file and memory dataspace identifiers */ int *data; /* pointer to data buffer to write */ - + size_t tot_size_bytes; + hid_t dcpl_id; + hid_t memorydataspace; + hid_t filedataspace; + size_t slice_per_process; + size_t data_size; + size_t data_size_bytes; + + hsize_t chunk[3]; + hsize_t h5_counts[3]; + hsize_t h5_offsets[3]; hsize_t shape[3] = {1024, 1024, 1152}; /* @@ -598,7 +608,7 @@ static int MpioTest2G( MPI_Comm comm ) /* * Create the dataspace for the dataset. */ - size_t tot_size_bytes = sizeof(int); + tot_size_bytes = sizeof(int); for (int i = 0; i < 3; i++) { tot_size_bytes *= shape[i]; } @@ -611,9 +621,11 @@ static int MpioTest2G( MPI_Comm comm ) /* * Select chunking */ - hid_t dcpl_id = H5Pcreate (H5P_DATASET_CREATE); + dcpl_id = H5Pcreate (H5P_DATASET_CREATE); VRFY((dcpl_id >= 0), "H5P_DATASET_CREATE"); - hsize_t chunk[3] = {4, shape[1], shape[2]}; + chunk[0] = 4; + chunk[1] = shape[1]; + shape[2] = shape[2]; status = H5Pset_chunk(dcpl_id, 3, chunk); VRFY((status >= 0), "H5Pset_chunk succeeded"); @@ -634,10 +646,9 @@ static int MpioTest2G( MPI_Comm comm ) status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE); VRFY((status >= 0), ""); - size_t slice_per_process; H5_CHECKED_ASSIGN(slice_per_process, size_t, (shape[0] + (hsize_t)mpi_size - 1) / (hsize_t)mpi_size, hsize_t); - size_t data_size = slice_per_process * shape[1] * shape[2]; - size_t data_size_bytes = sizeof(int) * data_size; + data_size = slice_per_process * shape[1] * shape[2]; + data_size_bytes = sizeof(int) * data_size; data = HDmalloc(data_size_bytes); VRFY((data != NULL), "data HDmalloc succeeded"); @@ -645,9 +656,13 @@ static int MpioTest2G( MPI_Comm comm ) data[i] = mpi_rank; } - hsize_t h5_counts[3] = { slice_per_process, shape[1], shape[2] }; - hsize_t h5_offsets[3] = { (size_t)mpi_rank * slice_per_process, 0, 0}; - hid_t filedataspace = H5Screate_simple(3, shape, NULL); + h5_counts[0] = slice_per_process; + h5_counts[1] = shape[1]; + h5_counts[2] = shape[2]; + h5_offsets[0] = (size_t)mpi_rank * slice_per_process; + h5_offsets[1] = 0; + h5_offsets[2] = 0; + filedataspace = H5Screate_simple(3, shape, NULL); VRFY((filedataspace >= 0), "H5Screate_simple succeeded"); // fix reminder along first dimension multiple of chunk[0] @@ -659,7 +674,7 @@ static int MpioTest2G( MPI_Comm comm ) h5_offsets, NULL, h5_counts, NULL); VRFY((status >= 0), "H5Sselect_hyperslab succeeded"); - hid_t memorydataspace = H5Screate_simple(3, h5_counts, NULL); + memorydataspace = H5Screate_simple(3, h5_counts, NULL); VRFY((memorydataspace >= 0), "H5Screate_simple succeeded"); status = H5Dwrite(dset_id, H5T_NATIVE_INT, @@ -2149,7 +2164,7 @@ extend_writeInd2(void) { const char *filename; hid_t fid; /* HDF5 file ID */ - hid_t fapl; /* File access templates */ + hid_t fapl_id; /* File access templates */ hid_t fs; /* File dataspace ID */ hid_t ms; /* Memory dataspace ID */ hid_t dataset; /* Dataset ID */ @@ -2177,15 +2192,15 @@ extend_writeInd2(void) * START AN HDF5 FILE * -------------------*/ /* setup file access template */ - fapl = create_faccess_plist(test_comm, MPI_INFO_NULL, facc_type); - VRFY((fapl >= 0), "create_faccess_plist succeeded"); + fapl_id = create_faccess_plist(test_comm, MPI_INFO_NULL, facc_type); + VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); /* create the file collectively */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((fid >= 0), "H5Fcreate succeeded"); /* Release file-access template */ - ret = H5Pclose(fapl); + ret = H5Pclose(fapl_id); VRFY((ret >= 0), "H5Pclose succeeded"); @@ -3403,7 +3418,7 @@ test_actual_io_mode(int selection_mode) { hid_t sid = -1; hid_t dataset = -1; hid_t data_type = H5T_NATIVE_INT; - hid_t fapl = -1; + hid_t fapl_id = -1; hid_t mem_space = -1; hid_t file_space = -1; hid_t dcpl = -1; @@ -3454,11 +3469,11 @@ test_actual_io_mode(int selection_mode) { HDassert(filename != NULL); /* Setup the file access template */ - fapl = create_faccess_plist(mpi_comm, mpi_info, facc_type); - VRFY((fapl >= 0), "create_faccess_plist() succeeded"); + fapl_id = create_faccess_plist(mpi_comm, mpi_info, facc_type); + VRFY((fapl_id >= 0), "create_faccess_plist() succeeded"); /* Create the file */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((fid >= 0), "H5Fcreate succeeded"); /* Create the basic Space */ @@ -3790,7 +3805,7 @@ test_actual_io_mode(int selection_mode) { /* Release some resources */ ret = H5Sclose(sid); - ret = H5Pclose(fapl); + ret = H5Pclose(fapl_id); ret = H5Pclose(dcpl); ret = H5Pclose(dxpl_write); ret = H5Pclose(dxpl_read); @@ -3919,7 +3934,7 @@ test_no_collective_cause_mode(int selection_mode) hid_t sid = -1; hid_t dataset = -1; hid_t data_type = H5T_NATIVE_INT; - hid_t fapl = -1; + hid_t fapl_id = -1; hid_t dcpl = -1; hid_t dxpl_write = -1; hid_t dxpl_read = -1; @@ -4000,11 +4015,11 @@ test_no_collective_cause_mode(int selection_mode) HDassert(filename != NULL); /* Setup the file access template */ - fapl = create_faccess_plist(mpi_comm, mpi_info, l_facc_type); - VRFY((fapl >= 0), "create_faccess_plist() succeeded"); + fapl_id = create_faccess_plist(mpi_comm, mpi_info, l_facc_type); + VRFY((fapl_id >= 0), "create_faccess_plist() succeeded"); /* Create the file */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((fid >= 0), "H5Fcreate succeeded"); @@ -4171,8 +4186,8 @@ test_no_collective_cause_mode(int selection_mode) /* Release some resources */ if (sid) H5Sclose(sid); - if (fapl) - H5Pclose(fapl); + if (fapl_id) + H5Pclose(fapl_id); if (dcpl) H5Pclose(dcpl); if (dxpl_write) diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index 70c77c3..e71f936 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -50,7 +50,6 @@ hsize_t space_dim2 = SPACE_DIM2; static void coll_chunktest(const char* filename, int chunk_factor, int select_factor, int api_option, int file_selection, int mem_selection, int mode); -hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type); /* * Setup the coordinates for point selection. @@ -228,8 +227,8 @@ verify_data(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], /* Set up the selection */ static void -ccslab_set(int mpi_rank, - int mpi_size, +ccslab_set(int my_mpi_rank, + int my_mpi_size, hsize_t start[], hsize_t count[], hsize_t stride[], @@ -247,7 +246,7 @@ ccslab_set(int mpi_rank, stride[1] = 1; count[0] = space_dim1; count[1] = space_dim2; - start[0] = (hsize_t)mpi_rank*count[0]; + start[0] = (hsize_t)my_mpi_rank*count[0]; start[1] = 0; break; @@ -260,7 +259,7 @@ ccslab_set(int mpi_rank, stride[1] = 3; count[0] = space_dim1/(stride[0]*block[0]); count[1] = (space_dim2)/(stride[1]*block[1]); - start[0] = space_dim1*(hsize_t)mpi_rank; + start[0] = space_dim1*(hsize_t)my_mpi_rank; start[1] = 0; break; @@ -272,9 +271,9 @@ ccslab_set(int mpi_rank, block[1] = 1; stride[0] = 1; stride[1] = 1; - count[0] = ((mpi_rank >= MAX(1,(mpi_size-2)))?0:space_dim1); + count[0] = ((my_mpi_rank >= MAX(1,(my_mpi_size-2)))?0:space_dim1); count[1] = space_dim2; - start[0] = (hsize_t)mpi_rank*count[0]; + start[0] = (hsize_t)my_mpi_rank*count[0]; start[1] = 0; break; @@ -286,13 +285,13 @@ ccslab_set(int mpi_rank, block[0] = 1; count[0] = 2; - stride[0] = (hsize_t)(space_dim1*(hsize_t)mpi_size/4+1); + stride[0] = (hsize_t)(space_dim1*(hsize_t)my_mpi_size/4+1); block[1] = space_dim2; count[1] = 1; start[1] = 0; stride[1] = 1; - if((mpi_rank *3)<(mpi_size*2)) start[0] = (hsize_t)mpi_rank; - else start[0] = 1 + space_dim1*(hsize_t)mpi_size/2 + (hsize_t)(mpi_rank-2*mpi_size/3); + if((my_mpi_rank *3)<(my_mpi_size*2)) start[0] = (hsize_t)my_mpi_rank; + else start[0] = 1 + space_dim1*(hsize_t)my_mpi_size/2 + (hsize_t)(my_mpi_rank-2*my_mpi_size/3); break; case BYROW_SELECTINCHUNK: @@ -300,12 +299,12 @@ ccslab_set(int mpi_rank, block[0] = 1; count[0] = 1; - start[0] = (hsize_t)mpi_rank*space_dim1; + start[0] = (hsize_t)my_mpi_rank*space_dim1; stride[0]= 1; - block[1] = space_dim2; - count[1] = 1; - stride[1]= 1; - start[1] = 0; + block[1] = space_dim2; + count[1] = 1; + stride[1]= 1; + start[1] = 0; break; @@ -1182,10 +1181,10 @@ 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 my_mpi_rank; /* mpi variables */ /* need the rank for error checking macros */ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + MPI_Comm_rank(MPI_COMM_WORLD, &my_mpi_rank); ret_pl = H5Pcreate (H5P_FILE_ACCESS); VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); @@ -1539,6 +1538,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(file_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } switch (mem_selection) { @@ -1562,6 +1564,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(mem_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } /* set up the collective transfer property list */ @@ -1798,6 +1803,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(file_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } switch (mem_selection) { @@ -1821,6 +1829,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(mem_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } /* fill dataset with test data */ diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c index e6df2d8..e716f41 100644 --- a/testpar/t_chunk_alloc.c +++ b/testpar/t_chunk_alloc.c @@ -385,18 +385,18 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in /* set expected value according the write pattern */ switch (write_pattern) { - case all: - value = i%mpi_size + 1; - break; - case none: - value = 0; - break; - case sec_last: - if (i==nchunks-2) - value = 100; - else + case all: + value = i%mpi_size + 1; + break; + case none: value = 0; break; + case sec_last: + if (i==nchunks-2) + value = 100; + else + value = 0; + break; default: HDassert(0); } diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index e950015..20c119f 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -710,6 +710,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(file_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } switch (mem_selection) { @@ -733,6 +736,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(mem_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } /* set up the collective transfer property list */ @@ -965,6 +971,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(file_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } switch (mem_selection) { @@ -988,6 +997,9 @@ coll_chunktest(const char* filename, status = H5Sselect_all(mem_dataspace); VRFY((status >= 0), "H5Sselect_all succeeded"); break; + + default: + break; } /* fill dataset with test data */ diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 6cdb0af7..db0d059 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -235,6 +235,9 @@ void compact_dataset(void) char dname[]="dataset"; herr_t ret; const char *filename; +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + hbool_t prop_value; +#endif size = get_size(); @@ -314,7 +317,6 @@ void compact_dataset(void) VRFY((dataset >= 0), "H5Dopen2 succeeded"); #ifdef H5_HAVE_INSTRUMENTED_LIBRARY - hbool_t prop_value; prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; ret = H5Pinsert2(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); @@ -620,6 +622,9 @@ void dataset_fillvalue(void) int acc, i, ii, j, k, l; /* Local index variables */ herr_t ret; /* Generic return value */ const char *filename; +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + hbool_t prop_value; +#endif MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -664,7 +669,6 @@ void dataset_fillvalue(void) VRFY((dxpl >= 0), "H5Pcreate succeeded"); #ifdef H5_HAVE_INSTRUMENTED_LIBRARY - hbool_t prop_value; prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF; ret = H5Pinsert2(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/testpar/t_prestart.c b/testpar/t_prestart.c index fc9d475..cf974e8 100644 --- a/testpar/t_prestart.c +++ b/testpar/t_prestart.c @@ -34,8 +34,8 @@ main (int argc, char **argv) hid_t file_id, dset_id, grp_id; hid_t fapl, sid, mem_dataspace; herr_t ret; - char filename[1024]; - int mpi_size, mpi_rank, ndims, i, j; + char filename[1024]; + int mpi_size, mpi_rank, ndims; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; hsize_t dims[RANK]; @@ -43,6 +43,7 @@ main (int argc, char **argv) hsize_t count[RANK]; hsize_t stride[RANK]; hsize_t block[RANK]; + hsize_t i, j; DATATYPE *data_array = NULL, *dataptr; /* data buffer */ MPI_Init(&argc, &argv); @@ -73,8 +74,8 @@ main (int argc, char **argv) ndims = H5Sget_simple_extent_dims(sid, dims, NULL); VRFY((ndims == 2), "H5Sget_simple_extent_dims succeeded"); - VRFY(dims[0] == ROW_FACTOR*mpi_size, "Wrong dataset dimensions"); - VRFY(dims[1] == COL_FACTOR*mpi_size, "Wrong dataset dimensions"); + VRFY(dims[0] == (hsize_t)(ROW_FACTOR*mpi_size), "Wrong dataset dimensions"); + VRFY(dims[1] == (hsize_t)(COL_FACTOR*mpi_size), "Wrong dataset dimensions"); /* allocate memory for data buffer */ data_array = (DATATYPE *)HDmalloc(dims[0]*dims[1]*sizeof(DATATYPE)); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index c12cf5a..34fcc72 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -397,14 +397,9 @@ hs_dr_pio_test__setup(const int test_num, * * JRM -- 9/16/10 */ - if ( express_test == 0 ) { - tv_ptr->chunk_dims[0] = 1; + tv_ptr->chunk_dims[0] = 1; - } else { - - tv_ptr->chunk_dims[0] = 1; - } tv_ptr->chunk_dims[1] = tv_ptr->chunk_dims[2] = tv_ptr->chunk_dims[3] = tv_ptr->chunk_dims[4] = (hsize_t)(tv_ptr->chunk_edge_size); diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index e1a86a1..fe8a618 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -223,7 +223,7 @@ void coll_write_test(int chunk_factor) hsize_t chunk_dims[2]; herr_t ret; - unsigned i; + int i; int fillvalue = 0; /* Fill value for the dataset */ int *matrix_out = NULL; @@ -682,7 +682,7 @@ coll_read_test(void) hsize_t block[2]; /* Block sizes */ herr_t ret; - unsigned i; + int i; int *matrix_out; int *matrix_out1; /* Buffer to read from the dataset */ |