diff options
author | Kimmy Mu <kmu@hdfgroup.org> | 2020-01-29 20:12:18 (GMT) |
---|---|---|
committer | Kimmy Mu <kmu@hdfgroup.org> | 2020-01-29 20:12:18 (GMT) |
commit | 8c60f6264c46cd9155ce34e12e29e9b0272c0c67 (patch) | |
tree | 4ee7db9cfd3ff489825e82a23b6e010245fe4183 /tools | |
parent | 91d29817413e00f1dcd006d13790df6ce7aeb5c0 (diff) | |
parent | 781fa57f6ee816e037dd12fff02d37ff7ec9c2b1 (diff) | |
download | hdf5-8c60f6264c46cd9155ce34e12e29e9b0272c0c67.zip hdf5-8c60f6264c46cd9155ce34e12e29e9b0272c0c67.tar.gz hdf5-8c60f6264c46cd9155ce34e12e29e9b0272c0c67.tar.bz2 |
Merge pull request #2324 in HDFFV/hdf5 from ~KMU/hdf5:hdf5_1_12 to hdf5_1_12
* commit '781fa57f6ee816e037dd12fff02d37ff7ec9c2b1':
pick up missing piece from merge
Merge pull request #2311 in HDFFV/hdf5 from ~KMU/hdf5:misc to develop
remove redundent definition
Merge pull request #2311 in HDFFV/hdf5 from ~KMU/hdf5:misc to develop
Merge pull request #2311 in HDFFV/hdf5 from ~KMU/hdf5:misc to develop
Merge pull request #2315 in HDFFV/hdf5 from ~KMU/hdf5:develop to develop
missing prototype warning
prototype issue
Merge pull request #2306 in HDFFV/hdf5 from ~KMU/hdf5:develop to develop
Merge pull request #2300 in HDFFV/hdf5 from ~KMU/hdf5:squashed_cast to develop
Merge pull request #2291 in HDFFV/hdf5 from ~KMU/hdf5:bugfix/uninitialized to develop
Merge pull request #2295 in HDFFV/hdf5 from ~KMU/hdf5:bugfix/float to develop
Merge pull request #2292 in HDFFV/hdf5 from ~KMU/hdf5:bugfix/prototype to develop
Merge pull request #2094 in HDFFV/hdf5 from ~KMU/hdf5:bugfix/unused to develop
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/h5diff.c | 8 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 6 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 2 | ||||
-rw-r--r-- | tools/src/h5diff/ph5diff_main.c | 2 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump_xml.c | 5 | ||||
-rw-r--r-- | tools/src/h5import/h5import.c | 8 | ||||
-rw-r--r-- | tools/src/h5ls/h5ls.c | 16 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 2 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_parse.c | 2 | ||||
-rw-r--r-- | tools/src/misc/h5clear.c | 2 | ||||
-rw-r--r-- | tools/test/h5copy/h5copygentest.c | 8 | ||||
-rw-r--r-- | tools/test/h5diff/h5diffgentest.c | 16 | ||||
-rw-r--r-- | tools/test/h5dump/h5dumpgentest.c | 233 | ||||
-rw-r--r-- | tools/test/h5repack/h5repackgentest.c | 21 | ||||
-rw-r--r-- | tools/test/h5repack/h5repacktst.c | 12 | ||||
-rw-r--r-- | tools/test/perform/chunk_cache.c | 11 | ||||
-rw-r--r-- | tools/test/perform/iopipe.c | 36 | ||||
-rw-r--r-- | tools/test/perform/perf.c | 34 | ||||
-rw-r--r-- | tools/test/perform/pio_engine.c | 342 | ||||
-rw-r--r-- | tools/test/perform/pio_perf.c | 56 |
20 files changed, 426 insertions, 396 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 8c434ac..86726b4 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1048,7 +1048,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, */ #ifdef H5_HAVE_PARALLEL { - char *workerTasks = (char*)HDmalloc((g_nTasks - 1) * sizeof(char)); + char *workerTasks = (char*)HDmalloc((size_t)(g_nTasks - 1) * sizeof(char)); int n; int busyTasks = 0; struct diffs_found nFoundbyWorker; @@ -1057,7 +1057,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, MPI_Status Status; /*set all tasks as free */ - HDmemset(workerTasks, 1, (g_nTasks - 1)); + HDmemset(workerTasks, 1, (size_t)(g_nTasks - 1) * sizeof(char)); #endif for(i = 0; i < table->nobjs; i++) { @@ -1345,8 +1345,8 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } /* end else */ } /* end while */ - for(i = 1; i < g_nTasks; i++) - MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD); + for(i = 1; (int)i < g_nTasks; i++) + MPI_Send(NULL, 0, MPI_BYTE, (int)i, MPI_TAG_END, MPI_COMM_WORLD); /* Print any final data waiting in our queue */ print_incoming_data(); diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 088e230..6cfe3d2 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -4559,7 +4559,7 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) { return FALSE; } - if (value == expected) + if (H5_DBL_ABS_EQUAL(value, expected)) return TRUE; if (opts->use_system_epsilon) @@ -4603,7 +4603,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts) return FALSE; } - if (value == expected) + if (H5_LDBL_ABS_EQUAL(value, expected)) return TRUE; if (opts->use_system_epsilon) @@ -4645,7 +4645,7 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) { return FALSE; } - if (value == expected) + if (H5_FLT_ABS_EQUAL(value, expected)) return TRUE; if (opts->use_system_epsilon) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index d6d94a6..3cca910 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -3317,7 +3317,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, if (vmaps) { size_t next; - ssize_t ssize_out; + ssize_t H5_ATTR_NDEBUG_UNUSED ssize_out; ctx->indent_level++; for (next = 0; next < (unsigned) vmaps; next++) { diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c index 5ba5fb3..c473c8b 100644 --- a/tools/src/h5diff/ph5diff_main.c +++ b/tools/src/h5diff/ph5diff_main.c @@ -166,7 +166,7 @@ ph5diff_worker(int nID) { struct diff_mpi_args args; struct diffs_found diffs; - int i; + unsigned i; /* Make certain we've received the filenames and opened the files already */ if(file1_id < 0 || file2_id < 0) diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index 7a3ad80..d9f1f67 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -1798,12 +1798,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset, hid_t space = H5I_INVALID_HID; hid_t type = H5I_INVALID_HID; hid_t p_type = H5I_INVALID_HID; - hsize_t size[64]; - hsize_t nelmts = 1; - int ndims; - int i; int status = -1; - void *buf = NULL; hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 81f9a32..00fe7cf 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4725,15 +4725,15 @@ uint32_t swap_uint32(uint32_t val) int32_t swap_int32(int32_t val) { - val = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF); + val = (int32_t)(((uint32_t)(val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF)); return (val << 16) | ((val >> 16) & 0xFFFF); } int64_t swap_int64(int64_t val) { - val = ((val << 8) & 0xFF00FF00FF00FF00ULL) | ((val >> 8) & 0x00FF00FF00FF00FFULL); - val = ((val << 16) & 0xFFFF0000FFFF0000ULL) | ((val >> 16) & 0x0000FFFF0000FFFFULL); - return (val << 32) | ((val >> 32) & 0xFFFFFFFFULL); + val = (int64_t)(((uint64_t)(val << 8) & 0xFF00FF00FF00FF00ULL) | ((uint64_t)(val >> 8) & 0x00FF00FF00FF00FFULL)); + val = (int64_t)(((uint64_t)(val << 16) & 0xFFFF0000FFFF0000ULL) | ((uint64_t)(val >> 16) & 0x0000FFFF0000FFFFULL)); + return (int64_t)((uint64_t)(val << 32) | ((uint64_t)(val >> 32) & 0xFFFFFFFFULL)); } uint64_t swap_uint64(uint64_t val) diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 279a598..f3f9ede 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1302,7 +1302,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx hid_t new_obj_sid = H5I_INVALID_HID; hsize_t elmt_counter = 0; /*counts the # elements printed. */ size_t ncols = 80; /* available output width */ - size_t i; + int i; hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t datactx; /* print context */ @@ -1312,7 +1312,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx datactx = *ctx; /* print context */ /* Assume entire data space to be printed */ if (datactx.ndims > 0) - for (i = 0; i < (size_t)datactx.ndims; i++) + for (i = 0; (unsigned)i < datactx.ndims; i++) datactx.p_min_idx[i] = 0; datactx.need_prefix = TRUE; @@ -1447,13 +1447,13 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx /* Print point information */ H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2"); h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, info, &datactx, - &buffer, &curr_pos, ncols, i, elmt_counter); + &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter); } else if(region_type == H5S_SEL_HYPERSLABS) { /* Print block information */ H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, info, &datactx, - &buffer, &curr_pos, ncols, i, elmt_counter); + &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter); } else H5TOOLS_INFO("invalid region type"); @@ -1656,7 +1656,7 @@ dump_dataset_values(hid_t dset) init_acc_pos(&ctx, total_size); ctx.need_prefix = TRUE; - if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), ndims))) { + if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) { H5TOOLS_DEBUG("H5Dread reference read"); if(H5Dread(dset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf) < 0) { HDfree(ref_buf); @@ -1695,7 +1695,7 @@ done: *------------------------------------------------------------------------- */ static void -dump_attribute_values(hid_t attr, const char *attr_name) +dump_attribute_values(hid_t attr) { hid_t f_type = H5I_INVALID_HID; hid_t space = H5I_INVALID_HID; @@ -1827,7 +1827,7 @@ dump_attribute_values(hid_t attr, const char *attr_name) init_acc_pos(&ctx, total_size); ctx.need_prefix = TRUE; - if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), ndims))) { + if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) { H5TOOLS_DEBUG("H5Aread reference read"); if(H5Aread(attr, H5T_STD_REF, ref_buf) < 0) { HDfree(ref_buf); @@ -1955,7 +1955,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain h5tools_str_close(&buffer); if (data_g) - dump_attribute_values(attr, attr_name); + dump_attribute_values(attr); H5Aclose(attr); } else { diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index df8c7ef..ea6b0e1 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -280,7 +280,7 @@ int read_info(const char *filename, pack_opt_t *options) char comp_info[1024]; FILE *fp = NULL; char c; - int i, rc = 1; + int i; int ret_value = EXIT_SUCCESS; if (NULL == (fp = HDfopen(filename, "r"))) { diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index 03fcf0e..95cacc1 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/h5repack/h5repack_parse.c @@ -228,7 +228,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, l = 0; } else if (f == -1) { - filt->filt_flag = HDstrtoul(stype, NULL, 0); + filt->filt_flag = (unsigned)HDstrtoul(stype, NULL, 0); f = 0; } else if (p == -1) { diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index 927167b..38fa6a2 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -175,7 +175,7 @@ parse_command_line(int argc, const char **argv) usage(h5tools_getprogname()); goto done; } - increment = HDatoi(opt_arg); + increment = (hsize_t)HDatoi(opt_arg); } break; diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c index 716b0d2..2a8a575 100644 --- a/tools/test/h5copy/h5copygentest.c +++ b/tools/test/h5copy/h5copygentest.c @@ -744,9 +744,9 @@ static void Test_Obj_Copy(void) /* Set the FAPL for the type of format */ /* Create source file */ if(new_format) - fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new); - else - fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new); + else + fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if(fid < 0) { HDfprintf(stderr, "Error: H5Fcreate failed.\n"); goto out; @@ -756,7 +756,7 @@ static void Test_Obj_Copy(void) gent_empty_group(fid); gent_nested_datasets(fid); gent_nested_group(fid); - gent_att_compound_vlstr(fid); + gent_att_compound_vlstr(fid); H5Fclose(fid); fid = (-1); diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 05bad77..98001ff 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -4227,7 +4227,7 @@ static void test_comps_array(const char *fname, const char *dset, const char *at hsize_t sdims_dset[] = { SDIM_DSET }; hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; int i, j; - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for (i = 0; i < SDIM_DSET; i++) { @@ -4336,7 +4336,7 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at hsize_t sdims_dset[] = { SDIM_DSET }; unsigned i, j; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for (i = 0; i < SDIM_DSET; i++) { @@ -4454,7 +4454,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch hsize_t sdims_dset[] = { SDIM_DSET }; hsize_t sdims_arry[] = { SDIM_CMPD_ARRAY }; unsigned i, j, k; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write in compound1 */ for (i = 0; i < SDIM_DSET; i++) { @@ -4597,7 +4597,7 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; unsigned i, j, k; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for (i = 0; i < SDIM_DSET; i++) { @@ -5214,7 +5214,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make hid_t aid = H5I_INVALID_HID; hid_t sid = H5I_INVALID_HID; hid_t tid = H5I_INVALID_HID; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, l, n; float f; @@ -6205,7 +6205,7 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff hid_t aid = H5I_INVALID_HID; hid_t sid = H5I_INVALID_HID; hid_t tid = H5I_INVALID_HID; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, l, n; float f; @@ -7197,7 +7197,7 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff hid_t sid = H5I_INVALID_HID; hid_t tid = H5I_INVALID_HID; hid_t dcpl = H5I_INVALID_HID; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, l, n; float f; int fillvalue = 2; @@ -7832,7 +7832,7 @@ void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) hsize_t start[10]; /* starting location of hyperslab */ hsize_t count[10]; /* element count of hyperslab */ hsize_t coord[5][2]; /* coordinates for point selection */ - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; int i; /* allocate the buffer for write the references */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index a686660..026ab20 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -1554,7 +1554,7 @@ gent_many(void) dset1_t dset1[6]; hsize_t dim[4]; - herr_t ret; + herr_t H5_ATTR_NDEBUG_UNUSED ret; fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2603,7 +2603,7 @@ static void gent_vldatatypes(void) hid_t file, dset, space, type; hsize_t dims[] = { SPACE1_DIM1 }; int i; - herr_t ret=0; + herr_t H5_ATTR_NDEBUG_UNUSED ret=0; file = H5Fcreate(FILE21, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2698,7 +2698,7 @@ gent_vldatatypes2(void) hid_t tid1, tid2; /* Datatype IDs */ hsize_t dims1[] = {SPACE1_DIM1}; unsigned i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for(i = 0; i < SPACE1_DIM1; i++) { @@ -2771,7 +2771,7 @@ static void gent_vldatatypes3(void) hid_t tid1, tid2; /* Datatype IDs */ hsize_t dims1[] = {SPACE1_DIM1}; unsigned i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { @@ -2840,7 +2840,7 @@ static void gent_vldatatypes4(void) hid_t tid1, tid2; /* Datatype IDs */ hsize_t dims1[] = {SPACE1_DIM1}; unsigned i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { @@ -2897,14 +2897,14 @@ static void gent_vldatatypes4(void) /* Generate a variable-length dataset with NULL values in it */ static void gent_vldatatypes5(void) { - hvl_t wdata [SPACE1_DIM1]; - hid_t fid1; - hid_t dataset; - hid_t sid1; - hid_t tid1; - hsize_t dims1[] = {SPACE1_DIM1}; - int i,j; /* counting variable */ - herr_t ret; /* Generic return value */ + hvl_t wdata [SPACE1_DIM1]; + hid_t fid1; + hid_t dataset; + hid_t sid1; + hid_t tid1; + hsize_t dims1[] = {SPACE1_DIM1}; + int i,j; /* counting variable */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* initialize data for dataset */ for(i=0; i<SPACE1_DIM1; i++) { @@ -2966,16 +2966,15 @@ static void gent_vldatatypes5(void) static void gent_array1_big(void) { - int *wdata; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Datatype ID */ - hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM}; - hsize_t tdims1[] = {ARRAY1BIG_DIM}; - int i,j; /* counting variables */ - herr_t ret; /* Generic return value */ - + int *wdata; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM}; + hsize_t tdims1[] = {ARRAY1BIG_DIM}; + int i,j; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* for region reference dataset */ hid_t dset2; @@ -3101,15 +3100,15 @@ static void gent_array1(void) static void gent_array2(void) { - int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */ - hid_t fid; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3}; - int i,j,k,l; /* counting variables */ - herr_t ret; /* Generic return value */ + int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */ + hid_t fid; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3}; + int i,j,k,l; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3147,17 +3146,17 @@ static void gent_array2(void) static void gent_array3(void) { - int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */ - hid_t fid; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid1; /* 1-D array Datatype ID */ - hid_t tid2; /* 2-D array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2}; - int i,j,k,l; /* counting variables */ - herr_t ret; /* Generic return value */ + int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */ + hid_t fid; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid1; /* 1-D array Datatype ID */ + hid_t tid2; /* 2-D array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2}; + int i,j,k,l; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3204,16 +3203,16 @@ static void gent_array4(void) int i; float f; } s2_t; - s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Compound Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Compound Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int i,j; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3270,17 +3269,17 @@ static void gent_array5(void) int i; float f[ARRAY1_DIM1]; } s2_t; - s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Compound Datatype ID */ - hid_t tid3; /* Nested Array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Compound Datatype ID */ + hid_t tid3; /* Nested Array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int i,j,k; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3341,16 +3340,16 @@ static void gent_array5(void) static void gent_array6(void) { - hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* VL Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* VL Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int i,j,k; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3401,17 +3400,17 @@ static void gent_array6(void) static void gent_array7(void) { - hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* VL Datatype ID */ - hid_t tid3; /* Nested Array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int i,j,k,l; /* Index variables */ - herr_t ret; /* Generic return value */ + hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* VL Datatype ID */ + hid_t tid3; /* Nested Array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int i,j,k,l; /* Index variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3475,7 +3474,7 @@ static void gent_array8(void) hid_t filetype = H5I_INVALID_HID; /* Handles */ hid_t space = H5I_INVALID_HID; /* Handles */ hid_t dset = H5I_INVALID_HID; /* Handles */ - herr_t status = -1; + herr_t H5_ATTR_NDEBUG_UNUSED status = -1; hsize_t sdims[] = {F64_DIM0}; hsize_t tdims[] = {F64_DIM1}; int *wdata; /* Write buffer */ @@ -3542,7 +3541,7 @@ static void gent_empty(void) } empty_struct; hid_t file, dset, space, type; hsize_t dims[] = { SPACE1_DIM1 }; - herr_t ret=0; + herr_t H5_ATTR_NDEBUG_UNUSED ret=0; file = H5Fcreate(FILE32, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -3930,7 +3929,7 @@ static void write_attr_in(hid_t loc_id, hid_t aid; hid_t sid; hid_t tid; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, n; float f; @@ -4371,7 +4370,7 @@ static void write_dset_in(hid_t loc_id, hid_t sid; hid_t tid; hid_t plist_id; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, n; float f; int fillvalue=2; @@ -4809,7 +4808,7 @@ static void gent_attr_all(void) hid_t root_id; hid_t sid; hsize_t dims[1] = {2}; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Create a file and a dataset */ fid = H5Fcreate(FILE40, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -4967,7 +4966,7 @@ static void gent_compound_complex(void) hid_t array4_tid; /* Array datatype handle */ hid_t datafile, dataset; /* Datafile/dataset handles */ hid_t dataspace; /* Dataspace handle */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = {F41_LENGTH}; /* Dataspace dimensions */ hsize_t array_dimb[] = {F41_DIMb}; /* Array dimensions */ hsize_t array_dimd[]={F41_ARRAY_DIMd1,F41_ARRAY_DIMd2}; /* Array dimensions */ @@ -5116,7 +5115,7 @@ static void gent_named_dtype_attr(void) hid_t aid; hid_t gid; int data=8; - herr_t ret; + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Create a file */ fid=H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -5338,7 +5337,7 @@ make_external(hid_t fid) hsize_t cur_size[1]; /*data space current size */ hsize_t max_size[1]; /*data space maximum size */ hsize_t size; /*bytes reserved for data in the external file*/ - int ret; + int H5_ATTR_NDEBUG_UNUSED ret; cur_size[0] = max_size[0] = 100; size = (max_size[0]*sizeof(int)/2); @@ -5386,7 +5385,8 @@ static void gent_filters(void) hsize_t dims1[RANK] = {DIM1,DIM2}; hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; int buf1[DIM1][DIM2]; - int i, j, n, ret; + int i, j, n; + int H5_ATTR_NDEBUG_UNUSED ret; for(i=n=0; i<DIM1; i++){ for(j=0; j<DIM2; j++){ @@ -5732,8 +5732,7 @@ static void gent_fcontents(void) hid_t tid; /* datatype ID */ hsize_t dims[1]={4}; int buf[4]={1,2,3,4}; - int ret; - + int H5_ATTR_NDEBUG_UNUSED ret; /* create a file */ fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -5866,7 +5865,7 @@ static void gent_fvalues(void) hvl_t fillval3; /* vlen fill value */ hsize_t dimarray[1]={3}; /* array dimension */ int buf4[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int ret; + int H5_ATTR_NDEBUG_UNUSED ret; /* create a file */ fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -6024,9 +6023,9 @@ static void gent_string(void) c_t buf3 = {24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; char buf4[] = {"Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; hsize_t dims1[] = {1}; - hsize_t dims2[] = {SPACE1_DIM1}; - hsize_t dims4[1]; - int ret; + hsize_t dims2[] = {SPACE1_DIM1}; + hsize_t dims4[1]; + int H5_ATTR_NDEBUG_UNUSED ret; dims4[0] = sizeof(buf4); @@ -6121,7 +6120,8 @@ static void gent_aindices(void) int buf2[10][10]; int buf3[2][10][10]; int buf4[2][2][10][10]; - int i, j, k, l, n, ret; + int i, j, k, l, n; + int H5_ATTR_NDEBUG_UNUSED ret; for(i = n = 0; i < 100; i++) buf1[i] = n++; @@ -6188,11 +6188,11 @@ static void gent_aindices(void) */ static void gent_longlinks(void) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ - char *objname = NULL; /* Name of object [Long] */ - size_t u; /* Local index variable */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t H5_ATTR_NDEBUG_UNUSED gid2 = (-1); /* Datatype ID */ + char *objname = NULL; /* Name of object [Long] */ + size_t u; /* Local index variable */ /* Create files */ fid = H5Fcreate(FILE51, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -6369,7 +6369,7 @@ gent_bigdims(void) hsize_t i; char c; size_t nelmts; - int ret; + int H5_ATTR_NDEBUG_UNUSED ret; /* create a file */ fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -6465,7 +6465,8 @@ gent_hyperslab(void) hid_t fid; /* file id */ hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */ double *buf; - int i, ret; + int i; + int H5_ATTR_NDEBUG_UNUSED ret; buf = (double*) HDmalloc(32 * 4097 * sizeof(double) ); for(i = 0; i < 32 * 4097; i++) @@ -7091,7 +7092,8 @@ gent_dataset_idx(void) hsize_t dims[2]; hsize_t maxdims[2]; int buf[20][10]; - int i, j, ret; + int i, j; + int H5_ATTR_NDEBUG_UNUSED ret; /* Get a copy of the file aaccess property */ fapl = H5Pcreate(H5P_FILE_ACCESS); @@ -7615,7 +7617,7 @@ static void gent_charsets(void) { hid_t fid, did, sid; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; hsize_t dim[] = {1}; /* Dataspace dimensions */ typedef struct CharSetInfo { const char *ascii_p_; @@ -7689,7 +7691,7 @@ static void gent_compound_intsizes(void) { Array1Struct *Array1; hid_t Array1Structid; /* File datatype identifier */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */ int m, n, o; /* Array init loop vars */ @@ -7962,7 +7964,7 @@ static void gent_compound_attr_intsizes(void) { Array1Struct Array1[F70_LENGTH]; hid_t Array1Structid; /* File datatype identifier */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */ int m, n, o; /* Array init loop vars */ @@ -8838,7 +8840,7 @@ static void gent_compound_int_array(void) { Cmpd1Struct *Cmpd1; hid_t Cmpd1Structid; /* File datatype identifier */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = { F76_LENGTH }; /* Dataspace dimensions */ int m, n; /* Array init loop vars */ @@ -9094,7 +9096,7 @@ static void gent_compound_ints(void) { hid_t Cmpd1Structid; /* File datatype identifier */ hid_t Cmpd2Structid; /* File datatype identifier */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = { F77_LENGTH }; /* Dataspace dimensions */ int m; /* Array init loop vars */ @@ -10396,7 +10398,8 @@ static void gent_udfilter(void) hsize_t dims1[RANK] = {DIM1,DIM2}; hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; int buf1[DIM1][DIM2]; - int i, j, n, ret; + int i, j, n; + int H5_ATTR_NDEBUG_UNUSED ret; for(i=n=0; i<DIM1; i++){ for(j=0; j<DIM2; j++){ diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 77fb28a..7604964 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -147,7 +147,7 @@ __make_file(const char *basename, struct external_def *ext, H5REPACKGENTEST_OOPS; } - space_id = H5Screate_simple(rank, dims, NULL); + space_id = H5Screate_simple((int)rank, dims, NULL); if (space_id == H5I_INVALID_HID) H5REPACKGENTEST_OOPS; @@ -231,9 +231,9 @@ generate_int32le_3d(hbool_t external) { /* generate values, alternating positive and negative */ - for (i = 0, n = 0; i < dims[0]; i++) { - for (j = 0; j < dims[1]; j++) { - for (k = 0; k < dims[2]; k++, n++) { + for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) { + for (j = 0; (hsize_t)j < dims[1]; j++) { + for (k = 0; (hsize_t)k < dims[2]; k++, n++) { wdata[n] = (k + j * 512 + i * 4096) * ((n & 1) ? (-1) : (1)); } } @@ -263,9 +263,9 @@ generate_uint8be(hbool_t external) { /* Generate values, ping-pong from ends of range */ - for (i = 0, n = 0; i < dims[0]; i++) { - for (j = 0; j < dims[1]; j++) { - for (k = 0; k < dims[2]; k++, n++) { + for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) { + for (j = 0; (hsize_t)j < dims[1]; j++) { + for (k = 0; (hsize_t)k < dims[2]; k++, n++) { wdata[n] = (uint8_t)((n & 1) ? -n : n); } } @@ -294,9 +294,9 @@ generate_f32le(hbool_t external) { int ret_value = 0; /* Generate values */ - for (i = 0, k = 0, n = 0; i < dims[0]; i++) { - for (j = 0; j < dims[1]; j++, k++, n++) { - wdata[k] = (float)(n * 801.1 * ((k % 5 == 1) ? (-1) : (1))); + for (i = 0, k = 0, n = 0; (hsize_t)i < dims[0]; i++) { + for (j = 0; (hsize_t)j < dims[1]; j++, k++, n++) { + wdata[k] = n * 801.1f * ((k % 5 == 1) ? (-1) : (1)); } } @@ -314,7 +314,6 @@ generate_f32le(hbool_t external) { int main(void) { int i = 0; - int ret_value = 0; for (i = 0; i < 2; i++) { hbool_t external = (i & 1) ? TRUE : FALSE; diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index f32e87c..2654685 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3684,10 +3684,10 @@ make_userblock(void) { hid_t fid = H5I_INVALID_HID; hid_t fcpl = H5I_INVALID_HID; - int fd = -1; /* File descriptor for writing userblock */ - char ub[USERBLOCK_SIZE]; /* User block data */ - ssize_t nwritten; /* # of bytes written */ - size_t u; /* Local index variable */ + int fd = -1; /* File descriptor for writing userblock */ + char ub[USERBLOCK_SIZE]; /* User block data */ + ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */ + size_t u; /* Local index variable */ /* Create file creation property list with userblock set */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) @@ -3749,7 +3749,7 @@ verify_userblock( const char* filename) int fd = -1; /* File descriptor for writing userblock */ char ub[USERBLOCK_SIZE]; /* User block data */ hsize_t ub_size = 0; /* User block size */ - ssize_t nread; /* # of bytes read */ + ssize_t H5_ATTR_NDEBUG_UNUSED nread; /* # of bytes read */ size_t u; /* Local index variable */ /* Open file with userblock */ @@ -3816,7 +3816,7 @@ make_userblock_file(void) { int fd = -1; /* File descriptor for writing userblock */ char ub[USERBLOCK_SIZE]; /* User block data */ - ssize_t nwritten; /* # of bytes written */ + ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */ size_t u; /* Local index variable */ /* initialize userblock data */ diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 1d2e791..5557558 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -247,7 +247,8 @@ static int check_partial_chunks_perf(hid_t file) dataset = H5Dopen2 (file, DSET1_NAME, dapl); - memspace = H5Screate_simple(row_rank, row_dim, NULL); + H5_CHECK_OVERFLOW(row_rank, hsize_t, int); + memspace = H5Screate_simple((int)row_rank, row_dim, NULL); filespace = H5Dget_space(dataset); nbytes_global = 0; @@ -256,7 +257,7 @@ static int check_partial_chunks_perf(hid_t file) /* Read the data row by row */ for(i = 0; i < DSET1_DIM1; i++) { - start[0] = i; + start[0] = (hsize_t)i; if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) goto error; @@ -318,7 +319,9 @@ static int check_hash_value_perf(hid_t file) if((dataset = H5Dopen2 (file, DSET2_NAME, dapl)) < 0) goto error; - if((memspace = H5Screate_simple(column_rank, column_dim, NULL)) < 0) + + H5_CHECK_OVERFLOW(column_rank, hsize_t, int); + if((memspace = H5Screate_simple((int)column_rank, column_dim, NULL)) < 0) goto error; if((filespace = H5Dget_space(dataset)) < 0) goto error; @@ -329,7 +332,7 @@ static int check_hash_value_perf(hid_t file) /* Read the data column by column */ for(i = 0; i < DSET2_DIM2; i++) { - start[1] = i; + start[1] = (hsize_t)i; if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, count, NULL) < 0) goto error; diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index 57c0d52..bf4728d 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -133,7 +133,7 @@ synchronize (void) #if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__) _flushall(); #else - int status; + int H5_ATTR_NDEBUG_UNUSED status; status = HDsystem("sync"); HDassert(status >= 0); @@ -169,7 +169,6 @@ main (void) unsigned char *the_data = NULL; hid_t file, dset, file_space = H5I_INVALID_HID; - herr_t status; #ifdef H5_HAVE_GETRUSAGE struct rusage r_start, r_stop; #else @@ -178,8 +177,9 @@ main (void) struct timeval t_start, t_stop; int fd; unsigned u; - hssize_t n; - off_t offset; + herr_t H5_ATTR_NDEBUG_UNUSED status; + hssize_t H5_ATTR_NDEBUG_UNUSED n; + off_t H5_ATTR_NDEBUG_UNUSED offset; hsize_t start[2]; hsize_t count[2]; @@ -198,15 +198,15 @@ main (void) /* Open the files */ file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert (file>=0); + HDassert (file>=0); fd = HDopen (RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666); - assert (fd>=0); + HDassert (fd>=0); /* Create the dataset */ file_space = H5Screate_simple (2, size, size); - assert(file_space >= 0); + HDassert(file_space >= 0); dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(dset >= 0); + HDassert(dset >= 0); the_data = (unsigned char *)malloc((size_t)(size[0] * size[1])); /* initial fill for lazy malloc */ @@ -268,7 +268,7 @@ main (void) HDfflush(stderr); status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data); - assert (status>=0); + HDassert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -306,9 +306,9 @@ main (void) putc (PROGRESS, stderr); HDfflush(stderr); offset = HDlseek (fd, (off_t)0, SEEK_SET); - assert (0==offset); + HDassert (0==offset); n = HDwrite (fd, the_data, (size_t)(size[0]*size[1])); - assert (n>=0 && (size_t)n==size[0]*size[1]); + HDassert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -347,7 +347,7 @@ main (void) HDfflush(stderr); status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, the_data); - assert (status>=0); + HDassert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -385,9 +385,9 @@ main (void) putc (PROGRESS, stderr); HDfflush(stderr); offset = HDlseek (fd, (off_t)0, SEEK_SET); - assert (0==offset); + HDassert (0==offset); n = HDread (fd, the_data, (size_t)(size[0]*size[1])); - assert (n>=0 && (size_t)n==size[0]*size[1]); + HDassert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -427,7 +427,7 @@ main (void) HDfflush(stderr); status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data); - assert (status>=0); + HDassert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -449,11 +449,11 @@ main (void) (size_t)(nread*size[0]*size[1])); /* Read hyperslab */ - assert (size[0]>20 && size[1]>20); + HDassert (size[0]>20 && size[1]>20); start[0] = start[1] = 10; count[0] = count[1] = size[0]-20; status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL); - assert (status>=0); + HDassert (status>=0); synchronize (); #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_start); @@ -471,7 +471,7 @@ main (void) HDfflush(stderr); status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data); - assert (status>=0); + HDassert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index 34b8a2d..364836f 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -110,15 +110,15 @@ const char *FILENAME[] = { /* function prototypes */ static int parse_args(int argc, char **argv); -extern int errno; - +#ifndef H5_HAVE_UNISTD_H /* globals needed for getopt */ extern char *optarg; +#endif int main(int argc, char **argv) { - char *buf, *tmp, *buf2, *tmp2, *check; - int i, j, mynod=0, nprocs=1, err, my_correct = 1, correct, myerrno; + char *buf, *tmp, *buf2 = NULL, *tmp2 = NULL, *check; + int i, j, mynod=0, nprocs=1, my_correct = 1, correct, myerrno; double stim, etim; double write_tim = 0; double read_tim = 0; @@ -127,10 +127,6 @@ int main(int argc, char **argv) double min_read_tim, min_write_tim; double ave_read_tim, ave_write_tim; int64_t iter_jump = 0; - int64_t seek_position = 0; - MPI_File fh; - MPI_Status status; - int nchars; char filename[MAX_PATH]; herr_t ret; /* Generic return value */ @@ -164,7 +160,7 @@ int main(int argc, char **argv) iter_jump = nprocs * opt_block; /* setup a buffer of data to write */ - if (!(tmp = (char *) malloc(opt_block + 256))) { + if (!(tmp = (char *) malloc((size_t)opt_block + 256))) { perror("malloc"); goto die_jar_jar_die; } @@ -172,7 +168,7 @@ int main(int argc, char **argv) if (opt_correct) { /* do the same buffer setup for verifiable data */ - if (!(tmp2 = (char *) malloc(opt_block + 256))) { + if (!(tmp2 = (char *) malloc((size_t)opt_block + 256))) { perror("malloc2"); goto die_jar_jar_die; } @@ -222,7 +218,7 @@ int main(int argc, char **argv) VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL); /* define a contiquous dataset of opt_iter*nprocs*opt_block chars */ - dims[0] = opt_iter * nprocs * opt_block; + dims[0] = (hsize_t)opt_iter * (hsize_t)nprocs * (hsize_t)opt_block; sid = H5Screate_simple(RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL); dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid, @@ -230,7 +226,7 @@ int main(int argc, char **argv) VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL); /* create the memory dataspace and the file dataspace */ - dims[0] = opt_block; + dims[0] = (hsize_t)opt_block; mem_dataspace = H5Screate_simple(RANK, dims, NULL); VRFY((mem_dataspace >= 0), "", H5FATAL); file_dataspace = H5Dget_space(dataset); @@ -242,7 +238,7 @@ int main(int argc, char **argv) for(j=0; j < opt_iter; j++) { /* setup a file dataspace selection */ start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); - stride[0] = block[0] = opt_block; + stride[0] = block[0] = (hsize_t)opt_block; count[0]= 1; ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); @@ -295,7 +291,7 @@ int main(int argc, char **argv) for (j=0; j < opt_iter; j++) { /* setup a file dataspace selection */ start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); - stride[0] = block[0] = opt_block; + stride[0] = block[0] = (hsize_t)opt_block; count[0]= 1; ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL); @@ -326,7 +322,7 @@ int main(int argc, char **argv) /* if the user wanted to check correctness, compare the write * buffer to the read buffer */ - if (opt_correct && memcmp(buf, buf2, opt_block)) { + if (opt_correct && memcmp(buf, buf2, (size_t)opt_block)) { HDfprintf(stderr, "node %d, correctness test failed\n", mynod); my_correct = 0; MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, @@ -367,8 +363,8 @@ int main(int argc, char **argv) /* print out the results on one node */ if (mynod == 0) { - read_bw = ((int64_t)(opt_block*nprocs*opt_iter))/(max_read_tim*1000000.0); - write_bw = ((int64_t)(opt_block*nprocs*opt_iter))/(max_write_tim*1000000.0); + read_bw = (double)((int64_t)(opt_block*nprocs*opt_iter))/(max_read_tim*1000000.0); + write_bw = (double)((int64_t)(opt_block*nprocs*opt_iter))/(max_write_tim*1000000.0); printf("nr_procs = %d, nr_iter = %d, blk_sz = %ld\n", nprocs, opt_iter, (long)opt_block); @@ -439,9 +435,9 @@ parse_args(int argc, char **argv) { char *p; - opt_alignment = HDatoi(optarg); + opt_alignment = (hsize_t)HDatoi(optarg); if(NULL != (p = (char*)HDstrchr(optarg, '/'))) - opt_threshold = HDatoi(p + 1); + opt_threshold = (hsize_t)HDatoi(p + 1); } HDfprintf(stdout, "alignment/threshold=%Hu/%Hu\n", diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index d000f60..3863550 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -54,24 +54,15 @@ /* sizes of various items. these sizes won't change during program execution */ /* The following three must have the same type */ -#define ELMT_SIZE (sizeof(unsigned char)) /* we're doing bytes */ -#define ELMT_MPI_TYPE MPI_BYTE #define ELMT_H5_TYPE H5T_NATIVE_UCHAR #define GOTOERROR(errcode) { ret_code = errcode; goto done; } -#define GOTODONE { goto done; } #define ERRMSG(mesg) { \ HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ } -#define MSG(mesg) { \ - HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ - HDfprintf(stderr, "(%s) at line %4d in %s\n", \ - mesg, (int)__LINE__, __FILE__); \ -} - /* verify: if val is false (0), print mesg. */ #define VRFY(val, mesg) do { \ if (!val) { \ @@ -260,7 +251,7 @@ do_pio(parameters param) } if (!param.dim2d){ - if(((snbytes/pio_mpi_nprocs_g)%buf_size)!=0) { + if(((size_t)(snbytes/pio_mpi_nprocs_g)%buf_size)!=0) { HDfprintf(stderr, "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " "trasfer buffer size (%zu)\n", @@ -269,7 +260,7 @@ do_pio(parameters param) } } else { - if((snbytes%buf_size)!=0) { + if(((size_t)snbytes%buf_size)!=0) { HDfprintf(stderr, "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the " "trasfer buffer size (%zu)\n", @@ -371,15 +362,17 @@ done: switch (iot) { case POSIXIO: if (fd.posixfd != -1) - hrc = do_fclose(iot, &fd); + hrc = do_fclose(iot, &fd); break; case MPIO: if (fd.mpifd != MPI_FILE_NULL) - hrc = do_fclose(iot, &fd); + hrc = do_fclose(iot, &fd); break; case PHDF5: if (fd.h5fd != -1) - hrc = do_fclose(iot, &fd); + hrc = do_fclose(iot, &fd); + break; + default: break; } @@ -422,6 +415,8 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si case PHDF5: suffix = ".h5"; break; + default: + break; } /* First use the environment variable and then try the constant */ @@ -589,7 +584,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end if */ /* Interleaved Pattern: */ else { - bytes_begin[0] = (off_t)(blk_size*pio_mpi_rank_g); + bytes_begin[0] = (off_t)(blk_size*(size_t)pio_mpi_rank_g); } /* end else */ /* Prepare buffer for verifying data */ @@ -613,9 +608,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, bytes_begin[0] = 0; if(!parms->h5_use_chunks || parms->io_type==PHDF5) - bytes_begin[1] = (off_t)(blk_size*pio_mpi_rank_g); + bytes_begin[1] = (off_t)(blk_size*(size_t)pio_mpi_rank_g); else - bytes_begin[1] = (off_t)(blk_size*blk_size*pio_mpi_rank_g); + bytes_begin[1] = (off_t)(blk_size*blk_size*(size_t)pio_mpi_rank_g); } /* end else */ /* Prepare buffer for verifying data */ @@ -693,7 +688,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT"); /* Build contiguous file's derived type */ - mrc = MPI_Type_vector((int)blk_size, (int)1, (int)(snbytes/buf_size), + mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes/buf_size), mpi_partial_buffer_cont, &mpi_cont_type); VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE"); @@ -711,7 +706,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT"); /* Build interleaved file's derived type */ - mrc = MPI_Type_vector((int)buf_size, (int)1, (int)(snbytes/blk_size), + mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes/blk_size), mpi_partial_buffer_inter, &mpi_inter_type); VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE"); @@ -738,7 +733,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT"); /* Build chunk interleaved file's derived type */ - mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)(snbytes/blk_size), + mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)((size_t)snbytes/blk_size), mpi_full_chunk, &mpi_chunk_inter_type); VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE"); @@ -754,22 +749,22 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, if (!parms->dim2d){ if(nbytes>0) { /* define a contiguous dataset of nbytes native bytes */ - h5dims[0] = nbytes; + h5dims[0] = (hsize_t)nbytes; h5dset_space_id = H5Screate_simple(1, h5dims, NULL); VRFY((h5dset_space_id >= 0), "H5Screate_simple"); /* Set up the file dset space id to select the pattern to access */ if (!parms->interleaved){ /* Contiguous pattern */ - h5start[0] = bytes_begin[0]; + h5start[0] = (hsize_t)bytes_begin[0]; h5stride[0] = h5block[0] = blk_size; h5count[0] = buf_size/blk_size; } /* end if */ else { /* Interleaved access pattern */ /* Skip offset over blocks of other processes */ - h5start[0] = bytes_begin[0]; - h5stride[0] = blk_size*pio_mpi_nprocs_g; + h5start[0] = (hsize_t)bytes_begin[0]; + h5stride[0] = blk_size*(size_t)pio_mpi_nprocs_g; h5block[0] = blk_size; h5count[0] = buf_size/blk_size; } /* end else */ @@ -797,16 +792,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, else { if(nbytes>0) { /* define a contiguous dataset of nbytes native bytes */ - h5dims[0] = snbytes; - h5dims[1] = snbytes; + h5dims[0] = (hsize_t)snbytes; + h5dims[1] = (hsize_t)snbytes; h5dset_space_id = H5Screate_simple(2, h5dims, NULL); VRFY((h5dset_space_id >= 0), "H5Screate_simple"); /* Set up the file dset space id to select the pattern to access */ if (!parms->interleaved){ /* Contiguous pattern */ - h5start[0] = bytes_begin[0]; - h5start[1] = bytes_begin[1]; + h5start[0] = (hsize_t)bytes_begin[0]; + h5start[1] = (hsize_t)bytes_begin[1]; h5stride[0] = 1; h5stride[1] = h5block[0] = h5block[1] = blk_size; h5count[0] = 1; @@ -815,10 +810,10 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, else { /* Interleaved access pattern */ /* Skip offset over blocks of other processes */ - h5start[0] = bytes_begin[0]; - h5start[1] = bytes_begin[1]; + h5start[0] = (hsize_t)bytes_begin[0]; + h5start[1] = (hsize_t)bytes_begin[1]; h5stride[0] = blk_size; - h5stride[1] = blk_size*pio_mpi_nprocs_g; + h5stride[1] = blk_size*(size_t)pio_mpi_nprocs_g; h5block[0] = h5block[1] = blk_size; h5count[0] = buf_size/blk_size; h5count[1] = 1; @@ -866,6 +861,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end if */ } /* end if */ break; + + default: + break; } /* end switch */ for (ndset = 1; ndset <= ndsets; ++ndset) { @@ -929,6 +927,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, GOTOERROR(FAIL); } break; + + default: + break; } /* The task is to transfer bytes_count bytes, starting at @@ -982,7 +983,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((rc != 0), "POSIXWRITE"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size; + nbytes_xfer+=(ssize_t)buf_size; } /* end if */ /* Interleaved access pattern */ else { @@ -1011,7 +1012,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, buf_p+=blk_size; /* Advance global offset in dataset */ - nbytes_xfer+=blk_size; + nbytes_xfer+=(ssize_t)blk_size; /* Decrement number of bytes left this time */ nbytes_toxfer-=blk_size; @@ -1025,8 +1026,8 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* Contiguous access pattern */ if (!parms->interleaved) { /* Compute file offset */ - file_offset=posix_file_offset+(off_t)(((nbytes_xfer/blk_size) - /snbytes)*(blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes)); + file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/blk_size) + /(size_t)snbytes)*(blk_size*(size_t)snbytes)+(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes)); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = buf_size; @@ -1037,9 +1038,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* Interleaved access pattern */ else { /* Compute file offset */ - file_offset=posix_file_offset+(off_t)((((nbytes_xfer/buf_size) - *pio_mpi_nprocs_g)/snbytes)*(buf_size*snbytes) - +((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes); + file_offset=posix_file_offset+(off_t)(((((size_t)nbytes_xfer/buf_size) + *(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*(buf_size*(size_t)snbytes) + +(((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = blk_size; @@ -1070,16 +1071,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size)) *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */ - file_offset=posix_file_offset+(off_t)(((nbytes_xfer/(buf_size/blk_size) - *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)+((nbytes_xfer/(buf_size/blk_size)) - *pio_mpi_nprocs_g)%(snbytes*blk_size)); + file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/(buf_size/blk_size) + *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes)+(((size_t)nbytes_xfer/(buf_size/blk_size)) + *(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size)); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = blk_size * blk_size; /* Global offset advance after each I/O operation */ /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */ - file_offset_advance = (off_t)(snbytes*blk_size); + file_offset_advance = (off_t)snbytes*(off_t)blk_size; } /* end else */ } /* end else */ @@ -1106,7 +1107,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, buf_p+=nbytes_xfer_advance; /* Advance global offset in dataset */ - nbytes_xfer+=nbytes_xfer_advance; + nbytes_xfer+=(ssize_t)nbytes_xfer_advance; /* Decrement number of bytes left this time */ nbytes_toxfer-=nbytes_xfer_advance; @@ -1137,7 +1138,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size; + nbytes_xfer+=(ssize_t)buf_size; } /* end if */ /* Interleaved access pattern */ else { @@ -1162,7 +1163,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, buf_p+=blk_size; /* Advance global offset in dataset */ - nbytes_xfer+=blk_size; + nbytes_xfer+=(ssize_t)blk_size; /* Decrement number of bytes left this time */ nbytes_toxfer-=blk_size; @@ -1183,7 +1184,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size; + nbytes_xfer+=(ssize_t)buf_size; } /* end if */ /* Interleaved access pattern */ else { @@ -1202,7 +1203,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size; + nbytes_xfer+=(ssize_t)buf_size; } /* end else */ } /* end else */ } /* end if */ @@ -1213,8 +1214,8 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* Contiguous access pattern */ if (!parms->interleaved) { /* Compute offset in file */ - mpi_offset=mpi_file_offset+((nbytes_xfer/blk_size)/snbytes)* - (blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes); + mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/blk_size)/(size_t)snbytes)* + (blk_size*(size_t)snbytes))+(MPI_Offset)(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = buf_size; @@ -1228,8 +1229,8 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* Interleaved access pattern */ else { /* Compute offset in file */ - mpi_offset=mpi_file_offset+(((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)/snbytes)* - (buf_size*snbytes)+((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes; + mpi_offset=mpi_file_offset+(MPI_Offset)(((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)* + (buf_size*(size_t)snbytes))+(MPI_Offset)((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = blk_size; @@ -1266,16 +1267,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+ ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes /blk_size*(blk_size*blk_size)); */ - mpi_offset=mpi_file_offset+((nbytes_xfer/(buf_size/blk_size) - *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes) - +((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes*blk_size); + mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size) + *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes)) + +(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size))*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size)); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = blk_size * blk_size; /* Global offset advance after each I/O operation */ /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */ - mpi_offset_advance = (MPI_Offset)(snbytes*blk_size); + mpi_offset_advance = (MPI_Offset)((size_t)snbytes*blk_size); /* MPI type to be used for collective access */ mpi_collective_type = mpi_chunk_inter_type; @@ -1301,7 +1302,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, buf_p+=nbytes_xfer_advance; /* Advance global offset in dataset */ - nbytes_xfer+=nbytes_xfer_advance; + nbytes_xfer+=(ssize_t)nbytes_xfer_advance; /* Decrement number of bytes left this time */ nbytes_toxfer-=nbytes_xfer_advance; @@ -1324,7 +1325,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size*blk_size; + nbytes_xfer+=(off_t)buf_size*(off_t)blk_size; } /* end else */ } /* end else */ @@ -1353,22 +1354,22 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((hrc >= 0), "H5Dwrite"); /* Increment number of bytes transferred */ - nbytes_xfer += buf_size; + nbytes_xfer += (ssize_t)buf_size; } /* end if */ /* 2D dataspace */ else { /* Set up the file dset space id to move the selection to process */ if (!parms->interleaved){ /* Contiguous pattern */ - h5offset[0] = (nbytes_xfer/(snbytes*blk_size))*blk_size; - h5offset[1] = (nbytes_xfer%(snbytes*blk_size))/blk_size; + h5offset[0] = (hssize_t)(((size_t)nbytes_xfer/((size_t)snbytes*blk_size))*blk_size); + h5offset[1] = (hssize_t)(((size_t)nbytes_xfer%((size_t)snbytes*blk_size))/blk_size); } /* end if */ else { /* Interleaved access pattern */ /* Skip offset over blocks of other processes */ - h5offset[0] = ((nbytes_xfer*pio_mpi_nprocs_g)/(snbytes*buf_size))*buf_size; - h5offset[1] = ((nbytes_xfer*pio_mpi_nprocs_g)%(snbytes*buf_size))/buf_size; + h5offset[0] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*buf_size))*buf_size); + h5offset[1] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*buf_size))/buf_size); } /* end else */ hrc = H5Soffset_simple(h5dset_space_id, h5offset); @@ -1380,11 +1381,14 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((hrc >= 0), "H5Dwrite"); /* Increment number of bytes transferred */ - nbytes_xfer += buf_size*blk_size; + nbytes_xfer += (off_t)buf_size*(off_t)blk_size; } /* end else */ break; + + default: + break; } /* switch (parms->io_type) */ } /* end while */ @@ -1569,7 +1573,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end if */ /* Interleaved Pattern: */ else { - bytes_begin[0] = (off_t)(blk_size*pio_mpi_rank_g); + bytes_begin[0] = (off_t)blk_size*(off_t)pio_mpi_rank_g; } /* end else */ }/* end if */ /* 2D dataspace */ @@ -1591,9 +1595,9 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, bytes_begin[0] = 0; if (!parms->h5_use_chunks || parms->io_type==PHDF5) - bytes_begin[1] = (off_t)(blk_size*pio_mpi_rank_g); + bytes_begin[1] = (off_t)blk_size*(off_t)pio_mpi_rank_g; else - bytes_begin[1] = (off_t)(blk_size*blk_size*pio_mpi_rank_g); + bytes_begin[1] = (off_t)blk_size*(off_t)blk_size*(off_t)pio_mpi_rank_g; } /* end else */ } /* end else */ @@ -1665,7 +1669,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT"); /* Build contiguous file's derived type */ - mrc = MPI_Type_vector((int)blk_size, (int)1, (int)(snbytes/buf_size), + mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes/buf_size), mpi_partial_buffer_cont, &mpi_cont_type); VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE"); @@ -1683,7 +1687,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT"); /* Build interleaved file's derived type */ - mrc = MPI_Type_vector((int)buf_size, (int)1, (int)(snbytes/blk_size), + mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes/blk_size), mpi_partial_buffer_inter, &mpi_inter_type); VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE"); @@ -1710,7 +1714,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT"); /* Build chunk interleaved file's derived type */ - mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)(snbytes/blk_size), + mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)((size_t)snbytes/blk_size), mpi_full_chunk, &mpi_chunk_inter_type); VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE"); @@ -1725,22 +1729,22 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, if (!parms->dim2d){ if(nbytes>0) { /* define a contiguous dataset of nbytes native bytes */ - h5dims[0] = nbytes; + h5dims[0] = (hsize_t)nbytes; h5dset_space_id = H5Screate_simple(1, h5dims, NULL); VRFY((h5dset_space_id >= 0), "H5Screate_simple"); /* Set up the file dset space id to select the pattern to access */ if (!parms->interleaved){ /* Contiguous pattern */ - h5start[0] = bytes_begin[0]; + h5start[0] = (hsize_t)bytes_begin[0]; h5stride[0] = h5block[0] = blk_size; h5count[0] = buf_size/blk_size; } /* end if */ else { /* Interleaved access pattern */ /* Skip offset over blocks of other processes */ - h5start[0] = bytes_begin[0]; - h5stride[0] = blk_size*pio_mpi_nprocs_g; + h5start[0] = (hsize_t)bytes_begin[0]; + h5stride[0] = blk_size*(size_t)pio_mpi_nprocs_g; h5block[0] = blk_size; h5count[0] = buf_size/blk_size; } /* end else */ @@ -1768,16 +1772,16 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, else { if(nbytes>0) { /* define a contiguous dataset of nbytes native bytes */ - h5dims[0] = snbytes; - h5dims[1] = snbytes; + h5dims[0] = (hsize_t)snbytes; + h5dims[1] = (hsize_t)snbytes; h5dset_space_id = H5Screate_simple(2, h5dims, NULL); VRFY((h5dset_space_id >= 0), "H5Screate_simple"); /* Set up the file dset space id to select the pattern to access */ if (!parms->interleaved){ /* Contiguous pattern */ - h5start[0] = bytes_begin[0]; - h5start[1] = bytes_begin[1]; + h5start[0] = (hsize_t)bytes_begin[0]; + h5start[1] = (hsize_t)bytes_begin[1]; h5stride[0] = 1; h5stride[1] = h5block[0] = h5block[1] = blk_size; h5count[0] = 1; @@ -1786,10 +1790,10 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, else { /* Interleaved access pattern */ /* Skip offset over blocks of other processes */ - h5start[0] = bytes_begin[0]; - h5start[1] = bytes_begin[1]; + h5start[0] = (hsize_t)bytes_begin[0]; + h5start[1] = (hsize_t)bytes_begin[1]; h5stride[0] = blk_size; - h5stride[1] = blk_size*pio_mpi_nprocs_g; + h5stride[1] = blk_size*(size_t)pio_mpi_nprocs_g; h5block[0] = h5block[1] = blk_size; h5count[0] = buf_size/blk_size; h5count[1] = 1; @@ -1824,19 +1828,22 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* Create the dataset transfer property list */ h5dxpl = H5Pcreate(H5P_DATASET_XFER); if (h5dxpl < 0) { - HDfprintf(stderr, "HDF5 Property List Create failed\n"); - GOTOERROR(FAIL); + HDfprintf(stderr, "HDF5 Property List Create failed\n"); + GOTOERROR(FAIL); } /* Change to collective I/O, if asked */ if(parms->collective) { - hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 Property List Set failed\n"); - GOTOERROR(FAIL); - } /* end if */ + hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE); + if (hrc < 0) { + HDfprintf(stderr, "HDF5 Property List Set failed\n"); + GOTOERROR(FAIL); + } /* end if */ } /* end if */ break; + + default: + break; } /* end switch */ for (ndset = 1; ndset <= ndsets; ++ndset) { @@ -1847,19 +1854,21 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, switch (parms->io_type) { case POSIXIO: case MPIO: - /* both posix and mpi io just need dataset offset in file*/ - dset_offset = (ndset - 1) * nbytes; - break; + /* both posix and mpi io just need dataset offset in file*/ + dset_offset = (ndset - 1) * nbytes; + break; case PHDF5: HDsprintf(dname, "Dataset_%ld", ndset); - h5ds_id = H5DOPEN(fd->h5fd, dname); - if (h5ds_id < 0) { - HDfprintf(stderr, "HDF5 Dataset open failed\n"); - GOTOERROR(FAIL); - } + h5ds_id = H5DOPEN(fd->h5fd, dname); + if (h5ds_id < 0) { + HDfprintf(stderr, "HDF5 Dataset open failed\n"); + GOTOERROR(FAIL); + } + break; - break; + default: + break; } /* The task is to transfer bytes_count bytes, starting at @@ -1913,7 +1922,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((rc != 0), "POSIXREAD"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size; + nbytes_xfer+=(off_t)buf_size; } /* end if */ /* Interleaved access pattern */ else { @@ -1942,7 +1951,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, buf_p+=blk_size; /* Advance global offset in dataset */ - nbytes_xfer+=blk_size; + nbytes_xfer+=(off_t)blk_size; /* Decrement number of bytes left this time */ nbytes_toxfer-=blk_size; @@ -1956,8 +1965,8 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* Contiguous access pattern */ if (!parms->interleaved) { /* Compute file offset */ - file_offset=posix_file_offset+(off_t)(((nbytes_xfer/blk_size) - /snbytes)*(blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes)); + file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/blk_size) + /(size_t)snbytes)*(blk_size*(size_t)snbytes)+(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes)); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = buf_size; @@ -1968,9 +1977,9 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* Interleaved access pattern */ else { /* Compute file offset */ - file_offset=posix_file_offset+(off_t)((((nbytes_xfer/buf_size) - *pio_mpi_nprocs_g)/snbytes)*(buf_size*snbytes) - +((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes); + file_offset=posix_file_offset+(off_t)(((((size_t)nbytes_xfer/buf_size) + *(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*(buf_size*(size_t)snbytes) + +(((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = blk_size; @@ -2001,16 +2010,16 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size)) *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */ - file_offset=posix_file_offset+(off_t)(((nbytes_xfer/(buf_size/blk_size) - *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)+((nbytes_xfer/(buf_size/blk_size)) - *pio_mpi_nprocs_g)%(snbytes*blk_size)); + file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/(buf_size/blk_size) + *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes)+(((size_t)nbytes_xfer/(buf_size/blk_size)) + *(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size)); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = blk_size * blk_size; /* Global offset advance after each I/O operation */ /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */ - file_offset_advance = (off_t)(snbytes*blk_size); + file_offset_advance = (off_t)((size_t)snbytes*blk_size); } /* end else */ } /* end else */ @@ -2037,7 +2046,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, buf_p+=nbytes_xfer_advance; /* Advance global offset in dataset */ - nbytes_xfer+=nbytes_xfer_advance; + nbytes_xfer+=(off_t)nbytes_xfer_advance; /* Decrement number of bytes left this time */ nbytes_toxfer-=nbytes_xfer_advance; @@ -2067,7 +2076,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_READ"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size; + nbytes_xfer+=(off_t)buf_size; } /* end if */ /* Interleaved access pattern */ else { @@ -2092,7 +2101,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, buf_p+=blk_size; /* Advance global offset in dataset */ - nbytes_xfer+=blk_size; + nbytes_xfer+=(off_t)blk_size; /* Decrement number of bytes left this time */ nbytes_toxfer-=blk_size; @@ -2113,7 +2122,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_READ"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size; + nbytes_xfer+=(off_t)buf_size; } /* end if */ /* Interleaved access pattern */ else { @@ -2132,7 +2141,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_READ"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size; + nbytes_xfer+=(off_t)buf_size; } /* end else */ } /* end else */ } /* end if */ @@ -2143,8 +2152,8 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* Contiguous access pattern */ if (!parms->interleaved) { /* Compute offset in file */ - mpi_offset=mpi_file_offset+((nbytes_xfer/blk_size)/snbytes)* - (blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes); + mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/blk_size)/(size_t)snbytes)* + (blk_size*(size_t)snbytes))+(MPI_Offset)(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = buf_size; @@ -2158,8 +2167,8 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* Interleaved access pattern */ else { /* Compute offset in file */ - mpi_offset=mpi_file_offset+(((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)/snbytes)* - (buf_size*snbytes)+((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes; + mpi_offset=mpi_file_offset+(MPI_Offset)(((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)* + (buf_size*(size_t)snbytes))+(MPI_Offset)((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = blk_size; @@ -2196,16 +2205,16 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+ ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes /blk_size*(blk_size*blk_size)); */ - mpi_offset=mpi_file_offset+((nbytes_xfer/(buf_size/blk_size) - *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes) - +((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes*blk_size); + mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size) + *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes)) + +(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size))*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size)); /* Number of bytes to be transferred per I/O operation */ nbytes_xfer_advance = blk_size * blk_size; /* Global offset advance after each I/O operation */ /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */ - mpi_offset_advance = (MPI_Offset)(snbytes*blk_size); + mpi_offset_advance = (MPI_Offset)((size_t)snbytes*blk_size); /* MPI type to be used for collective access */ mpi_collective_type = mpi_chunk_inter_type; @@ -2231,7 +2240,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, buf_p+=nbytes_xfer_advance; /* Advance global offset in dataset */ - nbytes_xfer+=nbytes_xfer_advance; + nbytes_xfer+=(off_t)nbytes_xfer_advance; /* Decrement number of bytes left this time */ nbytes_toxfer-=nbytes_xfer_advance; @@ -2254,7 +2263,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((mrc==MPI_SUCCESS), "MPIO_READ"); /* Advance global offset in dataset */ - nbytes_xfer+=buf_size*blk_size; + nbytes_xfer+=(off_t)buf_size*(off_t)blk_size; } /* end else */ } /* end else */ @@ -2282,21 +2291,21 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((hrc >= 0), "H5Dread"); /* Increment number of bytes transferred */ - nbytes_xfer += buf_size; + nbytes_xfer += (off_t)buf_size; } /* end if */ /* 2D dataspace */ else { /* Set up the file dset space id to move the selection to process */ if (!parms->interleaved){ /* Contiguous pattern */ - h5offset[0] = (nbytes_xfer/(snbytes*blk_size))*blk_size; - h5offset[1] = (nbytes_xfer%(snbytes*blk_size))/blk_size; + h5offset[0] = (hssize_t)(((size_t)nbytes_xfer/((size_t)snbytes*blk_size))*blk_size); + h5offset[1] = (hssize_t)(((size_t)nbytes_xfer%((size_t)snbytes*blk_size))/blk_size); } /* end if */ else { /* Interleaved access pattern */ /* Skip offset over blocks of other processes */ - h5offset[0] = ((nbytes_xfer*pio_mpi_nprocs_g)/(snbytes*buf_size))*buf_size; - h5offset[1] = ((nbytes_xfer*pio_mpi_nprocs_g)%(snbytes*buf_size))/buf_size; + h5offset[0] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*buf_size))*buf_size); + h5offset[1] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*buf_size))/buf_size); } /* end else */ hrc = H5Soffset_simple(h5dset_space_id, h5offset); @@ -2308,10 +2317,13 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, VRFY((hrc >= 0), "H5Dread"); /* Increment number of bytes transferred */ - nbytes_xfer += buf_size*blk_size; + nbytes_xfer += (off_t)buf_size*(off_t)blk_size; } /* end else */ break; + + default: + break; } /* switch (parms->io_type) */ /* Verify raw data, if asked */ @@ -2541,6 +2553,9 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) } break; + + default: + break; } done: @@ -2561,38 +2576,41 @@ do_fclose(iotype iot, file_descr *fd /*out*/) int mrc = 0, rc = 0; switch (iot) { - case POSIXIO: - rc = POSIXCLOSE(fd->posixfd); + case POSIXIO: + rc = POSIXCLOSE(fd->posixfd); - if (rc != 0){ - HDfprintf(stderr, "POSIX File Close failed\n"); - GOTOERROR(FAIL); - } + if (rc != 0){ + HDfprintf(stderr, "POSIX File Close failed\n"); + GOTOERROR(FAIL); + } - fd->posixfd = -1; - break; + fd->posixfd = -1; + break; - case MPIO: - mrc = MPI_File_close(&fd->mpifd); + case MPIO: + mrc = MPI_File_close(&fd->mpifd); - if (mrc != MPI_SUCCESS){ - HDfprintf(stderr, "MPI File close failed\n"); - GOTOERROR(FAIL); - } + if (mrc != MPI_SUCCESS){ + HDfprintf(stderr, "MPI File close failed\n"); + GOTOERROR(FAIL); + } - fd->mpifd = MPI_FILE_NULL; - break; + fd->mpifd = MPI_FILE_NULL; + break; - case PHDF5: - hrc = H5Fclose(fd->h5fd); + case PHDF5: + hrc = H5Fclose(fd->h5fd); - if (hrc < 0) { - HDfprintf(stderr, "HDF5 File Close failed\n"); - GOTOERROR(FAIL); - } + if (hrc < 0) { + HDfprintf(stderr, "HDF5 File Close failed\n"); + GOTOERROR(FAIL); + } - fd->h5fd = -1; - break; + fd->h5fd = -1; + break; + + default: + break; } done: @@ -2619,15 +2637,17 @@ do_cleanupfile(iotype iot, char *fname) clean_file_g = (getenv("HDF5_NOCLEANUP")==NULL) ? 1 : 0; if (clean_file_g){ - switch (iot){ - case POSIXIO: - HDremove(fname); - break; - case MPIO: - case PHDF5: - MPI_File_delete(fname, h5_io_info_g); - break; - } + switch (iot){ + case POSIXIO: + HDremove(fname); + break; + case MPIO: + case PHDF5: + MPI_File_delete(fname, h5_io_info_g); + break; + default: + break; + } } } diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 5977731..826e7a9 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -80,8 +80,13 @@ #define PIO_MPI 0x2 #define PIO_HDF5 0x4 +#ifdef STANDALONE +#define DBL_EPSILON 2.2204460492503131e-16 +#define H5_DBL_ABS_EQUAL(X,Y) (fabs((X)-(Y)) < DBL_EPSILON) +#endif + /* report 0.0 in case t is zero too */ -#define MB_PER_SEC(bytes,t) (((t)==0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) +#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 @@ -311,6 +316,7 @@ static void output_report(const char *fmt, ...); static void print_indent(register int indent); static void usage(const char *prog); static void report_parameters(struct options *opts); +static off_t squareo(off_t); /* * Function: main @@ -393,6 +399,12 @@ finish: return exit_value; } +off_t +squareo(off_t x) +{ + return x * x; +} + /* * Function: run_test_loop * Purpose: Run the I/O tests. Write the results to OUTPUT. @@ -428,8 +440,8 @@ run_test_loop(struct options *opts) parms.interleaved = opts->interleaved; parms.collective = opts->collective; parms.dim2d = opts->dim2d; - parms.h5_align = opts->h5_alignment; - parms.h5_thresh = opts->h5_threshold; + parms.h5_align = (hsize_t)opts->h5_alignment; + parms.h5_thresh = (hsize_t)opts->h5_threshold; parms.h5_use_chunks = opts->h5_use_chunks; parms.h5_write_only = opts->h5_write_only; parms.verify = opts->verify; @@ -456,7 +468,7 @@ run_test_loop(struct options *opts) parms.buf_size = buf_size; if (parms.dim2d){ - parms.num_bytes = (off_t)pow((double)(opts->num_bpp*parms.num_procs),2); + parms.num_bytes = squareo(opts->num_bpp * parms.num_procs); if (parms.interleaved) output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n", buf_size, opts->blk_size, @@ -558,6 +570,8 @@ run_test(iotype iot, parameters parms, struct options *opts) case PHDF5: output_report("PHDF5 (w/MPI-IO driver)\n"); break; + default: + break; } MPI_Comm_size(pio_comm_g, &comm_size); @@ -879,7 +893,7 @@ accumulate_minmax_stuff(minmax *mm, int count) int i; minmax total_mm; - total_mm.sum = 0.0; + total_mm.sum = 0.0f; total_mm.max = -DBL_MAX; total_mm.min = DBL_MAX; total_mm.num = count; @@ -1155,10 +1169,10 @@ report_parameters(struct options *opts) recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); HDfprintf(output, "rank %d: File size=", rank); - recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->min_num_procs),2) - * opts->num_dsets), ":"); - recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->max_num_procs),2) - * opts->num_dsets), "\n"); + recover_size_and_print((long long)(squareo(opts->num_bpp * opts->min_num_procs) + * opts->num_dsets), ":"); + recover_size_and_print((long long)(squareo(opts->num_bpp * opts->max_num_procs) + * opts->num_dsets), "\n"); HDfprintf(output, "rank %d: Transfer buffer size=", rank); if(opts->interleaved){ @@ -1322,7 +1336,7 @@ parse_command_line(int argc, char *argv[]) break; #endif /* 0 */ case 'B': - cl_opts->blk_size = parse_size_directive(opt_arg); + cl_opts->blk_size = (size_t)parse_size_directive(opt_arg); break; case 'c': /* Turn on chunked HDF5 dataset creation */ @@ -1423,10 +1437,10 @@ parse_command_line(int argc, char *argv[]) cl_opts->h5_write_only = TRUE; break; case 'x': - cl_opts->min_xfer_size = parse_size_directive(opt_arg); + cl_opts->min_xfer_size = (size_t)parse_size_directive(opt_arg); break; case 'X': - cl_opts->max_xfer_size = parse_size_directive(opt_arg); + cl_opts->max_xfer_size = (size_t)parse_size_directive(opt_arg); break; case 'h': case '?': @@ -1446,13 +1460,13 @@ parse_command_line(int argc, char *argv[]) } if (cl_opts->max_xfer_size == 0) - cl_opts->max_xfer_size = cl_opts->num_bpp; + cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp; if (cl_opts->min_xfer_size == 0) - cl_opts->min_xfer_size = (cl_opts->num_bpp)/2; + cl_opts->min_xfer_size = (size_t)(cl_opts->num_bpp)/2; if (cl_opts->blk_size == 0) - cl_opts->blk_size = (cl_opts->num_bpp)/2; + cl_opts->blk_size = (size_t)(cl_opts->num_bpp)/2; /* set default if none specified yet */ @@ -1462,15 +1476,15 @@ parse_command_line(int argc, char *argv[]) /* verify parameters sanity. Adjust if needed. */ /* cap xfer_size with bytes per process */ if (!cl_opts->dim2d) { - if (cl_opts->min_xfer_size > cl_opts->num_bpp) - cl_opts->min_xfer_size = cl_opts->num_bpp; - if (cl_opts->max_xfer_size > cl_opts->num_bpp) - cl_opts->max_xfer_size = cl_opts->num_bpp; + if (cl_opts->min_xfer_size > (size_t)cl_opts->num_bpp) + cl_opts->min_xfer_size = (size_t)cl_opts->num_bpp; + if (cl_opts->max_xfer_size > (size_t)cl_opts->num_bpp) + cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp; } if (cl_opts->min_xfer_size > cl_opts->max_xfer_size) cl_opts->min_xfer_size = cl_opts->max_xfer_size; - if (cl_opts->blk_size > cl_opts->num_bpp ) - cl_opts->blk_size = cl_opts->num_bpp; + if (cl_opts->blk_size > (size_t)cl_opts->num_bpp ) + cl_opts->blk_size = (size_t)cl_opts->num_bpp; /* check range of number of processes */ if (cl_opts->min_num_procs <= 0) cl_opts->min_num_procs = 1; |