diff options
author | kmu <kmu@hdfgroup.org> | 2020-01-23 21:12:00 (GMT) |
---|---|---|
committer | kmu <kmu@hdfgroup.org> | 2020-01-23 21:12:00 (GMT) |
commit | 838d4ec56bfc82266a2110635e14d36e075075cc (patch) | |
tree | 0da94266f7a4f65b4f2f9045c2913dce9ec89863 /tools/test/perform | |
parent | a9aaad9be317ed92150ccc6b4e8574e596447dba (diff) | |
download | hdf5-838d4ec56bfc82266a2110635e14d36e075075cc.zip hdf5-838d4ec56bfc82266a2110635e14d36e075075cc.tar.gz hdf5-838d4ec56bfc82266a2110635e14d36e075075cc.tar.bz2 |
squash cast warning fix
Diffstat (limited to 'tools/test/perform')
-rw-r--r-- | tools/test/perform/chunk_cache.c | 11 | ||||
-rw-r--r-- | tools/test/perform/perf.c | 22 | ||||
-rw-r--r-- | tools/test/perform/pio_engine.c | 200 | ||||
-rw-r--r-- | tools/test/perform/pio_perf.c | 49 |
4 files changed, 146 insertions, 136 deletions
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; |