summaryrefslogtreecommitdiffstats
path: root/tools/test/perform
diff options
context:
space:
mode:
Diffstat (limited to 'tools/test/perform')
-rw-r--r--tools/test/perform/CMakeLists.txt39
-rw-r--r--tools/test/perform/CMakeTests.cmake305
-rw-r--r--tools/test/perform/Makefile.am4
-rw-r--r--tools/test/perform/Makefile.in102
-rw-r--r--tools/test/perform/chunk.c4
-rw-r--r--tools/test/perform/chunk_cache.c394
-rw-r--r--tools/test/perform/direct_write_perf.c86
-rw-r--r--tools/test/perform/iopipe.c419
-rw-r--r--tools/test/perform/overhead.c8
-rw-r--r--tools/test/perform/perf.c34
-rw-r--r--tools/test/perform/perf_meta.c2
-rw-r--r--tools/test/perform/pio_engine.c432
-rw-r--r--tools/test/perform/pio_perf.c82
-rw-r--r--tools/test/perform/pio_perf.h3
-rw-r--r--tools/test/perform/pio_standalone.c132
-rw-r--r--tools/test/perform/pio_standalone.h6
-rw-r--r--tools/test/perform/sio_engine.c63
-rw-r--r--tools/test/perform/sio_perf.c24
-rw-r--r--tools/test/perform/sio_perf.h3
-rw-r--r--tools/test/perform/sio_standalone.h19
-rw-r--r--tools/test/perform/zip_perf.c4
21 files changed, 1328 insertions, 837 deletions
diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt
index d6a25d5..3c45e85 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)
# --------------------------------------------------------------------
@@ -21,20 +21,21 @@ endif ()
set_target_properties (h5perf_serial PROPERTIES FOLDER perform)
if (HDF5_BUILD_PERFORM_STANDALONE)
- #-- Adding test for h5perf_serial_alone
+ #-- Adding test for h5perf_serial_alone - io_timer.c includes
set (h5perf_serial_alone_SOURCES
+ ${HDF5_TOOLS_DIR}/lib/io_timer.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c
)
add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES})
- target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5perf_serial_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_serial_alone STATIC)
- target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
else ()
TARGET_C_PROPERTIES (h5perf_serial_alone SHARED)
- target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
endif ()
set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform)
set_property (TARGET h5perf_serial_alone
@@ -72,6 +73,21 @@ else ()
endif ()
set_target_properties (iopipe PROPERTIES FOLDER perform)
+#-- Adding test for chunk_cache
+set (chunk_cache_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk_cache.c
+)
+add_executable (chunk_cache ${chunk_cache_SOURCES})
+target_include_directories (chunk_cache PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (chunk_cache STATIC)
+ target_link_libraries (chunk_cache PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+else ()
+ TARGET_C_PROPERTIES (chunk_cache SHARED)
+ target_link_libraries (chunk_cache PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+endif ()
+set_target_properties (chunk_cache PROPERTIES FOLDER perform)
+
#-- Adding test for overhead
set (overhead_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c
@@ -117,7 +133,7 @@ else ()
endif ()
set_target_properties (zip_perf PROPERTIES FOLDER perform)
-if (H5_HAVE_PARALLEL AND BUILD_TESTING)
+if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
if (UNIX)
#-- Adding test for perf - only on unix systems
set (perf_SOURCES
@@ -154,18 +170,19 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING)
if (HDF5_BUILD_PERFORM_STANDALONE)
#-- Adding test for h5perf
set (h5perf_alone_SOURCES
+ ${HDF5_TOOLS_DIR}/lib/io_timer.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c
)
add_executable (h5perf_alone ${h5perf_alone_SOURCES})
- target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ 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_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+ 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_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ 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
@@ -174,4 +191,6 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING)
endif ()
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake
index f0ae416..5d61f7b 100644
--- a/tools/test/perform/CMakeTests.cmake
+++ b/tools/test/perform/CMakeTests.cmake
@@ -22,175 +22,176 @@ add_custom_target(zip_perf_files ALL COMMENT "Copying files needed by zip_perf t
#-----------------------------------------------------------------------------
# Add Tests
#-----------------------------------------------------------------------------
+if (HDF5_TEST_SERIAL)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME PERFORM_h5perform-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ chunk.h5
+ iopipe.h5
+ iopipe.raw
+ x-diag-rd.dat
+ x-diag-wr.dat
+ x-rowmaj-rd.dat
+ x-rowmaj-wr.dat
+ x-gnuplot
+ h5perf_serial.txt
+ h5perf_serial.txt.err
+ chunk.txt
+ chunk.txt.err
+ iopipe.txt
+ iopipe.txt.err
+ overhead.txt
+ overhead.txt.err
+ perf_meta.txt
+ perf_meta.txt.err
+ zip_perf-h.txt
+ zip_perf-h.txt.err
+ zip_perf.txt
+ zip_perf.txt.err
+ )
-# Remove any output file left over from previous test run
-add_test (
- NAME PERFORM_h5perform-clearall-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- chunk.h5
- iopipe.h5
- iopipe.raw
- x-diag-rd.dat
- x-diag-wr.dat
- x-rowmaj-rd.dat
- x-rowmaj-wr.dat
- x-gnuplot
- h5perf_serial.txt
- h5perf_serial.txt.err
- chunk.txt
- chunk.txt.err
- iopipe.txt
- iopipe.txt.err
- overhead.txt
- overhead.txt.err
- perf_meta.txt
- perf_meta.txt.err
- zip_perf-h.txt
- zip_perf-h.txt.err
- zip_perf.txt
- zip_perf.txt.err
-)
-
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial>)
-else ()
- add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5perf_serial>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=h5perf_serial.txt"
- #-D "TEST_REFERENCE=h5perf_serial.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial>)
+ else ()
+ add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5perf_serial>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=h5perf_serial.txt"
+ #-D "TEST_REFERENCE=h5perf_serial.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_h5perf_serial PROPERTIES
+ TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_h5perf_serial PROPERTIES
- TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_BUILD_PERFORM_STANDALONE)
- add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial_alone>)
-endif ()
+ if (HDF5_BUILD_PERFORM_STANDALONE)
+ add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial_alone>)
+ endif ()
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:chunk>)
-else ()
- add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:chunk>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=chunk.txt"
- #-D "TEST_REFERENCE=chunk.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:chunk>)
+ else ()
+ add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:chunk>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=chunk.txt"
+ #-D "TEST_REFERENCE=chunk.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_chunk PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_chunk PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:iopipe>)
-else ()
- add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:iopipe>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=iopipe.txt"
- #-D "TEST_REFERENCE=iopipe.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:iopipe>)
+ else ()
+ add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:iopipe>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=iopipe.txt"
+ #-D "TEST_REFERENCE=iopipe.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_iopipe PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_iopipe PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:overhead>)
-else ()
- add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:overhead>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=overhead.txt"
- #-D "TEST_REFERENCE=overhead.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:overhead>)
+ else ()
+ add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:overhead>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=overhead.txt"
+ #-D "TEST_REFERENCE=overhead.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_overhead PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_overhead PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:perf_meta>)
-else ()
- add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:perf_meta>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=perf_meta.txt"
- #-D "TEST_REFERENCE=perf_meta.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:perf_meta>)
+ else ()
+ add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:perf_meta>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=perf_meta.txt"
+ #-D "TEST_REFERENCE=perf_meta.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_perf_meta PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_perf_meta PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> "-h")
-else ()
- add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=zip_perf-h.txt"
- #-D "TEST_REFERENCE=zip_perf-h.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> "-h")
+ else ()
+ add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=zip_perf-h.txt"
+ #-D "TEST_REFERENCE=zip_perf-h.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_zip_perf_help PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_zip_perf_help PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> tfilters.h5)
-else ()
- add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=zip_perf.txt"
- #-D "TEST_REFERENCE=zip_perf.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> tfilters.h5)
+ else ()
+ add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=zip_perf.txt"
+ #-D "TEST_REFERENCE=zip_perf.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_zip_perf PROPERTIES
+ DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects"
)
endif ()
-set_tests_properties (PERFORM_zip_perf PROPERTIES
- DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects"
-)
-if (H5_HAVE_PARALLEL)
+if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
if (UNIX)
add_test (NAME MPI_TEST_PERFORM_perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:perf> ${MPIEXEC_POSTFLAGS})
endif ()
diff --git a/tools/test/perform/Makefile.am b/tools/test/perform/Makefile.am
index 5a89a66..39800d7 100644
--- a/tools/test/perform/Makefile.am
+++ b/tools/test/perform/Makefile.am
@@ -50,12 +50,12 @@ if BUILD_PARALLEL_CONDITIONAL
TEST_PROG_PARA=h5perf perf
endif
# Serial test programs.
-TEST_PROG = iopipe chunk overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS)
+TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS)
# check_PROGRAMS will be built but not installed. Do not any executable
# that is in bin_PROGRAMS already. Otherwise, it will be removed twice in
# "make clean" and some systems, e.g., AIX, do not like it.
-check_PROGRAMS= iopipe chunk overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf
+check_PROGRAMS= iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf
h5perf_SOURCES=pio_perf.c pio_engine.c
h5perf_serial_SOURCES=sio_perf.c sio_engine.c
diff --git a/tools/test/perform/Makefile.in b/tools/test/perform/Makefile.in
index 6f1619a..efd772d 100644
--- a/tools/test/perform/Makefile.in
+++ b/tools/test/perform/Makefile.in
@@ -108,9 +108,9 @@ host_triplet = @host@
@BUILD_PARALLEL_CONDITIONAL_TRUE@bin_PROGRAMS = \
@BUILD_PARALLEL_CONDITIONAL_TRUE@ h5perf_serial$(EXEEXT) \
@BUILD_PARALLEL_CONDITIONAL_TRUE@ h5perf$(EXEEXT)
-check_PROGRAMS = iopipe$(EXEEXT) chunk$(EXEEXT) overhead$(EXEEXT) \
- zip_perf$(EXEEXT) perf_meta$(EXEEXT) $(am__EXEEXT_2) \
- perf$(EXEEXT)
+check_PROGRAMS = iopipe$(EXEEXT) chunk$(EXEEXT) chunk_cache$(EXEEXT) \
+ overhead$(EXEEXT) zip_perf$(EXEEXT) perf_meta$(EXEEXT) \
+ $(am__EXEEXT_2) perf$(EXEEXT)
TESTS = $(am__EXEEXT_3)
subdir = tools/test/perform
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -152,6 +152,10 @@ AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
+chunk_cache_SOURCES = chunk_cache.c
+chunk_cache_OBJECTS = chunk_cache.$(OBJEXT)
+chunk_cache_LDADD = $(LDADD)
+chunk_cache_DEPENDENCIES = $(LIBHDF5)
am_h5perf_OBJECTS = pio_perf.$(OBJEXT) pio_engine.$(OBJEXT)
h5perf_OBJECTS = $(am_h5perf_OBJECTS)
h5perf_DEPENDENCIES = $(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
@@ -214,10 +218,12 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = chunk.c $(h5perf_SOURCES) $(h5perf_serial_SOURCES) iopipe.c \
- overhead.c perf.c perf_meta.c zip_perf.c
-DIST_SOURCES = chunk.c $(h5perf_SOURCES) $(h5perf_serial_SOURCES) \
- iopipe.c overhead.c perf.c perf_meta.c zip_perf.c
+SOURCES = chunk.c chunk_cache.c $(h5perf_SOURCES) \
+ $(h5perf_serial_SOURCES) iopipe.c overhead.c perf.c \
+ perf_meta.c zip_perf.c
+DIST_SOURCES = chunk.c chunk_cache.c $(h5perf_SOURCES) \
+ $(h5perf_serial_SOURCES) iopipe.c overhead.c perf.c \
+ perf_meta.c zip_perf.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -426,9 +432,9 @@ am__set_TESTS_bases = \
bases=`echo $$bases`
RECHECK_LOGS = $(TEST_LOGS)
AM_RECURSIVE_TARGETS = check recheck
-am__EXEEXT_3 = iopipe$(EXEEXT) chunk$(EXEEXT) overhead$(EXEEXT) \
- zip_perf$(EXEEXT) perf_meta$(EXEEXT) h5perf_serial$(EXEEXT) \
- $(am__EXEEXT_2)
+am__EXEEXT_3 = iopipe$(EXEEXT) chunk$(EXEEXT) chunk_cache$(EXEEXT) \
+ overhead$(EXEEXT) zip_perf$(EXEEXT) perf_meta$(EXEEXT) \
+ h5perf_serial$(EXEEXT) $(am__EXEEXT_2)
TEST_SUITE_LOG = test-suite.log
LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
@@ -457,13 +463,13 @@ AMTAR = @AMTAR@
# H5_CFLAGS holds flags that should be used when building hdf5,
# but which should not be exported to h5cc for building other programs.
-# AM_CFLAGS is an automake construct which should be used by Makefiles
+# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
-AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
+AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \
-I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
-AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_JAVACFLAGS = @AM_JAVACFLAGS@
@@ -483,6 +489,7 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
CFLAGS = @CFLAGS@
+CLANG_SANITIZE_CHECKS = @CLANG_SANITIZE_CHECKS@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
@@ -499,6 +506,7 @@ DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@
DEV_WARNINGS = @DEV_WARNINGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
@@ -535,8 +543,11 @@ H5_CFLAGS = @H5_CFLAGS@
H5_CLASSPATH = @H5_CLASSPATH@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
+H5_ECFLAGS = @H5_ECFLAGS@
+H5_ECXXFLAGS = @H5_ECXXFLAGS@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
+H5_IS_DARWIN = @H5_IS_DARWIN@
H5_JAVACFLAGS = @H5_JAVACFLAGS@
H5_JAVAFLAGS = @H5_JAVAFLAGS@
H5_JNIFLAGS = @H5_JNIFLAGS@
@@ -559,6 +570,7 @@ HL = @HL@
HL_FOR = @HL_FOR@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
+IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -595,6 +607,7 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
+MIRROR_VFD = @MIRROR_VFD@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -654,6 +667,7 @@ TIME = @TIME@
TR = @TR@
TRACE_API = @TRACE_API@
UNAME_INFO = @UNAME_INFO@
+USE_FILE_LOCKING = @USE_FILE_LOCKING@
USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@
USE_FILTER_SZIP = @USE_FILTER_SZIP@
USINGMEMCHECKER = @USINGMEMCHECKER@
@@ -689,6 +703,7 @@ docdir = $(exec_prefix)/doc
dvidir = @dvidir@
enable_shared = @enable_shared@
enable_static = @enable_static@
+examplesdir = @examplesdir@
exec_prefix = @exec_prefix@
fortran_linux_linker_option = @fortran_linux_linker_option@
host = @host@
@@ -745,15 +760,15 @@ LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la
LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
-# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
-# has been removed. According to the official description of DESTDIR by Gnu at
-# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
-# prepended to the normal and complete install path that it precedes for the
-# purpose of installing in a temporary directory which is useful for building
-# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
-# '/' at the beginning of the normal install path. When DESTDIR is empty the
-# path then begins with '//', which is incorrect and causes problems at least for
-# Cygwin.
+# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
+# has been removed. According to the official description of DESTDIR by Gnu at
+# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
+# prepended to the normal and complete install path that it precedes for the
+# purpose of installing in a temporary directory which is useful for building
+# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
+# '/' at the beginning of the normal install path. When DESTDIR is empty the
+# path then begins with '//', which is incorrect and causes problems at least for
+# Cygwin.
# Scripts used to build examples
# If only shared libraries have been installed, have h5cc build examples with
@@ -790,7 +805,7 @@ h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# Parallel test programs.
@BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_PROG_PARA = h5perf perf
# Serial test programs.
-TEST_PROG = iopipe chunk overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS)
+TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS)
h5perf_SOURCES = pio_perf.c pio_engine.c
h5perf_serial_SOURCES = sio_perf.c sio_engine.c
@@ -819,7 +834,7 @@ LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \
PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \
$(EXTRA_PROG)
-chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
AM_SH_LOG_FLAGS =
@@ -925,6 +940,10 @@ chunk$(EXEEXT): $(chunk_OBJECTS) $(chunk_DEPENDENCIES) $(EXTRA_chunk_DEPENDENCIE
@rm -f chunk$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(chunk_OBJECTS) $(chunk_LDADD) $(LIBS)
+chunk_cache$(EXEEXT): $(chunk_cache_OBJECTS) $(chunk_cache_DEPENDENCIES) $(EXTRA_chunk_cache_DEPENDENCIES)
+ @rm -f chunk_cache$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(chunk_cache_OBJECTS) $(chunk_cache_LDADD) $(LIBS)
+
h5perf$(EXEEXT): $(h5perf_OBJECTS) $(h5perf_DEPENDENCIES) $(EXTRA_h5perf_DEPENDENCIES)
@rm -f h5perf$(EXEEXT)
$(AM_V_CCLD)$(h5perf_LINK) $(h5perf_OBJECTS) $(h5perf_LDADD) $(LIBS)
@@ -960,6 +979,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk_cache.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iopipe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/overhead.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf.Po@am__quote@
@@ -1196,6 +1216,13 @@ chunk.log: chunk$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+chunk_cache.log: chunk_cache$(EXEEXT)
+ @p='chunk_cache$(EXEEXT)'; \
+ b='chunk_cache'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
overhead.log: overhead$(EXEEXT)
@p='overhead$(EXEEXT)'; \
b='overhead'; \
@@ -1508,28 +1535,37 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
echo "============================" > $${log}; \
fi; \
if test "X$(FORTRAN_API)" = "Xyes"; then \
- echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
+ echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
if test -n "$(REALTIMEOUTPUT)"; then \
- echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \
+ echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \
else \
- echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+ echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \
fi; \
elif test "X$(CXX_API)" = "Xyes"; then \
- echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
+ echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \
if test -n "$(REALTIMEOUTPUT)"; then \
- echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log};\
+ echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log};\
else \
- echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\
+ echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" >> $${log};\
fi; \
else \
- echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
+ echo "Testing: $${tname} $(TEST_FLAGS)"; \
if test -n "$(REALTIMEOUTPUT)"; then \
- echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \
+ echo "Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \
else \
- echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+ echo "Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \
fi; \
fi; \
if test -n "$(REALTIMEOUTPUT)"; then \
+ if test -n "$(HDF5_DRIVER)"; then \
+ echo "Virtual file driver (VFD): $(HDF5_DRIVER)" | tee -a $${log}; \
+ fi; \
+ else \
+ if test -n "$(HDF5_DRIVER)"; then \
+ echo "Virtual file driver (VFD): $(HDF5_DRIVER)" >> $${log}; \
+ fi; \
+ fi; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
echo "============================" | tee -a $${log}; \
else \
echo "============================" >> $${log}; \
diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c
index 804f88e..bd16e1d 100644
--- a/tools/test/perform/chunk.c
+++ b/tools/test/perform/chunk.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <robb@arborea.spizella.com>
+ * Programmer: Robb Matzke
* Thursday, May 14, 1998
*
* Purpose: Checks the effect of various I/O request sizes and raw data
@@ -72,7 +72,7 @@
/* #define DIAG_NRDCC 521 */
static size_t nio_g;
-static hid_t fapl_g = -1;
+static hid_t fapl_g = H5I_INVALID_HID;
/* Local function prototypes */
static size_t
diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c
new file mode 100644
index 0000000..d7c56af
--- /dev/null
+++ b/tools/test/perform/chunk_cache.c
@@ -0,0 +1,394 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: check the performance of chunk cache in these two cases (HDFFV-10601):
+ * 1. partial chunks exist along any dimension.
+ * 2. number of slots in chunk cache is smaller than the number of chunks
+ * in the fastest-growing dimension.
+ */
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5test.h"
+
+#define FILENAME "chunk_cache_perf.h5"
+
+#define RANK 2
+
+#define DSET1_NAME "partial_chunks"
+#define DSET1_DIM1 9 * 1000
+#define DSET1_DIM2 9
+#define CHUNK1_DIM1 2 * 1000
+#define CHUNK1_DIM2 2
+
+#define DSET2_NAME "hash_value"
+#define DSET2_DIM1 300
+#define DSET2_DIM2 600
+#define CHUNK2_DIM1 100
+#define CHUNK2_DIM2 100
+
+#define RDCC_NSLOTS 5
+#define RDCC_NBYTES 1024 * 1024 * 10
+#define RDCC_W0 0.75F
+
+#define FILTER_COUNTER 306
+static size_t nbytes_global;
+
+typedef struct test_time_t {
+ long tv_sec;
+ long tv_usec;
+} test_time_t;
+
+/* Local function prototypes for the dummy filter */
+static size_t
+counter (unsigned flags, size_t cd_nelmts,
+ const unsigned *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
+
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_COUNTER[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER_COUNTER, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "counter", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ counter, /* The actual filter function */
+}};
+
+/*-------------------------------------------------------------------------
+ * Count number of bytes but don't do anything else. Keep
+ * track of the data of chunks being read from file into memory.
+ */
+static size_t
+counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
+ const unsigned H5_ATTR_UNUSED *cd_values, size_t nbytes,
+ size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+{
+ nbytes_global += nbytes;
+ return nbytes;
+}
+
+/*---------------------------------------------------------------------------*/
+static void
+cleanup (void)
+{
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove (FILENAME);
+ }
+}
+
+/*-------------------------------------------------------------------------------
+ * Create a chunked dataset with partial chunks along either dimensions:
+ * dataset dimension: 9000 x 9
+ * chunk dimension: 2000 x 2
+ */
+static int create_dset1(hid_t file)
+{
+ hid_t dataspace = H5I_INVALID_HID, dataset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2};
+ hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2};
+ int **data; /* data for writing */
+
+ /* Create the data space. */
+ if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0)
+ goto error;
+
+ /* Modify dataset creation properties, i.e. enable chunking */
+ if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk (dcpl, RANK, chunk_dims) < 0)
+ goto error;
+
+ /* Set the dummy filter simply for counting the number of bytes being read into the memory */
+ if(H5Zregister(H5Z_COUNTER) < 0)
+ goto error;
+
+ if(H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0)
+ goto error;
+
+ /* Create a new dataset within the file using chunk creation properties. */
+ if((dataset = H5Dcreate2 (file, DSET1_NAME, H5T_NATIVE_INT, dataspace,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create & fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2);
+ H5TEST_FILL_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2);
+
+
+ /* Write data to dataset */
+ if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, data) < 0)
+ goto error;
+
+ /* Close resources */
+ H5Dclose (dataset);
+ H5Pclose (dcpl);
+ H5Sclose (dataspace);
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose (dataset);
+ H5Pclose (dcpl);
+ H5Sclose (dataspace);
+ } H5E_END_TRY;
+
+ return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Create a chunked dataset for testing hash values:
+ * dataset dimensions: 300 x 600
+ * chunk dimensions: 100 x 100
+ */
+static int create_dset2(hid_t file)
+{
+ hid_t dataspace = H5I_INVALID_HID, dataset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2};
+ hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2};
+ int **data; /* data for writing */
+
+ /* Create the data space. */
+ if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ goto error;
+
+ /* Modify dataset creation properties, i.e. enable chunking */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto error;
+
+ /* Set the dummy filter simply for counting the number of bytes being read into the memory */
+ if(H5Zregister(H5Z_COUNTER) < 0)
+ goto error;
+ if(H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0)
+ goto error;
+
+ /* Create a new dataset within the file using chunk creation properties. */
+ if((dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, dataspace,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create & fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2);
+ H5TEST_FILL_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2);
+
+ /* Write data to dataset */
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ goto error;
+
+ /* Close resources */
+ H5Dclose(dataset);
+ H5Pclose(dcpl);
+ H5Sclose(dataspace);
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dataset);
+ H5Pclose(dcpl);
+ H5Sclose(dataspace);
+ } H5E_END_TRY;
+
+ return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Check the performance of the chunk cache when partial chunks exist
+ * along the dataset dimensions.
+ */
+static int check_partial_chunks_perf(hid_t file)
+{
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t filespace = H5I_INVALID_HID;
+ hid_t memspace = H5I_INVALID_HID;
+ hid_t dapl = H5I_INVALID_HID;
+
+ int rdata[DSET1_DIM2]; /* data for reading */
+ int i;
+
+ hsize_t row_rank = 1;
+ hsize_t row_dim[1] = {DSET1_DIM2};
+ hsize_t start[RANK] = {0, 0};
+ hsize_t count[RANK] = {1, DSET1_DIM2};
+ double start_t, end_t;
+
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0)
+ goto error;
+
+ dataset = H5Dopen2 (file, DSET1_NAME, dapl);
+
+ H5_CHECK_OVERFLOW(row_rank, hsize_t, int);
+ memspace = H5Screate_simple((int)row_rank, row_dim, NULL);
+ filespace = H5Dget_space(dataset);
+
+ nbytes_global = 0;
+
+ start_t = H5_get_time();
+
+ /* Read the data row by row */
+ for(i = 0; i < DSET1_DIM1; i++) {
+ start[0] = (hsize_t)i;
+ if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET,
+ start, NULL, count, NULL) < 0)
+ goto error;
+
+ if(H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace,
+ H5P_DEFAULT, rdata) < 0)
+ goto error;
+ }
+
+ end_t = H5_get_time();
+
+ if((end_t - start_t) > (double)0.0f)
+ printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global);
+ else
+ printf("1. Partial chunks: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global);
+
+ H5Dclose (dataset);
+ H5Sclose (filespace);
+ H5Sclose (memspace);
+ H5Pclose (dapl);
+
+ return 0;
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose (dataset);
+ H5Sclose (filespace);
+ H5Sclose (memspace);
+ H5Pclose (dapl);
+ } H5E_END_TRY;
+ return 1;
+}
+
+/*---------------------------------------------------------------------------
+ * Check the performance of chunk cache when the number of cache slots
+ * is smaller than the number of chunks along the fastest-growing
+ * dimension of the dataset.
+ */
+static int check_hash_value_perf(hid_t file)
+{
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t filespace = H5I_INVALID_HID;
+ hid_t memspace = H5I_INVALID_HID;
+ hid_t dapl = H5I_INVALID_HID;
+
+ int rdata[DSET2_DIM1]; /* data for reading */
+ int i;
+
+ hsize_t column_rank = 1;
+ hsize_t column_dim[1] = {DSET2_DIM1};
+ hsize_t start[RANK] = {0, 0};
+ hsize_t count[RANK] = {DSET2_DIM1, 1};
+ double start_t, end_t;
+
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0)
+ goto error;
+
+ if((dataset = H5Dopen2 (file, DSET2_NAME, dapl)) < 0)
+ goto error;
+
+ 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;
+
+ nbytes_global = 0;
+
+ start_t = H5_get_time();
+
+ /* Read the data column by column */
+ for(i = 0; i < DSET2_DIM2; i++) {
+ start[1] = (hsize_t)i;
+ if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET,
+ start, NULL, count, NULL) < 0)
+ goto error;
+
+ if(H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace,
+ H5P_DEFAULT, rdata) < 0)
+ goto error;
+ }
+
+ end_t = H5_get_time();
+
+ if((end_t - start_t) > (double)0.0f)
+ printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global);
+ else
+ printf("2. Hash value: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global);
+
+ H5Dclose (dataset);
+ H5Sclose (filespace);
+ H5Sclose (memspace);
+ H5Pclose (dapl);
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose (dataset);
+ H5Sclose (filespace);
+ H5Sclose (memspace);
+ H5Pclose (dapl);
+ } H5E_END_TRY;
+ return 1;
+}
+
+/*-------------------------------------------------------------------------------------
+ * Purpose: check the performance of chunk cache in these two cases (HDFFV-10601):
+ * 1. partial chunks exist along any dimension.
+ * 2. number of slots in chunk cache is smaller than the number of chunks
+ * in the fastest-growing dimension.
+ *-------------------------------------------------------------------------------------*/
+int
+main (void)
+{
+ hid_t file; /* handles */
+ int nerrors = 0;
+
+ /* Create a new file. If file exists its contents will be overwritten. */
+ if((file = H5Fcreate (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ nerrors += create_dset1(file);
+ nerrors += create_dset2(file);
+
+ if(H5Fclose (file) < 0)
+ goto error;
+
+ /* Re-open the file for testing performance. */
+ if((file = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ goto error;
+
+ nerrors += check_partial_chunks_perf(file);
+ nerrors += check_hash_value_perf(file);
+
+ if(H5Fclose (file) < 0)
+ goto error;
+
+ if (nerrors>0) goto error;
+ cleanup();
+ return 0;
+
+error:
+ fprintf(stderr, "*** ERRORS DETECTED ***\n");
+ return 1;
+}
diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c
index f13cd24..20b7237 100644
--- a/tools/test/perform/direct_write_perf.c
+++ b/tools/test/perform/direct_write_perf.c
@@ -75,7 +75,7 @@ const char *FILENAME[] = {
#define NX 100
#define NY 1000
#define NZ 250
-#define CHUNK_NX 1
+#define CHUNK_NX 1
#define CHUNK_NY 1000
#define CHUNK_NZ 250
@@ -108,7 +108,7 @@ void reportTime(struct timeval start, double mbytes)
} /* end if */
/*printf("mbytes=%lf, sec=%lf, usec=%lf\n", mbytes, (double)timeval_diff.tv_sec, (double)timeval_diff.tv_usec);*/
- printf("MBytes/second: %lf\n", (double)mbytes/((double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0)));
+ printf("MBytes/second: %lf\n", (double)mbytes/((double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0)));
}
/*--------------------------------------------------
@@ -121,7 +121,7 @@ int create_file(hid_t fapl_id)
hid_t fapl;
hid_t cparms;
hid_t dataspace, dataset;
- hsize_t dims[RANK] = {NX, NY, NZ};
+ hsize_t dims[RANK] = {NX, NY, NZ};
hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ};
unsigned int aggression = 9; /* Compression aggression setting */
int ret;
@@ -198,7 +198,7 @@ int create_file(hid_t fapl_id)
if(H5Dclose(dataset) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
+ if(H5Fclose(file) < 0)
TEST_ERROR;
if(H5Sclose(dataspace) < 0)
@@ -223,7 +223,7 @@ int create_file(hid_t fapl_id)
/* Initialize data for chunks */
for(i = 0; i < NX; i++) {
p = direct_buf[i] = (unsigned int*)malloc(CHUNK_NY*CHUNK_NZ*sizeof(unsigned int));
-
+
for(j=0; j < CHUNK_NY*CHUNK_NZ; j++, p++)
*p = rand() % 65000;
@@ -267,7 +267,7 @@ error:
}
/*--------------------------------------------------
- * Benchmark the performance of the new function
+ * Benchmark the performance of the new function
* with precompressed data.
*--------------------------------------------------
*/
@@ -283,8 +283,8 @@ test_direct_write_uncompressed_data(hid_t fapl_id)
unsigned filter_mask = 0;
hsize_t offset[RANK] = {0, 0, 0};
- struct timeval timeval_start;
-
+ struct timeval timeval_start;
+
TESTING("H5Dwrite_chunk for uncompressed data");
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -301,8 +301,8 @@ test_direct_write_uncompressed_data(hid_t fapl_id)
TEST_ERROR;
- /* Write the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
+ /* Write the compressed chunk data repeatedly to cover all the chunks in the
+ * dataset, using the direct writing function. */
for(i=0; i<NX; i++) {
status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, CHUNK_NY*CHUNK_NZ*sizeof(unsigned int), direct_buf[i]);
(offset[0])++;
@@ -315,8 +315,8 @@ test_direct_write_uncompressed_data(hid_t fapl_id)
H5Pclose(dxpl);
H5Fclose(file);
- /* Report the performance */
- reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
+ /* Report the performance */
+ reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
PASSED();
return 0;
@@ -332,7 +332,7 @@ error:
/*--------------------------------------------------
- * Benchmark the performance of the new function
+ * Benchmark the performance of the new function
* with precompressed data.
*--------------------------------------------------
*/
@@ -348,8 +348,8 @@ test_direct_write_compressed_data(hid_t fapl_id)
unsigned filter_mask = 0;
hsize_t offset[RANK] = {0, 0, 0};
- struct timeval timeval_start;
-
+ struct timeval timeval_start;
+
TESTING("H5DOwrite_chunk for pre-compressed data");
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -366,8 +366,8 @@ test_direct_write_compressed_data(hid_t fapl_id)
TEST_ERROR;
- /* Write the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
+ /* Write the compressed chunk data repeatedly to cover all the chunks in the
+ * dataset, using the direct writing function. */
for(i=0; i<NX; i++) {
status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, data_size[i], outbuf[i]);
(offset[0])++;
@@ -379,9 +379,9 @@ test_direct_write_compressed_data(hid_t fapl_id)
H5Dclose(dataset);
H5Pclose(dxpl);
H5Fclose(file);
-
- /* Report the performance */
- reportTime(timeval_start, (double)(total_size/MB));
+
+ /* Report the performance */
+ reportTime(timeval_start, (double)(total_size/MB));
PASSED();
return 0;
@@ -416,7 +416,7 @@ test_compressed_write(hid_t fapl_id)
hsize_t count[RANK]; /* Block count */
hsize_t block[RANK]; /* Block sizes */
- struct timeval timeval_start;
+ struct timeval timeval_start;
TESTING("H5Dwrite with compression enabled");
@@ -443,14 +443,14 @@ test_compressed_write(hid_t fapl_id)
stride[0] = stride[1] = stride[2] = 1;
count[0] = count[1] = count[2] = 1;
block[0] = CHUNK_NX; block[1] = CHUNK_NY; block[2] = CHUNK_NZ;
-
+
for(i=0; i<NX; i++) {
/*
* Select hyperslab for one chunk in the file
*/
if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
TEST_ERROR;
- (start[0])++;
+ (start[0])++;
if((status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, dataspace,
H5P_DEFAULT, direct_buf[i])) < 0)
@@ -465,10 +465,10 @@ test_compressed_write(hid_t fapl_id)
H5Sclose(mem_space);
H5Pclose(dxpl);
H5Fclose(file);
-
- /* Report the performance */
- reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
-
+
+ /* Report the performance */
+ reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
+
PASSED();
return 0;
@@ -504,7 +504,7 @@ test_no_compress_write(hid_t fapl_id)
hsize_t count[RANK]; /* Block count */
hsize_t block[RANK]; /* Block sizes */
- struct timeval timeval_start;
+ struct timeval timeval_start;
TESTING("H5Dwrite without compression");
@@ -531,14 +531,14 @@ test_no_compress_write(hid_t fapl_id)
stride[0] = stride[1] = stride[2] = 1;
count[0] = count[1] = count[2] = 1;
block[0] = CHUNK_NX; block[1] = CHUNK_NY; block[2] = CHUNK_NZ;
-
+
for(i=0; i<NX; i++) {
/*
* Select hyperslab for one chunk in the file
*/
if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
TEST_ERROR;
- (start[0])++;
+ (start[0])++;
if((status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, dataspace,
H5P_DEFAULT, direct_buf[i])) < 0)
@@ -553,10 +553,10 @@ test_no_compress_write(hid_t fapl_id)
H5Sclose(mem_space);
H5Pclose(dxpl);
H5Fclose(file);
-
- /* Report the performance */
- reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
-
+
+ /* Report the performance */
+ reportTime(timeval_start, (double)(NX*NY*NZ*sizeof(unsigned int)/MB));
+
PASSED();
return 0;
@@ -576,13 +576,13 @@ error:
* data to a Unix file
*--------------------------------------------------
*/
-int
+int
test_unix_write(void)
{
int file, flag;
- ssize_t op_size;
+ ssize_t op_size;
int i;
- struct timeval timeval_start;
+ struct timeval timeval_start;
TESTING("Write compressed data to a Unix file");
@@ -595,8 +595,8 @@ test_unix_write(void)
if ((file=open(FILENAME[1],flag))== -1)
TEST_ERROR;
- /* Write the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
+ /* Write the compressed chunk data repeatedly to cover all the chunks in the
+ * dataset, using the direct writing function. */
for(i=0; i<NX; i++) {
op_size = write(file, outbuf[i],data_size[i]);
if (op_size < 0)
@@ -617,14 +617,14 @@ test_unix_write(void)
TEST_ERROR;
}
- /* Report the performance */
- reportTime(timeval_start, (double)(total_size/MB));
+ /* Report the performance */
+ reportTime(timeval_start, (double)(total_size/MB));
PASSED();
return 0;
error:
- return 1;
+ return 1;
}
/*--------------------------------------------------
@@ -650,7 +650,7 @@ main (void)
free(outbuf[i]);
free(direct_buf[i]);
}
-
+
return 0;
}
diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c
index 2d9c44f..bb74a1b 100644
--- a/tools/test/perform/iopipe.c
+++ b/tools/test/perform/iopipe.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Thursday, March 12, 1998
*/
@@ -21,10 +21,6 @@
#include "H5private.h"
-#ifdef H5_HAVE_SYS_TIMEB
-#include <sys/timeb.h>
-#endif
-
#define RAW_FILE_NAME "iopipe.raw"
#define HDF5_FILE_NAME "iopipe.h5"
@@ -56,25 +52,18 @@
* Programmer: Robb Matzke
* Thursday, March 12, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-#ifdef H5_HAVE_GETRUSAGE
static void
-print_stats (const char *prefix,
+print_stats(const char *prefix,
+#ifdef H5_HAVE_GETRUSAGE
struct rusage *r_start, struct rusage *r_stop,
- struct timeval *t_start, struct timeval *t_stop,
- size_t nbytes)
-#else /* H5_HAVE_GETRUSAGE */
-static void
-print_stats (const char *prefix,
- struct timeval *r_start, struct timeval *r_stop,
- struct timeval *t_start, struct timeval *t_stop,
- size_t nbytes)
#endif /* H5_HAVE_GETRUSAGE */
+ double t_start, double t_stop,
+ size_t nbytes)
{
- double e_time, bw;
+ double e_time;
+ char bw[16];
#ifdef H5_HAVE_GETRUSAGE
double u_time, s_time;
@@ -88,27 +77,16 @@ print_stats (const char *prefix,
((double)(r_start->ru_stime.tv_sec)+
(double)(r_start->ru_stime.tv_usec)/(double)1000000.0F);
#endif
-#ifndef H5_HAVE_SYS_TIMEB
- e_time = ((double)(t_stop->tv_sec)+
- (double)(t_stop->tv_usec)/(double)1000000.0F) -
- ((double)(t_start->tv_sec)+
- (double)(t_start->tv_usec)/(double)1000000.0F);
-#else
- e_time = ((double)(t_stop->tv_sec)+
- (double)(t_stop->tv_usec)/(double)1000.0F) -
- ((double)(t_start->tv_sec)+
- (double)(t_start->tv_usec)/(double)1000.0F);
-#endif
- bw = (double)nbytes / e_time;
+ e_time = t_stop - t_start;
+ H5_bandwidth(bw, (double)nbytes, e_time);
#ifdef H5_HAVE_GETRUSAGE
- printf (HEADING "%1.2fuser %1.2fsystem %1.2felapsed %1.2fMB/s\n",
- prefix, u_time, s_time, e_time, bw/(1024*1024));
+ HDprintf(HEADING "%1.2fuser %1.2fsystem %1.2felapsed %s\n",
+ prefix, u_time, s_time, e_time, bw);
#else
- printf (HEADING "%1.2felapsed %1.2fMB/s\n",
- prefix, e_time, bw/(1024*1024));
+ HDprintf(HEADING "%1.2felapsed %s\n",
+ prefix, e_time, bw);
#endif
-
}
@@ -122,18 +100,16 @@ print_stats (const char *prefix,
* Programmer: Robb Matzke
* Thursday, March 12, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
-synchronize (void)
+synchronize(void)
{
#ifdef H5_HAVE_SYSTEM
#if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__)
_flushall();
#else
- int status;
+ int H5_ATTR_NDEBUG_UNUSED status;
status = HDsystem("sync");
HDassert(status >= 0);
@@ -157,349 +133,244 @@ synchronize (void)
* Programmer: Robb Matzke
* Thursday, March 12, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
-main (void)
+main(void)
{
- static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
- static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS;
+ hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
+ unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS;
unsigned char *the_data = NULL;
- hid_t file, dset, file_space = -1;
- herr_t status;
+ hid_t file, dset, file_space = H5I_INVALID_HID;
#ifdef H5_HAVE_GETRUSAGE
struct rusage r_start, r_stop;
-#else
- struct timeval r_start, r_stop;
#endif
- struct timeval t_start, t_stop;
+ double 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];
-#ifdef H5_HAVE_SYS_TIMEB
- struct _timeb *tbstart = malloc(sizeof(struct _timeb));
- struct _timeb *tbstop = malloc(sizeof(struct _timeb));
-#endif
/*
* The extra cast in the following statement is a bug workaround for the
* Win32 version 5.0 compiler.
* 1998-11-06 ptl
*/
- printf ("I/O request size is %1.1fMB\n",
- (double)(hssize_t)(size[0]*size[1])/(double)1024.0F*(double)1024);
+ HDprintf("I/O request size is %1.1fMB\n",
+ (double)(hssize_t)(size[0] * size[1]) / (double)1024.0F * (double)1024);
/* Open the files */
- file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- assert (file>=0);
- fd = HDopen (RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666);
- assert (fd>=0);
+ file = H5Fcreate(HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(file >= 0);
+ fd = HDopen(RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666);
+ HDassert(fd >= 0);
/* Create the dataset */
- file_space = H5Screate_simple (2, size, size);
- assert(file_space >= 0);
+ file_space = H5Screate_simple(2, size, size);
+ HDassert(file_space >= 0);
dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- assert(dset >= 0);
- the_data = (unsigned char *)malloc((size_t)(size[0] * size[1]));
+ HDassert(dset >= 0);
+ the_data = (unsigned char *)HDmalloc((size_t)(size[0] * size[1]));
/* initial fill for lazy malloc */
HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
+
/* Fill raw */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "fill raw");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "fill raw");
for(u = 0; u < nwrite; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1]));
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("fill raw",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("fill raw",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Fill hdf5 */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "fill hdf5");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "fill hdf5");
for(u = 0; u < nread; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
- H5P_DEFAULT, the_data);
- assert (status>=0);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space,
+ H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("fill hdf5",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("fill hdf5",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Write the raw dataset */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "out raw");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "out raw");
for(u = 0; u < nwrite; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- offset = HDlseek (fd, (off_t)0, SEEK_SET);
- assert (0==offset);
- n = HDwrite (fd, the_data, (size_t)(size[0]*size[1]));
- assert (n>=0 && (size_t)n==size[0]*size[1]);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ offset = HDlseek(fd, (off_t)0, SEEK_SET);
+ HDassert(0 == offset);
+ n = HDwrite(fd, the_data, (size_t)(size[0] * size[1]));
+ HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("out raw",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("out raw",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Write the hdf5 dataset */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "out hdf5");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "out hdf5");
for(u = 0; u < nwrite; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, the_data);
- assert (status>=0);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dwrite(dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("out hdf5",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("out hdf5",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Read the raw dataset */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "in raw");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "in raw");
for(u = 0; u < nread; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- offset = HDlseek (fd, (off_t)0, SEEK_SET);
- assert (0==offset);
- n = HDread (fd, the_data, (size_t)(size[0]*size[1]));
- assert (n>=0 && (size_t)n==size[0]*size[1]);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ offset = HDlseek(fd, (off_t)0, SEEK_SET);
+ HDassert(0 == offset);
+ n = HDread(fd, the_data, (size_t)(size[0] * size[1]));
+ HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("in raw",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("in raw",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Read the hdf5 dataset */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "in hdf5");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "in hdf5");
for(u = 0; u < nread; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
- H5P_DEFAULT, the_data);
- assert (status>=0);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space,
+ H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("in hdf5",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("in hdf5",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (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);
- synchronize ();
+ count[0] = count[1] = size[0] - 20;
+ status = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, NULL, count, NULL);
+ HDassert(status >= 0);
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "in hdf5 partial");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "in hdf5 partial");
for(u = 0; u < nread; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
- H5P_DEFAULT, the_data);
- assert (status>=0);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space,
+ H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc('\n', stderr);
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
print_stats("in hdf5 partial",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*count[0]*count[1]));
-
-
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Close everything */
HDclose(fd);
+
H5Dclose(dset);
H5Sclose(file_space);
H5Fclose(file);
- free(the_data);
+
+ HDfree(the_data);
return 0;
}
diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c
index 108d9e4..bb3aff5 100644
--- a/tools/test/perform/overhead.c
+++ b/tools/test/perform/overhead.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, September 28, 1998
*
* Purpose: Creates a chunked dataset and measures the storage overhead.
@@ -217,9 +217,9 @@ test(fill_t fill_style, const double splits[],
fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
if ((fd=HDopen(FILE_NAME_1, O_RDONLY, 0666)) < 0) goto error;
- if(FILL_RANDOM==fill_style)
+ if(FILL_RANDOM==fill_style)
had = (int *)calloc((size_t)cur_size[0], sizeof(int));
-
+
for (i=1; i<=cur_size[0]; i++) {
/* Decide which chunk to write to */
@@ -391,7 +391,7 @@ main(int argc, char *argv[])
nerrors += test(FILL_INWARD, splits, FALSE, use_cache);
nerrors += test(FILL_OUTWARD, splits, FALSE, use_cache);
nerrors += test(FILL_RANDOM, splits, FALSE, use_cache);
- }
+ }
else {
if (use_cache) usage(argv[0]);
nerrors += test(fill_style, splits, TRUE, FALSE);
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/perf_meta.c b/tools/test/perform/perf_meta.c
index b56f074..77248cc 100644
--- a/tools/test/perform/perf_meta.c
+++ b/tools/test/perform/perf_meta.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* Friday, Oct 3, 2004
*
* Purpose: Tests performance of metadata
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
index 798e32e..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(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",
@@ -311,21 +303,21 @@ do_pio(parameters param)
/* Need barrier to make sure everyone starts at the same time */
MPI_Barrier(pio_comm_g);
- set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
+ io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
hrc = do_fopen(&param, fname, &fd, PIO_CREATE | PIO_WRITE);
VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
+ io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
hrc = do_write(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
- set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
+ io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_write failed");
/* Close file for write */
hrc = do_fclose(iot, &fd);
- set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
+ io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_fclose failed");
if (!param.h5_write_only) {
@@ -339,20 +331,20 @@ do_pio(parameters param)
MPI_Barrier(pio_comm_g);
/* Open file for read */
- set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
+ io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
hrc = do_fopen(&param, fname, &fd, PIO_READ);
VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
+ io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
hrc = do_read(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
- set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
+ io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_read failed");
/* Close file for read */
hrc = do_fclose(iot, &fd);
- set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
+ io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_fclose failed");
}
@@ -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 */
@@ -557,16 +553,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
/* HDF5 variables */
herr_t hrc; /*HDF5 return code */
hsize_t h5dims[2]; /*dataset dim sizes */
- hid_t h5dset_space_id = -1; /*dataset space ID */
- hid_t h5mem_space_id = -1; /*memory dataspace ID */
- hid_t h5ds_id = -1; /*dataset handle */
+ hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+ hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+ hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
hsize_t h5block[2]; /*dataspace selection */
hsize_t h5stride[2];
hsize_t h5count[2];
hsize_t h5start[2];
hssize_t h5offset[2]; /* Selection offset within dataspace */
- hid_t h5dcpl = -1; /* Dataset creation property list */
- hid_t h5dxpl = -1; /* Dataset transfer property list */
+ hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+ hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
/* Get the parameters from the parameter block */
blk_size=parms->blk_size;
@@ -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(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
@@ -958,7 +960,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
} /* end else */
/* Start "raw data" write timer */
- set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
while (nbytes_xfer < bytes_count){
/* Write */
@@ -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,16 +1382,19 @@ 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 */
/* Stop "raw data" write timer */
- set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
/* Calculate write time */
@@ -1402,7 +1407,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
GOTOERROR(FAIL);
}
- h5ds_id = -1;
+ h5ds_id = H5I_INVALID_HID;
} /* end if */
} /* end for */
@@ -1458,7 +1463,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
ret_code = FAIL;
} else {
- h5dset_space_id = -1;
+ h5dset_space_id = H5I_INVALID_HID;
}
}
@@ -1468,7 +1473,7 @@ done:
HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
ret_code = FAIL;
} else {
- h5mem_space_id = -1;
+ h5mem_space_id = H5I_INVALID_HID;
}
}
@@ -1478,13 +1483,20 @@ done:
HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
ret_code = FAIL;
} else {
- h5dxpl = -1;
+ h5dxpl = H5I_INVALID_HID;
}
}
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.
@@ -1537,15 +1549,15 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* HDF5 variables */
herr_t hrc; /*HDF5 return code */
hsize_t h5dims[2]; /*dataset dim sizes */
- hid_t h5dset_space_id = -1; /*dataset space ID */
- hid_t h5mem_space_id = -1; /*memory dataspace ID */
- hid_t h5ds_id = -1; /*dataset handle */
+ hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+ hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+ hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
hsize_t h5block[2]; /*dataspace selection */
hsize_t h5stride[2];
hsize_t h5count[2];
hsize_t h5start[2];
hssize_t h5offset[2]; /* Selection offset within dataspace */
- hid_t h5dxpl = -1; /* Dataset transfer property list */
+ hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
/* Get the parameters from the parameter block */
blk_size=parms->blk_size;
@@ -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(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
@@ -1889,7 +1906,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
} /* end else */
/* Start "raw data" read timer */
- set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
while (nbytes_xfer < bytes_count){
/* Read */
@@ -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 */
@@ -2344,7 +2364,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
} /* end while */
/* Stop "raw data" read timer */
- set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
/* Calculate read time */
@@ -2357,7 +2377,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
GOTOERROR(FAIL);
}
- h5ds_id = -1;
+ h5ds_id = H5I_INVALID_HID;
} /* end if */
} /* end for */
@@ -2413,7 +2433,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
ret_code = FAIL;
} else {
- h5dset_space_id = -1;
+ h5dset_space_id = H5I_INVALID_HID;
}
}
@@ -2423,7 +2443,7 @@ done:
HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
ret_code = FAIL;
} else {
- h5mem_space_id = -1;
+ h5mem_space_id = H5I_INVALID_HID;
}
}
@@ -2433,7 +2453,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
ret_code = FAIL;
} else {
- h5dxpl = -1;
+ h5dxpl = H5I_INVALID_HID;
}
}
@@ -2451,7 +2471,7 @@ done:
do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
{
int ret_code = SUCCESS, mrc;
- hid_t acc_tpl = -1; /* file access templates */
+ hid_t acc_tpl = H5I_INVALID_HID; /* file access templates */
switch (param->io_type) {
case POSIXIO:
@@ -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;
+ }
}
}
@@ -2639,9 +2667,9 @@ int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Status *status)
{
int err;
- set_time(timer_g, HDF5_MPI_READ, TSTART);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTART);
err=PMPI_File_read_at(fh, offset, buf, count, datatype, status);
- set_time(timer_g, HDF5_MPI_READ, TSTOP);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTOP);
return err;
}
@@ -2650,9 +2678,9 @@ int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Status *status)
{
int err;
- set_time(timer_g, HDF5_MPI_READ, TSTART);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTART);
err=PMPI_File_read_at_all(fh, offset, buf, count, datatype, status);
- set_time(timer_g, HDF5_MPI_READ, TSTOP);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTOP);
return err;
}
@@ -2660,9 +2688,9 @@ int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Status *status)
{
int err;
- set_time(timer_g, HDF5_MPI_WRITE, TSTART);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTART);
err=PMPI_File_write_at(fh, offset, buf, count, datatype, status);
- set_time(timer_g, HDF5_MPI_WRITE, TSTOP);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP);
return err;
}
@@ -2670,9 +2698,9 @@ int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Status *status)
{
int err;
- set_time(timer_g, HDF5_MPI_WRITE, TSTART);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTART);
err=PMPI_File_write_at_all(fh, offset, buf, count, datatype, status);
- set_time(timer_g, HDF5_MPI_WRITE, TSTOP);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP);
return err;
}
diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c
index 93741c4..cb15f64 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
@@ -321,7 +327,7 @@ static void report_parameters(struct options *opts);
* Modifications:
*/
int
-main(int argc, char **argv)
+main(int argc, char *argv[])
{
int ret;
int exit_value = EXIT_SUCCESS;
@@ -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);
@@ -587,74 +601,74 @@ run_test(iotype iot, parameters parms, struct options *opts)
res = do_pio(parms);
/* gather all of the "mpi write" times */
- t = get_time(res.timers, HDF5_MPI_WRITE);
+ t = io_time_get(res.timers, HDF5_MPI_WRITE);
get_minmax(&write_mpi_mm, t);
write_mpi_mm_table[i] = write_mpi_mm;
/* gather all of the "write" times */
- t = get_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS);
get_minmax(&write_mm, t);
write_mm_table[i] = write_mm;
/* gather all of the "write" times from open to close */
- t = get_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS);
get_minmax(&write_gross_mm, t);
write_gross_mm_table[i] = write_gross_mm;
/* gather all of the raw "write" times */
- t = get_time(res.timers, HDF5_RAW_WRITE_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS);
get_minmax(&write_raw_mm, t);
write_raw_mm_table[i] = write_raw_mm;
/* gather all of the file open times (time from open to first write) */
- t = get_time(res.timers, HDF5_FILE_WRITE_OPEN);
+ t = io_time_get(res.timers, HDF5_FILE_WRITE_OPEN);
get_minmax(&write_open_mm, t);
write_open_mm_table[i] = write_open_mm;
/* gather all of the file close times (time from last write to close) */
- t = get_time(res.timers, HDF5_FILE_WRITE_CLOSE);
+ t = io_time_get(res.timers, HDF5_FILE_WRITE_CLOSE);
get_minmax(&write_close_mm, t);
write_close_mm_table[i] = write_close_mm;
if (!parms.h5_write_only) {
/* gather all of the "mpi read" times */
- t = get_time(res.timers, HDF5_MPI_READ);
+ t = io_time_get(res.timers, HDF5_MPI_READ);
get_minmax(&read_mpi_mm, t);
read_mpi_mm_table[i] = read_mpi_mm;
/* gather all of the "read" times */
- t = get_time(res.timers, HDF5_FINE_READ_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS);
get_minmax(&read_mm, t);
read_mm_table[i] = read_mm;
/* gather all of the "read" times from open to close */
- t = get_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS);
get_minmax(&read_gross_mm, t);
read_gross_mm_table[i] = read_gross_mm;
/* gather all of the raw "read" times */
- t = get_time(res.timers, HDF5_RAW_READ_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS);
get_minmax(&read_raw_mm, t);
read_raw_mm_table[i] = read_raw_mm;
/* gather all of the file open times (time from open to first read) */
- t = get_time(res.timers, HDF5_FILE_READ_OPEN);
+ t = io_time_get(res.timers, HDF5_FILE_READ_OPEN);
get_minmax(&read_open_mm, t);
read_open_mm_table[i] = read_open_mm;
/* gather all of the file close times (time from last read to close) */
- t = get_time(res.timers, HDF5_FILE_READ_CLOSE);
+ t = io_time_get(res.timers, HDF5_FILE_READ_CLOSE);
get_minmax(&read_close_mm, t);
read_close_mm_table[i] = read_close_mm;
@@ -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(opts->num_bpp * opts->min_num_procs,2)
- * opts->num_dsets), ":");
- recover_size_and_print((long long)(pow(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;
diff --git a/tools/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h
index 7605f20..55d721e 100644
--- a/tools/test/perform/pio_perf.h
+++ b/tools/test/perform/pio_perf.h
@@ -13,12 +13,13 @@
#ifndef PIO_PERF_H__
#define PIO_PERF_H__
-#include "io_timer.h"
#ifndef STANDALONE
+#include "io_timer.h"
#include "h5test.h"
#include "h5tools.h"
#include "h5tools_utils.h"
#else
+#include "io_timer.h"
#include "pio_standalone.h"
#endif
diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c
index 0fba904..8cdca85 100644
--- a/tools/test/perform/pio_standalone.c
+++ b/tools/test/perform/pio_standalone.c
@@ -164,3 +164,135 @@ print_version(const char *progname)
progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
}
+
+#ifdef STANDALONE
+/*
+ * Function: h5_set_info_object
+ * Purpose: Process environment variables setting to set up MPI Info
+ * object.
+ * Return: 0 if all is fine; otherwise non-zero.
+ * Programmer: Albert Cheng, 2002/05/21.
+ * Modifications:
+ * Bill Wendling, 2002/05/31
+ * Modified so that the HDF5_MPI_INFO environment variable can
+ * be a semicolon separated list of "key=value" pairings. Most
+ * of the code is to remove any whitespaces which might be
+ * surrounding the "key=value" pairs.
+ */
+int
+h5_set_info_object(void)
+{
+ char *envp; /* environment pointer */
+ int ret_value=0;
+
+ /* handle any MPI INFO hints via $HDF5_MPI_INFO */
+ if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){
+ char *next, *valp;
+
+ valp = envp = next = HDstrdup(envp);
+
+ if (!valp) return 0;
+
+ /* create an INFO object if not created yet */
+ if (h5_io_info_g == MPI_INFO_NULL)
+ MPI_Info_create(&h5_io_info_g);
+
+ do {
+ size_t len;
+ char *key_val, *endp, *namep;
+
+ if (*valp == ';')
+ valp++;
+
+ /* copy key/value pair into temporary buffer */
+ len = strcspn(valp, ";");
+ next = &valp[len];
+ key_val = (char *)HDcalloc(1, len + 1);
+
+ /* increment the next pointer past the terminating semicolon */
+ if (*next == ';')
+ ++next;
+
+ namep = HDstrncpy(key_val, valp, len);
+
+ /* pass up any beginning whitespaces */
+ while (*namep && (*namep == ' ' || *namep == '\t'))
+ namep++;
+
+ if (!*namep) continue; /* was all white space, so move to next k/v pair */
+
+ /* eat up any ending white spaces */
+ endp = &namep[HDstrlen(namep) - 1];
+
+ while (endp && (*endp == ' ' || *endp == '\t'))
+ *endp-- = '\0';
+
+ /* find the '=' */
+ valp = HDstrchr(namep, '=');
+
+ if (valp != NULL) { /* it's a valid key/value pairing */
+ char *tmp_val = valp + 1;
+
+ /* change '=' to \0, move valp down one */
+ *valp-- = '\0';
+
+ /* eat up ending whitespace on the "key" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp-- = '\0';
+
+ valp = tmp_val;
+
+ /* eat up beginning whitespace on the "value" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp++ = '\0';
+
+ /* actually set the darned thing */
+ if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) {
+ HDprintf("MPI_Info_set failed\n");
+ ret_value = -1;
+ }
+ }
+
+ valp = next;
+ HDfree(key_val);
+ } while (next && *next);
+
+ HDfree(envp);
+ }
+
+ return ret_value;
+}
+
+
+/*
+ * Function: h5_dump_info_object
+ * Purpose: Display content of an MPI Info object
+ * Return: void
+ * Programmer: Albert Cheng 2002/05/21
+ * Modifications:
+ */
+void
+h5_dump_info_object(MPI_Info info)
+{
+ char key[MPI_MAX_INFO_KEY+1];
+ char value[MPI_MAX_INFO_VAL+1];
+ int flag;
+ int i, nkeys;
+
+ HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL);
+ if (info==MPI_INFO_NULL){
+ HDprintf("object is MPI_INFO_NULL\n");
+ }
+ else {
+ MPI_Info_get_nkeys(info, &nkeys);
+ HDprintf("object has %d items\n", nkeys);
+ for (i=0; i<nkeys; i++){
+ MPI_Info_get_nthkey(info, i, key);
+ MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+ HDprintf("%s=%s\n", key, value);
+ }
+
+ }
+}
+#endif /* STANDALONE */
+
diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h
index e6db2e8..f2cda4f 100644
--- a/tools/test/perform/pio_standalone.h
+++ b/tools/test/perform/pio_standalone.h
@@ -213,7 +213,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDgetpwnam(S) getpwnam(S)
#define HDgetpwuid(U) getpwuid(U)
#define HDgetrusage(X,S) getrusage(X,S)
-#define HDgets(S) gets(S)
+/* Don't define a macro for gets() - it was removed in C11 */
#ifdef H5_HAVE_WIN32_API
H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
@@ -483,8 +483,8 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#endif
#ifdef H5_HAVE_PARALLEL
-H5TEST_DLL int h5_set_info_object(void);
-H5TEST_DLL void h5_dump_info_object(MPI_Info info);
+int h5_set_info_object(void);
+void h5_dump_info_object(MPI_Info info);
#endif
diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c
index 488f575..aa3a316 100644
--- a/tools/test/perform/sio_engine.c
+++ b/tools/test/perform/sio_engine.c
@@ -114,11 +114,11 @@ static const char *multi_letters = "msbrglo"; /* string for multi driver */
/* HDF5 global variables */
static hsize_t h5count[MAX_DIMS]; /*selection count */
static hssize_t h5offset[MAX_DIMS]; /* Selection offset within dataspace */
-static hid_t h5dset_space_id = -1; /*dataset space ID */
-static hid_t h5mem_space_id = -1; /*memory dataspace ID */
-static hid_t h5ds_id = -1; /*dataset handle */
-static hid_t h5dcpl = -1; /* Dataset creation property list */
-static hid_t h5dxpl = -1; /* Dataset transfer property list */
+static hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+static hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+static hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
+static hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+static hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
/*
* Function: do_sio
@@ -212,18 +212,18 @@ do_sio(parameters param, results *res)
HDfprintf(output, "data filename=%s\n",
fname);
- set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
+ io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
hrc = do_fopen(&param, fname, &fd, SIO_CREATE | SIO_WRITE);
VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
+ io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
hrc = do_write(res, &fd, &param, buffer);
- set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
+ io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_write failed");
/* Close file for write */
hrc = do_fclose(iot, &fd);
- set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
+ io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_fclose failed");
if (!param.h5_write_only) {
@@ -232,19 +232,19 @@ do_sio(parameters param, results *res)
*/
/* Open file for read */
- set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
+ io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
hrc = do_fopen(&param, fname, &fd, SIO_READ);
VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
+ io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
hrc = do_read(res, &fd, &param, buffer);
- set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
+ io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_read failed");
/* Close file for read */
hrc = do_fclose(iot, &fd);
- set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
+ io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_fclose failed");
}
@@ -550,7 +550,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer)
}
/* Start "raw data" write timer */
- set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
/* Perform write */
hrc = dset_write(rank-1, fd, parms, buffer);
@@ -562,7 +562,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer)
/* Stop "raw data" write timer */
- set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
/* Calculate write time */
@@ -575,7 +575,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer)
GOTOERROR(FAIL);
}
- h5ds_id = -1;
+ h5ds_id = H5I_INVALID_HID;
} /* end if */
done:
@@ -587,7 +587,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
ret_code = FAIL;
} else {
- h5dset_space_id = -1;
+ h5dset_space_id = H5I_INVALID_HID;
}
}
@@ -597,7 +597,7 @@ done:
HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
ret_code = FAIL;
} else {
- h5mem_space_id = -1;
+ h5mem_space_id = H5I_INVALID_HID;
}
}
@@ -607,7 +607,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
ret_code = FAIL;
} else {
- h5dxpl = -1;
+ h5dxpl = H5I_INVALID_HID;
}
}
@@ -872,7 +872,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
} /* end switch */
/* Start "raw data" read timer */
- set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
hrc = dset_read(rank-1, fd, parms, buffer, buffer2);
if (hrc < 0) {
@@ -881,7 +881,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
}
/* Stop "raw data" read timer */
- set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
/* Calculate read time */
@@ -894,7 +894,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
GOTOERROR(FAIL);
}
- h5ds_id = -1;
+ h5ds_id = H5I_INVALID_HID;
} /* end if */
done:
@@ -906,7 +906,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
ret_code = FAIL;
} else {
- h5dset_space_id = -1;
+ h5dset_space_id = H5I_INVALID_HID;
}
}
@@ -916,7 +916,7 @@ done:
HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
ret_code = FAIL;
} else {
- h5mem_space_id = -1;
+ h5mem_space_id = H5I_INVALID_HID;
}
}
@@ -926,7 +926,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
ret_code = FAIL;
} else {
- h5dxpl = -1;
+ h5dxpl = H5I_INVALID_HID;
}
}
@@ -1137,7 +1137,7 @@ done:
hid_t
set_vfd(parameters *param)
{
- hid_t my_fapl = -1;
+ hid_t my_fapl = H5I_INVALID_HID;
vfdtype vfd;
vfd = param->vfd;
@@ -1174,7 +1174,7 @@ set_vfd(parameters *param)
HDmemset(memb_addr, 0, sizeof memb_addr);
HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt++) {
memb_fapl[mt] = H5P_DEFAULT;
HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
@@ -1268,8 +1268,7 @@ done:
* 'temp' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static void
do_cleanupfile(iotype iot, char *filename)
{
@@ -1312,7 +1311,7 @@ do_cleanupfile(iotype iot, char *filename)
H5FD_mem_t mt;
assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
- for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
HDsnprintf(temp, sizeof temp, "%s-%c.h5",
filename, multi_letters[mt]);
HDremove(temp); /*don't care if it fails*/
@@ -1322,7 +1321,7 @@ do_cleanupfile(iotype iot, char *filename)
}
H5Pclose(fapl);
break;
-
+
default:
/* unknown request */
HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
@@ -1331,5 +1330,5 @@ do_cleanupfile(iotype iot, char *filename)
}
}
}
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c
index 90030d8..d2eb3fc 100644
--- a/tools/test/perform/sio_perf.c
+++ b/tools/test/perform/sio_perf.c
@@ -303,7 +303,7 @@ typedef struct _minmax {
/* local functions */
static hsize_t parse_size_directive(const char *size);
-static struct options *parse_command_line(int argc, char *argv[]);
+static struct options *parse_command_line(int argc, const char *argv[]);
static void run_test_loop(struct options *options);
static int run_test(iotype iot, parameters parms, struct options *opts);
static void output_all_info(minmax *mm, int count, int indent_level);
@@ -324,7 +324,7 @@ static void report_parameters(struct options *opts);
* Modifications:
*/
int
-main(int argc, char **argv)
+main(int argc, const char *argv[])
{
int exit_value = EXIT_SUCCESS;
struct options *opts = NULL;
@@ -498,50 +498,50 @@ run_test(iotype iot, parameters parms, struct options *opts)
do_sio(parms, &res);
/* gather all of the "sys write" times */
- t = get_time(res.timers, HDF5_MPI_WRITE);
+ t = io_time_get(res.timers, HDF5_MPI_WRITE);
get_minmax(&write_sys_mm, t);
write_sys_mm_table[i] = write_sys_mm;
/* gather all of the "write" times */
- t = get_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS);
get_minmax(&write_mm, t);
write_mm_table[i] = write_mm;
/* gather all of the "write" times from open to close */
- t = get_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS);
get_minmax(&write_gross_mm, t);
write_gross_mm_table[i] = write_gross_mm;
/* gather all of the raw "write" times */
- t = get_time(res.timers, HDF5_RAW_WRITE_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS);
get_minmax(&write_raw_mm, t);
write_raw_mm_table[i] = write_raw_mm;
if (!parms.h5_write_only) {
/* gather all of the "mpi read" times */
- t = get_time(res.timers, HDF5_MPI_READ);
+ t = io_time_get(res.timers, HDF5_MPI_READ);
get_minmax(&read_sys_mm, t);
read_sys_mm_table[i] = read_sys_mm;
/* gather all of the "read" times */
- t = get_time(res.timers, HDF5_FINE_READ_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS);
get_minmax(&read_mm, t);
read_mm_table[i] = read_mm;
/* gather all of the "read" times from open to close */
- t = get_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS);
get_minmax(&read_gross_mm, t);
read_gross_mm_table[i] = read_gross_mm;
/* gather all of the raw "read" times */
- t = get_time(res.timers, HDF5_RAW_READ_FIXED_DIMS);
+ t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS);
get_minmax(&read_raw_mm, t);
read_raw_mm_table[i] = read_gross_mm;
@@ -944,7 +944,7 @@ report_parameters(struct options *opts)
* Added multidimensional testing (Christian Chilan, April, 2008)
*/
static struct options *
-parse_command_line(int argc, char *argv[])
+parse_command_line(int argc, const char *argv[])
{
int opt;
struct options *cl_opts;
@@ -984,7 +984,7 @@ parse_command_line(int argc, char *argv[])
cl_opts->h5_extendable = FALSE; /* Use extendable dataset */
cl_opts->verify = FALSE; /* No Verify data correctness by default */
- while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
case 'a':
cl_opts->h5_alignment = parse_size_directive(opt_arg);
diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h
index 83caf54..d26c78b 100644
--- a/tools/test/perform/sio_perf.h
+++ b/tools/test/perform/sio_perf.h
@@ -13,12 +13,13 @@
#ifndef SIO_PERF_H__
#define SIO_PERF_H__
-#include "io_timer.h"
#ifndef STANDALONE
+#include "io_timer.h"
#include "h5test.h"
#include "h5tools.h"
#include "h5tools_utils.h"
#else
+#include "io_timer.h"
#include "sio_standalone.h"
#endif
diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h
index 5ce922b..99e13bc 100644
--- a/tools/test/perform/sio_standalone.h
+++ b/tools/test/perform/sio_standalone.h
@@ -47,13 +47,6 @@
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
-/*
- * A macro to portably increment enumerated types.
- */
-#ifndef H5_INC_ENUM
-# define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1))
-#endif
-
#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf((X)-(Y)) < FLT_EPSILON)
#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs ((X)-(Y)) < DBL_EPSILON)
#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl((X)-(Y)) < LDBL_EPSILON)
@@ -235,7 +228,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDgetpwnam(S) getpwnam(S)
#define HDgetpwuid(U) getpwuid(U)
#define HDgetrusage(X,S) getrusage(X,S)
-#define HDgets(S) gets(S)
+/* Don't define a macro for gets() - it was removed in C11 */
#ifdef H5_HAVE_WIN32_API
H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
@@ -505,8 +498,8 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#endif
#ifdef H5_HAVE_PARALLEL
-H5TEST_DLL int h5_set_info_object(void);
-H5TEST_DLL void h5_dump_info_object(MPI_Info info);
+int h5_set_info_object(void);
+void h5_dump_info_object(MPI_Info info);
#endif
@@ -534,4 +527,10 @@ typedef struct long_options {
extern int get_option(int argc, const char **argv, const char *opt,
const struct long_options *l_opt);
+
+extern int nCols; /*max number of columns for outputting */
+
+/* Definitions of useful routines */
+extern void print_version(const char *progname);
+
#endif
diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c
index e301bb3..8f1f584 100644
--- a/tools/test/perform/zip_perf.c
+++ b/tools/test/perform/zip_perf.c
@@ -552,7 +552,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
* Modifications:
*/
int
-main(int argc, char **argv)
+main(int argc, const char *argv[])
{
unsigned long min_buf_size = 128 * ONE_KB, max_buf_size = ONE_MB;
unsigned long file_size = 64 * ONE_MB;
@@ -563,7 +563,7 @@ main(int argc, char **argv)
/* Initialize h5tools lib */
h5tools_init();
- while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) > 0) {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) > 0) {
switch ((char)opt) {
case '0': case '1': case '2':
case '3': case '4': case '5':