summaryrefslogtreecommitdiffstats
path: root/tools/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-02-27 22:54:52 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-02-27 22:54:52 (GMT)
commit467b5d565cc6bb0a75f10ac0807c38ee0a0939a9 (patch)
treec2d87fcc51f380a2306949753c40cebd9e9aa796 /tools/test
parentf1aca8780ea647e705760149ceb925e363c31763 (diff)
downloadhdf5-467b5d565cc6bb0a75f10ac0807c38ee0a0939a9.zip
hdf5-467b5d565cc6bb0a75f10ac0807c38ee0a0939a9.tar.gz
hdf5-467b5d565cc6bb0a75f10ac0807c38ee0a0939a9.tar.bz2
Merge CMake and tools changes from develop
Diffstat (limited to 'tools/test')
-rw-r--r--tools/test/CMakeLists.txt2
-rw-r--r--tools/test/h5copy/CMakeLists.txt2
-rw-r--r--tools/test/h5copy/h5copygentest.c8
-rw-r--r--tools/test/h5diff/CMakeLists.txt2
-rw-r--r--tools/test/h5diff/h5diffgentest.c20
-rw-r--r--tools/test/h5dump/CMakeLists.txt2
-rw-r--r--tools/test/h5format_convert/CMakeLists.txt2
-rw-r--r--tools/test/h5import/CMakeLists.txt2
-rw-r--r--tools/test/h5jam/CMakeLists.txt2
-rw-r--r--tools/test/h5jam/testh5jam.sh.in4
-rw-r--r--tools/test/h5ls/CMakeLists.txt2
-rw-r--r--tools/test/h5repack/CMakeLists.txt2
-rw-r--r--tools/test/h5repack/CMakeTests.cmake60
-rw-r--r--tools/test/h5repack/h5repack.sh.in4
-rw-r--r--tools/test/h5repack/h5repackgentest.c21
-rw-r--r--tools/test/h5stat/CMakeLists.txt2
-rw-r--r--tools/test/misc/CMakeLists.txt2
-rw-r--r--tools/test/misc/vds/CMakeLists.txt2
-rw-r--r--tools/test/perform/CMakeLists.txt6
-rw-r--r--tools/test/perform/iopipe.c36
-rw-r--r--tools/test/perform/perf.c34
-rw-r--r--tools/test/perform/pio_engine.c356
-rw-r--r--tools/test/perform/pio_perf.c56
23 files changed, 355 insertions, 274 deletions
diff --git a/tools/test/CMakeLists.txt b/tools/test/CMakeLists.txt
index f4106fc..a43a848 100644
--- a/tools/test/CMakeLists.txt
+++ b/tools/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST C)
#-- Add the h5diff tests
diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt
index 028935f..034c8d3 100644
--- a/tools/test/h5copy/CMakeLists.txt
+++ b/tools/test/h5copy/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5COPY C)
# --------------------------------------------------------------------
diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c
index a519f22..8c8a890 100644
--- a/tools/test/h5copy/h5copygentest.c
+++ b/tools/test/h5copy/h5copygentest.c
@@ -744,9 +744,9 @@ static void Test_Obj_Copy(void)
/* Set the FAPL for the type of format */
/* Create source file */
if(new_format)
- fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
- else
- fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
+ else
+ fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if(fid < 0) {
HDfprintf(stderr, "Error: H5Fcreate failed.\n");
goto out;
@@ -756,7 +756,7 @@ static void Test_Obj_Copy(void)
gent_empty_group(fid);
gent_nested_datasets(fid);
gent_nested_group(fid);
- gent_att_compound_vlstr(fid);
+ gent_att_compound_vlstr(fid);
H5Fclose(fid);
fid = (-1);
diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt
index 82e09c6..e4bfc99 100644
--- a/tools/test/h5diff/CMakeLists.txt
+++ b/tools/test/h5diff/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5DIFF C)
# --------------------------------------------------------------------
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
index bb71a89..623205c 100644
--- a/tools/test/h5diff/h5diffgentest.c
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -303,8 +303,8 @@ int main(void)
static
int test_basic(const char *fname1, const char *fname2, const char *fname3)
{
- hid_t fid1 = -1, fid2 = H5I_INVALID_HID;
- hid_t gid1 = -1, gid2 = -1, gid3 = H5I_INVALID_HID;
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID, gid3 = H5I_INVALID_HID;
hsize_t dims1[1] = { 6 };
hsize_t dims2[2] = { 3, 2 };
@@ -1039,14 +1039,14 @@ int test_attributes(const char *file, int make_diffs /* flag to modify data buff
static int test_attributes_verbose_level(const char *fname1, const char *fname2)
{
herr_t status = SUCCEED;
- hid_t fid1 = -1, fid2 = H5I_INVALID_HID;
- hid_t f1_gid = -1, f2_gid = H5I_INVALID_HID;
- hid_t f1_gid2 = -1, f2_gid2 = H5I_INVALID_HID;
- hid_t f1_gid3 = -1, f2_gid3 = H5I_INVALID_HID;
- hid_t f1_gid4 = -1, f2_gid4 = H5I_INVALID_HID;
- hid_t f1_did = -1, f2_did = H5I_INVALID_HID;
- hid_t f1_sid = -1, f2_sid = H5I_INVALID_HID;
- hid_t f1_tid = -1, f2_tid = H5I_INVALID_HID;
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
+ hid_t f1_gid = H5I_INVALID_HID, f2_gid = H5I_INVALID_HID;
+ hid_t f1_gid2 = H5I_INVALID_HID, f2_gid2 = H5I_INVALID_HID;
+ hid_t f1_gid3 = H5I_INVALID_HID, f2_gid3 = H5I_INVALID_HID;
+ hid_t f1_gid4 = H5I_INVALID_HID, f2_gid4 = H5I_INVALID_HID;
+ hid_t f1_did = H5I_INVALID_HID, f2_did = H5I_INVALID_HID;
+ hid_t f1_sid = H5I_INVALID_HID, f2_sid = H5I_INVALID_HID;
+ hid_t f1_tid = H5I_INVALID_HID, f2_tid = H5I_INVALID_HID;
/* dset */
hsize_t dset_dims[1] = { 3 };
int dset_data[3] = { 0, 1, 2 };
diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt
index b9e4ef5..cfc542f 100644
--- a/tools/test/h5dump/CMakeLists.txt
+++ b/tools/test/h5dump/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5DUMP C)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt
index 9e49c4f..99420d8 100644
--- a/tools/test/h5format_convert/CMakeLists.txt
+++ b/tools/test/h5format_convert/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5FC C)
# --------------------------------------------------------------------
diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt
index a77ba00..f3991c5 100644
--- a/tools/test/h5import/CMakeLists.txt
+++ b/tools/test/h5import/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5IMPORT C)
# --------------------------------------------------------------------
diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt
index f00e781..78160d3 100644
--- a/tools/test/h5jam/CMakeLists.txt
+++ b/tools/test/h5jam/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5JAM C)
# --------------------------------------------------------------------
diff --git a/tools/test/h5jam/testh5jam.sh.in b/tools/test/h5jam/testh5jam.sh.in
index 3ae180b..bf705b4 100644
--- a/tools/test/h5jam/testh5jam.sh.in
+++ b/tools/test/h5jam/testh5jam.sh.in
@@ -474,9 +474,9 @@ UNJAMTEST () {
#
TOOLTEST_OUTPUT() {
- if [ "$1" == "JAM" ]; then
+ if [ "$1" = "JAM" ]; then
TOOLCMD=$JAM_BIN/$JAM
- elif [ "$1" == "UNJAM" ]; then
+ elif [ "$1" = "UNJAM" ]; then
TOOLCMD=$JAM_BIN/$UNJAM
fi
shift
diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt
index abbe6d0..3993277 100644
--- a/tools/test/h5ls/CMakeLists.txt
+++ b/tools/test/h5ls/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5LS C)
#-----------------------------------------------------------------------------
diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt
index 5722354..6f0b284 100644
--- a/tools/test/h5repack/CMakeLists.txt
+++ b/tools/test/h5repack/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5REPACK C)
# --------------------------------------------------------------------
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index 49a1680..6a078e3 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -632,12 +632,16 @@
macro (ADD_H5_TEST_META testname testfile)
# Remove any output file left over from previous test run
add_test (
- NAME H5REPACK_META-${testname}_N-clear-objects
+ NAME H5REPACK_META-${testname}-clear-objects
COMMAND ${CMAKE_COMMAND} -E remove
testfiles/out-${testname}_N.${testname}.h5
+ testfiles/out-${testname}_N.${testname}.out
+ testfiles/out-${testname}_N.${testname}.out.err
testfiles/out-${testname}_M.${testname}.h5
+ testfiles/out-${testname}_M.${testname}.out
+ testfiles/out-${testname}_M.${testname}.out.err
)
- set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES
+ set_tests_properties (H5REPACK_META-${testname}-clear-objects PROPERTIES
FIXTURES_REQUIRED clear_h5repack
)
add_test (
@@ -645,21 +649,61 @@
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5
)
set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES
- DEPENDS H5REPACK_META-${testname}_N-clear-objects
+ DEPENDS H5REPACK_META-${testname}-clear-objects
+ )
+ add_test (
+ NAME H5REPACK_META-${testname}_N_DFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_file_ext}>"
+ -D "TEST_ARGS:STRING=${testfile};out-${testname}_N.${testname}.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=out-${testname}_N.${testname}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=out-${testname}_N.${testname}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_META-${testname}_N_DFF PROPERTIES
+ DEPENDS H5REPACK_META-${testname}_N
)
add_test (
NAME H5REPACK_META-${testname}_M
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5
)
set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES
- DEPENDS H5REPACK_META-${testname}_N
+ DEPENDS H5REPACK_META-${testname}_N_DFF
)
-
- add_test (NAME H5REPACK_META-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5)
- set_tests_properties (H5REPACK_META-${testname} PROPERTIES
- WILL_FAIL "true"
+ add_test (
+ NAME H5REPACK_META-${testname}_M_DFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_file_ext}>"
+ -D "TEST_ARGS:STRING=${testfile};out-${testname}_M.${testname}.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=out-${testname}_M.${testname}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=out-${testname}_M.${testname}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_META-${testname}_M_DFF PROPERTIES
DEPENDS H5REPACK_META-${testname}_M
)
+ add_test (NAME H5REPACK_META-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_ONEFILE=out-${testname}_N.${testname}.out"
+ -D "TEST_TWOFILE=out-${testname}_M.${testname}.h5"
+ -D "TEST_FUNCTION=LTEQ"
+ -P "${HDF_RESOURCES_DIR}/fileCompareTest.cmake"
+ )
+ if (CMAKE_VERSION VERSION_LESS "3.14.0")
+ set_tests_properties (H5REPACK_META-${testname} PROPERTIES
+ DISABLED "true"
+ )
+ endif ()
+ set_tests_properties (H5REPACK_META-${testname} PROPERTIES
+ DEPENDS H5REPACK_META-${testname}_M_DFF
+ )
endmacro ()
macro (ADD_H5_UD_TEST testname resultcode resultfile)
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index 67056fb..b6cc167 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -303,7 +303,7 @@ TOOLTEST()
TESTING $H5REPACK $@
(
cd $TESTDIR
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ $ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
)
RET=$?
if [ $RET != 0 ] ; then
@@ -821,7 +821,7 @@ TOOLTESTM() {
TESTING $H5REPACK $@
(
cd $TESTDIR
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ $ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c
index 77fb28a..7604964 100644
--- a/tools/test/h5repack/h5repackgentest.c
+++ b/tools/test/h5repack/h5repackgentest.c
@@ -147,7 +147,7 @@ __make_file(const char *basename, struct external_def *ext,
H5REPACKGENTEST_OOPS;
}
- space_id = H5Screate_simple(rank, dims, NULL);
+ space_id = H5Screate_simple((int)rank, dims, NULL);
if (space_id == H5I_INVALID_HID)
H5REPACKGENTEST_OOPS;
@@ -231,9 +231,9 @@ generate_int32le_3d(hbool_t external) {
/* generate values, alternating positive and negative
*/
- for (i = 0, n = 0; i < dims[0]; i++) {
- for (j = 0; j < dims[1]; j++) {
- for (k = 0; k < dims[2]; k++, n++) {
+ for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) {
+ for (j = 0; (hsize_t)j < dims[1]; j++) {
+ for (k = 0; (hsize_t)k < dims[2]; k++, n++) {
wdata[n] = (k + j * 512 + i * 4096) * ((n & 1) ? (-1) : (1));
}
}
@@ -263,9 +263,9 @@ generate_uint8be(hbool_t external) {
/* Generate values, ping-pong from ends of range
*/
- for (i = 0, n = 0; i < dims[0]; i++) {
- for (j = 0; j < dims[1]; j++) {
- for (k = 0; k < dims[2]; k++, n++) {
+ for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) {
+ for (j = 0; (hsize_t)j < dims[1]; j++) {
+ for (k = 0; (hsize_t)k < dims[2]; k++, n++) {
wdata[n] = (uint8_t)((n & 1) ? -n : n);
}
}
@@ -294,9 +294,9 @@ generate_f32le(hbool_t external) {
int ret_value = 0;
/* Generate values */
- for (i = 0, k = 0, n = 0; i < dims[0]; i++) {
- for (j = 0; j < dims[1]; j++, k++, n++) {
- wdata[k] = (float)(n * 801.1 * ((k % 5 == 1) ? (-1) : (1)));
+ for (i = 0, k = 0, n = 0; (hsize_t)i < dims[0]; i++) {
+ for (j = 0; (hsize_t)j < dims[1]; j++, k++, n++) {
+ wdata[k] = n * 801.1f * ((k % 5 == 1) ? (-1) : (1));
}
}
@@ -314,7 +314,6 @@ generate_f32le(hbool_t external) {
int
main(void) {
int i = 0;
- int ret_value = 0;
for (i = 0; i < 2; i++) {
hbool_t external = (i & 1) ? TRUE : FALSE;
diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt
index 0e2ee5e..f50a747 100644
--- a/tools/test/h5stat/CMakeLists.txt
+++ b/tools/test/h5stat/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5STAT C)
# --------------------------------------------------------------------
diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt
index 089a302..060c15b 100644
--- a/tools/test/misc/CMakeLists.txt
+++ b/tools/test/misc/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_MISC C)
# --------------------------------------------------------------------
diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt
index 092cabc..71261c4 100644
--- a/tools/test/misc/vds/CMakeLists.txt
+++ b/tools/test/misc/vds/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_MISC_VDS C)
MACRO (ADD_H5_GENERATOR genfile)
diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt
index 0eb4044..c05698e 100644
--- a/tools/test/perform/CMakeLists.txt
+++ b/tools/test/perform/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_PERFORM C)
# --------------------------------------------------------------------
@@ -164,10 +164,10 @@ if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (h5perf_alone STATIC)
- target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
+ target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} ${LINK_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
else ()
TARGET_C_PROPERTIES (h5perf_alone SHARED)
- target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
+ target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIBSH_TARGET} ${LINK_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
endif ()
set_target_properties (h5perf_alone PROPERTIES FOLDER perform)
set_property (TARGET h5perf_alone
diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c
index 57c0d52..bf4728d 100644
--- a/tools/test/perform/iopipe.c
+++ b/tools/test/perform/iopipe.c
@@ -133,7 +133,7 @@ synchronize (void)
#if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__)
_flushall();
#else
- int status;
+ int H5_ATTR_NDEBUG_UNUSED status;
status = HDsystem("sync");
HDassert(status >= 0);
@@ -169,7 +169,6 @@ main (void)
unsigned char *the_data = NULL;
hid_t file, dset, file_space = H5I_INVALID_HID;
- herr_t status;
#ifdef H5_HAVE_GETRUSAGE
struct rusage r_start, r_stop;
#else
@@ -178,8 +177,9 @@ main (void)
struct timeval t_start, t_stop;
int fd;
unsigned u;
- hssize_t n;
- off_t offset;
+ herr_t H5_ATTR_NDEBUG_UNUSED status;
+ hssize_t H5_ATTR_NDEBUG_UNUSED n;
+ off_t H5_ATTR_NDEBUG_UNUSED offset;
hsize_t start[2];
hsize_t count[2];
@@ -198,15 +198,15 @@ main (void)
/* Open the files */
file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- assert (file>=0);
+ HDassert (file>=0);
fd = HDopen (RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666);
- assert (fd>=0);
+ HDassert (fd>=0);
/* Create the dataset */
file_space = H5Screate_simple (2, size, size);
- assert(file_space >= 0);
+ HDassert(file_space >= 0);
dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- assert(dset >= 0);
+ HDassert(dset >= 0);
the_data = (unsigned char *)malloc((size_t)(size[0] * size[1]));
/* initial fill for lazy malloc */
@@ -268,7 +268,7 @@ main (void)
HDfflush(stderr);
status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
H5P_DEFAULT, the_data);
- assert (status>=0);
+ HDassert (status>=0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -306,9 +306,9 @@ main (void)
putc (PROGRESS, stderr);
HDfflush(stderr);
offset = HDlseek (fd, (off_t)0, SEEK_SET);
- assert (0==offset);
+ HDassert (0==offset);
n = HDwrite (fd, the_data, (size_t)(size[0]*size[1]));
- assert (n>=0 && (size_t)n==size[0]*size[1]);
+ HDassert (n>=0 && (size_t)n==size[0]*size[1]);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -347,7 +347,7 @@ main (void)
HDfflush(stderr);
status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
H5P_DEFAULT, the_data);
- assert (status>=0);
+ HDassert (status>=0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -385,9 +385,9 @@ main (void)
putc (PROGRESS, stderr);
HDfflush(stderr);
offset = HDlseek (fd, (off_t)0, SEEK_SET);
- assert (0==offset);
+ HDassert (0==offset);
n = HDread (fd, the_data, (size_t)(size[0]*size[1]));
- assert (n>=0 && (size_t)n==size[0]*size[1]);
+ HDassert (n>=0 && (size_t)n==size[0]*size[1]);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -427,7 +427,7 @@ main (void)
HDfflush(stderr);
status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
H5P_DEFAULT, the_data);
- assert (status>=0);
+ HDassert (status>=0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -449,11 +449,11 @@ main (void)
(size_t)(nread*size[0]*size[1]));
/* Read hyperslab */
- assert (size[0]>20 && size[1]>20);
+ HDassert (size[0]>20 && size[1]>20);
start[0] = start[1] = 10;
count[0] = count[1] = size[0]-20;
status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL);
- assert (status>=0);
+ HDassert (status>=0);
synchronize ();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
@@ -471,7 +471,7 @@ main (void)
HDfflush(stderr);
status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
H5P_DEFAULT, the_data);
- assert (status>=0);
+ HDassert (status>=0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c
index 34b8a2d..364836f 100644
--- a/tools/test/perform/perf.c
+++ b/tools/test/perform/perf.c
@@ -110,15 +110,15 @@ const char *FILENAME[] = {
/* function prototypes */
static int parse_args(int argc, char **argv);
-extern int errno;
-
+#ifndef H5_HAVE_UNISTD_H
/* globals needed for getopt */
extern char *optarg;
+#endif
int main(int argc, char **argv)
{
- char *buf, *tmp, *buf2, *tmp2, *check;
- int i, j, mynod=0, nprocs=1, err, my_correct = 1, correct, myerrno;
+ char *buf, *tmp, *buf2 = NULL, *tmp2 = NULL, *check;
+ int i, j, mynod=0, nprocs=1, my_correct = 1, correct, myerrno;
double stim, etim;
double write_tim = 0;
double read_tim = 0;
@@ -127,10 +127,6 @@ int main(int argc, char **argv)
double min_read_tim, min_write_tim;
double ave_read_tim, ave_write_tim;
int64_t iter_jump = 0;
- int64_t seek_position = 0;
- MPI_File fh;
- MPI_Status status;
- int nchars;
char filename[MAX_PATH];
herr_t ret; /* Generic return value */
@@ -164,7 +160,7 @@ int main(int argc, char **argv)
iter_jump = nprocs * opt_block;
/* setup a buffer of data to write */
- if (!(tmp = (char *) malloc(opt_block + 256))) {
+ if (!(tmp = (char *) malloc((size_t)opt_block + 256))) {
perror("malloc");
goto die_jar_jar_die;
}
@@ -172,7 +168,7 @@ int main(int argc, char **argv)
if (opt_correct) {
/* do the same buffer setup for verifiable data */
- if (!(tmp2 = (char *) malloc(opt_block + 256))) {
+ if (!(tmp2 = (char *) malloc((size_t)opt_block + 256))) {
perror("malloc2");
goto die_jar_jar_die;
}
@@ -222,7 +218,7 @@ int main(int argc, char **argv)
VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL);
/* define a contiquous dataset of opt_iter*nprocs*opt_block chars */
- dims[0] = opt_iter * nprocs * opt_block;
+ dims[0] = (hsize_t)opt_iter * (hsize_t)nprocs * (hsize_t)opt_block;
sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL);
dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid,
@@ -230,7 +226,7 @@ int main(int argc, char **argv)
VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL);
/* create the memory dataspace and the file dataspace */
- dims[0] = opt_block;
+ dims[0] = (hsize_t)opt_block;
mem_dataspace = H5Screate_simple(RANK, dims, NULL);
VRFY((mem_dataspace >= 0), "", H5FATAL);
file_dataspace = H5Dget_space(dataset);
@@ -242,7 +238,7 @@ int main(int argc, char **argv)
for(j=0; j < opt_iter; j++) {
/* setup a file dataspace selection */
start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block));
- stride[0] = block[0] = opt_block;
+ stride[0] = block[0] = (hsize_t)opt_block;
count[0]= 1;
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL);
@@ -295,7 +291,7 @@ int main(int argc, char **argv)
for (j=0; j < opt_iter; j++) {
/* setup a file dataspace selection */
start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block));
- stride[0] = block[0] = opt_block;
+ stride[0] = block[0] = (hsize_t)opt_block;
count[0]= 1;
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL);
@@ -326,7 +322,7 @@ int main(int argc, char **argv)
/* if the user wanted to check correctness, compare the write
* buffer to the read buffer */
- if (opt_correct && memcmp(buf, buf2, opt_block)) {
+ if (opt_correct && memcmp(buf, buf2, (size_t)opt_block)) {
HDfprintf(stderr, "node %d, correctness test failed\n", mynod);
my_correct = 0;
MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN,
@@ -367,8 +363,8 @@ int main(int argc, char **argv)
/* print out the results on one node */
if (mynod == 0) {
- read_bw = ((int64_t)(opt_block*nprocs*opt_iter))/(max_read_tim*1000000.0);
- write_bw = ((int64_t)(opt_block*nprocs*opt_iter))/(max_write_tim*1000000.0);
+ read_bw = (double)((int64_t)(opt_block*nprocs*opt_iter))/(max_read_tim*1000000.0);
+ write_bw = (double)((int64_t)(opt_block*nprocs*opt_iter))/(max_write_tim*1000000.0);
printf("nr_procs = %d, nr_iter = %d, blk_sz = %ld\n", nprocs,
opt_iter, (long)opt_block);
@@ -439,9 +435,9 @@ parse_args(int argc, char **argv)
{
char *p;
- opt_alignment = HDatoi(optarg);
+ opt_alignment = (hsize_t)HDatoi(optarg);
if(NULL != (p = (char*)HDstrchr(optarg, '/')))
- opt_threshold = HDatoi(p + 1);
+ opt_threshold = (hsize_t)HDatoi(p + 1);
}
HDfprintf(stdout,
"alignment/threshold=%Hu/%Hu\n",
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
index d000f60..cdd698e 100644
--- a/tools/test/perform/pio_engine.c
+++ b/tools/test/perform/pio_engine.c
@@ -54,24 +54,15 @@
/* sizes of various items. these sizes won't change during program execution */
/* The following three must have the same type */
-#define ELMT_SIZE (sizeof(unsigned char)) /* we're doing bytes */
-#define ELMT_MPI_TYPE MPI_BYTE
#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
#define GOTOERROR(errcode) { ret_code = errcode; goto done; }
-#define GOTODONE { goto done; }
#define ERRMSG(mesg) { \
HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \
HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \
mesg, (int)__LINE__, __FILE__); \
}
-#define MSG(mesg) { \
- HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \
- HDfprintf(stderr, "(%s) at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
-}
-
/* verify: if val is false (0), print mesg. */
#define VRFY(val, mesg) do { \
if (!val) { \
@@ -138,6 +129,7 @@ static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/,
int flags);
static herr_t do_fclose(iotype iot, file_descr *fd);
static void do_cleanupfile(iotype iot, char *fname);
+static off_t sqrto(off_t);
/*
* Function: do_pio
@@ -208,7 +200,7 @@ do_pio(parameters param)
bsize = buf_size; /* Actual buffer size */
}
else {
- snbytes = (off_t)sqrt((double)nbytes); /* General dataset size */
+ snbytes = sqrto(nbytes); /* General dataset size */
bsize = buf_size * blk_size; /* Actual buffer size */
}
@@ -260,7 +252,7 @@ do_pio(parameters param)
}
if (!param.dim2d){
- if(((snbytes/pio_mpi_nprocs_g)%buf_size)!=0) {
+ if(((size_t)(snbytes/pio_mpi_nprocs_g)%buf_size)!=0) {
HDfprintf(stderr,
"Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
"trasfer buffer size (%zu)\n",
@@ -269,7 +261,7 @@ do_pio(parameters param)
}
}
else {
- if((snbytes%buf_size)!=0) {
+ if(((size_t)snbytes%buf_size)!=0) {
HDfprintf(stderr,
"Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
"trasfer buffer size (%zu)\n",
@@ -371,15 +363,17 @@ done:
switch (iot) {
case POSIXIO:
if (fd.posixfd != -1)
- hrc = do_fclose(iot, &fd);
+ hrc = do_fclose(iot, &fd);
break;
case MPIO:
if (fd.mpifd != MPI_FILE_NULL)
- hrc = do_fclose(iot, &fd);
+ hrc = do_fclose(iot, &fd);
break;
case PHDF5:
if (fd.h5fd != -1)
- hrc = do_fclose(iot, &fd);
+ hrc = do_fclose(iot, &fd);
+ break;
+ default:
break;
}
@@ -422,6 +416,8 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
case PHDF5:
suffix = ".h5";
break;
+ default:
+ break;
}
/* First use the environment variable and then try the constant */
@@ -589,7 +585,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 */
@@ -601,7 +597,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
/* nbytes is always the number of bytes per dataset (1D or 2D). If the
dataspace is 2D, snbytes is the size of a side of the dataset square.
*/
- snbytes = (off_t)sqrt((double)nbytes);
+ snbytes = sqrto(nbytes);
/* Contiguous Pattern: */
if (!parms->interleaved) {
@@ -613,9 +609,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
bytes_begin[0] = 0;
if(!parms->h5_use_chunks || parms->io_type==PHDF5)
- bytes_begin[1] = (off_t)(blk_size*pio_mpi_rank_g);
+ bytes_begin[1] = (off_t)(blk_size*(size_t)pio_mpi_rank_g);
else
- bytes_begin[1] = (off_t)(blk_size*blk_size*pio_mpi_rank_g);
+ bytes_begin[1] = (off_t)(blk_size*blk_size*(size_t)pio_mpi_rank_g);
} /* end else */
/* Prepare buffer for verifying data */
@@ -693,7 +689,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
/* Build contiguous file's derived type */
- mrc = MPI_Type_vector((int)blk_size, (int)1, (int)(snbytes/buf_size),
+ mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes/buf_size),
mpi_partial_buffer_cont, &mpi_cont_type);
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
@@ -711,7 +707,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
/* Build interleaved file's derived type */
- mrc = MPI_Type_vector((int)buf_size, (int)1, (int)(snbytes/blk_size),
+ mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes/blk_size),
mpi_partial_buffer_inter, &mpi_inter_type);
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
@@ -738,7 +734,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
/* Build chunk interleaved file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)(snbytes/blk_size),
+ mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)((size_t)snbytes/blk_size),
mpi_full_chunk, &mpi_chunk_inter_type);
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
@@ -754,22 +750,22 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
if (!parms->dim2d){
if(nbytes>0) {
/* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = nbytes;
+ h5dims[0] = (hsize_t)nbytes;
h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
VRFY((h5dset_space_id >= 0), "H5Screate_simple");
/* Set up the file dset space id to select the pattern to access */
if (!parms->interleaved){
/* Contiguous pattern */
- h5start[0] = bytes_begin[0];
+ h5start[0] = (hsize_t)bytes_begin[0];
h5stride[0] = h5block[0] = blk_size;
h5count[0] = buf_size/blk_size;
} /* end if */
else {
/* Interleaved access pattern */
/* Skip offset over blocks of other processes */
- h5start[0] = bytes_begin[0];
- h5stride[0] = blk_size*pio_mpi_nprocs_g;
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = blk_size*(size_t)pio_mpi_nprocs_g;
h5block[0] = blk_size;
h5count[0] = buf_size/blk_size;
} /* end else */
@@ -797,16 +793,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
else {
if(nbytes>0) {
/* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = snbytes;
- h5dims[1] = snbytes;
+ h5dims[0] = (hsize_t)snbytes;
+ h5dims[1] = (hsize_t)snbytes;
h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
VRFY((h5dset_space_id >= 0), "H5Screate_simple");
/* Set up the file dset space id to select the pattern to access */
if (!parms->interleaved){
/* Contiguous pattern */
- h5start[0] = bytes_begin[0];
- h5start[1] = bytes_begin[1];
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
h5stride[0] = 1;
h5stride[1] = h5block[0] = h5block[1] = blk_size;
h5count[0] = 1;
@@ -815,10 +811,10 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
else {
/* Interleaved access pattern */
/* Skip offset over blocks of other processes */
- h5start[0] = bytes_begin[0];
- h5start[1] = bytes_begin[1];
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
h5stride[0] = blk_size;
- h5stride[1] = blk_size*pio_mpi_nprocs_g;
+ h5stride[1] = blk_size*(size_t)pio_mpi_nprocs_g;
h5block[0] = h5block[1] = blk_size;
h5count[0] = buf_size/blk_size;
h5count[1] = 1;
@@ -866,6 +862,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
} /* end if */
} /* end if */
break;
+
+ default:
+ break;
} /* end switch */
for (ndset = 1; ndset <= ndsets; ++ndset) {
@@ -929,6 +928,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
GOTOERROR(FAIL);
}
break;
+
+ default:
+ break;
}
/* The task is to transfer bytes_count bytes, starting at
@@ -982,7 +984,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((rc != 0), "POSIXWRITE");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ nbytes_xfer+=(ssize_t)buf_size;
} /* end if */
/* Interleaved access pattern */
else {
@@ -1011,7 +1013,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
buf_p+=blk_size;
/* Advance global offset in dataset */
- nbytes_xfer+=blk_size;
+ nbytes_xfer+=(ssize_t)blk_size;
/* Decrement number of bytes left this time */
nbytes_toxfer-=blk_size;
@@ -1025,8 +1027,8 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Contiguous access pattern */
if (!parms->interleaved) {
/* Compute file offset */
- file_offset=posix_file_offset+(off_t)(((nbytes_xfer/blk_size)
- /snbytes)*(blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes));
+ file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/blk_size)
+ /(size_t)snbytes)*(blk_size*(size_t)snbytes)+(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes));
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = buf_size;
@@ -1037,9 +1039,9 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Interleaved access pattern */
else {
/* Compute file offset */
- file_offset=posix_file_offset+(off_t)((((nbytes_xfer/buf_size)
- *pio_mpi_nprocs_g)/snbytes)*(buf_size*snbytes)
- +((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes);
+ file_offset=posix_file_offset+(off_t)(((((size_t)nbytes_xfer/buf_size)
+ *(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*(buf_size*(size_t)snbytes)
+ +(((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes);
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = blk_size;
@@ -1070,16 +1072,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
*snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
*pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
- file_offset=posix_file_offset+(off_t)(((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)+((nbytes_xfer/(buf_size/blk_size))
- *pio_mpi_nprocs_g)%(snbytes*blk_size));
+ file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/(buf_size/blk_size)
+ *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes)+(((size_t)nbytes_xfer/(buf_size/blk_size))
+ *(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size));
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = blk_size * blk_size;
/* Global offset advance after each I/O operation */
/* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
- file_offset_advance = (off_t)(snbytes*blk_size);
+ file_offset_advance = (off_t)snbytes*(off_t)blk_size;
} /* end else */
} /* end else */
@@ -1106,7 +1108,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
buf_p+=nbytes_xfer_advance;
/* Advance global offset in dataset */
- nbytes_xfer+=nbytes_xfer_advance;
+ nbytes_xfer+=(ssize_t)nbytes_xfer_advance;
/* Decrement number of bytes left this time */
nbytes_toxfer-=nbytes_xfer_advance;
@@ -1137,7 +1139,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ nbytes_xfer+=(ssize_t)buf_size;
} /* end if */
/* Interleaved access pattern */
else {
@@ -1162,7 +1164,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
buf_p+=blk_size;
/* Advance global offset in dataset */
- nbytes_xfer+=blk_size;
+ nbytes_xfer+=(ssize_t)blk_size;
/* Decrement number of bytes left this time */
nbytes_toxfer-=blk_size;
@@ -1183,7 +1185,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ nbytes_xfer+=(ssize_t)buf_size;
} /* end if */
/* Interleaved access pattern */
else {
@@ -1202,7 +1204,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ nbytes_xfer+=(ssize_t)buf_size;
} /* end else */
} /* end else */
} /* end if */
@@ -1213,8 +1215,8 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Contiguous access pattern */
if (!parms->interleaved) {
/* Compute offset in file */
- mpi_offset=mpi_file_offset+((nbytes_xfer/blk_size)/snbytes)*
- (blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes);
+ mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/blk_size)/(size_t)snbytes)*
+ (blk_size*(size_t)snbytes))+(MPI_Offset)(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes);
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = buf_size;
@@ -1228,8 +1230,8 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Interleaved access pattern */
else {
/* Compute offset in file */
- mpi_offset=mpi_file_offset+(((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)/snbytes)*
- (buf_size*snbytes)+((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes;
+ mpi_offset=mpi_file_offset+(MPI_Offset)(((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*
+ (buf_size*(size_t)snbytes))+(MPI_Offset)((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes);
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = blk_size;
@@ -1266,16 +1268,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
(buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
/blk_size*(blk_size*blk_size)); */
- mpi_offset=mpi_file_offset+((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)
- +((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes*blk_size);
+ mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size)
+ *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes))
+ +(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size))*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size));
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = blk_size * blk_size;
/* Global offset advance after each I/O operation */
/* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
- mpi_offset_advance = (MPI_Offset)(snbytes*blk_size);
+ mpi_offset_advance = (MPI_Offset)((size_t)snbytes*blk_size);
/* MPI type to be used for collective access */
mpi_collective_type = mpi_chunk_inter_type;
@@ -1301,7 +1303,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
buf_p+=nbytes_xfer_advance;
/* Advance global offset in dataset */
- nbytes_xfer+=nbytes_xfer_advance;
+ nbytes_xfer+=(ssize_t)nbytes_xfer_advance;
/* Decrement number of bytes left this time */
nbytes_toxfer-=nbytes_xfer_advance;
@@ -1324,7 +1326,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size*blk_size;
+ nbytes_xfer+=(off_t)buf_size*(off_t)blk_size;
} /* end else */
} /* end else */
@@ -1353,22 +1355,22 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((hrc >= 0), "H5Dwrite");
/* Increment number of bytes transferred */
- nbytes_xfer += buf_size;
+ nbytes_xfer += (ssize_t)buf_size;
} /* end if */
/* 2D dataspace */
else {
/* Set up the file dset space id to move the selection to process */
if (!parms->interleaved){
/* Contiguous pattern */
- h5offset[0] = (nbytes_xfer/(snbytes*blk_size))*blk_size;
- h5offset[1] = (nbytes_xfer%(snbytes*blk_size))/blk_size;
+ h5offset[0] = (hssize_t)(((size_t)nbytes_xfer/((size_t)snbytes*blk_size))*blk_size);
+ h5offset[1] = (hssize_t)(((size_t)nbytes_xfer%((size_t)snbytes*blk_size))/blk_size);
} /* end if */
else {
/* Interleaved access pattern */
/* Skip offset over blocks of other processes */
- h5offset[0] = ((nbytes_xfer*pio_mpi_nprocs_g)/(snbytes*buf_size))*buf_size;
- h5offset[1] = ((nbytes_xfer*pio_mpi_nprocs_g)%(snbytes*buf_size))/buf_size;
+ h5offset[0] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*buf_size))*buf_size);
+ h5offset[1] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*buf_size))/buf_size);
} /* end else */
hrc = H5Soffset_simple(h5dset_space_id, h5offset);
@@ -1380,11 +1382,14 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((hrc >= 0), "H5Dwrite");
/* Increment number of bytes transferred */
- nbytes_xfer += buf_size*blk_size;
+ nbytes_xfer += (off_t)buf_size*(off_t)blk_size;
} /* end else */
break;
+
+ default:
+ break;
} /* switch (parms->io_type) */
} /* end while */
@@ -1485,6 +1490,13 @@ done:
return ret_code;
}
+static off_t
+sqrto(off_t x)
+{
+ double root_x = sqrt((double)x);
+ return (off_t)root_x;
+}
+
/*
* Function: do_read
* Purpose: read the required amount of data from the file.
@@ -1569,7 +1581,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 */
@@ -1577,7 +1589,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* nbytes is always the number of bytes per dataset (1D or 2D). If the
dataspace is 2D, snbytes is the size of a side of the 'dataset square'.
*/
- snbytes = (off_t)sqrt((double)nbytes);
+ snbytes = sqrto(nbytes);
bsize = buf_size * blk_size;
@@ -1591,9 +1603,9 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
bytes_begin[0] = 0;
if (!parms->h5_use_chunks || parms->io_type==PHDF5)
- bytes_begin[1] = (off_t)(blk_size*pio_mpi_rank_g);
+ bytes_begin[1] = (off_t)blk_size*(off_t)pio_mpi_rank_g;
else
- bytes_begin[1] = (off_t)(blk_size*blk_size*pio_mpi_rank_g);
+ bytes_begin[1] = (off_t)blk_size*(off_t)blk_size*(off_t)pio_mpi_rank_g;
} /* end else */
} /* end else */
@@ -1665,7 +1677,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
/* Build contiguous file's derived type */
- mrc = MPI_Type_vector((int)blk_size, (int)1, (int)(snbytes/buf_size),
+ mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes/buf_size),
mpi_partial_buffer_cont, &mpi_cont_type);
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
@@ -1683,7 +1695,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
/* Build interleaved file's derived type */
- mrc = MPI_Type_vector((int)buf_size, (int)1, (int)(snbytes/blk_size),
+ mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes/blk_size),
mpi_partial_buffer_inter, &mpi_inter_type);
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
@@ -1710,7 +1722,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
/* Build chunk interleaved file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)(snbytes/blk_size),
+ mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)((size_t)snbytes/blk_size),
mpi_full_chunk, &mpi_chunk_inter_type);
VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
@@ -1725,22 +1737,22 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
if (!parms->dim2d){
if(nbytes>0) {
/* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = nbytes;
+ h5dims[0] = (hsize_t)nbytes;
h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
VRFY((h5dset_space_id >= 0), "H5Screate_simple");
/* Set up the file dset space id to select the pattern to access */
if (!parms->interleaved){
/* Contiguous pattern */
- h5start[0] = bytes_begin[0];
+ h5start[0] = (hsize_t)bytes_begin[0];
h5stride[0] = h5block[0] = blk_size;
h5count[0] = buf_size/blk_size;
} /* end if */
else {
/* Interleaved access pattern */
/* Skip offset over blocks of other processes */
- h5start[0] = bytes_begin[0];
- h5stride[0] = blk_size*pio_mpi_nprocs_g;
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = blk_size*(size_t)pio_mpi_nprocs_g;
h5block[0] = blk_size;
h5count[0] = buf_size/blk_size;
} /* end else */
@@ -1768,16 +1780,16 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
else {
if(nbytes>0) {
/* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = snbytes;
- h5dims[1] = snbytes;
+ h5dims[0] = (hsize_t)snbytes;
+ h5dims[1] = (hsize_t)snbytes;
h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
VRFY((h5dset_space_id >= 0), "H5Screate_simple");
/* Set up the file dset space id to select the pattern to access */
if (!parms->interleaved){
/* Contiguous pattern */
- h5start[0] = bytes_begin[0];
- h5start[1] = bytes_begin[1];
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
h5stride[0] = 1;
h5stride[1] = h5block[0] = h5block[1] = blk_size;
h5count[0] = 1;
@@ -1786,10 +1798,10 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
else {
/* Interleaved access pattern */
/* Skip offset over blocks of other processes */
- h5start[0] = bytes_begin[0];
- h5start[1] = bytes_begin[1];
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
h5stride[0] = blk_size;
- h5stride[1] = blk_size*pio_mpi_nprocs_g;
+ h5stride[1] = blk_size*(size_t)pio_mpi_nprocs_g;
h5block[0] = h5block[1] = blk_size;
h5count[0] = buf_size/blk_size;
h5count[1] = 1;
@@ -1824,19 +1836,22 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Create the dataset transfer property list */
h5dxpl = H5Pcreate(H5P_DATASET_XFER);
if (h5dxpl < 0) {
- HDfprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
}
/* Change to collective I/O, if asked */
if(parms->collective) {
- hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
+ hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
} /* end if */
break;
+
+ default:
+ break;
} /* end switch */
for (ndset = 1; ndset <= ndsets; ++ndset) {
@@ -1847,19 +1862,21 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
switch (parms->io_type) {
case POSIXIO:
case MPIO:
- /* both posix and mpi io just need dataset offset in file*/
- dset_offset = (ndset - 1) * nbytes;
- break;
+ /* both posix and mpi io just need dataset offset in file*/
+ dset_offset = (ndset - 1) * nbytes;
+ break;
case PHDF5:
HDsprintf(dname, "Dataset_%ld", ndset);
- h5ds_id = H5DOPEN(fd->h5fd, dname);
- if (h5ds_id < 0) {
- HDfprintf(stderr, "HDF5 Dataset open failed\n");
- GOTOERROR(FAIL);
- }
+ h5ds_id = H5DOPEN(fd->h5fd, dname);
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset open failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
- break;
+ default:
+ break;
}
/* The task is to transfer bytes_count bytes, starting at
@@ -1913,7 +1930,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((rc != 0), "POSIXREAD");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ nbytes_xfer+=(off_t)buf_size;
} /* end if */
/* Interleaved access pattern */
else {
@@ -1942,7 +1959,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
buf_p+=blk_size;
/* Advance global offset in dataset */
- nbytes_xfer+=blk_size;
+ nbytes_xfer+=(off_t)blk_size;
/* Decrement number of bytes left this time */
nbytes_toxfer-=blk_size;
@@ -1956,8 +1973,8 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Contiguous access pattern */
if (!parms->interleaved) {
/* Compute file offset */
- file_offset=posix_file_offset+(off_t)(((nbytes_xfer/blk_size)
- /snbytes)*(blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes));
+ file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/blk_size)
+ /(size_t)snbytes)*(blk_size*(size_t)snbytes)+(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes));
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = buf_size;
@@ -1968,9 +1985,9 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Interleaved access pattern */
else {
/* Compute file offset */
- file_offset=posix_file_offset+(off_t)((((nbytes_xfer/buf_size)
- *pio_mpi_nprocs_g)/snbytes)*(buf_size*snbytes)
- +((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes);
+ file_offset=posix_file_offset+(off_t)(((((size_t)nbytes_xfer/buf_size)
+ *(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*(buf_size*(size_t)snbytes)
+ +(((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes);
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = blk_size;
@@ -2001,16 +2018,16 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
*snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
*pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
- file_offset=posix_file_offset+(off_t)(((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)+((nbytes_xfer/(buf_size/blk_size))
- *pio_mpi_nprocs_g)%(snbytes*blk_size));
+ file_offset=posix_file_offset+(off_t)((((size_t)nbytes_xfer/(buf_size/blk_size)
+ *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes)+(((size_t)nbytes_xfer/(buf_size/blk_size))
+ *(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size));
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = blk_size * blk_size;
/* Global offset advance after each I/O operation */
/* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
- file_offset_advance = (off_t)(snbytes*blk_size);
+ file_offset_advance = (off_t)((size_t)snbytes*blk_size);
} /* end else */
} /* end else */
@@ -2037,7 +2054,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
buf_p+=nbytes_xfer_advance;
/* Advance global offset in dataset */
- nbytes_xfer+=nbytes_xfer_advance;
+ nbytes_xfer+=(off_t)nbytes_xfer_advance;
/* Decrement number of bytes left this time */
nbytes_toxfer-=nbytes_xfer_advance;
@@ -2067,7 +2084,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ nbytes_xfer+=(off_t)buf_size;
} /* end if */
/* Interleaved access pattern */
else {
@@ -2092,7 +2109,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
buf_p+=blk_size;
/* Advance global offset in dataset */
- nbytes_xfer+=blk_size;
+ nbytes_xfer+=(off_t)blk_size;
/* Decrement number of bytes left this time */
nbytes_toxfer-=blk_size;
@@ -2113,7 +2130,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ nbytes_xfer+=(off_t)buf_size;
} /* end if */
/* Interleaved access pattern */
else {
@@ -2132,7 +2149,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ nbytes_xfer+=(off_t)buf_size;
} /* end else */
} /* end else */
} /* end if */
@@ -2143,8 +2160,8 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Contiguous access pattern */
if (!parms->interleaved) {
/* Compute offset in file */
- mpi_offset=mpi_file_offset+((nbytes_xfer/blk_size)/snbytes)*
- (blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes);
+ mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/blk_size)/(size_t)snbytes)*
+ (blk_size*(size_t)snbytes))+(MPI_Offset)(((size_t)nbytes_xfer/blk_size)%(size_t)snbytes);
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = buf_size;
@@ -2158,8 +2175,8 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* Interleaved access pattern */
else {
/* Compute offset in file */
- mpi_offset=mpi_file_offset+(((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)/snbytes)*
- (buf_size*snbytes)+((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes;
+ mpi_offset=mpi_file_offset+(MPI_Offset)(((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)/(size_t)snbytes)*
+ (buf_size*(size_t)snbytes))+(MPI_Offset)((((size_t)nbytes_xfer/buf_size)*(size_t)pio_mpi_nprocs_g)%(size_t)snbytes);
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = blk_size;
@@ -2196,16 +2213,16 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
(buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
/blk_size*(blk_size*blk_size)); */
- mpi_offset=mpi_file_offset+((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)
- +((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes*blk_size);
+ mpi_offset=mpi_file_offset+(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size)
+ *(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*blk_size))*(buf_size*(size_t)snbytes))
+ +(MPI_Offset)((((size_t)nbytes_xfer/(buf_size/blk_size))*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*blk_size));
/* Number of bytes to be transferred per I/O operation */
nbytes_xfer_advance = blk_size * blk_size;
/* Global offset advance after each I/O operation */
/* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
- mpi_offset_advance = (MPI_Offset)(snbytes*blk_size);
+ mpi_offset_advance = (MPI_Offset)((size_t)snbytes*blk_size);
/* MPI type to be used for collective access */
mpi_collective_type = mpi_chunk_inter_type;
@@ -2231,7 +2248,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
buf_p+=nbytes_xfer_advance;
/* Advance global offset in dataset */
- nbytes_xfer+=nbytes_xfer_advance;
+ nbytes_xfer+=(off_t)nbytes_xfer_advance;
/* Decrement number of bytes left this time */
nbytes_toxfer-=nbytes_xfer_advance;
@@ -2254,7 +2271,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
/* Advance global offset in dataset */
- nbytes_xfer+=buf_size*blk_size;
+ nbytes_xfer+=(off_t)buf_size*(off_t)blk_size;
} /* end else */
} /* end else */
@@ -2282,21 +2299,21 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((hrc >= 0), "H5Dread");
/* Increment number of bytes transferred */
- nbytes_xfer += buf_size;
+ nbytes_xfer += (off_t)buf_size;
} /* end if */
/* 2D dataspace */
else {
/* Set up the file dset space id to move the selection to process */
if (!parms->interleaved){
/* Contiguous pattern */
- h5offset[0] = (nbytes_xfer/(snbytes*blk_size))*blk_size;
- h5offset[1] = (nbytes_xfer%(snbytes*blk_size))/blk_size;
+ h5offset[0] = (hssize_t)(((size_t)nbytes_xfer/((size_t)snbytes*blk_size))*blk_size);
+ h5offset[1] = (hssize_t)(((size_t)nbytes_xfer%((size_t)snbytes*blk_size))/blk_size);
} /* end if */
else {
/* Interleaved access pattern */
/* Skip offset over blocks of other processes */
- h5offset[0] = ((nbytes_xfer*pio_mpi_nprocs_g)/(snbytes*buf_size))*buf_size;
- h5offset[1] = ((nbytes_xfer*pio_mpi_nprocs_g)%(snbytes*buf_size))/buf_size;
+ h5offset[0] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)/((size_t)snbytes*buf_size))*buf_size);
+ h5offset[1] = (hssize_t)((((size_t)nbytes_xfer*(size_t)pio_mpi_nprocs_g)%((size_t)snbytes*buf_size))/buf_size);
} /* end else */
hrc = H5Soffset_simple(h5dset_space_id, h5offset);
@@ -2308,10 +2325,13 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
VRFY((hrc >= 0), "H5Dread");
/* Increment number of bytes transferred */
- nbytes_xfer += buf_size*blk_size;
+ nbytes_xfer += (off_t)buf_size*(off_t)blk_size;
} /* end else */
break;
+
+ default:
+ break;
} /* switch (parms->io_type) */
/* Verify raw data, if asked */
@@ -2541,6 +2561,9 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
}
break;
+
+ default:
+ break;
}
done:
@@ -2561,38 +2584,41 @@ do_fclose(iotype iot, file_descr *fd /*out*/)
int mrc = 0, rc = 0;
switch (iot) {
- case POSIXIO:
- rc = POSIXCLOSE(fd->posixfd);
+ case POSIXIO:
+ rc = POSIXCLOSE(fd->posixfd);
- if (rc != 0){
- HDfprintf(stderr, "POSIX File Close failed\n");
- GOTOERROR(FAIL);
- }
+ if (rc != 0){
+ HDfprintf(stderr, "POSIX File Close failed\n");
+ GOTOERROR(FAIL);
+ }
- fd->posixfd = -1;
- break;
+ fd->posixfd = -1;
+ break;
- case MPIO:
- mrc = MPI_File_close(&fd->mpifd);
+ case MPIO:
+ mrc = MPI_File_close(&fd->mpifd);
- if (mrc != MPI_SUCCESS){
- HDfprintf(stderr, "MPI File close failed\n");
- GOTOERROR(FAIL);
- }
+ if (mrc != MPI_SUCCESS){
+ HDfprintf(stderr, "MPI File close failed\n");
+ GOTOERROR(FAIL);
+ }
- fd->mpifd = MPI_FILE_NULL;
- break;
+ fd->mpifd = MPI_FILE_NULL;
+ break;
- case PHDF5:
- hrc = H5Fclose(fd->h5fd);
+ case PHDF5:
+ hrc = H5Fclose(fd->h5fd);
- if (hrc < 0) {
- HDfprintf(stderr, "HDF5 File Close failed\n");
- GOTOERROR(FAIL);
- }
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 File Close failed\n");
+ GOTOERROR(FAIL);
+ }
- fd->h5fd = -1;
- break;
+ fd->h5fd = -1;
+ break;
+
+ default:
+ break;
}
done:
@@ -2619,15 +2645,17 @@ do_cleanupfile(iotype iot, char *fname)
clean_file_g = (getenv("HDF5_NOCLEANUP")==NULL) ? 1 : 0;
if (clean_file_g){
- switch (iot){
- case POSIXIO:
- HDremove(fname);
- break;
- case MPIO:
- case PHDF5:
- MPI_File_delete(fname, h5_io_info_g);
- break;
- }
+ switch (iot){
+ case POSIXIO:
+ HDremove(fname);
+ break;
+ case MPIO:
+ case PHDF5:
+ MPI_File_delete(fname, h5_io_info_g);
+ break;
+ default:
+ break;
+ }
}
}
diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c
index 5977731..826e7a9 100644
--- a/tools/test/perform/pio_perf.c
+++ b/tools/test/perform/pio_perf.c
@@ -80,8 +80,13 @@
#define PIO_MPI 0x2
#define PIO_HDF5 0x4
+#ifdef STANDALONE
+#define DBL_EPSILON 2.2204460492503131e-16
+#define H5_DBL_ABS_EQUAL(X,Y) (fabs((X)-(Y)) < DBL_EPSILON)
+#endif
+
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) (((t)==0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
+#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
#ifndef TRUE
#define TRUE 1
@@ -311,6 +316,7 @@ static void output_report(const char *fmt, ...);
static void print_indent(register int indent);
static void usage(const char *prog);
static void report_parameters(struct options *opts);
+static off_t squareo(off_t);
/*
* Function: main
@@ -393,6 +399,12 @@ finish:
return exit_value;
}
+off_t
+squareo(off_t x)
+{
+ return x * x;
+}
+
/*
* Function: run_test_loop
* Purpose: Run the I/O tests. Write the results to OUTPUT.
@@ -428,8 +440,8 @@ run_test_loop(struct options *opts)
parms.interleaved = opts->interleaved;
parms.collective = opts->collective;
parms.dim2d = opts->dim2d;
- parms.h5_align = opts->h5_alignment;
- parms.h5_thresh = opts->h5_threshold;
+ parms.h5_align = (hsize_t)opts->h5_alignment;
+ parms.h5_thresh = (hsize_t)opts->h5_threshold;
parms.h5_use_chunks = opts->h5_use_chunks;
parms.h5_write_only = opts->h5_write_only;
parms.verify = opts->verify;
@@ -456,7 +468,7 @@ run_test_loop(struct options *opts)
parms.buf_size = buf_size;
if (parms.dim2d){
- parms.num_bytes = (off_t)pow((double)(opts->num_bpp*parms.num_procs),2);
+ parms.num_bytes = squareo(opts->num_bpp * parms.num_procs);
if (parms.interleaved)
output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n",
buf_size, opts->blk_size,
@@ -558,6 +570,8 @@ run_test(iotype iot, parameters parms, struct options *opts)
case PHDF5:
output_report("PHDF5 (w/MPI-IO driver)\n");
break;
+ default:
+ break;
}
MPI_Comm_size(pio_comm_g, &comm_size);
@@ -879,7 +893,7 @@ accumulate_minmax_stuff(minmax *mm, int count)
int i;
minmax total_mm;
- total_mm.sum = 0.0;
+ total_mm.sum = 0.0f;
total_mm.max = -DBL_MAX;
total_mm.min = DBL_MAX;
total_mm.num = count;
@@ -1155,10 +1169,10 @@ report_parameters(struct options *opts)
recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n");
HDfprintf(output, "rank %d: File size=", rank);
- recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->min_num_procs),2)
- * opts->num_dsets), ":");
- recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->max_num_procs),2)
- * opts->num_dsets), "\n");
+ recover_size_and_print((long long)(squareo(opts->num_bpp * opts->min_num_procs)
+ * opts->num_dsets), ":");
+ recover_size_and_print((long long)(squareo(opts->num_bpp * opts->max_num_procs)
+ * opts->num_dsets), "\n");
HDfprintf(output, "rank %d: Transfer buffer size=", rank);
if(opts->interleaved){
@@ -1322,7 +1336,7 @@ parse_command_line(int argc, char *argv[])
break;
#endif /* 0 */
case 'B':
- cl_opts->blk_size = parse_size_directive(opt_arg);
+ cl_opts->blk_size = (size_t)parse_size_directive(opt_arg);
break;
case 'c':
/* Turn on chunked HDF5 dataset creation */
@@ -1423,10 +1437,10 @@ parse_command_line(int argc, char *argv[])
cl_opts->h5_write_only = TRUE;
break;
case 'x':
- cl_opts->min_xfer_size = parse_size_directive(opt_arg);
+ cl_opts->min_xfer_size = (size_t)parse_size_directive(opt_arg);
break;
case 'X':
- cl_opts->max_xfer_size = parse_size_directive(opt_arg);
+ cl_opts->max_xfer_size = (size_t)parse_size_directive(opt_arg);
break;
case 'h':
case '?':
@@ -1446,13 +1460,13 @@ parse_command_line(int argc, char *argv[])
}
if (cl_opts->max_xfer_size == 0)
- cl_opts->max_xfer_size = cl_opts->num_bpp;
+ cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp;
if (cl_opts->min_xfer_size == 0)
- cl_opts->min_xfer_size = (cl_opts->num_bpp)/2;
+ cl_opts->min_xfer_size = (size_t)(cl_opts->num_bpp)/2;
if (cl_opts->blk_size == 0)
- cl_opts->blk_size = (cl_opts->num_bpp)/2;
+ cl_opts->blk_size = (size_t)(cl_opts->num_bpp)/2;
/* set default if none specified yet */
@@ -1462,15 +1476,15 @@ parse_command_line(int argc, char *argv[])
/* verify parameters sanity. Adjust if needed. */
/* cap xfer_size with bytes per process */
if (!cl_opts->dim2d) {
- if (cl_opts->min_xfer_size > cl_opts->num_bpp)
- cl_opts->min_xfer_size = cl_opts->num_bpp;
- if (cl_opts->max_xfer_size > cl_opts->num_bpp)
- cl_opts->max_xfer_size = cl_opts->num_bpp;
+ if (cl_opts->min_xfer_size > (size_t)cl_opts->num_bpp)
+ cl_opts->min_xfer_size = (size_t)cl_opts->num_bpp;
+ if (cl_opts->max_xfer_size > (size_t)cl_opts->num_bpp)
+ cl_opts->max_xfer_size = (size_t)cl_opts->num_bpp;
}
if (cl_opts->min_xfer_size > cl_opts->max_xfer_size)
cl_opts->min_xfer_size = cl_opts->max_xfer_size;
- if (cl_opts->blk_size > cl_opts->num_bpp )
- cl_opts->blk_size = cl_opts->num_bpp;
+ if (cl_opts->blk_size > (size_t)cl_opts->num_bpp )
+ cl_opts->blk_size = (size_t)cl_opts->num_bpp;
/* check range of number of processes */
if (cl_opts->min_num_procs <= 0)
cl_opts->min_num_procs = 1;