From fe75e8f66f79c16d083d80ccdca303f267e96745 Mon Sep 17 00:00:00 2001 From: Kimmy Mu Date: Thu, 23 Jan 2020 16:21:06 -0600 Subject: Merge pull request #2300 in HDFFV/hdf5 from ~KMU/hdf5:squashed_cast to develop * commit 'af5c33afabdae2e39bb45eb1b3e9c8366da01145': remove unnecessary stuff squash cast warning fix --- src/H5B2cache.c | 4 +- src/H5Cmpio.c | 37 +++--- src/H5Dchunk.c | 31 +++-- src/H5Dfill.c | 5 +- src/H5Dio.c | 22 ++-- src/H5Dmpio.c | 36 +++--- src/H5Rint.c | 3 +- src/H5Smpio.c | 37 ++++-- src/H5Ztrans.c | 2 +- src/H5mpi.c | 6 +- src/H5overflow.txt | 1 + test/dsets.c | 24 ++-- test/swmr_common.c | 24 +++- test/trefer.c | 6 +- test/use_disable_mdc_flushes.c | 21 ++-- test/vds_swmr.h | 24 +--- test/vds_swmr_gen.c | 6 +- test/vds_swmr_reader.c | 6 +- testpar/t_2Gio.c | 210 ++++++++++++++++---------------- testpar/t_bigio.c | 62 +++++----- testpar/t_cache.c | 35 +++--- testpar/t_chunk_alloc.c | 14 +-- testpar/t_coll_chunk.c | 30 ++--- testpar/t_coll_md_read.c | 14 +-- testpar/t_dset.c | 220 +++++++++++++++++----------------- testpar/t_file.c | 16 +-- testpar/t_filter_read.c | 4 +- testpar/t_mdset.c | 39 +++--- testpar/t_mpi.c | 10 +- testpar/t_prestart.c | 6 +- testpar/t_prop.c | 2 +- testpar/t_pshutdown.c | 8 +- testpar/t_span_tree.c | 58 ++++----- tools/lib/h5diff.c | 6 +- tools/lib/h5diff_array.c | 2 +- tools/src/h5import/h5import.c | 8 +- tools/src/h5ls/h5ls.c | 4 +- tools/src/h5repack/h5repack_parse.c | 2 +- tools/src/misc/h5clear.c | 2 +- tools/test/h5repack/h5repackgentest.c | 4 +- tools/test/perform/chunk_cache.c | 11 +- tools/test/perform/perf.c | 22 ++-- tools/test/perform/pio_engine.c | 200 +++++++++++++++---------------- tools/test/perform/pio_perf.c | 49 ++++---- 44 files changed, 682 insertions(+), 651 deletions(-) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 65286e6..80cb6c5 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -654,6 +654,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, uint32_t stored_chksum; /* Stored metadata checksum value */ unsigned u; /* Local index variable */ H5B2_internal_t *ret_value = NULL; /* Return value */ + int node_nrec = 0; FUNC_ENTER_STATIC @@ -716,7 +717,8 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, for(u = 0; u < (unsigned)(internal->nrec + 1); u++) { /* Decode node pointer */ H5F_addr_decode(udata->f, (const uint8_t **)&image, &(int_node_ptr->addr)); - UINT64DECODE_VAR(image, int_node_ptr->node_nrec, udata->hdr->max_nrec_size); + UINT64DECODE_VAR(image, node_nrec, udata->hdr->max_nrec_size); + H5_CHECKED_ASSIGN(int_node_ptr->node_nrec, uint16_t, node_nrec, int); if(udata->depth > 1) UINT64DECODE_VAR(image, int_node_ptr->all_nrec, udata->hdr->node_info[udata->depth - 1].cum_max_nrec_size) else diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index e784487..2c176e4 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -174,13 +174,13 @@ H5C_apply_candidate_list(H5F_t * f, int mpi_size) { int i; - int m; - int n; - unsigned first_entry_to_flush; - unsigned last_entry_to_flush; - unsigned total_entries_to_clear = 0; - unsigned total_entries_to_flush = 0; - int * candidate_assignment_table = NULL; + int m; + unsigned n; + unsigned first_entry_to_flush; + unsigned last_entry_to_flush; + unsigned total_entries_to_clear = 0; + unsigned total_entries_to_flush = 0; + unsigned * candidate_assignment_table = NULL; unsigned entries_to_flush[H5C_RING_NTYPES]; unsigned entries_to_clear[H5C_RING_NTYPES]; haddr_t addr; @@ -231,17 +231,18 @@ H5C_apply_candidate_list(H5F_t * f, HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") } /* end if */ - n = num_candidates / mpi_size; - m = num_candidates % mpi_size; - HDassert(n >= 0); - if(NULL == (candidate_assignment_table = (int *)H5MM_malloc(sizeof(int) * (size_t)(mpi_size + 1)))) + n = num_candidates / (unsigned)mpi_size; + if(num_candidates % (unsigned)mpi_size > INT_MAX) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "m overflow") + m = (int)(num_candidates % (unsigned)mpi_size); + + if(NULL == (candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for candidate assignment table") candidate_assignment_table[0] = 0; candidate_assignment_table[mpi_size] = num_candidates; if(m == 0) { /* mpi_size is an even divisor of num_candidates */ - HDassert(n > 0); for(i = 1; i < mpi_size; i++) candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n; } /* end if */ @@ -249,7 +250,7 @@ H5C_apply_candidate_list(H5F_t * f, for(i = 1; i <= m; i++) candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n + 1; - if(num_candidates < mpi_size) { + if(num_candidates < (unsigned)mpi_size) { for(i = m + 1; i < mpi_size; i++) candidate_assignment_table[i] = num_candidates; } /* end if */ @@ -263,7 +264,7 @@ H5C_apply_candidate_list(H5F_t * f, #if H5C_DO_SANITY_CHECKS /* Verify that the candidate assignment table has the expected form */ for(i = 1; i < mpi_size - 1; i++) { - int a, b; + unsigned a, b; a = candidate_assignment_table[i] - candidate_assignment_table[i - 1]; b = candidate_assignment_table[i + 1] - candidate_assignment_table[i]; @@ -282,7 +283,7 @@ H5C_apply_candidate_list(H5F_t * f, tbl_buf[i] = '\0'; HDsprintf(&(tbl_buf[0]), "candidate assignment table = "); for(i = 0; i <= mpi_size; i++) - HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]); + HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[i]); HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); HDfprintf(stdout, "%s", tbl_buf); @@ -359,11 +360,11 @@ H5C_apply_candidate_list(H5F_t * f, n = 0; for(i = 0; i < H5C_RING_NTYPES; i++) { m += (int)entries_to_flush[i]; - n += (int)entries_to_clear[i]; + n += entries_to_clear[i]; } /* end if */ HDassert((unsigned)m == total_entries_to_flush); - HDassert((unsigned)n == total_entries_to_clear); + HDassert(n == total_entries_to_clear); #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_APPLY_CANDIDATE_LIST__DEBUG @@ -397,7 +398,7 @@ H5C_apply_candidate_list(H5F_t * f, done: if(candidate_assignment_table != NULL) - candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table); + candidate_assignment_table = (unsigned *)H5MM_xfree((void *)candidate_assignment_table); if(cache_ptr->coll_write_list) { if(H5SL_close(cache_ptr->coll_write_list) < 0) HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list") diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index fe98516..8d1ba80 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1683,7 +1683,7 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t /* Iterate through each chunk in the dataset */ while(sel_points) { H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */ - hssize_t schunk_points; /* Number of elements in chunk selection */ + hsize_t chunk_points; /* Number of elements in chunk selection */ /* Add temporary chunk to the list of chunks */ @@ -1727,12 +1727,11 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t } /* end if */ /* Get number of elements selected in chunk */ - if((schunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements") - H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, schunk_points, hssize_t); + chunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace); + H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, chunk_points, hsize_t); /* Decrement # of points left in file selection */ - sel_points -= (hsize_t)schunk_points; + sel_points -= chunk_points; /* Advance to next chunk if we are not done */ if(sel_points > 0) { @@ -1870,7 +1869,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t /* (Casting away const OK - QAK) */ if(TRUE == H5S_SELECT_INTERSECT_BLOCK(fm->file_space, coords, end)) { H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */ - hssize_t schunk_points; /* Number of elements in chunk selection */ + hsize_t chunk_points; /* Number of elements in chunk selection */ /* Create dataspace for chunk, 'AND'ing the overall selection with * the current chunk. @@ -1923,12 +1922,11 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t } /* end if */ /* Get number of elements selected in chunk */ - if((schunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements") - H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, schunk_points, hssize_t); + chunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace); + H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, chunk_points, hsize_t); /* Decrement # of points left in file selection */ - sel_points -= (hsize_t)schunk_points; + sel_points -= chunk_points; /* Leave if we are done */ if(sel_points == 0) @@ -4983,12 +4981,12 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, /* Distribute evenly the number of blocks between processes. */ if(mpi_size == 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero") - num_blocks = chunk_info->num_io / mpi_size; /* value should be the same on all procs */ + num_blocks = (size_t)(chunk_info->num_io / (size_t)mpi_size); /* value should be the same on all procs */ /* after evenly distributing the blocks between processes, are there any leftover blocks for each individual process (round-robin) */ - leftover_blocks = chunk_info->num_io % mpi_size; + leftover_blocks = (size_t)(chunk_info->num_io % (size_t)mpi_size); /* Cast values to types needed by MPI */ H5_CHECKED_ASSIGN(blocks, int, num_blocks, size_t); @@ -4997,9 +4995,9 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, /* Allocate buffers */ /* (MSC - should not need block_lens if MPI_type_create_hindexed_block is working) */ - if(NULL == (block_lens = (int *)H5MM_malloc((blocks + 1) * sizeof(int)))) + if(NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer") - if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((blocks + 1) * sizeof(MPI_Aint)))) + if(NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer") for(i = 0 ; i < blocks ; i++) { @@ -5104,7 +5102,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) const hsize_t *scaled = udata->common.scaled; /* Scaled chunk offset */ H5S_sel_iter_t *chunk_iter = NULL; /* Memory selection iteration info */ hbool_t chunk_iter_init = FALSE; /* Whether the chunk iterator has been initialized */ - hssize_t sel_nelmts; /* Number of elements in selection */ + hsize_t sel_nelmts; /* Number of elements in selection */ hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */ size_t chunk_size; /*size of a chunk */ void *chunk; /* The file chunk */ @@ -5165,8 +5163,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) /* Get the number of elements in the selection */ sel_nelmts = H5S_GET_SELECT_NPOINTS(udata->chunk_space); - HDassert(sel_nelmts >= 0); - H5_CHECK_OVERFLOW(sel_nelmts, hssize_t, size_t); + H5_CHECK_OVERFLOW(sel_nelmts, hsize_t, size_t); /* Check for VL datatype & non-default fill value */ if(udata->fb_info.has_vlen_fill_type) diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 3ccee90..f5a5238 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -249,12 +249,11 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, * of the VL data. */ if(TRUE == H5T_detect_class(fill_type, H5T_VLEN, FALSE)) { - hssize_t nelmts; /* Number of data elements */ + hsize_t nelmts; /* Number of data elements */ /* Get the number of elements in the selection */ nelmts = H5S_GET_SELECT_NPOINTS(space); - HDassert(nelmts >= 0); - H5_CHECK_OVERFLOW(nelmts, hssize_t, size_t); + H5_CHECK_OVERFLOW(nelmts, hsize_t, size_t); /* Allocate a temporary buffer */ if(NULL == (tmp_buf = H5FL_BLK_MALLOC(type_conv, (size_t)nelmts * buf_size))) diff --git a/src/H5Dio.c b/src/H5Dio.c index 6b02b68..0f4e703 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -409,9 +409,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Note that if this variable is used, the */ /* projected mem space must be discarded at the */ /* end of the function to avoid a memory leak. */ - H5D_storage_t store; /*union of EFL and chunk pointer in file space */ - hssize_t snelmts; /*total number of elmts (signed) */ - hsize_t nelmts; /*total number of elmts */ + H5D_storage_t store; /* union of EFL and chunk pointer in file space */ + hsize_t nelmts; /* total number of elmts */ hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ @@ -425,9 +424,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, file_space = dataset->shared->space; if(!mem_space) mem_space = file_space; - if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dst dataspace has invalid selection") - H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t); + nelmts = H5S_GET_SELECT_NPOINTS(mem_space); /* Set up datatype info for operation */ if(H5D__typeinfo_init(dataset, mem_type_id, FALSE, &type_info) < 0) @@ -450,7 +447,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, #endif /*H5_HAVE_PARALLEL*/ /* Make certain that the number of elements in each selection is the same */ - if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) + if(nelmts != H5S_GET_SELECT_NPOINTS(file_space)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different number of elements selected") /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */ @@ -623,9 +620,8 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Note that if this variable is used, the */ /* projected mem space must be discarded at the */ /* end of the function to avoid a memory leak. */ - H5D_storage_t store; /*union of EFL and chunk pointer in file space */ - hssize_t snelmts; /*total number of elmts (signed) */ - hsize_t nelmts; /*total number of elmts */ + H5D_storage_t store; /* union of EFL and chunk pointer in file space */ + hsize_t nelmts; /* total number of elmts */ hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ @@ -680,12 +676,10 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if(!mem_space) mem_space = file_space; - if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection") - H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t); + nelmts = H5S_GET_SELECT_NPOINTS(mem_space); /* Make certain that the number of elements in each selection is the same */ - if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) + if(nelmts != H5S_GET_SELECT_NPOINTS(file_space)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different number of elements selected") /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 0dbbe9f..91557c3 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -2524,7 +2524,9 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, } /* end if */ /* Broadcasting the MPI_IO option info. and chunk address info. */ - if(MPI_SUCCESS != (mpi_code = MPI_Bcast(mergebuf, ((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm))) + if((sizeof(haddr_t) + 1) * total_chunks > INT_MAX) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "result overflow") + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(mergebuf, (int)((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm))) HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code) H5MM_memcpy(assign_io_mode, mergebuf, total_chunks); @@ -2606,7 +2608,7 @@ H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_typ H5D_chunk_info_t *chunk_info; H5D_chunk_ud_t udata; H5SL_node_t *chunk_node; - hssize_t select_npoints; + hsize_t select_npoints; hssize_t chunk_npoints; if(NULL == (local_info_array = (H5D_filtered_collective_io_info_t *) H5MM_malloc(num_chunks_selected * sizeof(H5D_filtered_collective_io_info_t)))) @@ -2632,8 +2634,7 @@ H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_typ H5MM_memcpy(local_info_array[i].scaled, chunk_info->scaled, sizeof(chunk_info->scaled)); - if ((select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->mspace); local_info_array[i].io_size = (size_t) select_npoints * type_info->src_type_size; /* Currently the full overwrite status of a chunk is only obtained on a per-process @@ -2841,7 +2842,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty if (mpi_rank != chunk_entry->owners.new_owner) { H5D_chunk_info_t *chunk_info = NULL; unsigned char *mod_data_p = NULL; - hssize_t iter_nelmts; + hsize_t iter_nelmts; size_t mod_data_size; /* Look up the chunk and get its file and memory dataspaces */ @@ -2854,9 +2855,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to get encoded dataspace size") - if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace); + H5_CHECK_OVERFLOW(iter_nelmts, hsize_t, size_t); mod_data_size += (size_t) iter_nelmts * type_info->src_type_size; if(NULL == (mod_data[num_send_requests] = (unsigned char *) H5MM_malloc(mod_data_size))) @@ -3088,7 +3089,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk H5Z_EDC_t err_detect; /* Error detection info */ H5Z_cb_t filter_cb; /* I/O filter callback function */ unsigned filter_mask = 0; - hssize_t iter_nelmts; /* Number of points to iterate over for the chunk IO operation */ + hsize_t iter_nelmts; /* Number of points to iterate over for the chunk IO operation */ hssize_t extent_npoints; hsize_t true_chunk_size; hbool_t mem_iter_init = FALSE; @@ -3193,17 +3194,15 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") file_iter_init = TRUE; - if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); - if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size))) + if(NULL == (tmp_gath_buf = H5MM_malloc(iter_nelmts * type_info->src_type_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer") if(!H5D__gather_mem(chunk_entry->buf, file_iter, (size_t) iter_nelmts, tmp_gath_buf)) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't gather from chunk buffer") - if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace); if(H5D__scatter_mem(tmp_gath_buf, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer") @@ -3211,10 +3210,9 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk break; case H5D_IO_OP_WRITE: - if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace); - if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size))) + if(NULL == (tmp_gath_buf = H5MM_malloc(iter_nelmts * type_info->src_type_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer") /* Gather modification data from the application write buffer into a temporary buffer */ @@ -3230,8 +3228,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information") mem_iter_init = TRUE; - if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); /* Scatter the owner's modification data into the chunk data buffer according to * the file space. @@ -3262,8 +3259,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") mem_iter_init = TRUE; - if((iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace); /* Update the chunk data with the received modification data */ if(H5D__scatter_mem(mod_data_p, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0) diff --git a/src/H5Rint.c b/src/H5Rint.c index af1b6e2..486c1ff 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -819,6 +819,7 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, HDassert(token_size <= H5O_MAX_TOKEN_SIZE); H5MM_memcpy(&ref->info.obj.token, obj_token, sizeof(H5O_token_t)); + HDassert(token_size <= 255); ref->token_size = (uint8_t)token_size; FUNC_LEAVE_NOAPI(ret_value) @@ -1200,7 +1201,7 @@ H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, /* Decode token */ H5MM_memcpy(obj_token, p, *token_size); - *nbytes = (size_t)*token_size + H5_SIZEOF_UINT8_T; + *nbytes = (size_t)(*token_size + H5_SIZEOF_UINT8_T); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 800913f..6397f4b 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -293,8 +293,8 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, for(i = 0; i < num_big_types; i++) { #if MPI_VERSION >= 3 - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count, - 1, &disp[i*bigio_count], elmt_type, &inner_types[i]))) + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)bigio_count, + 1, &disp[(hsize_t)i*bigio_count], elmt_type, &inner_types[i]))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code) #else if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count, @@ -308,7 +308,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, if(remaining_points) { #if MPI_VERSION >= 3 if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points, - 1, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types]))) + 1, &disp[(hsize_t)num_big_types*bigio_count], elmt_type, &inner_types[num_big_types]))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code) #else if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points, @@ -403,8 +403,11 @@ H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_typ curr = space->select.sel_info.pnt_lst->head; for(u = 0 ; u < num_points ; u++) { /* Calculate the displacement of the current point */ - disp[u] = H5VM_array_offset(space->extent.rank, space->extent.size, curr->pnt); - disp[u] *= elmt_size; + hsize_t disp_tmp = H5VM_array_offset(space->extent.rank, space->extent.size, curr->pnt); + if(disp_tmp > LONG_MAX) /* Maximum value of type long */ + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "disp overflow") + disp[u] = (MPI_Aint)disp_tmp; + disp[u] *= (MPI_Aint)elmt_size; /* This is a File Space used to set the file view, so adjust the displacements * to have them monotonically non-decreasing. @@ -423,7 +426,7 @@ H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_typ */ if(do_permute) { if(u > 0 && disp[u] < disp[u - 1]) { - unsigned s = 0, l = u, m = u / 2; + hsize_t s = 0, l = u, m = u / 2; *is_permuted = TRUE; do { @@ -565,7 +568,9 @@ H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute, /* Loop, while bytes left in sequence */ while(curr_len > 0) { /* Set the displacement of the current point */ - disp[u] = curr_off; + if(curr_off > LONG_MAX) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "curr_off overflow") + disp[u] = (MPI_Aint)curr_off; /* This is a memory displacement, so for each point selected, * apply the map that was generated by the file selection */ @@ -893,8 +898,14 @@ if(H5DEBUG(S)) ****************************************/ /* Calculate start and extent values of this dimension */ - start_disp = d[i].start * offset[i] * elmt_size; - new_extent = (MPI_Aint)elmt_size * max_xtent[i]; + /* Check if value overflow to cast to type MPI_Aint */ + if(d[i].start > LONG_MAX || offset[i] > LONG_MAX || elmt_size > LONG_MAX) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "result overflow") + start_disp = (MPI_Aint)d[i].start * (MPI_Aint)offset[i] * (MPI_Aint)elmt_size; + + if(max_xtent[i] > LONG_MAX) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "max_xtent overflow") + new_extent = (MPI_Aint)elmt_size * (MPI_Aint)max_xtent[i]; if(MPI_SUCCESS != (mpi_code = MPI_Type_get_extent(outer_type, &lb, &extent_len))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_get_extent failed", mpi_code) @@ -1161,7 +1172,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, nelmts = (span->high - span->low) + 1; /* Store displacement & block length */ - disp[outercount] = (MPI_Aint)elmt_size * span->low; + disp[outercount] = (MPI_Aint)elmt_size * (MPI_Aint)span->low; H5_CHECK_OVERFLOW(nelmts, hsize_t, int) blocklen[outercount] = (int)nelmts; @@ -1183,7 +1194,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, /* create the block type from elmt_type while checking the 32 bit int limit */ if((hsize_t)(blocklen[u]) > bigio_count) { - if(H5_mpio_create_large_type(blocklen[u], 0, *elmt_type, &temp_type) < 0) + if(H5_mpio_create_large_type((hsize_t)blocklen[u], 0, *elmt_type, &temp_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection") } /* end if */ else @@ -1219,7 +1230,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes") /* Calculate the total bytes of the lower dimension */ - stride = (*down) * elmt_size; + stride = (MPI_Aint)(*down) * (MPI_Aint)elmt_size; /* Loop over span nodes */ outercount = 0; @@ -1251,7 +1262,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, /* Displacement should be in byte and should have dimension information */ /* First using MPI Type vector to build derived data type for this span only */ /* Need to calculate the disp in byte for this dimension. */ - disp[outercount] = span->low * stride; + disp[outercount] = (MPI_Aint)span->low * stride; blocklen[outercount] = 1; /* Generate MPI datatype for next dimension down */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 2245bd3..6d07513 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -324,7 +324,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); #define H5Z_XFORM_DO_OP5(TYPE, SIZE) \ { \ - TYPE val = (TYPE)((tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val); \ + TYPE val = ((tree->type == H5Z_XFORM_INTEGER) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \ H5VM_array_fill(array, &val, sizeof(TYPE), (SIZE)); \ } diff --git a/src/H5mpi.c b/src/H5mpi.c index 42d6ba8..d9f161c 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -482,7 +482,7 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, /* Calculate how many Big MPI datatypes are needed to represent the buffer */ num_big_types = (int)(num_elements/bigio_count); - leftover = num_elements - num_big_types * (hsize_t)bigio_count; + leftover = (hsize_t)num_elements - (hsize_t)num_big_types * bigio_count; H5_CHECKED_ASSIGN(remaining_bytes, int, leftover, hsize_t); /* Create a contiguous datatype of size equal to the largest @@ -491,11 +491,11 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, * use type_hvector to create the type with the displacement provided */ if (0 == stride_bytes) { - if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(bigio_count, old_type, &inner_type))) + if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)bigio_count, old_type, &inner_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) } /* end if */ else - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(bigio_count, 1, stride_bytes, old_type, &inner_type))) + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)bigio_count, 1, stride_bytes, old_type, &inner_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) /* Create a contiguous datatype of the buffer (minus the remaining < 2GB part) diff --git a/src/H5overflow.txt b/src/H5overflow.txt index ed71b98..9fb3b89 100644 --- a/src/H5overflow.txt +++ b/src/H5overflow.txt @@ -31,6 +31,7 @@ unsigned, UNSIGNED; int8_t, SIGNED; int, SIGNED; +long, SIGNED; int64_t, SIGNED; uint8_t, UNSIGNED; uint16_t, UNSIGNED; diff --git a/test/dsets.c b/test/dsets.c index f6f7f4a..8f89d82 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -7165,8 +7165,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i=0; i SHRT_MAX) { + HDfprintf(stderr, "rank(%d) of dataset overflow\n", rank); + return -1; + } + *bufptr++ = (short)i; + } /* extend the dataset by one for new plane */ dims[0]=i+1; diff --git a/test/vds_swmr.h b/test/vds_swmr.h index 43c78a4..edb01bc 100644 --- a/test/vds_swmr.h +++ b/test/vds_swmr.h @@ -84,31 +84,17 @@ #define N_PLANES_TO_WRITE 25 /* Planes */ -H5TEST_DLLVAR hsize_t PLANES[N_SOURCES][RANK] = { - {1, SM_HEIGHT, WIDTH}, - {1, LG_HEIGHT, WIDTH}, - {1, SM_HEIGHT, WIDTH}, - {1, LG_HEIGHT, WIDTH}, - {1, SM_HEIGHT, WIDTH}, - {1, LG_HEIGHT, WIDTH} -}; +H5TEST_DLLVAR hsize_t PLANES[N_SOURCES][RANK]; /* File names for source datasets */ -H5TEST_DLLVAR char FILE_NAMES[N_SOURCES][NAME_LEN] = { - {"vds_swmr_src_a.h5"}, - {"vds_swmr_src_b.h5"}, - {"vds_swmr_src_c.h5"}, - {"vds_swmr_src_d.h5"}, - {"vds_swmr_src_e.h5"}, - {"vds_swmr_src_f.h5"} -}; +H5TEST_DLLVAR char FILE_NAMES[N_SOURCES][NAME_LEN]; /* VDS file name */ -H5TEST_DLLVAR char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5"; +H5TEST_DLLVAR char VDS_FILE_NAME[NAME_LEN]; /* Dataset names */ -H5TEST_DLLVAR char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; -H5TEST_DLLVAR char VDS_DSET_NAME[NAME_LEN] = "vds_dset"; +H5TEST_DLLVAR char SOURCE_DSET_PATH[NAME_LEN]; +H5TEST_DLLVAR char VDS_DSET_NAME[NAME_LEN]; /* Fill values */ #endif /* VDS_SWMR_H */ diff --git a/test/vds_swmr_gen.c b/test/vds_swmr_gen.c index 2589653..b14ecc2 100644 --- a/test/vds_swmr_gen.c +++ b/test/vds_swmr_gen.c @@ -145,11 +145,13 @@ main(void) if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL, MAX_DIMS[i], NULL) < 0) TEST_ERROR - start[1] = map_start; + start[1] = (hsize_t)map_start; if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL, MAX_DIMS[i], NULL) < 0) TEST_ERROR - map_start += PLANES[i][1]; + if(PLANES[i][1] > INT_MAX) + TEST_ERROR + map_start += (int)PLANES[i][1]; /* Add VDS mapping */ if(H5Pset_virtual(vds_dcplid, vds_sid, FILE_NAMES[i], diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c index eb9a82b..1ee65a0 100644 --- a/test/vds_swmr_reader.c +++ b/test/vds_swmr_reader.c @@ -45,8 +45,10 @@ main(void) TEST_ERROR /* Create the read buffer */ - n_elements = VDS_PLANE[1] * VDS_PLANE[2]; - size = n_elements * sizeof(int); + if(VDS_PLANE[1] * VDS_PLANE[2] > INT_MAX) + TEST_ERROR + n_elements = (int)(VDS_PLANE[1] * VDS_PLANE[2]); + size = (size_t)n_elements * sizeof(int); if(NULL == (buffer = (int *)HDmalloc(size))) TEST_ERROR diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index aebf9cf..e833a0a 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -285,61 +285,61 @@ slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], switch (mode) { case BYROW: /* Each process takes a slabs of rows. */ - block[0] = dim0 / mpi_size; - block[1] = dim1; + block[0] = (hsize_t)dim0 / (hsize_t)mpi_size; + block[1] = (hsize_t)dim1; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; - start[0] = mpi_rank * block[0]; + start[0] = (hsize_t)mpi_rank * block[0]; start[1] = 0; if (VERBOSE_MED) HDprintf("slab_set BYROW\n"); break; case BYCOL: /* Each process takes a block of columns. */ - block[0] = dim0; - block[1] = dim1 / mpi_size; + block[0] = (hsize_t)dim0; + block[1] = (hsize_t)dim1 / (hsize_t)mpi_size; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; start[0] = 0; - start[1] = mpi_rank * block[1]; + start[1] = (hsize_t)mpi_rank * block[1]; if (VERBOSE_MED) HDprintf("slab_set BYCOL\n"); break; case ZROW: /* Similar to BYROW except process 0 gets 0 row */ - block[0] = (mpi_rank ? dim0 / mpi_size : 0); - block[1] = dim1; + block[0] = (hsize_t)(mpi_rank ? dim0 / mpi_size : 0); + block[1] = (hsize_t)dim1; stride[0] = (mpi_rank ? block[0] : 1); /* avoid setting stride to 0 */ stride[1] = block[1]; count[0] = 1; count[1] = 1; - start[0] = (mpi_rank ? mpi_rank * block[0] : 0); + start[0] = (hsize_t)(mpi_rank ? (hsize_t)mpi_rank * block[0] : 0); start[1] = 0; if (VERBOSE_MED) HDprintf("slab_set ZROW\n"); break; case ZCOL: /* Similar to BYCOL except process 0 gets 0 column */ - block[0] = dim0; - block[1] = (mpi_rank ? dim1 / mpi_size : 0); + block[0] = (hsize_t)dim0; + block[1] = (hsize_t)(mpi_rank ? dim1 / mpi_size : 0); stride[0] = block[0]; stride[1] = (mpi_rank ? block[1] : 1); /* avoid setting stride to 0 */ count[0] = 1; count[1] = 1; start[0] = 0; - start[1] = (mpi_rank ? mpi_rank * block[1] : 0); + start[1] = (hsize_t)(mpi_rank ? (hsize_t)mpi_rank * block[1] : 0); if (VERBOSE_MED) HDprintf("slab_set ZCOL\n"); break; default: /* Unknown mode. Set it to cover the whole dataset. */ HDprintf("unknown slab_set mode (%d)\n", mode); - block[0] = dim0; - block[1] = dim1; + block[0] = (hsize_t)dim0; + block[1] = (hsize_t)dim1; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; @@ -732,8 +732,8 @@ dataset_writeInd(void) * and the slabs local to the MPI process. * ------------------------------------------- */ /* setup dimensionality object */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple (MAX_RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -853,9 +853,9 @@ dataset_readInd(void) MPI_Comm_rank(test_comm,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* setup file access template */ @@ -984,12 +984,12 @@ dataset_writeAll(void) MPI_Comm_rank(test_comm,&mpi_rank); /* set up the coords array selection */ - num_points = dim1; - coords = (hsize_t *)HDmalloc(dim1 * MAX_RANK * sizeof(hsize_t)); + num_points = (size_t)dim1; + coords = (hsize_t *)HDmalloc((size_t)dim1 * (size_t)MAX_RANK * sizeof(hsize_t)); VRFY((coords != NULL), "coords malloc succeeded"); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- @@ -1013,8 +1013,8 @@ dataset_writeAll(void) * and create the dataset * ------------------------- */ /* setup 2-D dimensionality object */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple (MAX_RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -1315,16 +1315,16 @@ dataset_writeAll(void) if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); block[0] = 1; - block[1] = dim1; + block[1] = (hsize_t)dim1; stride[0] = 1; - stride[1] = dim1; + stride[1] = (hsize_t)dim1; count[0] = 1; count[1] = 1; - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)dim0/(hsize_t)mpi_size * (hsize_t)mpi_rank; start[1] = 0; dataset_fill(start, block, data_array1); @@ -1371,7 +1371,7 @@ dataset_writeAll(void) /* Dataset6: point selection in File - Point selection in Memory*/ /* create a file dataspace independently */ - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)dim0/(hsize_t)mpi_size * (hsize_t)mpi_rank; start[1] = 0; point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER); file_dataspace = H5Dget_space (dataset6); @@ -1409,7 +1409,7 @@ dataset_writeAll(void) /* Dataset7: point selection in File - All selection in Memory*/ /* create a file dataspace independently */ - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)dim0/(hsize_t)mpi_size * (hsize_t)mpi_rank; start[1] = 0; point_set (start, count, stride, block, num_points, coords, IN_ORDER); file_dataspace = H5Dget_space (dataset7); @@ -1515,14 +1515,14 @@ dataset_readAll(void) MPI_Comm_rank(test_comm,&mpi_rank); /* set up the coords array selection */ - num_points = dim1; - coords = (hsize_t *)HDmalloc(dim0 * dim1 * MAX_RANK * sizeof(hsize_t)); + num_points = (size_t)dim1; + coords = (hsize_t *)HDmalloc((size_t)dim0 * (size_t)dim1 * MAX_RANK * sizeof(hsize_t)); VRFY((coords != NULL), "coords malloc succeeded"); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- @@ -1700,18 +1700,18 @@ dataset_readAll(void) if(data_array1) free(data_array1); if(data_origin1) free(data_origin1); - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); block[0] = 1; - block[1] = dim1; + block[1] = (hsize_t)dim1; stride[0] = 1; - stride[1] = dim1; + stride[1] = (hsize_t)dim1; count[0] = 1; count[1] = 1; - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)dim0/(hsize_t)mpi_size * (hsize_t)mpi_rank; start[1] = 0; dataset_fill(start, block, data_origin1); @@ -1761,12 +1761,12 @@ dataset_readAll(void) H5Pclose(xfer_plist); if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* Dataset6: point selection in File - Point selection in Memory*/ /* create a file dataspace independently */ - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)dim0/(hsize_t)mpi_size * (hsize_t)mpi_rank; start[1] = 0; point_set (start, count, stride, block, num_points, coords, IN_ORDER); file_dataspace = H5Dget_space (dataset6); @@ -1806,7 +1806,7 @@ dataset_readAll(void) H5Pclose(xfer_plist); if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* Dataset7: point selection in memory - All selection in file*/ @@ -1816,12 +1816,12 @@ dataset_readAll(void) ret = H5Sselect_all(file_dataspace); VRFY((ret >= 0), "H5Sselect_all succeeded"); - num_points = dim0 * dim1; + num_points = (size_t)dim0 * (size_t)dim1; k=0; for (i=0 ; i= 0), "H5Dread dataset7 succeeded"); - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)dim0/(hsize_t)mpi_size * (hsize_t)mpi_rank; start[1] = 0; ret = dataset_vrfy(start, count, stride, block, data_array1+(dim0/mpi_size * dim1 * mpi_rank), data_origin1); if(ret) nerrors++; @@ -1927,11 +1927,11 @@ extend_writeInd(void) MPI_Comm_rank(test_comm,&mpi_rank); /* setup chunk-size. Make sure sizes are > 0 */ - chunk_dims[0] = chunkdim0; - chunk_dims[1] = chunkdim1; + chunk_dims[0] = (hsize_t)chunkdim0; + chunk_dims[1] = (hsize_t)chunkdim1; /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- @@ -2018,8 +2018,8 @@ extend_writeInd(void) VRFY((mem_dataspace >= 0), ""); /* Extend its current dim sizes before writing */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; ret = H5Dset_extent(dataset1, dims); VRFY((ret >= 0), "H5Dset_extent succeeded"); @@ -2078,8 +2078,8 @@ extend_writeInd(void) H5Sclose(file_dataspace); /* Extend dataset2 and try again. Should succeed. */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; ret = H5Dset_extent(dataset2, dims); VRFY((ret >= 0), "H5Dset_extent succeeded"); @@ -2240,7 +2240,7 @@ extend_writeInd2(void) * Write to the second half of the dataset * -------------------------*/ for (i=0; i<(int)orig_size; i++) - written[i] = orig_size + i; + H5_CHECKED_ASSIGN(written[i], int, orig_size + (hsize_t)i, hsize_t); MESG("data array re-initialized"); if(VERBOSE_MED) { MESG("writing at offset 10: "); @@ -2315,11 +2315,11 @@ extend_readInd(void) MPI_Comm_rank(test_comm,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); - data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array2 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- @@ -2498,11 +2498,11 @@ extend_writeAll(void) MPI_Comm_rank(test_comm,&mpi_rank); /* setup chunk-size. Make sure sizes are > 0 */ - chunk_dims[0] = chunkdim0; - chunk_dims[1] = chunkdim1; + chunk_dims[0] = (hsize_t)chunkdim0; + chunk_dims[1] = (hsize_t)chunkdim1; /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- @@ -2589,8 +2589,8 @@ extend_writeAll(void) VRFY((mem_dataspace >= 0), ""); /* Extend its current dim sizes before writing */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; ret = H5Dset_extent(dataset1, dims); VRFY((ret >= 0), "H5Dset_extent succeeded"); @@ -2672,8 +2672,8 @@ extend_writeAll(void) H5Sclose(file_dataspace); /* Extend dataset2 and try again. Should succeed. */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; ret = H5Dset_extent(dataset2, dims); VRFY((ret >= 0), "H5Dset_extent succeeded"); @@ -2745,11 +2745,11 @@ extend_readAll(void) MPI_Comm_rank(test_comm,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); - data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array2 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- @@ -2917,7 +2917,7 @@ compress_readAll(void) hid_t dataspace; /* Dataspace ID */ hid_t dataset; /* Dataset ID */ int rank=1; /* Dataspace rank */ - hsize_t dim=dim0; /* Dataspace dimensions */ + hsize_t dim=(hsize_t)dim0; /* Dataspace dimensions */ unsigned u; /* Local index variable */ unsigned chunk_opts; /* Chunk options */ unsigned disable_partial_chunk_filters; /* Whether filters are disabled on partial chunks */ @@ -2945,7 +2945,7 @@ compress_readAll(void) /* Initialize data buffers */ for(u=0; u 0 */ - chunk_dims[0] = chunkdim0; - chunk_dims[1] = chunkdim1; + chunk_dims[0] = (hsize_t)chunkdim0; + chunk_dims[1] = (hsize_t)chunkdim1; /* ------------------- * START AN HDF5 FILE @@ -3160,8 +3160,8 @@ none_selection_chunk(void) VRFY((ret >= 0), "H5Pset_chunk succeeded"); /* setup dimensionality object */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple(MAX_RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -3438,8 +3438,8 @@ test_actual_io_mode(int selection_mode) { VRFY((fid >= 0), "H5Fcreate succeeded"); /* Create the basic Space */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple (MAX_RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -3450,7 +3450,7 @@ test_actual_io_mode(int selection_mode) { /* If we are not testing contiguous datasets */ if(is_chunked) { /* Set up chunk information. */ - chunk_dims[0] = dims[0]/mpi_size; + chunk_dims[0] = dims[0]/(hsize_t)mpi_size; chunk_dims[1] = dims[1]; ret = H5Pset_chunk(dcpl, 2, chunk_dims); VRFY((ret >= 0),"chunk creation property list succeeded"); @@ -3516,14 +3516,14 @@ test_actual_io_mode(int selection_mode) { slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); } else { /* Select the first and the nth chunk in the nth column */ - block[0] = dim0 / mpi_size; - block[1] = dim1 / mpi_size; + block[0] = (hsize_t)(dim0 / mpi_size); + block[1] = (hsize_t)(dim1 / mpi_size); count[0] = 2; count[1] = 1; - stride[0] = mpi_rank * block[0]; + stride[0] = (hsize_t)mpi_rank * block[0]; stride[1] = 1; start[0] = 0; - start[1] = mpi_rank*block[1]; + start[1] = (hsize_t)mpi_rank*block[1]; } test_name = "Multi Chunk - Mixed"; @@ -3554,17 +3554,17 @@ test_actual_io_mode(int selection_mode) { if(mpi_rank == 0) { /* Select the first chunk in the first column */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - block[0] = block[0] / mpi_size; + block[0] = block[0] / (hsize_t)mpi_size; } else { /* Select the first and the nth chunk in the nth column */ - block[0] = dim0 / mpi_size; - block[1] = dim1 / mpi_size; + block[0] = (hsize_t)(dim0 / mpi_size); + block[1] = (hsize_t)(dim1 / mpi_size); count[0] = 2; count[1] = 1; - stride[0] = mpi_rank * block[0]; + stride[0] = (hsize_t)mpi_rank * block[0]; stride[1] = 1; start[0] = 0; - start[1] = mpi_rank*block[1]; + start[1] = (hsize_t)mpi_rank*block[1]; } /* If the testname was not already set by the RESET case */ @@ -3637,7 +3637,7 @@ test_actual_io_mode(int selection_mode) { length = dim0 * dim1; /* Allocate and initialize the buffer */ - buffer = (int *)HDmalloc(sizeof(int) * length); + buffer = (int *)HDmalloc(sizeof(int) * (size_t)length); VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); for(i = 0; i < length; i++) buffer[i] = i; @@ -3964,8 +3964,8 @@ test_no_collective_cause_mode(int selection_mode) dims[1] = BIG_Y_FACTOR * 6; } else { - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; } sid = H5Screate_simple (MAX_RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -3987,7 +3987,7 @@ test_no_collective_cause_mode(int selection_mode) /* If we are not testing contiguous datasets */ if(is_chunked) { /* Set up chunk information. */ - chunk_dims[0] = dims[0]/mpi_size; + chunk_dims[0] = dims[0]/(hsize_t)mpi_size; chunk_dims[1] = dims[1]; ret = H5Pset_chunk(dcpl, 2, chunk_dims); VRFY((ret >= 0),"chunk creation property list succeeded"); @@ -4068,10 +4068,10 @@ test_no_collective_cause_mode(int selection_mode) } /* Get the number of elements in the selection */ - length = dims[0] * dims[1]; + H5_CHECKED_ASSIGN(length, int, dims[0] * dims[1], hsize_t); /* Allocate and initialize the buffer */ - buffer = (int *)HDmalloc(sizeof(int) * length); + buffer = (int *)HDmalloc(sizeof(int) * (size_t)length); VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); for(i = 0; i < length; i++) buffer[i] = i; @@ -4497,10 +4497,10 @@ dataset_atomicity(void) buf_size = dim0 * dim1; /* allocate memory for data buffer */ - write_buf = (int *)HDcalloc(buf_size, sizeof(int)); + write_buf = (int *)HDcalloc((size_t)buf_size, sizeof(int)); VRFY((write_buf != NULL), "write_buf HDcalloc succeeded"); /* allocate memory for data buffer */ - read_buf = (int *)HDcalloc(buf_size, sizeof(int)); + read_buf = (int *)HDcalloc((size_t)buf_size, sizeof(int)); VRFY((read_buf != NULL), "read_buf HDcalloc succeeded"); /* setup file access template */ @@ -4516,8 +4516,8 @@ dataset_atomicity(void) VRFY((ret >= 0), "H5Pclose succeeded"); /* setup dimensionality object */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple (MAX_RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -4655,10 +4655,10 @@ dataset_atomicity(void) VRFY((dataset2 >= 0), "H5Dopen2 succeeded"); /* allocate memory for data buffer */ - write_buf = (int *)HDcalloc(buf_size, sizeof(int)); + write_buf = (int *)HDcalloc((size_t)buf_size, sizeof(int)); VRFY((write_buf != NULL), "write_buf HDcalloc succeeded"); /* allocate memory for data buffer */ - read_buf = (int *)HDcalloc(buf_size, sizeof(int)); + read_buf = (int *)HDcalloc((size_t)buf_size, sizeof(int)); VRFY((read_buf != NULL), "read_buf HDcalloc succeeded"); for (i=0 ; i= mpi_rank*(block[0]+1)) { + if ((hsize_t)i >= (hsize_t)mpi_rank*(block[0]+1)) { break; } - if ((i+1)%(block[0]+1)==0) { + if (((hsize_t)i+1)%(block[0]+1)==0) { k += dim1; continue; } for (j=0 ; j= mpi_rank*(block[1]+1)) { - k += dim1 - mpi_rank*(block[1]+1); + if ((hsize_t)j >= (hsize_t)mpi_rank*(block[1]+1)) { + H5_CHECKED_ASSIGN(k, int, (hsize_t)dim1 - (hsize_t)mpi_rank*(block[1]+1) + (hsize_t)k, hsize_t); break; } - if ((j+1)%(block[1]+1)==0) { + if (((hsize_t)j+1)%(block[1]+1)==0) { k++; continue; } diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index 1bc66b5..45396de 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -249,7 +249,7 @@ ccslab_set(int mpi_rank, stride[1] = 1; count[0] = space_dim1; count[1] = space_dim2; - start[0] = mpi_rank*count[0]; + start[0] = (hsize_t)mpi_rank*count[0]; start[1] = 0; break; @@ -258,11 +258,11 @@ ccslab_set(int mpi_rank, /* Each process takes several disjoint blocks. */ block[0] = 1; block[1] = 1; - stride[0] = 3; - stride[1] = 3; - count[0] = space_dim1/(stride[0]*block[0]); - count[1] = (space_dim2)/(stride[1]*block[1]); - start[0] = space_dim1*mpi_rank; + stride[0] = 3; + 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[1] = 0; break; @@ -276,7 +276,7 @@ ccslab_set(int mpi_rank, stride[1] = 1; count[0] = ((mpi_rank >= MAX(1,(mpi_size-2)))?0:space_dim1); count[1] = space_dim2; - start[0] = mpi_rank*count[0]; + start[0] = (hsize_t)mpi_rank*count[0]; start[1] = 0; break; @@ -287,14 +287,14 @@ ccslab_set(int mpi_rank, half of the domain. */ block[0] = 1; - count[0] = 2; - stride[0] = space_dim1*mpi_size/4+1; + count[0] = 2; + stride[0] = (hsize_t)(space_dim1*(hsize_t)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] = mpi_rank; - else start[0] = 1 + space_dim1*mpi_size/2 + (mpi_rank-2*mpi_size/3); + 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); break; case BYROW_SELECTINCHUNK: @@ -302,7 +302,7 @@ ccslab_set(int mpi_rank, block[0] = 1; count[0] = 1; - start[0] = mpi_rank*space_dim1; + start[0] = (hsize_t)mpi_rank*space_dim1; stride[0]= 1; block[1] = space_dim2; count[1] = 1; @@ -313,7 +313,7 @@ ccslab_set(int mpi_rank, default: /* Unknown mode. Set it to cover the whole dataset. */ - block[0] = space_dim1*mpi_size; + block[0] = space_dim1*(hsize_t)mpi_size; block[1] = space_dim2; stride[0] = block[0]; stride[1] = block[1]; @@ -521,7 +521,7 @@ dataset_big_write(void) HDprintf("\nTesting Dataset1 write by ROW\n"); /* Create a large dataset */ dims[0] = bigcount; - dims[1] = mpi_size; + dims[1] = (hsize_t)mpi_size; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -529,13 +529,13 @@ dataset_big_write(void) VRFY((dataset >= 0), "H5Dcreate2 succeeded"); H5Sclose(sid); - block[0] = dims[0]/mpi_size; + block[0] = dims[0]/(hsize_t)mpi_size; block[1] = dims[1]; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; - start[0] = mpi_rank*block[0]; + start[0] = (hsize_t)mpi_rank*block[0]; start[1] = 0; /* create a file dataspace independently */ @@ -584,7 +584,7 @@ dataset_big_write(void) HDprintf("\nTesting Dataset2 write by COL\n"); /* Create a large dataset */ dims[0] = bigcount; - dims[1] = mpi_size; + dims[1] = (hsize_t)mpi_size; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -593,13 +593,13 @@ dataset_big_write(void) H5Sclose(sid); block[0] = dims[0]; - block[1] = dims[1]/mpi_size; + block[1] = dims[1]/(hsize_t)mpi_size; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; start[0] = 0; - start[1] = mpi_rank*block[1]; + start[1] = (hsize_t)mpi_rank*block[1]; /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset); @@ -710,7 +710,7 @@ dataset_big_write(void) HDprintf("\nTesting Dataset4 write point selection\n"); /* Create a large dataset */ dims[0] = bigcount; - dims[1] = mpi_size * 4; + dims[1] = (hsize_t)(mpi_size * 4); sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -725,7 +725,7 @@ dataset_big_write(void) count[0] = 1; count[1] = 1; start[0] = 0; - start[1] = dims[1]/mpi_size * mpi_rank; + start[1] = dims[1]/(hsize_t)mpi_size * (hsize_t)mpi_rank; num_points = bigcount; @@ -838,16 +838,16 @@ dataset_big_read(void) VRFY((dataset >= 0), "H5Dopen2 succeeded"); dims[0] = bigcount; - dims[1] = mpi_size; + dims[1] = (hsize_t)mpi_size; /* Each process takes a slabs of cols. */ block[0] = dims[0]; - block[1] = dims[1]/mpi_size; + block[1] = dims[1]/(hsize_t)mpi_size; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; start[0] = 0; - start[1] = mpi_rank*block[1]; + start[1] = (hsize_t)mpi_rank*block[1]; /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset); @@ -900,15 +900,15 @@ dataset_big_read(void) VRFY((dataset >= 0), "H5Dopen2 succeeded"); dims[0] = bigcount; - dims[1] = mpi_size; + dims[1] = (hsize_t)mpi_size; /* Each process takes a slabs of rows. */ - block[0] = dims[0]/mpi_size; + block[0] = dims[0]/(hsize_t)mpi_size; block[1] = dims[1]; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; - start[0] = mpi_rank*block[0]; + start[0] = (hsize_t)mpi_rank*block[0]; start[1] = 0; /* create a file dataspace independently */ @@ -1024,7 +1024,7 @@ dataset_big_read(void) VRFY((dataset >= 0), "H5Dopen2 succeeded"); dims[0] = bigcount; - dims[1] = mpi_size * 4; + dims[1] = (hsize_t)(mpi_size * 4); block[0] = dims[0]/2; block[1] = 2; @@ -1033,7 +1033,7 @@ dataset_big_read(void) count[0] = 1; count[1] = 1; start[0] = 0; - start[1] = dims[1]/mpi_size * mpi_rank; + start[1] = dims[1]/(hsize_t)mpi_size * (hsize_t)mpi_rank; fill_datasets(start, block, wdata); MESG("data_array initialized"); @@ -1463,7 +1463,7 @@ coll_chunktest(const char* filename, VRFY((status >= 0),""); /* setup dimensionality object */ - dims[0] = space_dim1*mpi_size; + dims[0] = space_dim1*(hsize_t)mpi_size; dims[1] = space_dim2; /* allocate memory for data buffer */ @@ -1501,7 +1501,7 @@ coll_chunktest(const char* filename, VRFY((crp_plist >= 0),""); /* Set up chunk information. */ - chunk_dims[0] = dims[0]/chunk_factor; + chunk_dims[0] = dims[0]/(hsize_t)chunk_factor; /* to decrease the testing time, maintain bigger chunk size */ (chunk_factor == 1) ? (chunk_dims[1] = space_dim2) : (chunk_dims[1] = space_dim2/2); diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 058cde6..09d2ecc 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1619,9 +1619,9 @@ serve_read_request(struct mssg_t * mssg_ptr) reply.dest = mssg_ptr->src; reply.mssg_num = -1; /* set by send function */ reply.base_addr = data[target_index].base_addr; - reply.len = data[target_index].len; + H5_CHECKED_ASSIGN(reply.len, unsigned, data[target_index].len, size_t); reply.ver = data[target_index].ver; - reply.count = 0; + reply.count = 0; reply.magic = MSSG_MAGIC; /* and update the counters */ @@ -1841,7 +1841,7 @@ serve_write_request(struct mssg_t * mssg_ptr) reply.dest = mssg_ptr->src; reply.mssg_num = -1; /* set by send function */ reply.base_addr = data[target_index].base_addr; - reply.len = data[target_index].len; + H5_CHECKED_ASSIGN(reply.len, unsigned, data[target_index].len, size_t); reply.ver = data[target_index].ver; reply.count = 0; reply.magic = MSSG_MAGIC; @@ -1927,7 +1927,7 @@ serve_total_writes_request(struct mssg_t * mssg_ptr) reply.base_addr = 0; reply.len = 0; reply.ver = 0; - reply.count = total_writes; + reply.count = (unsigned)total_writes; reply.magic = MSSG_MAGIC; } @@ -2006,7 +2006,7 @@ serve_total_reads_request(struct mssg_t * mssg_ptr) reply.base_addr = 0; reply.len = 0; reply.ver = 0; - reply.count = total_reads; + reply.count = (unsigned)total_reads; reply.magic = MSSG_MAGIC; } @@ -2100,7 +2100,7 @@ serve_entry_writes_request(struct mssg_t * mssg_ptr) reply.base_addr = target_addr; reply.len = 0; reply.ver = 0; - reply.count = data[target_index].writes; + reply.count = (unsigned)data[target_index].writes; reply.magic = MSSG_MAGIC; } } @@ -2197,7 +2197,7 @@ serve_entry_reads_request(struct mssg_t * mssg_ptr) reply.base_addr = target_addr; reply.len = 0; reply.ver = 0; - reply.count = (long)(data[target_index].reads); + reply.count = (unsigned)(data[target_index].reads); reply.magic = MSSG_MAGIC; } } @@ -2633,7 +2633,7 @@ datum_notify(H5C_notify_action_t action, void *thing) mssg.dest = world_server_mpi_rank; mssg.mssg_num = -1; /* set by send function */ mssg.base_addr = entry_ptr->base_addr; - mssg.len = entry_ptr->len; + H5_CHECKED_ASSIGN(mssg.len, unsigned, entry_ptr->len, size_t); mssg.ver = 0; /* bogus -- should be corrected by server */ mssg.count = 0; /* not used */ mssg.magic = MSSG_MAGIC; @@ -2789,7 +2789,7 @@ datum_notify(H5C_notify_action_t action, void *thing) mssg.dest = world_server_mpi_rank; mssg.mssg_num = -1; /* set by send function */ mssg.base_addr = entry_ptr->base_addr; - mssg.len = entry_ptr->len; + H5_CHECKED_ASSIGN(mssg.len, unsigned, entry_ptr->len, size_t); mssg.ver = entry_ptr->ver; mssg.count = 0; mssg.magic = MSSG_MAGIC; @@ -4667,7 +4667,7 @@ verify_entry_reads(haddr_t addr, } } else { - reported_entry_reads = mssg.count; + H5_CHECKED_ASSIGN(reported_entry_reads, int, mssg.count, unsigned); } } @@ -4774,7 +4774,7 @@ verify_entry_writes(haddr_t addr, } } else { - reported_entry_writes = mssg.count; + H5_CHECKED_ASSIGN(reported_entry_writes, int, mssg.count, unsigned); } } @@ -5230,7 +5230,7 @@ server_smoke_check(void) mssg.dest = world_server_mpi_rank; mssg.mssg_num = -1; /* set by send function */ mssg.base_addr = data[world_mpi_rank].base_addr; - mssg.len = data[world_mpi_rank].len; + H5_CHECKED_ASSIGN(mssg.len, unsigned, data[world_mpi_rank].len, size_t); mssg.ver = ++(data[world_mpi_rank].ver); mssg.count = 0; mssg.magic = MSSG_MAGIC; @@ -5335,7 +5335,7 @@ server_smoke_check(void) mssg.dest = world_server_mpi_rank; mssg.mssg_num = -1; /* set by send function */ mssg.base_addr = data[world_mpi_rank].base_addr; - mssg.len = data[world_mpi_rank].len; + H5_CHECKED_ASSIGN(mssg.len, unsigned, data[world_mpi_rank].len, size_t); mssg.ver = 0; /* bogus -- should be corrected by server */ mssg.count = 0; mssg.magic = MSSG_MAGIC; @@ -7265,7 +7265,8 @@ smoke_check_6(int metadata_write_strategy) } /* Make sure coll entries do not cross the 80% threshold */ - HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + H5_CHECK_OVERFLOW(cache_ptr->max_cache_size, size_t, double); + HDassert((double)cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); } /* insert the other half independently */ @@ -7286,7 +7287,7 @@ smoke_check_6(int metadata_write_strategy) } /* Make sure coll entries do not cross the 80% threshold */ - HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + HDassert((double)cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); } /* flush the file */ @@ -7316,7 +7317,7 @@ smoke_check_6(int metadata_write_strategy) } /* Make sure coll entries do not cross the 80% threshold */ - HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + HDassert((double)cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); } /* protect the other half independently */ @@ -7337,7 +7338,7 @@ smoke_check_6(int metadata_write_strategy) } /* Make sure coll entries do not cross the 80% threshold */ - HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + HDassert((double)cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); } for ( i = 0; i < (virt_num_data_entries); i++ ) diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c index bfa0bfe..e6df2d8 100644 --- a/testpar/t_chunk_alloc.c +++ b/testpar/t_chunk_alloc.c @@ -95,7 +95,7 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ /* Only MAINPROCESS should create the file. Others just wait. */ if (MAINPROCESS){ nchunks=chunk_factor*mpi_size; - dims[0]=nchunks*CHUNK_SIZE; + dims[0]=(hsize_t)(nchunks*CHUNK_SIZE); /* Create the data space with unlimited dimensions. */ dataspace = H5Screate_simple (1, dims, maxdims); VRFY((dataspace >= 0), ""); @@ -127,7 +127,7 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ count[0] = 1; stride[0] = 1; block[0] = chunk_dims[0]; - offset[0] = (nchunks-2)*chunk_dims[0]; + offset[0] = (hsize_t)(nchunks-2)*chunk_dims[0]; hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block); VRFY((hrc >= 0), ""); @@ -157,7 +157,7 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ /* verify file size */ filesize = get_filesize(filename); - est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char); + est_filesize = (MPI_Offset)nchunks * (MPI_Offset)CHUNK_SIZE * (MPI_Offset)sizeof(unsigned char); VRFY((filesize >= est_filesize), "file size check"); } @@ -233,7 +233,7 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti dataspace = H5Dget_space(*dataset); VRFY((dataspace >= 0), ""); - size[0] = nchunks*CHUNK_SIZE; + size[0] = (hsize_t)nchunks*CHUNK_SIZE; switch (action) { @@ -245,7 +245,7 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti stride[0] = 1; block[0] = chunk_dims[0]; for (i=0; i= 0), ""); @@ -294,7 +294,7 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti /* verify file size */ filesize = get_filesize(filename); - est_filesize = nchunks*CHUNK_SIZE*sizeof(unsigned char); + est_filesize = (MPI_Offset)nchunks*(MPI_Offset)CHUNK_SIZE*(MPI_Offset)sizeof(unsigned char); VRFY((filesize >= est_filesize), "file size check"); /* Can close some plists */ @@ -374,7 +374,7 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in /* reset buffer values */ HDmemset(buffer, -1, CHUNK_SIZE); - offset[0] = i*chunk_dims[0]; + offset[0] = (hsize_t)i*chunk_dims[0]; hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block); VRFY((hrc >= 0), ""); diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 2d758ba..e950015 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -637,7 +637,7 @@ coll_chunktest(const char* filename, VRFY((status >= 0),""); /* setup dimensionality object */ - dims[0] = SPACE_DIM1*mpi_size; + dims[0] = (hsize_t)(SPACE_DIM1*mpi_size); dims[1] = SPACE_DIM2; /* allocate memory for data buffer */ @@ -670,7 +670,7 @@ coll_chunktest(const char* filename, VRFY((crp_plist >= 0),""); /* Set up chunk information. */ - chunk_dims[0] = dims[0]/chunk_factor; + chunk_dims[0] = dims[0]/(hsize_t)chunk_factor; /* to decrease the testing time, maintain bigger chunk size */ (chunk_factor == 1) ? (chunk_dims[1] = SPACE_DIM2) : (chunk_dims[1] = SPACE_DIM2/2); @@ -1057,7 +1057,7 @@ ccslab_set(int mpi_rank, stride[1] = 1; count[0] = SPACE_DIM1; count[1] = SPACE_DIM2; - start[0] = mpi_rank*count[0]; + start[0] = (hsize_t)mpi_rank*count[0]; start[1] = 0; break; @@ -1066,11 +1066,11 @@ ccslab_set(int mpi_rank, /* Each process takes several disjoint blocks. */ block[0] = 1; block[1] = 1; - stride[0] = 3; - stride[1] = 3; - count[0] = SPACE_DIM1/(stride[0]*block[0]); - count[1] = (SPACE_DIM2)/(stride[1]*block[1]); - start[0] = SPACE_DIM1*mpi_rank; + stride[0] = 3; + stride[1] = 3; + count[0] = SPACE_DIM1/(stride[0]*block[0]); + count[1] = (SPACE_DIM2)/(stride[1]*block[1]); + start[0] = (hsize_t)SPACE_DIM1*(hsize_t)mpi_rank; start[1] = 0; break; @@ -1084,7 +1084,7 @@ ccslab_set(int mpi_rank, stride[1] = 1; count[0] = ((mpi_rank >= MAX(1,(mpi_size-2)))?0:SPACE_DIM1); count[1] = SPACE_DIM2; - start[0] = mpi_rank*count[0]; + start[0] = (hsize_t)mpi_rank*count[0]; start[1] = 0; break; @@ -1095,14 +1095,14 @@ ccslab_set(int mpi_rank, half of the domain. */ block[0] = 1; - count[0] = 2; - stride[0] = SPACE_DIM1*mpi_size/4+1; + count[0] = 2; + stride[0] = (hsize_t)SPACE_DIM1*(hsize_t)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] = mpi_rank; - else start[0] = 1 + SPACE_DIM1*mpi_size/2 + (mpi_rank-2*mpi_size/3); + if((mpi_rank *3)<(mpi_size*2)) start[0] = (hsize_t)mpi_rank; + else start[0] = (hsize_t)(1 + SPACE_DIM1*mpi_size/2 + (mpi_rank-2*mpi_size/3)); break; case BYROW_SELECTINCHUNK: @@ -1110,7 +1110,7 @@ ccslab_set(int mpi_rank, block[0] = 1; count[0] = 1; - start[0] = mpi_rank*SPACE_DIM1; + start[0] = (hsize_t)(mpi_rank*SPACE_DIM1); stride[0]= 1; block[1] = SPACE_DIM2; count[1] = 1; @@ -1121,7 +1121,7 @@ ccslab_set(int mpi_rank, default: /* Unknown mode. Set it to cover the whole dataset. */ - block[0] = SPACE_DIM1*mpi_size; + block[0] = (hsize_t)SPACE_DIM1*(hsize_t)mpi_size; block[1] = SPACE_DIM2; stride[0] = block[0]; stride[1] = block[1]; diff --git a/testpar/t_coll_md_read.c b/testpar/t_coll_md_read.c index c0fe04b..d4b2106 100644 --- a/testpar/t_coll_md_read.c +++ b/testpar/t_coll_md_read.c @@ -96,8 +96,8 @@ void test_partial_no_selection_coll_md_read(void) dataset_dims = HDmalloc(PARTIAL_NO_SELECTION_DATASET_NDIMS * sizeof(*dataset_dims)); VRFY((dataset_dims != NULL), "malloc succeeded"); - dataset_dims[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE * mpi_size; - dataset_dims[1] = PARTIAL_NO_SELECTION_X_DIM_SCALE * mpi_size; + dataset_dims[0] = (hsize_t)PARTIAL_NO_SELECTION_Y_DIM_SCALE * (hsize_t)mpi_size; + dataset_dims[1] = (hsize_t)PARTIAL_NO_SELECTION_X_DIM_SCALE * (hsize_t)mpi_size; max_dataset_dims[0] = H5S_UNLIMITED; max_dataset_dims[1] = H5S_UNLIMITED; @@ -120,12 +120,12 @@ void test_partial_no_selection_coll_md_read(void) * * The ranks will write rows across the dataset. */ - start[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE * mpi_rank; + start[0] = (hsize_t)PARTIAL_NO_SELECTION_Y_DIM_SCALE * (hsize_t)mpi_rank; start[1] = 0; stride[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE; stride[1] = PARTIAL_NO_SELECTION_X_DIM_SCALE; count[0] = 1; - count[1] = mpi_size; + count[1] = (hsize_t)mpi_size; block[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE; block[1] = PARTIAL_NO_SELECTION_X_DIM_SCALE; @@ -405,7 +405,7 @@ void test_link_chunk_io_sort_chunk_issue(void) dataset_dims = HDmalloc(LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS * sizeof(*dataset_dims)); VRFY((dataset_dims != NULL), "malloc succeeded"); - dataset_dims[0] = LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE * mpi_size * LINK_CHUNK_IO_SORT_CHUNK_ISSUE_Y_DIM_SCALE; + dataset_dims[0] = (hsize_t)LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE * (hsize_t)mpi_size * (hsize_t)LINK_CHUNK_IO_SORT_CHUNK_ISSUE_Y_DIM_SCALE; max_dataset_dims[0] = H5S_UNLIMITED; fspace_id = H5Screate_simple(LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS, dataset_dims, max_dataset_dims); @@ -428,8 +428,8 @@ void test_link_chunk_io_sort_chunk_issue(void) * The ranks will write rows across the dataset. */ stride[0] = LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE; - count[0] = (dataset_dims[0] / LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE) / mpi_size; - start[0] = count[0] * mpi_rank; + count[0] = (dataset_dims[0] / LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE) / (hsize_t)mpi_size; + start[0] = count[0] * (hsize_t)mpi_rank; block[0] = LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE; VRFY((H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, stride, count, block) >= 0), "H5Sselect_hyperslab succeeded"); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 87782d0..05baf3f 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -48,61 +48,61 @@ slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], switch (mode) { case BYROW: /* Each process takes a slabs of rows. */ - block[0] = dim0 / mpi_size; - block[1] = dim1; + block[0] = (hsize_t)(dim0 / mpi_size); + block[1] = (hsize_t)dim1; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; - start[0] = mpi_rank * block[0]; + start[0] = (hsize_t)mpi_rank * block[0]; start[1] = 0; if (VERBOSE_MED) HDprintf("slab_set BYROW\n"); break; case BYCOL: /* Each process takes a block of columns. */ - block[0] = dim0; - block[1] = dim1 / mpi_size; + block[0] = (hsize_t)dim0; + block[1] = (hsize_t)(dim1 / mpi_size); stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; start[0] = 0; - start[1] = mpi_rank * block[1]; + start[1] = (hsize_t)mpi_rank * block[1]; if (VERBOSE_MED) HDprintf("slab_set BYCOL\n"); break; case ZROW: /* Similar to BYROW except process 0 gets 0 row */ - block[0] = (mpi_rank ? dim0 / mpi_size : 0); - block[1] = dim1; + block[0] = (hsize_t)(mpi_rank ? dim0 / mpi_size : 0); + block[1] = (hsize_t)dim1; stride[0] = (mpi_rank ? block[0] : 1); /* avoid setting stride to 0 */ stride[1] = block[1]; count[0] = 1; count[1] = 1; - start[0] = (mpi_rank ? mpi_rank * block[0] : 0); + start[0] = (hsize_t)(mpi_rank ? (hsize_t)mpi_rank * block[0] : 0); start[1] = 0; if (VERBOSE_MED) HDprintf("slab_set ZROW\n"); break; case ZCOL: /* Similar to BYCOL except process 0 gets 0 column */ - block[0] = dim0; - block[1] = (mpi_rank ? dim1 / mpi_size : 0); + block[0] = (hsize_t)dim0; + block[1] = (hsize_t)(mpi_rank ? dim1 / mpi_size : 0); stride[0] = block[0]; stride[1] = (mpi_rank ? block[1] : 1); /* avoid setting stride to 0 */ count[0] = 1; count[1] = 1; start[0] = 0; - start[1] = (mpi_rank ? mpi_rank * block[1] : 0); + start[1] = (hsize_t)(mpi_rank ? (hsize_t)mpi_rank * block[1] : 0); if (VERBOSE_MED) HDprintf("slab_set ZCOL\n"); break; default: /* Unknown mode. Set it to cover the whole dataset. */ HDprintf("unknown slab_set mode (%d)\n", mode); - block[0] = dim0; - block[1] = dim1; + block[0] = (hsize_t)dim0; + block[1] = (hsize_t)dim1; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; @@ -308,7 +308,7 @@ dataset_writeInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ---------------------------------------- @@ -332,8 +332,8 @@ dataset_writeInd(void) * and the slabs local to the MPI process. * ------------------------------------------- */ /* setup dimensionality object */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -453,9 +453,9 @@ dataset_readInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* setup file access template */ @@ -583,12 +583,12 @@ dataset_writeAll(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* set up the coords array selection */ - num_points = dim1; - coords = (hsize_t *)HDmalloc(dim1 * RANK * sizeof(hsize_t)); + num_points = (size_t)dim1; + coords = (hsize_t *)HDmalloc((size_t)dim1 * (size_t)RANK * sizeof(hsize_t)); VRFY((coords != NULL), "coords malloc succeeded"); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- @@ -612,8 +612,8 @@ dataset_writeAll(void) * and create the dataset * ------------------------- */ /* setup 2-D dimensionality object */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -914,16 +914,16 @@ dataset_writeAll(void) if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); block[0] = 1; - block[1] = dim1; + block[1] = (hsize_t)dim1; stride[0] = 1; - stride[1] = dim1; + stride[1] = (hsize_t)dim1; count[0] = 1; count[1] = 1; - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)(dim0/mpi_size * mpi_rank); start[1] = 0; dataset_fill(start, block, data_array1); @@ -970,7 +970,7 @@ dataset_writeAll(void) /* Dataset6: point selection in File - Point selection in Memory*/ /* create a file dataspace independently */ - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)(dim0/mpi_size * mpi_rank); start[1] = 0; point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER); file_dataspace = H5Dget_space (dataset6); @@ -1008,7 +1008,7 @@ dataset_writeAll(void) /* Dataset7: point selection in File - All selection in Memory*/ /* create a file dataspace independently */ - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)(dim0/mpi_size * mpi_rank); start[1] = 0; point_set (start, count, stride, block, num_points, coords, IN_ORDER); file_dataspace = H5Dget_space (dataset7); @@ -1114,14 +1114,14 @@ dataset_readAll(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* set up the coords array selection */ - num_points = dim1; - coords = (hsize_t *)HDmalloc(dim0 * dim1 * RANK * sizeof(hsize_t)); + num_points = (size_t)dim1; + coords = (hsize_t *)HDmalloc((size_t)dim0 * (size_t)dim1 * (size_t)RANK * sizeof(hsize_t)); VRFY((coords != NULL), "coords malloc succeeded"); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- @@ -1299,18 +1299,18 @@ dataset_readAll(void) if(data_array1) free(data_array1); if(data_origin1) free(data_origin1); - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); block[0] = 1; - block[1] = dim1; + block[1] = (hsize_t)dim1; stride[0] = 1; - stride[1] = dim1; + stride[1] = (hsize_t)dim1; count[0] = 1; count[1] = 1; - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)(dim0/mpi_size * mpi_rank); start[1] = 0; dataset_fill(start, block, data_origin1); @@ -1361,12 +1361,12 @@ dataset_readAll(void) if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* Dataset6: point selection in File - Point selection in Memory*/ /* create a file dataspace independently */ - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)(dim0/mpi_size * mpi_rank); start[1] = 0; point_set (start, count, stride, block, num_points, coords, IN_ORDER); file_dataspace = H5Dget_space (dataset6); @@ -1406,7 +1406,7 @@ dataset_readAll(void) H5Pclose(xfer_plist); if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* Dataset7: point selection in memory - All selection in file*/ @@ -1416,12 +1416,12 @@ dataset_readAll(void) ret = H5Sselect_all(file_dataspace); VRFY((ret >= 0), "H5Sselect_all succeeded"); - num_points = dim0 * dim1; + H5_CHECKED_ASSIGN(num_points, size_t, dim0 * dim1, int); k=0; for (i=0 ; i= 0), "H5Dread dataset7 succeeded"); - start[0] = dim0/mpi_size * mpi_rank; + start[0] = (hsize_t)(dim0/mpi_size * mpi_rank); start[1] = 0; ret = dataset_vrfy(start, count, stride, block, data_array1+(dim0/mpi_size * dim1 * mpi_rank), data_origin1); if(ret) nerrors++; @@ -1527,11 +1527,11 @@ extend_writeInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* setup chunk-size. Make sure sizes are > 0 */ - chunk_dims[0] = chunkdim0; - chunk_dims[1] = chunkdim1; + chunk_dims[0] = (hsize_t)chunkdim0; + chunk_dims[1] = (hsize_t)chunkdim1; /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- @@ -1618,8 +1618,8 @@ extend_writeInd(void) VRFY((mem_dataspace >= 0), ""); /* Extend its current dim sizes before writing */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; ret = H5Dset_extent(dataset1, dims); VRFY((ret >= 0), "H5Dset_extent succeeded"); @@ -1678,8 +1678,8 @@ extend_writeInd(void) H5Sclose(file_dataspace); /* Extend dataset2 and try again. Should succeed. */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; ret = H5Dset_extent(dataset2, dims); VRFY((ret >= 0), "H5Dset_extent succeeded"); @@ -1840,7 +1840,7 @@ extend_writeInd2(void) * Write to the second half of the dataset * -------------------------*/ for (i=0; i<(int)orig_size; i++) - written[i] = orig_size + i; + written[i] = (int)orig_size + i; MESG("data array re-initialized"); if(VERBOSE_MED) { MESG("writing at offset 10: "); @@ -1915,11 +1915,11 @@ extend_readInd(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); - data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array2 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- @@ -2098,11 +2098,11 @@ extend_writeAll(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* setup chunk-size. Make sure sizes are > 0 */ - chunk_dims[0] = chunkdim0; - chunk_dims[1] = chunkdim1; + chunk_dims[0] = (hsize_t)chunkdim0; + chunk_dims[1] = (hsize_t)chunkdim1; /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); /* ------------------- @@ -2189,8 +2189,8 @@ extend_writeAll(void) VRFY((mem_dataspace >= 0), ""); /* Extend its current dim sizes before writing */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; ret = H5Dset_extent(dataset1, dims); VRFY((ret >= 0), "H5Dset_extent succeeded"); @@ -2272,8 +2272,8 @@ extend_writeAll(void) H5Sclose(file_dataspace); /* Extend dataset2 and try again. Should succeed. */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; ret = H5Dset_extent(dataset2, dims); VRFY((ret >= 0), "H5Dset_extent succeeded"); @@ -2345,11 +2345,11 @@ extend_readAll(void) MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded"); - data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_array2 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded"); - data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc((size_t)dim0*(size_t)dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded"); /* ------------------- @@ -2517,7 +2517,7 @@ compress_readAll(void) hid_t dataspace; /* Dataspace ID */ hid_t dataset; /* Dataset ID */ int rank=1; /* Dataspace rank */ - hsize_t dim=dim0; /* Dataspace dimensions */ + hsize_t dim=(hsize_t)dim0; /* Dataspace dimensions */ unsigned u; /* Local index variable */ unsigned chunk_opts; /* Chunk options */ unsigned disable_partial_chunk_filters; /* Whether filters are disabled on partial chunks */ @@ -2545,7 +2545,7 @@ compress_readAll(void) /* Initialize data buffers */ for(u=0; u 0 */ - chunk_dims[0] = chunkdim0; - chunk_dims[1] = chunkdim1; + chunk_dims[0] = (hsize_t)chunkdim0; + chunk_dims[1] = (hsize_t)chunkdim1; /* ------------------- * START AN HDF5 FILE @@ -2760,8 +2760,8 @@ none_selection_chunk(void) VRFY((ret >= 0), "H5Pset_chunk succeeded"); /* setup dimensionality object */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple(RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -3038,8 +3038,8 @@ test_actual_io_mode(int selection_mode) { VRFY((fid >= 0), "H5Fcreate succeeded"); /* Create the basic Space */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -3050,7 +3050,7 @@ test_actual_io_mode(int selection_mode) { /* If we are not testing contiguous datasets */ if(is_chunked) { /* Set up chunk information. */ - chunk_dims[0] = dims[0]/mpi_size; + chunk_dims[0] = dims[0]/(hsize_t)mpi_size; chunk_dims[1] = dims[1]; ret = H5Pset_chunk(dcpl, 2, chunk_dims); VRFY((ret >= 0),"chunk creation property list succeeded"); @@ -3116,14 +3116,14 @@ test_actual_io_mode(int selection_mode) { slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); } else { /* Select the first and the nth chunk in the nth column */ - block[0] = dim0 / mpi_size; - block[1] = dim1 / mpi_size; + block[0] = (hsize_t)(dim0 / mpi_size); + block[1] = (hsize_t)(dim1 / mpi_size); count[0] = 2; count[1] = 1; - stride[0] = mpi_rank * block[0]; + stride[0] = (hsize_t)mpi_rank * block[0]; stride[1] = 1; start[0] = 0; - start[1] = mpi_rank*block[1]; + start[1] = (hsize_t)mpi_rank*block[1]; } test_name = "Multi Chunk - Mixed"; @@ -3154,17 +3154,17 @@ test_actual_io_mode(int selection_mode) { if(mpi_rank == 0) { /* Select the first chunk in the first column */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - block[0] = block[0] / mpi_size; + block[0] = block[0] / (hsize_t)mpi_size; } else { /* Select the first and the nth chunk in the nth column */ - block[0] = dim0 / mpi_size; - block[1] = dim1 / mpi_size; + block[0] = (hsize_t)(dim0 / mpi_size); + block[1] = (hsize_t)(dim1 / mpi_size); count[0] = 2; count[1] = 1; - stride[0] = mpi_rank * block[0]; + stride[0] = (hsize_t)mpi_rank * block[0]; stride[1] = 1; start[0] = 0; - start[1] = mpi_rank*block[1]; + start[1] = (hsize_t)mpi_rank*block[1]; } /* If the testname was not already set by the RESET case */ @@ -3237,7 +3237,7 @@ test_actual_io_mode(int selection_mode) { length = dim0 * dim1; /* Allocate and initialize the buffer */ - buffer = (int *)HDmalloc(sizeof(int) * length); + buffer = (int *)HDmalloc(sizeof(int) * (size_t)length); VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); for(i = 0; i < length; i++) buffer[i] = i; @@ -3566,8 +3566,8 @@ test_no_collective_cause_mode(int selection_mode) dims[1] = COL_FACTOR * 6; } else { - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; } sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -3589,7 +3589,7 @@ test_no_collective_cause_mode(int selection_mode) /* If we are not testing contiguous datasets */ if(is_chunked) { /* Set up chunk information. */ - chunk_dims[0] = dims[0]/mpi_size; + chunk_dims[0] = dims[0]/(hsize_t)mpi_size; chunk_dims[1] = dims[1]; ret = H5Pset_chunk(dcpl, 2, chunk_dims); VRFY((ret >= 0),"chunk creation property list succeeded"); @@ -3670,10 +3670,10 @@ test_no_collective_cause_mode(int selection_mode) } /* Get the number of elements in the selection */ - length = dims[0] * dims[1]; + H5_CHECKED_ASSIGN(length, int, dims[0] * dims[1], uint64_t); /* Allocate and initialize the buffer */ - buffer = (int *)HDmalloc(sizeof(int) * length); + buffer = (int *)HDmalloc(sizeof(int) * (size_t)length); VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); for(i = 0; i < length; i++) buffer[i] = i; @@ -3864,8 +3864,8 @@ test_no_collective_cause_mode_filter(int selection_mode) } /* Create the basic Space */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -3883,7 +3883,7 @@ test_no_collective_cause_mode_filter(int selection_mode) /* If we are not testing contiguous datasets */ if(is_chunked) { /* Set up chunk information. */ - chunk_dims[0] = dims[0]/mpi_size; + chunk_dims[0] = dims[0]/(hsize_t)mpi_size; chunk_dims[1] = dims[1]; ret = H5Pset_chunk(dcpl, 2, chunk_dims); VRFY((ret >= 0),"chunk creation property list succeeded"); @@ -3913,7 +3913,7 @@ test_no_collective_cause_mode_filter(int selection_mode) length = dim0 * dim1; /* Allocate and initialize the buffer */ - buffer = (int *)HDmalloc(sizeof(int) * length); + buffer = (int *)HDmalloc(sizeof(int) * (size_t)length); VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); for(i = 0; i < length; i++) buffer[i] = i; @@ -4099,10 +4099,10 @@ dataset_atomicity(void) buf_size = dim0 * dim1; /* allocate memory for data buffer */ - write_buf = (int *)HDcalloc(buf_size, sizeof(int)); + write_buf = (int *)HDcalloc((size_t)buf_size, sizeof(int)); VRFY((write_buf != NULL), "write_buf HDcalloc succeeded"); /* allocate memory for data buffer */ - read_buf = (int *)HDcalloc(buf_size, sizeof(int)); + read_buf = (int *)HDcalloc((size_t)buf_size, sizeof(int)); VRFY((read_buf != NULL), "read_buf HDcalloc succeeded"); /* setup file access template */ @@ -4118,8 +4118,8 @@ dataset_atomicity(void) VRFY((ret >= 0), "H5Pclose succeeded"); /* setup dimensionality object */ - dims[0] = dim0; - dims[1] = dim1; + dims[0] = (hsize_t)dim0; + dims[1] = (hsize_t)dim1; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -4257,10 +4257,10 @@ dataset_atomicity(void) VRFY((dataset2 >= 0), "H5Dopen2 succeeded"); /* allocate memory for data buffer */ - write_buf = (int *)HDcalloc(buf_size, sizeof(int)); + write_buf = (int *)HDcalloc((size_t)buf_size, sizeof(int)); VRFY((write_buf != NULL), "write_buf HDcalloc succeeded"); /* allocate memory for data buffer */ - read_buf = (int *)HDcalloc(buf_size, sizeof(int)); + read_buf = (int *)HDcalloc((size_t)buf_size, sizeof(int)); VRFY((read_buf != NULL), "read_buf HDcalloc succeeded"); for (i=0 ; i= mpi_rank*(block[0]+1)) { + if ((hsize_t)i >= (hsize_t)mpi_rank*(block[0]+1)) { break; } - if ((i+1)%(block[0]+1)==0) { + if (((hsize_t)i+1)%(block[0]+1)==0) { k += dim1; continue; } for (j=0 ; j= mpi_rank*(block[1]+1)) { - k += dim1 - mpi_rank*(block[1]+1); + if ((hsize_t)j >= (hsize_t)mpi_rank*(block[1]+1)) { + H5_CHECKED_ASSIGN(k, int, (hsize_t)dim1 - (hsize_t)mpi_rank*(block[1]+1), hsize_t); break; } - if ((j+1)%(block[1]+1)==0) { + if (((hsize_t)j+1)%(block[1]+1)==0) { k++; continue; } diff --git a/testpar/t_file.c b/testpar/t_file.c index 99ac189..6183b8d 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -471,19 +471,19 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str grp_id = H5Gcreate2(file_id, "GROUP", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((grp_id >= 0), ""); - dims[0] = ROW_FACTOR*mpi_size; - dims[1] = COL_FACTOR*mpi_size; + dims[0] = (hsize_t)(ROW_FACTOR*mpi_size); + dims[1] = (hsize_t)(COL_FACTOR*mpi_size); sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); /* Each process takes a slabs of rows. */ - block[0] = dims[0]/mpi_size; + block[0] = dims[0]/(hsize_t)mpi_size; block[1] = dims[1]; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; - start[0] = mpi_rank*block[0]; + start[0] = (hsize_t)mpi_rank*block[0]; start[1] = 0; num_elements = block[0] * block[1]; @@ -632,17 +632,17 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, grp_id = H5Gopen2(file_id, "GROUP", H5P_DEFAULT); VRFY((grp_id >= 0), ""); - dims[0] = ROW_FACTOR*mpi_size; - dims[1] = COL_FACTOR*mpi_size; + dims[0] = (hsize_t)(ROW_FACTOR*mpi_size); + dims[1] = (hsize_t)(COL_FACTOR*mpi_size); /* Each process takes a slabs of rows. */ - block[0] = dims[0]/mpi_size; + block[0] = dims[0]/(hsize_t)mpi_size; block[1] = dims[1]; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; - start[0] = mpi_rank*block[0]; + start[0] = (hsize_t)mpi_rank*block[0]; start[1] = 0; num_elements = block[0] * block[1]; diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c index cabb51e..7b0e677 100644 --- a/testpar/t_filter_read.c +++ b/testpar/t_filter_read.c @@ -74,10 +74,10 @@ filter_read_internal(const char *filename, hid_t dcpl, hs_size[0] = size[0] = HS_DIM1; hs_size[1] = HS_DIM2; - size[1] = hs_size[1] * mpi_size; + size[1] = hs_size[1] * (hsize_t)mpi_size; hs_offset[0] = 0; - hs_offset[1] = hs_size[1] * mpi_rank; + hs_offset[1] = hs_size[1] * (hsize_t)mpi_rank; /* Create the data space */ sid = H5Screate_simple(2, size, NULL); diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index ee868ee..6cdb0af7 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -157,11 +157,12 @@ void multiple_dset_write(void) ndatasets = pt->count; size = get_size(); + H5_CHECK_OVERFLOW(size, int, size_t); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - outme = HDmalloc((size_t)(size * size * sizeof(double))); + outme = HDmalloc((size_t)size * (size_t)size * sizeof(double)); VRFY((outme != NULL), "HDmalloc succeeded for outme"); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); @@ -238,15 +239,15 @@ void compact_dataset(void) size = get_size(); for(i = 0; i < DIM; i++ ) - file_dims[i] = size; + file_dims[i] = (hsize_t)size; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - outme = HDmalloc((size_t)(size * size * sizeof(double))); + outme = HDmalloc((size_t)((size_t)size * (size_t)size * sizeof(double))); VRFY((outme != NULL), "HDmalloc succeeded for outme"); - inme = HDmalloc((size_t)(size * size * sizeof(double))); + inme = HDmalloc((size_t)size * (size_t)size * sizeof(double)); VRFY((outme != NULL), "HDmalloc succeeded for inme"); filename = GetTestParameters(); @@ -363,7 +364,7 @@ void null_dataset(void) hid_t iof, plist, dxpl, dataset, attr, sid; unsigned uval=2; /* Buffer for writing to dataset */ int val=1; /* Buffer for writing to attribute */ - int nelem; + hssize_t nelem; char dname[]="dataset"; char attr_name[]="attribute"; herr_t ret; @@ -627,7 +628,7 @@ void dataset_fillvalue(void) /* Set the dataset dimension to be one row more than number of processes */ /* and calculate the actual dataset size. */ - dset_dims[0]=mpi_size+1; + dset_dims[0]=(hsize_t)(mpi_size+1); dset_size=dset_dims[0]*dset_dims[1]*dset_dims[2]*dset_dims[3]; /* Allocate space for the buffers */ @@ -720,7 +721,7 @@ void dataset_fillvalue(void) * Each process writes 1 row of data. Thus last row is not written. */ /* Create hyperslabs in memory and file dataspaces */ - req_start[0]=mpi_rank; + req_start[0]=(hsize_t)mpi_rank; ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, req_start, NULL, req_count, NULL); VRFY((ret >= 0), "H5Sselect_hyperslab succeeded on memory dataspace"); ret = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, req_start, NULL, req_count, NULL); @@ -878,7 +879,7 @@ void collective_group_write(void) chunk_size[0] =(hsize_t)(size / 2); chunk_size[1] =(hsize_t)(size / 2); - outme = HDmalloc((size_t)(size * size * sizeof(DATATYPE))); + outme = HDmalloc((size_t)size * (size_t)size * sizeof(DATATYPE)); VRFY((outme != NULL), "HDmalloc succeeded for outme"); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); @@ -1002,10 +1003,10 @@ group_dataset_read(hid_t fid, int mpi_rank, int m) size = get_size(); - indata =(DATATYPE*)HDmalloc((size_t)(size * size * sizeof(DATATYPE))); + indata =(DATATYPE*)HDmalloc((size_t)size * (size_t)size * sizeof(DATATYPE)); VRFY((indata != NULL), "HDmalloc succeeded for indata"); - outdata =(DATATYPE*)HDmalloc((size_t)(size * size * sizeof(DATATYPE))); + outdata =(DATATYPE*)HDmalloc((size_t)size * (size_t)size * sizeof(DATATYPE)); VRFY((outdata != NULL), "HDmalloc succeeded for outdata"); /* open every group under root group. */ @@ -1173,7 +1174,7 @@ write_dataset(hid_t memspace, hid_t filespace, hid_t gid) size = get_size(); - outme = HDmalloc((size_t)(size * size * sizeof(double))); + outme = HDmalloc((size_t)size * (size_t)size * sizeof(double)); VRFY((outme != NULL), "HDmalloc succeeded for outme"); for(n = 0; n < NDATASET; n++) { @@ -1333,10 +1334,10 @@ read_dataset(hid_t memspace, hid_t filespace, hid_t gid) size = get_size(); - indata =(DATATYPE*)HDmalloc((size_t)(size * size * sizeof(DATATYPE))); + indata =(DATATYPE*)HDmalloc((size_t)size * (size_t)size * sizeof(DATATYPE)); VRFY((indata != NULL), "HDmalloc succeeded for indata"); - outdata =(DATATYPE*)HDmalloc((size_t)(size * size * sizeof(DATATYPE))); + outdata =(DATATYPE*)HDmalloc((size_t)size * (size_t)size * sizeof(DATATYPE)); VRFY((outdata != NULL), "HDmalloc succeeded for outdata"); for(n=0; n= 0), "H5Gcreate succeeded"); - dims[0] = ROW_FACTOR*mpi_size; - dims[1] = COL_FACTOR*mpi_size; + dims[0] = (hsize_t)ROW_FACTOR*(hsize_t)mpi_size; + dims[1] = (hsize_t)COL_FACTOR*(hsize_t)mpi_size; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); @@ -81,13 +81,13 @@ main (int argc, char **argv) VRFY((data_array != NULL), "data_array HDmalloc succeeded"); /* Each process takes a slabs of rows. */ - block[0] = dims[0]/mpi_size; + block[0] = dims[0]/(hsize_t)mpi_size; block[1] = dims[1]; stride[0] = block[0]; stride[1] = block[1]; count[0] = 1; count[1] = 1; - start[0] = mpi_rank*block[0]; + start[0] = (hsize_t)mpi_rank*block[0]; start[1] = 0; /* put some trivial data in the data_array */ diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index c3cc7b5..e1a86a1 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -246,19 +246,19 @@ void coll_write_test(int chunk_factor) * Buffers' initialization. */ - mdim1[0] = MSPACE1_DIM *mpi_size; + mdim1[0] = (hsize_t)(MSPACE1_DIM*mpi_size); mdim[0] = MSPACE_DIM1; - mdim[1] = MSPACE_DIM2*mpi_size; + mdim[1] = (hsize_t)(MSPACE_DIM2*mpi_size); fsdim[0] = FSPACE_DIM1; - fsdim[1] = FSPACE_DIM2*mpi_size; + fsdim[1] = (hsize_t)(FSPACE_DIM2*mpi_size); - vector = (int*)HDmalloc(sizeof(int)*mdim1[0]*mpi_size); - matrix_out = (int*)HDmalloc(sizeof(int)*mdim[0]*mdim[1]*mpi_size); - matrix_out1 = (int*)HDmalloc(sizeof(int)*mdim[0]*mdim[1]*mpi_size); + vector = (int*)HDmalloc(sizeof(int)*(size_t)mdim1[0]*(size_t)mpi_size); + matrix_out = (int*)HDmalloc(sizeof(int)*(size_t)mdim[0]*(size_t)mdim[1]*(size_t)mpi_size); + matrix_out1 = (int*)HDmalloc(sizeof(int)*(size_t)mdim[0]*(size_t)mdim[1]*(size_t)mpi_size); - HDmemset(vector,0,sizeof(int)*mdim1[0]*mpi_size); + HDmemset(vector,0,sizeof(int)*(size_t)mdim1[0]*(size_t)mpi_size); vector[0] = vector[MSPACE1_DIM*mpi_size - 1] = -1; - for (i = 1; i < MSPACE1_DIM*mpi_size - 1; i++) vector[i] = i; + for (i = 1; i < MSPACE1_DIM*mpi_size - 1; i++) H5_CHECKED_ASSIGN(vector[i], int, i, unsigned); /* Grab file access property list */ facc_plist = create_faccess_plist(comm, info, facc_type); @@ -280,8 +280,8 @@ void coll_write_test(int chunk_factor) VRFY((ret >= 0),"Fill value creation property list succeeded"); if(chunk_factor != 0) { - chunk_dims[0] = fsdim[0] / chunk_factor; - chunk_dims[1] = fsdim[1] / chunk_factor; + chunk_dims[0] = fsdim[0] / (hsize_t)chunk_factor; + chunk_dims[1] = fsdim[1] / (hsize_t)chunk_factor; ret = H5Pset_chunk(dcrt_plist, 2, chunk_dims); VRFY((ret >= 0),"chunk creation property list succeeded"); } @@ -317,7 +317,7 @@ void coll_write_test(int chunk_factor) */ start[0] = FHSTART0; - start[1] = FHSTART1 + mpi_rank * FHSTRIDE1 * FHCOUNT1; + start[1] = (hsize_t)(FHSTART1 + mpi_rank * FHSTRIDE1 * FHCOUNT1); stride[0] = FHSTRIDE0; stride[1] = FHSTRIDE1; count[0] = FHCOUNT0; @@ -338,7 +338,7 @@ void coll_write_test(int chunk_factor) */ start[0] = SHSTART0; - start[1] = SHSTART1+SHCOUNT1*SHBLOCK1*mpi_rank; + start[1] = (hsize_t)(SHSTART1+SHCOUNT1*SHBLOCK1*mpi_rank); stride[0] = SHSTRIDE0; stride[1] = SHSTRIDE1; count[0] = SHCOUNT0; @@ -476,7 +476,7 @@ void coll_write_test(int chunk_factor) * */ start[0] = RFFHSTART0; - start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1; + start[1] = (hsize_t)(RFFHSTART1+mpi_rank*RFFHCOUNT1); block[0] = RFFHBLOCK0; block[1] = RFFHBLOCK1; stride[0] = RFFHSTRIDE0; @@ -503,7 +503,7 @@ void coll_write_test(int chunk_factor) */ start[0] = RFSHSTART0; - start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank; + start[1] = (hsize_t)(RFSHSTART1+RFSHCOUNT1*mpi_rank); block[0] = RFSHBLOCK0; block[1] = RFSHBLOCK1; stride[0] = RFSHSTRIDE0; @@ -542,7 +542,7 @@ void coll_write_test(int chunk_factor) start[0] = RMFHSTART0; - start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1; + start[1] = (hsize_t)(RMFHSTART1+mpi_rank*RMFHCOUNT1); block[0] = RMFHBLOCK0; block[1] = RMFHBLOCK1; stride[0] = RMFHSTRIDE0; @@ -565,7 +565,7 @@ void coll_write_test(int chunk_factor) * */ start[0] = RMSHSTART0; - start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1; + start[1] = (hsize_t)(RMSHSTART1+mpi_rank*RMSHCOUNT1); block[0] = RMSHBLOCK0; block[1] = RMSHBLOCK1; stride[0] = RMSHSTRIDE0; @@ -580,8 +580,8 @@ void coll_write_test(int chunk_factor) * Initialize data buffer. */ - HDmemset(matrix_out,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); - HDmemset(matrix_out1,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); + HDmemset(matrix_out,0,sizeof(int)*(size_t)MSPACE_DIM1*(size_t)MSPACE_DIM2*(size_t)mpi_size); + HDmemset(matrix_out1,0,sizeof(int)*(size_t)MSPACE_DIM1*(size_t)MSPACE_DIM2*(size_t)mpi_size); /* * Read data back to the buffer matrix_out. */ @@ -704,9 +704,9 @@ coll_read_test(void) /* Initialize the buffer */ mdim[0] = MSPACE_DIM1; - mdim[1] = MSPACE_DIM2*mpi_size; - matrix_out =(int*)HDmalloc(sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); - matrix_out1=(int*)HDmalloc(sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); + mdim[1] = (hsize_t)(MSPACE_DIM2*mpi_size); + matrix_out =(int*)HDmalloc(sizeof(int)*(size_t)MSPACE_DIM1*(size_t)MSPACE_DIM2*(size_t)mpi_size); + matrix_out1=(int*)HDmalloc(sizeof(int)*(size_t)MSPACE_DIM1*(size_t)MSPACE_DIM2*(size_t)mpi_size); /*** For testing collective hyperslab selection read ***/ @@ -741,7 +741,7 @@ coll_read_test(void) * */ start[0] = RFFHSTART0; - start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1; + start[1] = (hsize_t)(RFFHSTART1+mpi_rank*RFFHCOUNT1); block[0] = RFFHBLOCK0; block[1] = RFFHBLOCK1; stride[0] = RFFHSTRIDE0; @@ -761,7 +761,7 @@ coll_read_test(void) * */ start[0] = RFSHSTART0; - start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank; + start[1] = (hsize_t)(RFSHSTART1+RFSHCOUNT1*mpi_rank); block[0] = RFSHBLOCK0; block[1] = RFSHBLOCK1; stride[0] = RFSHSTRIDE0; @@ -791,7 +791,7 @@ coll_read_test(void) */ start[0] = RMFHSTART0; - start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1; + start[1] = (hsize_t)(RMFHSTART1+mpi_rank*RMFHCOUNT1); block[0] = RMFHBLOCK0; block[1] = RMFHBLOCK1; stride[0] = RMFHSTRIDE0; @@ -813,7 +813,7 @@ coll_read_test(void) * */ start[0] = RMSHSTART0; - start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1; + start[1] = (hsize_t)(RMSHSTART1+mpi_rank*RMSHCOUNT1); block[0] = RMSHBLOCK0; block[1] = RMSHBLOCK1; stride[0] = RMSHSTRIDE0; @@ -828,8 +828,8 @@ coll_read_test(void) * Initialize data buffer. */ - HDmemset(matrix_out,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); - HDmemset(matrix_out1,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); + HDmemset(matrix_out,0,sizeof(int)*(size_t)MSPACE_DIM1*(size_t)MSPACE_DIM2*(size_t)mpi_size); + HDmemset(matrix_out1,0,sizeof(int)*(size_t)MSPACE_DIM1*(size_t)MSPACE_DIM2*(size_t)mpi_size); /* * Read data back to the buffer matrix_out. @@ -1004,9 +1004,9 @@ lower_dim_size_comp_test__select_checker_board( * pre-C99 compilers again. */ - base_count = dims[sel_offset] / (checker_edge_size * 2); + base_count = dims[sel_offset] / (hsize_t)(checker_edge_size * 2); - if ( (dims[sel_rank] % (checker_edge_size * 2)) > 0 ) { + if ( (dims[sel_rank] % (hsize_t)(checker_edge_size * 2)) > 0 ) { base_count++; } diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 8c434ac..7830e25 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++) { @@ -1346,7 +1346,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } /* end while */ for(i = 1; i < g_nTasks; i++) - MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD); + 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 d19c3c1..6cfe3d2 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -4603,7 +4603,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts) return FALSE; } - if (H5_DBL_ABS_EQUAL(value, expected)) + if (H5_LDBL_ABS_EQUAL(value, expected)) return TRUE; if (opts->use_system_epsilon) 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 80ae814..3dfbb49 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -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); @@ -1827,7 +1827,7 @@ dump_attribute_values(hid_t attr) 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); 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/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 7c0e7f1..a61d8d7 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; @@ -296,7 +296,7 @@ generate_f32le(hbool_t external) { /* 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))); + wdata[k] = n * 801.1f * ((k % 5 == 1) ? (-1) : (1)); } } 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/perf.c b/tools/test/perform/perf.c index 8926d14..3f56d8b 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -158,7 +158,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; } @@ -166,7 +166,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; } @@ -216,7 +216,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, @@ -224,7 +224,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); @@ -236,7 +236,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); @@ -289,7 +289,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); @@ -320,7 +320,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, @@ -361,8 +361,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); @@ -433,9 +433,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 f3cb3ec..8bc522f 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -251,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", @@ -260,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", @@ -580,7 +580,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 */ @@ -604,9 +604,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 */ @@ -684,7 +684,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"); @@ -702,7 +702,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"); @@ -729,7 +729,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"); @@ -745,22 +745,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 */ @@ -788,16 +788,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; @@ -806,10 +806,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; @@ -973,7 +973,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 { @@ -1002,7 +1002,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; @@ -1016,8 +1016,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; @@ -1028,9 +1028,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; @@ -1061,16 +1061,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 */ @@ -1097,7 +1097,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; @@ -1128,7 +1128,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 { @@ -1153,7 +1153,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; @@ -1174,7 +1174,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 { @@ -1193,7 +1193,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 */ @@ -1204,8 +1204,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; @@ -1219,8 +1219,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; @@ -1257,16 +1257,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; @@ -1292,7 +1292,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; @@ -1315,7 +1315,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 */ @@ -1344,22 +1344,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); @@ -1371,7 +1371,7 @@ 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 */ @@ -1560,7 +1560,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 */ @@ -1582,9 +1582,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 */ @@ -1656,7 +1656,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"); @@ -1674,7 +1674,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"); @@ -1701,7 +1701,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"); @@ -1716,22 +1716,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 */ @@ -1759,16 +1759,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; @@ -1777,10 +1777,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; @@ -1904,7 +1904,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 { @@ -1933,7 +1933,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; @@ -1947,8 +1947,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; @@ -1959,9 +1959,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; @@ -1992,16 +1992,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 */ @@ -2028,7 +2028,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; @@ -2058,7 +2058,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 { @@ -2083,7 +2083,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; @@ -2104,7 +2104,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 { @@ -2123,7 +2123,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 */ @@ -2134,8 +2134,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; @@ -2149,8 +2149,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; @@ -2187,16 +2187,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; @@ -2222,7 +2222,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; @@ -2245,7 +2245,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 */ @@ -2273,21 +2273,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); @@ -2299,7 +2299,7 @@ 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; diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 1a40f44..4c0ec5e 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -81,7 +81,7 @@ #define PIO_HDF5 0x4 #define DBL_EPSILON 2.2204460492503131e-16 -#define H5_DBL_ABS_EQUAL(X,Y) (fabsf((X)-(Y)) < DBL_EPSILON) +#define H5_DBL_ABS_EQUAL(X,Y) (fabs((X)-(Y)) < DBL_EPSILON) /* 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))) @@ -315,6 +315,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 @@ -397,6 +398,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. @@ -432,8 +439,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; @@ -460,7 +467,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, @@ -883,7 +890,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; @@ -1159,10 +1166,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){ @@ -1326,7 +1333,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 */ @@ -1427,10 +1434,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 '?': @@ -1450,13 +1457,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 */ @@ -1466,15 +1473,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; -- cgit v0.12