summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
Diffstat (limited to 'testpar')
-rw-r--r--testpar/CMakeLists.txt79
-rw-r--r--testpar/CMakeTests.cmake144
-rw-r--r--testpar/CMakeVFDTests.cmake75
-rw-r--r--testpar/COPYING2
-rw-r--r--testpar/Makefile.am14
-rw-r--r--testpar/Makefile.in56
-rw-r--r--testpar/t_cache.c6188
-rw-r--r--testpar/t_chunk_alloc.c303
-rw-r--r--testpar/t_coll_chunk.c1203
-rw-r--r--testpar/t_dset.c2732
-rw-r--r--testpar/t_file.c92
-rw-r--r--testpar/t_file_image.c313
-rw-r--r--testpar/t_filter_read.c368
-rw-r--r--testpar/t_init_term.c35
-rw-r--r--testpar/t_mdset.c2108
-rw-r--r--testpar/t_mpi.c1548
-rw-r--r--testpar/t_pflush1.c275
-rw-r--r--testpar/t_pflush2.c282
-rw-r--r--testpar/t_ph5basic.c151
-rw-r--r--testpar/t_prestart.c95
-rw-r--r--testpar/t_pshutdown.c82
-rw-r--r--testpar/t_shapesame.c4322
-rw-r--r--testpar/t_span_tree.c3113
-rw-r--r--testpar/testpar.h98
-rw-r--r--testpar/testpflush.sh.in64
-rw-r--r--testpar/testphdf5.c650
-rw-r--r--testpar/testphdf5.h305
27 files changed, 11462 insertions, 13235 deletions
diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt
index b341782..bf81c38 100644
--- a/testpar/CMakeLists.txt
+++ b/testpar/CMakeLists.txt
@@ -1,18 +1,11 @@
-cmake_minimum_required (VERSION 3.10)
-PROJECT (HDF5_TEST_PAR)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_TEST_PAR C)
#-----------------------------------------------------------------------------
-# Apply Definitions to compiler in this directory and below
-#-----------------------------------------------------------------------------
-add_definitions (${HDF_EXTRA_C_FLAGS})
-
-INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib )
-#-----------------------------------------------------------------------------
# Define Tests
#-----------------------------------------------------------------------------
-set (testphdf5_SRCS
+set (testphdf5_SOURCES
${HDF5_TEST_PAR_SOURCE_DIR}/testphdf5.c
${HDF5_TEST_PAR_SOURCE_DIR}/t_dset.c
${HDF5_TEST_PAR_SOURCE_DIR}/t_file.c
@@ -26,23 +19,59 @@ set (testphdf5_SRCS
)
#-- Adding test for testhdf5
-add_executable (testphdf5 ${testphdf5_SRCS})
-TARGET_C_PROPERTIES (testphdf5 STATIC " " " ")
-target_link_libraries (testphdf5 PUBLIC ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
-if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND)
- target_link_libraries (testphdf5 PRIVATE ${MPI_C_LIBRARIES})
+add_executable (testphdf5 ${testphdf5_SOURCES})
+target_compile_options(testphdf5 PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+target_include_directories (testphdf5
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+)
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (testphdf5 STATIC)
+ target_link_libraries (testphdf5
+ PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ )
+else ()
+ TARGET_C_PROPERTIES (testphdf5 SHARED)
+ target_link_libraries (testphdf5
+ PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ )
endif ()
set_target_properties (testphdf5 PROPERTIES FOLDER test/par)
-MACRO (ADD_H5P_EXE file)
+#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TEST_PAR_testphdf5_FORMAT testphdf5)
+endif ()
+
+macro (ADD_H5P_EXE file)
add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c)
- TARGET_C_PROPERTIES (${file} STATIC " " " ")
- target_link_libraries (${file} PUBLIC ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
- if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND)
- target_link_libraries (${file} PRIVATE ${MPI_C_LIBRARIES})
+ target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+ target_include_directories (${file}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ )
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (${file} STATIC)
+ target_link_libraries (${file}
+ PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ $<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:MinGW>>:ws2_32.lib>
+ )
+ else ()
+ TARGET_C_PROPERTIES (${file} SHARED)
+ target_link_libraries (${file}
+ PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>"
+ $<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:MinGW>>:ws2_32.lib>
+ )
endif ()
set_target_properties (${file} PROPERTIES FOLDER test/par)
-ENDMACRO (ADD_H5P_EXE file)
+
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TEST_PAR_${file}_FORMAT ${file})
+ endif ()
+endmacro (ADD_H5P_EXE file)
set (H5P_TESTS
t_mpi
@@ -55,8 +84,10 @@ set (H5P_TESTS
t_shapesame
)
-foreach (testp ${H5P_TESTS})
- ADD_H5P_EXE(${testp})
+foreach (h5_testp ${H5P_TESTS})
+ ADD_H5P_EXE(${h5_testp})
endforeach ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_PARALLEL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake
index 87470f3..2d78b17 100644
--- a/testpar/CMakeTests.cmake
+++ b/testpar/CMakeTests.cmake
@@ -5,7 +5,7 @@
# 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.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -15,59 +15,115 @@
### T E S T I N G ###
##############################################################################
##############################################################################
+# Remove any output file left over from previous test run
+add_test (
+ NAME MPI_TEST-clear-testphdf5-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ParaTest.h5
+ WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}
+)
+set_tests_properties (MPI_TEST-clear-testphdf5-objects PROPERTIES FIXTURES_SETUP par_clear_testphdf5)
-add_test (NAME TEST_PAR_testphdf5 COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS})
+set (SKIP_tests
+ cchunk1
+ cchunk2
+ cchunk3
+ cchunk4
+ ecdsetw
+ eidsetw2
+ selnone
+ cngrpw-ingrpr
+ cschunkw
+ ccchunkw
+ tldsc
+ actualio
+ MC_coll_MD_read
+)
+set (SKIP_testphdf5 "")
+foreach (skiptest ${SKIP_tests})
+ set (SKIP_testphdf5 "${SKIP_testphdf5};-x;${skiptest}")
+endforeach ()
+
+add_test (NAME MPI_TEST_testphdf5 COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS} ${SKIP_testphdf5})
+set_tests_properties (MPI_TEST_testphdf5 PROPERTIES
+ FIXTURES_REQUIRED par_clear_testphdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_PAR_BINARY_DIR}"
+ WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}
+)
+if (last_test)
+ set_tests_properties (MPI_TEST_testphdf5 PROPERTIES DEPENDS ${last_test})
+endif ()
+set (last_test "MPI_TEST_testphdf5")
-foreach (testp ${H5P_TESTS})
- add_test (NAME TEST_PAR_${testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${testp}> ${MPIEXEC_POSTFLAGS})
+#execute the skipped tests
+foreach (skiptest ${SKIP_tests})
+ add_test (NAME MPI_TEST_testphdf5_${skiptest} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS} -o ${skiptest})
+ set_tests_properties (MPI_TEST_testphdf5_${skiptest} PROPERTIES
+ FIXTURES_REQUIRED par_clear_testphdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_PAR_BINARY_DIR}"
+ WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}
+ )
+ if (last_test)
+ set_tests_properties (MPI_TEST_testphdf5_${skiptest} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ set (last_test "MPI_TEST_testphdf5_${skiptest}")
endforeach ()
-# The following will only be correct on windows shared
-#set_tests_properties (TEST_PAR_t_pflush1 PROPERTIES WILL_FAIL "true")
-set_property (TEST TEST_PAR_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED")
-set_tests_properties (TEST_PAR_t_pflush2 PROPERTIES DEPENDS TEST_PAR_t_pflush1)
+#if (HDF5_OPENMPI_VERSION_SKIP)
+# list (REMOVE_ITEM H5P_TESTS t_shapesame)
+#endif ()
-if (HDF5_TEST_VFD)
+set (test_par_CLEANFILES
+ t_cache_image_00.h5
+ t_cache_image_01.h5
+ t_cache_image_02.h5
+ flush.h5
+ noflush.h5
+ reloc_t_pread_data_file.h5
+ reloc_t_pread_group_0_file.h5
+ reloc_t_pread_group_1_file.h5
+ shutdown.h5
+ after_mpi_fin.h5
+ #the following should have been removed by the programs
+ bigio_test.h5
+ CacheTestDummy.h5
+ t_filters_parallel.h5
+ MPItest.h5
+ ShapeSameTest.h5
+)
- set (VFD_LIST
- sec2
- stdio
- core
- split
- multi
- family
- )
+# Remove any output file left over from previous test run
+add_test (
+ NAME MPI_TEST-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${test_par_CLEANFILES}
+ WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}
+)
+set_tests_properties (MPI_TEST-clear-objects PROPERTIES FIXTURES_SETUP par_clear_objects)
- set (H5P_VFD_TESTS
- t_pflush1
- t_pflush2
+foreach (h5_testp ${H5P_TESTS})
+ add_test (NAME MPI_TEST_${h5_testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${h5_testp}> ${MPIEXEC_POSTFLAGS})
+ set_tests_properties (MPI_TEST_${h5_testp} PROPERTIES
+ FIXTURES_REQUIRED par_clear_objects
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_PAR_BINARY_DIR}"
+ WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}
)
-
- if (DIRECT_VFD)
- set (VFD_LIST ${VFD_LIST} direct)
+ if (last_test)
+ set_tests_properties (MPI_TEST_${h5_testp} PROPERTIES DEPENDS ${last_test})
endif ()
+ set (last_test "MPI_TEST_${h5_testp}")
+endforeach ()
- macro (ADD_VFD_TEST vfdname resultcode)
- if (NOT HDF5_ENABLE_USING_MEMCHECKER)
- foreach (test ${H5P_VFD_TESTS})
- add_test (
- NAME TEST_PAR_VFD-${vfdname}-${test}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${test}>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${test}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- endforeach ()
- endif ()
- endmacro ()
+# The t_pflush1 test is hard-coded to fail.
+set_tests_properties (MPI_TEST_t_pflush1 PROPERTIES WILL_FAIL "true")
+#set_property (TEST MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED")
+set_tests_properties (MPI_TEST_t_pflush2 PROPERTIES DEPENDS MPI_TEST_t_pflush1)
+set_tests_properties (MPI_TEST_t_prestart PROPERTIES DEPENDS MPI_TEST_t_pshutdown)
- # Run test with different Virtual File Driver
- foreach (vfd ${VFD_LIST})
- ADD_VFD_TEST (${vfd} 0)
- endforeach ()
+##############################################################################
+##############################################################################
+### V F D T E S T S ###
+##############################################################################
+##############################################################################
+if (HDF5_TEST_VFD)
+ include (CMakeVFDTests.cmake)
endif ()
diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake
new file mode 100644
index 0000000..8c076fd
--- /dev/null
+++ b/testpar/CMakeVFDTests.cmake
@@ -0,0 +1,75 @@
+#
+# Copyright by The HDF Group.
+# 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://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+set (VFD_LIST
+ sec2
+ stdio
+ core
+ split
+ multi
+ family
+)
+
+set (H5P_VFD_TESTS
+ t_pflush1
+ t_pflush2
+)
+
+if (DIRECT_VFD)
+ set (VFD_LIST ${VFD_LIST} direct)
+endif ()
+
+foreach (vfdtest ${VFD_LIST})
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}")
+endforeach ()
+
+macro (ADD_VFD_TEST vfdname resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ foreach (h5_test ${H5P_VFD_TESTS})
+ add_test (
+ NAME MPI_TEST_VFD-${vfdname}-${h5_test}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${h5_test}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_VFD:STRING=${vfdname}"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_OUTPUT=${vfdname}-${h5_test}.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
+ -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
+ )
+ set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES
+ ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}"
+ WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}
+ )
+ endforeach ()
+ set_tests_properties (MPI_TEST_VFD-${vfdname}-pflush1 PROPERTIES WILL_FAIL "true")
+ #set_property (TEST MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED")
+ set_tests_properties (MPI_TEST_VFD-${vfdname}-pflush2 PROPERTIES DEPENDS MPI_TEST_VFD-${vfdname}-pflush1)
+ endif ()
+endmacro ()
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+# Run test with different Virtual File Driver
+foreach (h5_vfd ${VFD_LIST})
+ ADD_VFD_TEST (${h5_vfd} 0)
+endforeach ()
diff --git a/testpar/COPYING b/testpar/COPYING
index 6497ace..97969da 100644
--- a/testpar/COPYING
+++ b/testpar/COPYING
@@ -7,7 +7,7 @@
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
+ or in https://www.hdfgroup.org/licenses. If you do
not have access to either file, you may request a copy from
help@hdfgroup.org.
diff --git a/testpar/Makefile.am b/testpar/Makefile.am
index a602d6b..a1a3445 100644
--- a/testpar/Makefile.am
+++ b/testpar/Makefile.am
@@ -6,7 +6,7 @@
# 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.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
@@ -21,11 +21,19 @@ include $(top_srcdir)/config/commence.am
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test
+# Test scripts--
+# testpflush.sh:
+TEST_SCRIPT_PARA = testpflush.sh
+SCRIPT_DEPEND = t_pflush1$(EXEEXT) t_pflush2$(EXEEXT)
+
+check_SCRIPTS = $(TEST_SCRIPT_PARA)
+
# Test programs. These are our main targets.
#
-TEST_PROG_PARA=t_mpi testphdf5 t_cache t_pflush1 t_pflush2 t_pshutdown t_prestart t_init_term t_shapesame
+TEST_PROG_PARA=t_mpi testphdf5 t_cache t_pshutdown t_prestart t_init_term t_shapesame
-check_PROGRAMS = $(TEST_PROG_PARA)
+# t_pflush1 and t_pflush2 are used by testpflush.sh
+check_PROGRAMS = $(TEST_PROG_PARA) t_pflush1 t_pflush2
testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \
t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c
diff --git a/testpar/Makefile.in b/testpar/Makefile.in
index 2f88b44..dfc1c85 100644
--- a/testpar/Makefile.in
+++ b/testpar/Makefile.in
@@ -22,7 +22,7 @@
# 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.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -102,7 +102,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-check_PROGRAMS = $(am__EXEEXT_1)
+check_PROGRAMS = $(am__EXEEXT_1) t_pflush1$(EXEEXT) t_pflush2$(EXEEXT)
TESTS =
subdir = testpar
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -113,11 +113,11 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = testpflush.sh
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = t_mpi$(EXEEXT) testphdf5$(EXEEXT) t_cache$(EXEEXT) \
- t_pflush1$(EXEEXT) t_pflush2$(EXEEXT) t_pshutdown$(EXEEXT) \
- t_prestart$(EXEEXT) t_init_term$(EXEEXT) t_shapesame$(EXEEXT)
+ t_pshutdown$(EXEEXT) t_prestart$(EXEEXT) t_init_term$(EXEEXT) \
+ t_shapesame$(EXEEXT)
t_cache_SOURCES = t_cache.c
t_cache_OBJECTS = t_cache.$(OBJEXT)
t_cache_LDADD = $(LDADD)
@@ -424,9 +424,9 @@ am__set_b = \
*) \
b='$*';; \
esac
-am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/bin/depcomp \
- $(top_srcdir)/bin/mkinstalldirs $(top_srcdir)/bin/test-driver \
- $(top_srcdir)/config/commence.am \
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/testpflush.sh.in \
+ $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \
+ $(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
@@ -438,10 +438,10 @@ AMTAR = @AMTAR@
# 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
-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_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@
@@ -456,6 +456,7 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
CFLAGS = @CFLAGS@
+CLANG_SANITIZE_CHECKS = @CLANG_SANITIZE_CHECKS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
@@ -474,6 +475,7 @@ DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DEV_WARNINGS = @DEV_WARNINGS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
@@ -501,6 +503,8 @@ GREP = @GREP@
H5_CFLAGS = @H5_CFLAGS@
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_LDFLAGS = @H5_LDFLAGS@
@@ -508,9 +512,12 @@ H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LIBHDFS = @HAVE_LIBHDFS@
HAVE_PTHREAD = @HAVE_PTHREAD@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
+HDF5_TESTS = @HDF5_TESTS@
+HDF5_TOOLS = @HDF5_TOOLS@
HDF_CXX = @HDF_CXX@
HDF_FORTRAN = @HDF_FORTRAN@
HDF_FORTRAN2003 = @HDF_FORTRAN2003@
@@ -526,6 +533,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+JNI_LDFLAGS = @JNI_LDFLAGS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
@@ -547,6 +555,7 @@ NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@
OBJEXT = @OBJEXT@
+OPTIMIZATION = @OPTIMIZATION@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -559,8 +568,10 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PARALLEL = @PARALLEL@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
+PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
+ROS3_VFD = @ROS3_VFD@
RUNPARALLEL = @RUNPARALLEL@
RUNSERIAL = @RUNSERIAL@
R_INTEGER = @R_INTEGER@
@@ -574,6 +585,7 @@ STATIC_EXEC = @STATIC_EXEC@
STATIC_SHARED = @STATIC_SHARED@
STRICT_FORMAT_CHECKS = @STRICT_FORMAT_CHECKS@
STRIP = @STRIP@
+SYMBOLS = @SYMBOLS@
TESTPARALLEL = @TESTPARALLEL@
THREADSAFE = @THREADSAFE@
TIME = @TIME@
@@ -615,6 +627,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@
@@ -707,9 +720,15 @@ TRACE = perl $(top_srcdir)/bin/trace
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 MPItest.h5 \
Para*.h5 CacheTestDummy.h5 shutdown.h5 after_mpi_fin.h5 go
+# Test scripts--
+# testpflush.sh:
+TEST_SCRIPT_PARA = testpflush.sh
+SCRIPT_DEPEND = t_pflush1$(EXEEXT) t_pflush2$(EXEEXT)
+check_SCRIPTS = $(TEST_SCRIPT_PARA)
+
# Test programs. These are our main targets.
#
-TEST_PROG_PARA = t_mpi testphdf5 t_cache t_pflush1 t_pflush2 t_pshutdown t_prestart t_init_term t_shapesame
+TEST_PROG_PARA = t_mpi testphdf5 t_cache t_pshutdown t_prestart t_init_term t_shapesame
testphdf5_SOURCES = testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \
t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c
@@ -717,11 +736,11 @@ testphdf5_SOURCES = testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \
# The tests all depend on the hdf5 library and the test library
LDADD = $(LIBH5TEST) $(LIBHDF5)
-# Automake needs to be taught how to build lib, dyn, progs, and tests targets.
+# Automake needs to be taught how to build lib, progs and tests targets.
# These will be filled in automatically for the most part (e.g.,
# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and
# EXTRA_TEST variables are supplied to allow the user to force targets to
-# be built at certain times.
+# be built at certain times.
LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \
$(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
@@ -771,6 +790,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+testpflush.sh: $(top_builddir)/config.status $(srcdir)/testpflush.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -1040,7 +1061,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
echo "$$col$$br$$std"; \
fi; \
$$success || exit 1
-recheck: all $(check_PROGRAMS)
+recheck: all $(check_PROGRAMS) $(check_SCRIPTS)
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@set +e; $(am__set_TESTS_bases); \
bases=`for i in $$bases; do echo $$i; done \
@@ -1097,7 +1118,7 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile all-local
@@ -1235,6 +1256,7 @@ uninstall-am:
help:
@$(top_srcdir)/bin/makehelp
+
# lib/progs/tests targets recurse into subdirectories. build-* targets
# build files in this directory.
build-lib: $(LIB)
@@ -1270,7 +1292,7 @@ all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
# make install-doc doesn't do anything outside of doc directory, but
# Makefiles should recognize it.
# UPDATE: docs no longer reside in this build tree, so this target
-# is depreciated.
+# is deprecated.
install-doc uninstall-doc:
@echo "Nothing to be done."
@@ -1431,7 +1453,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index 813fb43..657b6d5 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -16,183 +16,170 @@
*
*/
-#include "h5test.h"
#include "testpar.h"
#include "H5Iprivate.h"
#include "H5ACprivate.h"
-#define H5C_PACKAGE /*suppress error about including H5Cpkg */
+#define H5C_PACKAGE /*suppress error about including H5Cpkg */
#include "H5Cpkg.h"
-#define H5AC_PACKAGE /*suppress error about including H5ACpkg */
+#define H5AC_PACKAGE /*suppress error about including H5ACpkg */
#include "H5ACpkg.h"
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#include "H5Fpkg.h"
+int nerrors = 0;
+int failures = 0;
+hbool_t verbose = TRUE; /* used to control error messages */
-int nerrors = 0;
-int failures = 0;
-hbool_t verbose = TRUE; /* used to control error messages */
-#if 0
-/* So far we haven't needed this, but that may change.
- * Keep it around for now
- */
-hid_t noblock_dxpl_id=(-1);
-#endif
-
-#define NFILENAME 2
+#define NFILENAME 2
#define PARATESTFILE filenames[0]
-const char *FILENAME[NFILENAME]={"CacheTestDummy", NULL};
+const char *FILENAME[NFILENAME] = {"CacheTestDummy", NULL};
#ifndef PATH_MAX
-#define PATH_MAX 512
-#endif /* !PATH_MAX */
-char filenames[NFILENAME][PATH_MAX];
-hid_t fapl; /* file access property list */
-
-
-int world_mpi_size = -1;
-int world_mpi_rank = -1;
-int world_server_mpi_rank = -1;
-MPI_Comm world_mpi_comm = MPI_COMM_NULL;
-int file_mpi_size = -1;
-int file_mpi_rank = -1;
-MPI_Comm file_mpi_comm = MPI_COMM_NULL;
-
+#define PATH_MAX 512
+#endif /* !PATH_MAX */
+char filenames[NFILENAME][PATH_MAX];
+hid_t fapl; /* file access property list */
+
+int world_mpi_size = -1;
+int world_mpi_rank = -1;
+int world_server_mpi_rank = -1;
+MPI_Comm world_mpi_comm = MPI_COMM_NULL;
+int file_mpi_size = -1;
+int file_mpi_rank = -1;
+MPI_Comm file_mpi_comm = MPI_COMM_NULL;
/* the following globals are used to maintain rudementary statistics
* to check the validity of the statistics maintained by H5C.c
*/
-long datum_clears = 0;
-long datum_pinned_clears = 0;
-long datum_destroys = 0;
-long datum_flushes = 0;
-long datum_pinned_flushes = 0;
-long datum_loads = 0;
-long global_pins = 0;
-long global_dirty_pins = 0;
-long local_pins = 0;
-
+long datum_clears = 0;
+long datum_pinned_clears = 0;
+long datum_destroys = 0;
+long datum_flushes = 0;
+long datum_pinned_flushes = 0;
+long datum_loads = 0;
+long global_pins = 0;
+long global_dirty_pins = 0;
+long local_pins = 0;
/* the following fields are used by the server process only */
-int total_reads = 0;
-int total_writes = 0;
-
+int total_reads = 0;
+int total_writes = 0;
/*****************************************************************************
* struct datum
*
- * Instances of struct datum are used to store information on entries
- * that may be loaded into the cache. The individual fields are
- * discussed below:
+ * Instances of struct datum are used to store information on entries
+ * that may be loaded into the cache. The individual fields are
+ * discussed below:
*
- * header: Instance of H5C_cache_entry_t used by the for its data.
- * This field is only used on the file processes, not on the
- * server process.
+ * header: Instance of H5C_cache_entry_t used by the for its data.
+ * This field is only used on the file processes, not on the
+ * server process.
*
- * This field MUST be the first entry in this structure.
+ * This field MUST be the first entry in this structure.
*
- * base_addr: Base address of the entry.
+ * base_addr: Base address of the entry.
*
- * len: Length of the entry.
+ * len: Length of the entry.
*
- * local_len: Length of the entry according to the cache. This
- * value must be positive, and may not be larger than len.
+ * local_len: Length of the entry according to the cache. This
+ * value must be positive, and may not be larger than len.
*
- * The field exists to allow us change the sizes of entries
- * in the cache without upsetting the server. This value
- * is only used locally, and is never sent to the server.
+ * The field exists to allow us change the sizes of entries
+ * in the cache without upsetting the server. This value
+ * is only used locally, and is never sent to the server.
*
- * ver: Version number of the entry. This number is initialize
- * to zero, and incremented each time the entry is modified.
+ * ver: Version number of the entry. This number is initialize
+ * to zero, and incremented each time the entry is modified.
*
- * dirty: Boolean flag indicating whether the entry is dirty.
+ * dirty: Boolean flag indicating whether the entry is dirty.
*
- * For current purposes, an entry is clean until it is
- * modified, and dirty until written to the server (cache
- * on process 0) or until it is marked clean (all other
- * caches).
+ * For current purposes, an entry is clean until it is
+ * modified, and dirty until written to the server (cache
+ * on process 0) or until it is marked clean (all other
+ * caches).
*
- * valid: Boolean flag indicating whether the entry contains
- * valid data. Attempts to read an entry whose valid
- * flag is not set should trigger an error.
+ * valid: Boolean flag indicating whether the entry contains
+ * valid data. Attempts to read an entry whose valid
+ * flag is not set should trigger an error.
*
- * locked: Boolean flag that is set to true iff the entry is in
- * the cache and locked.
+ * locked: Boolean flag that is set to true iff the entry is in
+ * the cache and locked.
*
- * global_pinned: Boolean flag that is set to true iff the entry has
- * been pinned collectively in all caches. Since writes must
- * be collective across all processes, only entries pinned
- * in this fashion may be marked dirty.
+ * global_pinned: Boolean flag that is set to true iff the entry has
+ * been pinned collectively in all caches. Since writes must
+ * be collective across all processes, only entries pinned
+ * in this fashion may be marked dirty.
*
- * local_pinned: Boolean flag that is set to true iff the entry
- * has been pinned in the local cache, but probably not all
- * caches. Such pins will typically not be consistant across
- * processes, and thus cannot be marked as dirty unless they
- * happen to overlap some collective operation.
+ * local_pinned: Boolean flag that is set to true iff the entry
+ * has been pinned in the local cache, but probably not all
+ * caches. Such pins will typically not be consistant across
+ * processes, and thus cannot be marked as dirty unless they
+ * happen to overlap some collective operation.
*
- * cleared: Boolean flag that is set to true whenever the entry is
- * dirty, and is cleared via a call to clear_datum().
+ * cleared: Boolean flag that is set to true whenever the entry is
+ * dirty, and is cleared via a call to datum_notify with the
+ * "entry cleaned" action.
*
- * flushed: Boolean flag that is set to true whenever the entry is
- * dirty, and is flushed via a call to flush_datum().
+ * flushed: Boolean flag that is set to true whenever the entry is
+ * dirty, and is flushed by the metadata cache.
*
- * reads: Integer field used to maintain a count of the number of
- * times this entry has been read from the server since
- * the last time the read and write counts were reset.
+ * reads: Integer field used to maintain a count of the number of
+ * times this entry has been read from the server since
+ * the last time the read and write counts were reset.
*
- * writes: Integer field used to maintain a count of the number of
- * times this entry has been written to the server since
- * the last time the read and write counts were reset.
+ * writes: Integer field used to maintain a count of the number of
+ * times this entry has been written to the server since
+ * the last time the read and write counts were reset.
*
- * index: Index of this instance of datum in the data_index[] array
- * discussed below.
+ * index: Index of this instance of datum in the data_index[] array
+ * discussed below.
*
*****************************************************************************/
-struct datum
-{
- H5C_cache_entry_t header;
- haddr_t base_addr;
- size_t len;
- size_t local_len;
- int ver;
- hbool_t dirty;
- hbool_t valid;
- hbool_t locked;
- hbool_t global_pinned;
- hbool_t local_pinned;
- hbool_t cleared;
- hbool_t flushed;
- int reads;
- int writes;
- int index;
+struct datum {
+ H5C_cache_entry_t header;
+ haddr_t base_addr;
+ size_t len;
+ size_t local_len;
+ int ver;
+ hbool_t dirty;
+ hbool_t valid;
+ hbool_t locked;
+ hbool_t global_pinned;
+ hbool_t local_pinned;
+ hbool_t cleared;
+ hbool_t flushed;
+ int reads;
+ int writes;
+ int index;
};
/*****************************************************************************
* data array
*
- * The data array is an array of instances of datum of size
- * NUM_DATA_ENTRIES that is used to track the particulars of all
- * the entries that may be loaded into the cache.
+ * The data array is an array of instances of datum of size
+ * NUM_DATA_ENTRIES that is used to track the particulars of all
+ * the entries that may be loaded into the cache.
*
- * It exists on all processes, although the master copy is maintained
- * by the server process. If the cache is performing correctly, all
- * versions should be effectively identical. By that I mean that
- * the data received from the server should always match that in
- * the local version of the data array.
+ * It exists on all processes, although the master copy is maintained
+ * by the server process. If the cache is performing correctly, all
+ * versions should be effectively identical. By that I mean that
+ * the data received from the server should always match that in
+ * the local version of the data array.
*
*****************************************************************************/
-#define NUM_DATA_ENTRIES 100000
+#define NUM_DATA_ENTRIES 100000
struct datum data[NUM_DATA_ENTRIES];
-
/* Many tests use the size of data array as the size of test loops.
* On some machines, this results in unacceptably long test runs.
*
@@ -207,127 +194,122 @@ struct datum data[NUM_DATA_ENTRIES];
* Further, this value must be consistant across all processes.
*/
-#define STD_VIRT_NUM_DATA_ENTRIES NUM_DATA_ENTRIES
-#define EXPRESS_VIRT_NUM_DATA_ENTRIES (NUM_DATA_ENTRIES / 10)
+#define STD_VIRT_NUM_DATA_ENTRIES NUM_DATA_ENTRIES
+#define EXPRESS_VIRT_NUM_DATA_ENTRIES (NUM_DATA_ENTRIES / 10)
/* Use a smaller test size to avoid creating huge MPE logfiles. */
-#define MPE_VIRT_NUM_DATA_ENTIES (NUM_DATA_ENTRIES / 100)
+#define MPE_VIRT_NUM_DATA_ENTIES (NUM_DATA_ENTRIES / 100)
int virt_num_data_entries = NUM_DATA_ENTRIES;
-
/*****************************************************************************
* data_index array
*
- * The data_index array is an array of integer used to maintain a list
- * of instances of datum in the data array in increasing base_addr order.
+ * The data_index array is an array of integer used to maintain a list
+ * of instances of datum in the data array in increasing base_addr order.
*
- * This array is necessary, as move operations can swap the values
- * of the base_addr fields of two instances of datum. Without this
- * array, we would no longer be able to use a binary search on a sorted
- * list to find the indexes of instances of datum given the values of
- * their base_addr fields.
+ * This array is necessary, as move operations can swap the values
+ * of the base_addr fields of two instances of datum. Without this
+ * array, we would no longer be able to use a binary search on a sorted
+ * list to find the indexes of instances of datum given the values of
+ * their base_addr fields.
*
*****************************************************************************/
int data_index[NUM_DATA_ENTRIES];
-
/*****************************************************************************
* The following two #defines are used to control code that is in turn used
- * to force "POSIX" semantics on the server process used to simulate metadata
- * reads and writes. Without some such mechanism, the test code contains
+ * to force "POSIX" semantics on the server process used to simulate metadata
+ * reads and writes. Without some such mechanism, the test code contains
* race conditions that will frequently cause spurious failures.
*
* When set to TRUE, DO_WRITE_REQ_ACK forces the server to send an ack after
- * each write request, and the client to wait until the ack is received
+ * each write request, and the client to wait until the ack is received
* before proceeding. This was my first solution to the problem, and at
* first glance, it would seem to have a lot of unnecessary overhead.
*
* In an attempt to reduce the overhead, I implemented a second solution
- * in which no acks are sent after writes. Instead, the metadata cache is
- * provided with a callback function to call after each sequence of writes.
- * This callback simply causes the client to send the server process a
+ * in which no acks are sent after writes. Instead, the metadata cache is
+ * provided with a callback function to call after each sequence of writes.
+ * This callback simply causes the client to send the server process a
* "sync" message and and await an ack in reply.
*
- * Strangely, at least on Phoenix, the first solution runs faster by a
- * rather large margin. However, I can imagine this changing with
+ * Strangely, at least on Phoenix, the first solution runs faster by a
+ * rather large margin. However, I can imagine this changing with
* different OS's and MPI implementatins.
*
- * Thus I have left code supporting the second solution in place.
+ * Thus I have left code supporting the second solution in place.
*
- * Note that while one of these two #defines must be set to TRUE, there
- * should never be any need to set both of them to TRUE (although the
+ * Note that while one of these two #defines must be set to TRUE, there
+ * should never be any need to set both of them to TRUE (although the
* tests will still function with this setting).
*****************************************************************************/
-#define DO_WRITE_REQ_ACK TRUE
-#define DO_SYNC_AFTER_WRITE FALSE
-
+#define DO_WRITE_REQ_ACK TRUE
+#define DO_SYNC_AFTER_WRITE FALSE
/*****************************************************************************
* struct mssg
*
- * The mssg structure is used as a generic container for messages to
- * and from the server. Not all fields are used in all cases.
+ * The mssg structure is used as a generic container for messages to
+ * and from the server. Not all fields are used in all cases.
*
- * req: Integer field containing the type of the message.
+ * req: Integer field containing the type of the message.
*
- * src: World communicator MPI rank of the sending process.
+ * src: World communicator MPI rank of the sending process.
*
- * dest: World communicator MPI rank of the destination process.
+ * dest: World communicator MPI rank of the destination process.
*
- * mssg_num: Serial number assigned to the message by the sender.
+ * mssg_num: Serial number assigned to the message by the sender.
*
- * base_addr: Base address of a datum. Not used in all mssgs.
+ * base_addr: Base address of a datum. Not used in all mssgs.
*
- * len: Length of a datum (in bytes). Not used in all mssgs.
+ * len: Length of a datum (in bytes). Not used in all mssgs.
*
- * ver: Version number of a datum. Not used in all mssgs.
+ * ver: Version number of a datum. Not used in all mssgs.
*
- * count: Reported number of total/entry reads/writes. Not used
- * in all mssgs.
+ * count: Reported number of total/entry reads/writes. Not used
+ * in all mssgs.
*
- * magic: Magic number for error detection. Must be set to
- * MSSG_MAGIC.
+ * magic: Magic number for error detection. Must be set to
+ * MSSG_MAGIC.
*
*****************************************************************************/
-#define WRITE_REQ_CODE 0
-#define WRITE_REQ_ACK_CODE 1
-#define READ_REQ_CODE 2
-#define READ_REQ_REPLY_CODE 3
-#define SYNC_REQ_CODE 4
-#define SYNC_ACK_CODE 5
-#define REQ_TTL_WRITES_CODE 6
-#define REQ_TTL_WRITES_RPLY_CODE 7
-#define REQ_TTL_READS_CODE 8
-#define REQ_TTL_READS_RPLY_CODE 9
-#define REQ_ENTRY_WRITES_CODE 10
-#define REQ_ENTRY_WRITES_RPLY_CODE 11
-#define REQ_ENTRY_READS_CODE 12
-#define REQ_ENTRY_READS_RPLY_CODE 13
-#define REQ_RW_COUNT_RESET_CODE 14
-#define REQ_RW_COUNT_RESET_RPLY_CODE 15
-#define DONE_REQ_CODE 16
-#define MAX_REQ_CODE 16
-
-#define MSSG_MAGIC 0x1248
-
-struct mssg_t
-{
- int req;
- int src;
- int dest;
- long int mssg_num;
- haddr_t base_addr;
- unsigned len;
- int ver;
- int count;
- unsigned magic;
+#define WRITE_REQ_CODE 0
+#define WRITE_REQ_ACK_CODE 1
+#define READ_REQ_CODE 2
+#define READ_REQ_REPLY_CODE 3
+#define SYNC_REQ_CODE 4
+#define SYNC_ACK_CODE 5
+#define REQ_TTL_WRITES_CODE 6
+#define REQ_TTL_WRITES_RPLY_CODE 7
+#define REQ_TTL_READS_CODE 8
+#define REQ_TTL_READS_RPLY_CODE 9
+#define REQ_ENTRY_WRITES_CODE 10
+#define REQ_ENTRY_WRITES_RPLY_CODE 11
+#define REQ_ENTRY_READS_CODE 12
+#define REQ_ENTRY_READS_RPLY_CODE 13
+#define REQ_RW_COUNT_RESET_CODE 14
+#define REQ_RW_COUNT_RESET_RPLY_CODE 15
+#define DONE_REQ_CODE 16
+#define MAX_REQ_CODE 16
+
+#define MSSG_MAGIC 0x1248
+
+struct mssg_t {
+ int req;
+ int src;
+ int dest;
+ long int mssg_num;
+ haddr_t base_addr;
+ unsigned len;
+ int ver;
+ unsigned count;
+ unsigned magic;
};
-MPI_Datatype mpi_mssg_t; /* for MPI derived type created from mssg */
-
+MPI_Datatype mpi_mssg_t; /* for MPI derived type created from mssg */
/*****************************************************************************/
/************************** function declarations ****************************/
@@ -341,19 +323,16 @@ static void reset_stats(void);
static hbool_t set_up_file_communicator(void);
-
/* data array manipulation functions */
-static int addr_to_datum_index(haddr_t base_addr);
+static int addr_to_datum_index(haddr_t base_addr);
static void init_data(void);
-
/* test coodination related functions */
-static int do_express_test(void);
+static int do_express_test(void);
static void do_sync(void);
-static int get_max_nerrors(void);
-
+static int get_max_nerrors(void);
/* mssg xfer related functions */
@@ -362,88 +341,68 @@ static hbool_t send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag);
static hbool_t setup_derived_types(void);
static hbool_t takedown_derived_types(void);
-
/* server functions */
static hbool_t reset_server_counters(void);
static hbool_t server_main(void);
-static hbool_t serve_read_request(struct mssg_t * mssg_ptr);
-static hbool_t serve_sync_request(struct mssg_t * mssg_ptr);
-static hbool_t serve_write_request(struct mssg_t * mssg_ptr);
-static hbool_t serve_total_writes_request(struct mssg_t * mssg_ptr);
-static hbool_t serve_total_reads_request(struct mssg_t * mssg_ptr);
-static hbool_t serve_entry_writes_request(struct mssg_t * mssg_ptr);
-static hbool_t serve_entry_reads_request(struct mssg_t * mssg_ptr);
-static hbool_t serve_rw_count_reset_request(struct mssg_t * mssg_ptr);
-
+static hbool_t serve_read_request(struct mssg_t *mssg_ptr);
+static hbool_t serve_sync_request(struct mssg_t *mssg_ptr);
+static hbool_t serve_write_request(struct mssg_t *mssg_ptr);
+static hbool_t serve_total_writes_request(struct mssg_t *mssg_ptr);
+static hbool_t serve_total_reads_request(struct mssg_t *mssg_ptr);
+static hbool_t serve_entry_writes_request(struct mssg_t *mssg_ptr);
+static hbool_t serve_entry_reads_request(struct mssg_t *mssg_ptr);
+static hbool_t serve_rw_count_reset_request(struct mssg_t *mssg_ptr);
/* call back functions & related data structures */
-static herr_t clear_datum(H5F_t * f, void * thing, hbool_t dest);
-static herr_t destroy_datum(H5F_t H5_ATTR_UNUSED * f, void * thing);
-static herr_t flush_datum(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t dest, haddr_t addr,
- void *thing);
+static herr_t clear_datum(H5F_t *f, void *thing, hbool_t dest);
+static herr_t destroy_datum(H5F_t H5_ATTR_UNUSED *f, void *thing);
+static herr_t flush_datum(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t dest, haddr_t addr, void *thing);
static void * load_datum(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr,
- void H5_ATTR_UNUSED *udata);
-static herr_t size_datum(H5F_t H5_ATTR_UNUSED * f, void * thing, size_t * size_ptr);
+ void H5_ATTR_UNUSED *udata);
+static herr_t size_datum(H5F_t H5_ATTR_UNUSED *f, void *thing, size_t *size_ptr);
-#define DATUM_ENTRY_TYPE H5AC_TEST_ID
+#define DATUM_ENTRY_TYPE H5AC_TEST_ID
-#define NUMBER_OF_ENTRY_TYPES 1
-
-const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
-{
- {
- DATUM_ENTRY_TYPE,
- (H5C_load_func_t)load_datum,
- (H5C_flush_func_t)flush_datum,
- (H5C_dest_func_t)destroy_datum,
- (H5C_clear_func_t)clear_datum,
- (H5C_size_func_t)size_datum
- }
-};
+#define NUMBER_OF_ENTRY_TYPES 1
+const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = {
+ {DATUM_ENTRY_TYPE, (H5C_load_func_t)load_datum, (H5C_flush_func_t)flush_datum,
+ (H5C_dest_func_t)destroy_datum, (H5C_clear_func_t)clear_datum, (H5C_size_func_t)size_datum}};
/* test utility functions */
-static void expunge_entry(H5F_t * file_ptr, int32_t idx);
-static void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr,
- int32_t idx, unsigned int flags);
-static void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx,
- int max_idx, int min_count,
- int max_count);
-static void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx);
-static void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect);
-static int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx,
- hbool_t via_unprotect);
-static void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx,
- int min_count, int max_count);
-static void lock_and_unlock_random_entry(H5F_t * file_ptr,
- int min_idx, int max_idx);
-static void lock_entry(H5F_t * file_ptr, int32_t idx);
+static void expunge_entry(H5F_t *file_ptr, int32_t idx);
+static void insert_entry(H5C_t *cache_ptr, H5F_t *file_ptr, int32_t idx, unsigned int flags);
+static void local_pin_and_unpin_random_entries(H5F_t *file_ptr, int min_idx, int max_idx, int min_count,
+ int max_count);
+static void local_pin_random_entry(H5F_t *file_ptr, int min_idx, int max_idx);
+static void local_unpin_all_entries(H5F_t *file_ptr, hbool_t via_unprotect);
+static int local_unpin_next_pinned_entry(H5F_t *file_ptr, int start_idx, hbool_t via_unprotect);
+static void lock_and_unlock_random_entries(H5F_t *file_ptr, int min_idx, int max_idx, int min_count,
+ int max_count);
+static void lock_and_unlock_random_entry(H5F_t *file_ptr, int min_idx, int max_idx);
+static void lock_entry(H5F_t *file_ptr, int32_t idx);
static void mark_entry_dirty(int32_t idx);
-static void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty);
+static void pin_entry(H5F_t *file_ptr, int32_t idx, hbool_t global, hbool_t dirty);
#ifdef H5_METADATA_TRACE_FILE
static void pin_protected_entry(int32_t idx, hbool_t global);
#endif /* H5_METADATA_TRACE_FILE */
-static void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx);
+static void move_entry(H5F_t *file_ptr, int32_t old_idx, int32_t new_idx);
static hbool_t reset_server_counts(void);
-static void resize_entry(int32_t idx, size_t new_size);
-static hbool_t setup_cache_for_test(hid_t * fid_ptr,
- H5F_t ** file_ptr_ptr,
- H5C_t ** cache_ptr_ptr,
- int metadata_write_strategy);
-static void setup_rand(void);
+static void resize_entry(int32_t idx, size_t new_size);
+static hbool_t setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr,
+ int metadata_write_strategy);
+static void setup_rand(void);
static hbool_t take_down_cache(hid_t fid);
static hbool_t verify_entry_reads(haddr_t addr, int expected_entry_reads);
static hbool_t verify_entry_writes(haddr_t addr, int expected_entry_writes);
static hbool_t verify_total_reads(int expected_total_reads);
static hbool_t verify_total_writes(int expected_total_writes);
-static void verify_writes(int num_writes, haddr_t * written_entries_tbl);
-static void unlock_entry(H5F_t * file_ptr, int32_t type, unsigned int flags);
-static void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global,
- hbool_t dirty, hbool_t via_unprotect);
-
+static void verify_writes(int num_writes, haddr_t *written_entries_tbl);
+static void unlock_entry(H5F_t *file_ptr, int32_t type, unsigned int flags);
+static void unpin_entry(H5F_t *file_ptr, int32_t idx, hbool_t global, hbool_t dirty, hbool_t via_unprotect);
/* test functions */
@@ -455,7 +414,6 @@ static hbool_t smoke_check_4(int metadata_write_strategy);
static hbool_t smoke_check_5(int metadata_write_strategy);
static hbool_t trace_file_check(int metadata_write_strategy);
-
/*****************************************************************************/
/****************************** stats functions ******************************/
/*****************************************************************************/
@@ -463,37 +421,32 @@ static hbool_t trace_file_check(int metadata_write_strategy);
#ifdef NOT_USED
/*****************************************************************************
*
- * Function: print_stats()
+ * Function: print_stats()
*
- * Purpose: Print the rudementary stats maintained by t_cache.
+ * Purpose: Print the rudementary stats maintained by t_cache.
*
- * This is a debugging function, which will not normally
- * be run as part of t_cache.
+ * This is a debugging function, which will not normally
+ * be run as part of t_cache.
*
- * Return: void
+ * Return: void
*
- * Programmer: JRM -- 4/17/06
+ * Programmer: JRM -- 4/17/06
*
* Modifications:
*
- * None.
+ * None.
*
*****************************************************************************/
static void
print_stats(void)
{
- HDfprintf(stdout,
- "%d: datum clears / pinned clears / destroys = %ld / %ld / %ld\n",
- world_mpi_rank, datum_clears, datum_pinned_clears,
- datum_destroys );
- HDfprintf(stdout,
- "%d: datum flushes / pinned flushes / loads = %ld / %ld / %ld\n",
- world_mpi_rank, datum_flushes, datum_pinned_flushes,
- datum_loads );
- HDfprintf(stdout,
- "%d: pins: global / global dirty / local = %ld / %ld / %ld\n",
- world_mpi_rank, global_pins, global_dirty_pins, local_pins);
+ HDfprintf(stdout, "%d: datum clears / pinned clears / destroys = %ld / %ld / %ld\n", world_mpi_rank,
+ datum_clears, datum_pinned_clears, datum_destroys);
+ HDfprintf(stdout, "%d: datum flushes / pinned flushes / loads = %ld / %ld / %ld\n", world_mpi_rank,
+ datum_flushes, datum_pinned_flushes, datum_loads);
+ HDfprintf(stdout, "%d: pins: global / global dirty / local = %ld / %ld / %ld\n", world_mpi_rank,
+ global_pins, global_dirty_pins, local_pins);
HDfflush(stdout);
return;
@@ -503,255 +456,242 @@ print_stats(void)
/*****************************************************************************
*
- * Function: reset_stats()
+ * Function: reset_stats()
*
- * Purpose: Reset the rudementary stats maintained by t_cache.
+ * Purpose: Reset the rudementary stats maintained by t_cache.
*
- * Return: void
+ * Return: void
*
- * Programmer: JRM -- 4/17/06
+ * Programmer: JRM -- 4/17/06
*
* Modifications:
*
- * None.
+ * None.
*
*****************************************************************************/
static void
reset_stats(void)
{
- datum_clears = 0;
- datum_pinned_clears = 0;
- datum_destroys = 0;
- datum_flushes = 0;
- datum_pinned_flushes = 0;
- datum_loads = 0;
- global_pins = 0;
- global_dirty_pins = 0;
- local_pins = 0;
+ datum_clears = 0;
+ datum_pinned_clears = 0;
+ datum_destroys = 0;
+ datum_flushes = 0;
+ datum_pinned_flushes = 0;
+ datum_loads = 0;
+ global_pins = 0;
+ global_dirty_pins = 0;
+ local_pins = 0;
return;
} /* reset_stats() */
-
/*****************************************************************************/
/**************************** MPI setup functions ****************************/
/*****************************************************************************/
/*****************************************************************************
*
- * Function: set_up_file_communicator()
+ * Function: set_up_file_communicator()
*
- * Purpose: Create the MPI communicator used to open a HDF5 file with.
- * In passing, also initialize the file_mpi... globals.
+ * Purpose: Create the MPI communicator used to open a HDF5 file with.
+ * In passing, also initialize the file_mpi... globals.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 11/16/05
+ * Programmer: JRM -- 11/16/05
*
* Modifications:
*
- * None.
+ * None.
*
*****************************************************************************/
static hbool_t
set_up_file_communicator(void)
{
- const char * fcn_name = "set_up_file_communicator()";
- hbool_t success = TRUE;
- int mpi_result;
- int num_excluded_ranks;
- int excluded_ranks[1];
- MPI_Group file_group;
- MPI_Group world_group;
+ const char *fcn_name = "set_up_file_communicator()";
+ hbool_t success = TRUE;
+ int mpi_result;
+ int num_excluded_ranks;
+ int excluded_ranks[1];
+ MPI_Group file_group;
+ MPI_Group world_group;
- if ( success ) {
+ if (success) {
mpi_result = MPI_Comm_group(world_mpi_comm, &world_group);
- if ( mpi_result != MPI_SUCCESS ) {
+ if (mpi_result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- fprintf(stdout,
- "%d:%s: MPI_Comm_group() failed with error %d.\n",
- world_mpi_rank, fcn_name, mpi_result);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Comm_group() failed with error %d.\n", world_mpi_rank, fcn_name,
+ mpi_result);
}
}
}
- if ( success ) {
+ if (success) {
num_excluded_ranks = 1;
- excluded_ranks[0] = world_server_mpi_rank;
- mpi_result = MPI_Group_excl(world_group, num_excluded_ranks,
- excluded_ranks, &file_group);
+ excluded_ranks[0] = world_server_mpi_rank;
+ mpi_result = MPI_Group_excl(world_group, num_excluded_ranks, excluded_ranks, &file_group);
- if ( mpi_result != MPI_SUCCESS ) {
+ if (mpi_result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- fprintf(stdout,
- "%d:%s: MPI_Group_excl() failed with error %d.\n",
- world_mpi_rank, fcn_name, mpi_result);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Group_excl() failed with error %d.\n", world_mpi_rank, fcn_name,
+ mpi_result);
}
}
}
- if ( success ) {
+ if (success) {
- mpi_result = MPI_Comm_create(world_mpi_comm, file_group,
- &file_mpi_comm);
+ mpi_result = MPI_Comm_create(world_mpi_comm, file_group, &file_mpi_comm);
- if ( mpi_result != MPI_SUCCESS ) {
+ if (mpi_result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- fprintf(stdout,
- "%d:%s: MPI_Comm_create() failed with error %d.\n",
- world_mpi_rank, fcn_name, mpi_result);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Comm_create() failed with error %d.\n", world_mpi_rank,
+ fcn_name, mpi_result);
}
+ }
+ else {
- } else {
-
- if ( world_mpi_rank != world_server_mpi_rank ) {
+ if (world_mpi_rank != world_server_mpi_rank) {
- if ( file_mpi_comm == MPI_COMM_NULL ) {
+ if (file_mpi_comm == MPI_COMM_NULL) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- fprintf(stdout,
- "%d:%s: file_mpi_comm == MPI_COMM_NULL.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: file_mpi_comm == MPI_COMM_NULL.\n", world_mpi_rank,
+ fcn_name);
}
}
- } else {
+ }
+ else {
file_mpi_size = world_mpi_size - 1; /* needed by the server */
- if ( file_mpi_comm != MPI_COMM_NULL ) {
+ if (file_mpi_comm != MPI_COMM_NULL) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- fprintf(stdout,
- "%d:%s: file_mpi_comm != MPI_COMM_NULL.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: file_mpi_comm != MPI_COMM_NULL.\n", world_mpi_rank,
+ fcn_name);
}
}
}
}
}
- if ( ( success ) && ( world_mpi_rank != world_server_mpi_rank ) ) {
+ if ((success) && (world_mpi_rank != world_server_mpi_rank)) {
mpi_result = MPI_Comm_size(file_mpi_comm, &file_mpi_size);
- if ( mpi_result != MPI_SUCCESS ) {
+ if (mpi_result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- fprintf(stdout,
- "%d:%s: MPI_Comm_size() failed with error %d.\n",
- world_mpi_rank, fcn_name, mpi_result);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Comm_size() failed with error %d.\n", world_mpi_rank, fcn_name,
+ mpi_result);
}
}
}
- if ( ( success ) && ( world_mpi_rank != world_server_mpi_rank ) ) {
+ if ((success) && (world_mpi_rank != world_server_mpi_rank)) {
mpi_result = MPI_Comm_rank(file_mpi_comm, &file_mpi_rank);
- if ( mpi_result != MPI_SUCCESS ) {
+ if (mpi_result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- fprintf(stdout,
- "%d:%s: MPI_Comm_rank() failed with error %d.\n",
- world_mpi_rank, fcn_name, mpi_result);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Comm_rank() failed with error %d.\n", world_mpi_rank, fcn_name,
+ mpi_result);
}
}
}
- return(success);
+ return (success);
} /* set_up_file_communicator() */
-
/*****************************************************************************/
/******************** data array manipulation functions **********************/
/*****************************************************************************/
/*****************************************************************************
*
- * Function: addr_to_datum_index()
+ * Function: addr_to_datum_index()
*
- * Purpose: Given the base address of a datum, find and return its index
- * in the data array.
+ * Purpose: Given the base address of a datum, find and return its index
+ * in the data array.
*
- * Return: Success: index of target datum.
+ * Return: Success: index of target datum.
*
- * Failure: -1.
+ * Failure: -1.
*
- * Programmer: JRM -- 12/20/05
+ * Programmer: JRM -- 12/20/05
*
*****************************************************************************/
static int
addr_to_datum_index(haddr_t base_addr)
{
/* const char * fcn_name = "addr_to_datum_index()"; */
- int top = NUM_DATA_ENTRIES - 1;
- int bottom = 0;
- int middle = (NUM_DATA_ENTRIES - 1) / 2;
+ int top = NUM_DATA_ENTRIES - 1;
+ int bottom = 0;
+ int middle = (NUM_DATA_ENTRIES - 1) / 2;
int ret_value = -1;
- while ( top >= bottom )
- {
- if ( base_addr < data[data_index[middle]].base_addr ) {
+ while (top >= bottom) {
+ if (base_addr < data[data_index[middle]].base_addr) {
- top = middle - 1;
+ top = middle - 1;
middle = (top + bottom) / 2;
-
- } else if ( base_addr > data[data_index[middle]].base_addr ) {
+ }
+ else if (base_addr > data[data_index[middle]].base_addr) {
bottom = middle + 1;
middle = (top + bottom) / 2;
-
- } else /* ( base_addr == data[data_index[middle]].base_addr ) */ {
+ }
+ else /* ( base_addr == data[data_index[middle]].base_addr ) */ {
ret_value = data_index[middle];
- bottom = top + 1; /* to force exit from while loop */
-
+ bottom = top + 1; /* to force exit from while loop */
}
}
- return(ret_value);
+ return (ret_value);
} /* addr_to_datum_index() */
-
/*****************************************************************************
*
- * Function: init_data()
+ * Function: init_data()
*
- * Purpose: Initialize the data array, from which cache entries are
- * loaded.
+ * Purpose: Initialize the data array, from which cache entries are
+ * loaded.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 12/20/05
+ * Programmer: JRM -- 12/20/05
*
*****************************************************************************/
static void
@@ -765,21 +705,18 @@ init_data(void)
* At present, I am using the first 20 entries of the Fibonacci
* sequence multiplied by 2. We will see how it works.
*/
- const int num_addr_offsets = 20;
- const haddr_t addr_offsets[20] = { 2, 2, 4, 6, 10,
- 16, 26, 42, 68, 110,
- 178, 288, 466, 754, 1220,
- 1974, 3194, 5168, 8362, 13539};
- int i;
- int j = 0;
- haddr_t addr = 512;
+ const int num_addr_offsets = 20;
+ const haddr_t addr_offsets[20] = {2, 2, 4, 6, 10, 16, 26, 42, 68, 110,
+ 178, 288, 466, 754, 1220, 1974, 3194, 5168, 8362, 13539};
+ int i;
+ int j = 0;
+ haddr_t addr = 512;
/* this must hold so moves don't change entry size. */
- HDassert( (NUM_DATA_ENTRIES / 2) % 20 == 0 );
- HDassert( (virt_num_data_entries / 2) % 20 == 0 );
+ HDassert((NUM_DATA_ENTRIES / 2) % 20 == 0);
+ HDassert((virt_num_data_entries / 2) % 20 == 0);
- for ( i = 0; i < NUM_DATA_ENTRIES; i++ )
- {
+ for (i = 0; i < NUM_DATA_ENTRIES; i++) {
data[i].base_addr = addr;
data[i].len = (size_t)(addr_offsets[j]);
data[i].local_len = (size_t)(addr_offsets[j]);
@@ -787,18 +724,18 @@ init_data(void)
data[i].dirty = FALSE;
data[i].valid = FALSE;
data[i].locked = FALSE;
- data[i].global_pinned = FALSE;
- data[i].local_pinned = FALSE;
- data[i].cleared = FALSE;
- data[i].flushed = FALSE;
+ data[i].global_pinned = FALSE;
+ data[i].local_pinned = FALSE;
+ data[i].cleared = FALSE;
+ data[i].flushed = FALSE;
data[i].reads = 0;
data[i].writes = 0;
- data[i].index = i;
+ data[i].index = i;
- data_index[i] = i;
+ data_index[i] = i;
addr += addr_offsets[j];
- HDassert( addr > data[i].base_addr );
+ HDassert(addr > data[i].base_addr);
j = (j + 1) % num_addr_offsets;
}
@@ -807,96 +744,84 @@ init_data(void)
} /* init_data() */
-
/*****************************************************************************/
/******************** test coodination related functions *********************/
/*****************************************************************************/
/*****************************************************************************
*
- * Function: do_express_test()
+ * Function: do_express_test()
*
- * Purpose: Do an MPI_Allreduce to obtain the maximum value returned
- * by GetTestExpress() across all processes. Return this
- * value.
+ * Purpose: Do an MPI_Allreduce to obtain the maximum value returned
+ * by GetTestExpress() across all processes. Return this
+ * value.
*
- * Envirmoment variables can be different across different
- * processes. This function ensures that all processes agree
- * on whether to do an express test.
+ * Envirmoment variables can be different across different
+ * processes. This function ensures that all processes agree
+ * on whether to do an express test.
*
- * Return: Success: Maximum of the values returned by
- * GetTestExpress() across all processes.
+ * Return: Success: Maximum of the values returned by
+ * GetTestExpress() across all processes.
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: JRM -- 4/25/06
+ * Programmer: JRM -- 4/25/06
*
*****************************************************************************/
static int
do_express_test(void)
{
- const char * fcn_name = "do_express_test()";
- int express_test;
- int max_express_test;
- int result;
+ const char *fcn_name = "do_express_test()";
+ int express_test;
+ int max_express_test;
+ int result;
express_test = GetTestExpress();
- result = MPI_Allreduce((void *)&express_test,
- (void *)&max_express_test,
- 1,
- MPI_INT,
- MPI_MAX,
- world_mpi_comm);
+ result =
+ MPI_Allreduce((void *)&express_test, (void *)&max_express_test, 1, MPI_INT, MPI_MAX, world_mpi_comm);
- if ( result != MPI_SUCCESS ) {
+ if (result != MPI_SUCCESS) {
nerrors++;
max_express_test = -1;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: MPI_Allreduce() failed.\n",
- world_mpi_rank, fcn_name );
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Allreduce() failed.\n", world_mpi_rank, fcn_name);
}
}
- return(max_express_test);
+ return (max_express_test);
} /* do_express_test() */
-
/*****************************************************************************
*
- * Function: do_sync()
- *
- * Purpose: Ensure that all messages sent by this process have been
- * processed before proceeding.
+ * Function: do_sync()
*
- * Do this by exchanging sync req / sync ack messages with
- * the server.
+ * Purpose: Ensure that all messages sent by this process have been
+ * processed before proceeding.
*
- * Do nothing if nerrors is greater than zero.
+ * Do this by exchanging sync req / sync ack messages with
+ * the server.
*
- * Return: void
+ * Do nothing if nerrors is greater than zero.
*
- * Programmer: JRM -- 5/10/06
+ * Return: void
*
- * Modifications:
- *
- * None.
+ * Programmer: JRM -- 5/10/06
*
*****************************************************************************/
-
static void
do_sync(void)
{
- const char * fcn_name = "do_sync()";
+ const char *fcn_name = "do_sync()";
struct mssg_t mssg;
- if ( nerrors <= 0 ) {
+ if (nerrors <= 0) {
/* compose the message */
- mssg.req = SYNC_REQ_CODE;
+ mssg.req = SYNC_REQ_CODE;
mssg.src = world_mpi_rank;
mssg.dest = world_server_mpi_rank;
mssg.mssg_num = -1; /* set by send function */
@@ -906,697 +831,629 @@ do_sync(void)
mssg.count = 0;
mssg.magic = MSSG_MAGIC;
- if ( ! send_mssg(&mssg, FALSE) ) {
+ if (!send_mssg(&mssg, FALSE)) {
- nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ nerrors++;
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( nerrors <= 0 ) {
+ if (nerrors <= 0) {
- if ( ! recv_mssg(&mssg, SYNC_ACK_CODE) ) {
+ if (!recv_mssg(&mssg, SYNC_ACK_CODE)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
- } else if ( ( mssg.req != SYNC_ACK_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ }
+ else if ((mssg.req != SYNC_ACK_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.magic != MSSG_MAGIC)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad data in sync ack.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in sync ack.\n", world_mpi_rank, fcn_name);
}
- }
+ }
}
return;
} /* do_sync() */
-
/*****************************************************************************
*
- * Function: get_max_nerrors()
- *
- * Purpose: Do an MPI_Allreduce to obtain the maximum value of nerrors
- * across all processes. Return this value.
- *
- * Return: Success: Maximum of the nerrors global variables across
- * all processes.
+ * Function: get_max_nerrors()
*
- * Failure: -1
+ * Purpose: Do an MPI_Allreduce to obtain the maximum value of nerrors
+ * across all processes. Return this value.
*
- * Programmer: JRM -- 1/3/06
+ * Return: Success: Maximum of the nerrors global variables across
+ * all processes.
*
- * Modifications:
+ * Failure: -1
*
- * None.
+ * Programmer: JRM -- 1/3/06
*
*****************************************************************************/
-
static int
get_max_nerrors(void)
{
- const char * fcn_name = "get_max_nerrors()";
- int max_nerrors;
- int result;
+ const char *fcn_name = "get_max_nerrors()";
+ int max_nerrors;
+ int result;
- result = MPI_Allreduce((void *)&nerrors,
- (void *)&max_nerrors,
- 1,
- MPI_INT,
- MPI_MAX,
- world_mpi_comm);
+ result = MPI_Allreduce((void *)&nerrors, (void *)&max_nerrors, 1, MPI_INT, MPI_MAX, world_mpi_comm);
- if ( result != MPI_SUCCESS ) {
+ if (result != MPI_SUCCESS) {
nerrors++;
max_nerrors = -1;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: MPI_Allreduce() failed.\n",
- world_mpi_rank, fcn_name );
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Allreduce() failed.\n", world_mpi_rank, fcn_name);
}
}
- return(max_nerrors);
+ return (max_nerrors);
} /* get_max_nerrors() */
-
/*****************************************************************************/
/************************ mssg xfer related functions ************************/
/*****************************************************************************/
/*****************************************************************************
*
- * Function: recv_mssg()
+ * Function: recv_mssg()
*
- * Purpose: Receive a message from any process in the provided instance
- * of struct mssg.
+ * Purpose: Receive a message from any process in the provided instance
+ * of struct mssg.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 12/22/05
+ * Programmer: JRM -- 12/22/05
*
* Modifications:
*
- * JRM -- 5/10/06
- * Added mssg_tag_offset parameter and supporting code.
+ * JRM -- 5/10/06
+ * Added mssg_tag_offset parameter and supporting code.
*
*****************************************************************************/
-#define CACHE_TEST_TAG 99 /* different from any used by the library */
+#define CACHE_TEST_TAG 99 /* different from any used by the library */
static hbool_t
-recv_mssg(struct mssg_t *mssg_ptr,
- int mssg_tag_offset)
+recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset)
{
- const char * fcn_name = "recv_mssg()";
- hbool_t success = TRUE;
- int mssg_tag = CACHE_TEST_TAG;
- int result;
- MPI_Status status;
+ const char *fcn_name = "recv_mssg()";
+ hbool_t success = TRUE;
+ int mssg_tag = CACHE_TEST_TAG;
+ int result;
+ MPI_Status status;
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_tag_offset < 0 ) ||
- ( mssg_tag_offset> MAX_REQ_CODE ) ) {
+ if ((mssg_ptr == NULL) || (mssg_tag_offset < 0) || (mssg_tag_offset > MAX_REQ_CODE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: bad param(s) on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: bad param(s) on entry.\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
mssg_tag += mssg_tag_offset;
}
- if ( success ) {
+ if (success) {
- result = MPI_Recv((void *)mssg_ptr, 1, mpi_mssg_t, MPI_ANY_SOURCE,
- mssg_tag, world_mpi_comm, &status);
+ result = MPI_Recv((void *)mssg_ptr, 1, mpi_mssg_t, MPI_ANY_SOURCE, mssg_tag, world_mpi_comm, &status);
- if ( result != MPI_SUCCESS ) {
+ if (result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: MPI_Recv() failed.\n",
- world_mpi_rank, fcn_name );
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Recv() failed.\n", world_mpi_rank, fcn_name);
}
- } else if ( mssg_ptr->magic != MSSG_MAGIC ) {
+ }
+ else if (mssg_ptr->magic != MSSG_MAGIC) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: invalid magic.\n", world_mpi_rank,
- fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: invalid magic.\n", world_mpi_rank, fcn_name);
}
- } else if ( mssg_ptr->src != status.MPI_SOURCE ) {
+ }
+ else if (mssg_ptr->src != status.MPI_SOURCE) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: mssg_ptr->src != status.MPI_SOURCE.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: mssg_ptr->src != status.MPI_SOURCE.\n", world_mpi_rank, fcn_name);
}
}
}
- return(success);
+ return (success);
} /* recv_mssg() */
-
/*****************************************************************************
*
- * Function: send_mssg()
+ * Function: send_mssg()
*
- * Purpose: Send the provided instance of mssg to the indicated target.
+ * Purpose: Send the provided instance of mssg to the indicated target.
*
- * Note that all source and destination ranks are in the
- * global communicator.
+ * Note that all source and destination ranks are in the
+ * global communicator.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 12/22/05
+ * Programmer: JRM -- 12/22/05
*
* Modifications:
*
- * JRM -- 5/10/06
- * Added the add_req_to_tag parameter and supporting code.
+ * JRM -- 5/10/06
+ * Added the add_req_to_tag parameter and supporting code.
*
*****************************************************************************/
-
static hbool_t
-send_mssg(struct mssg_t *mssg_ptr,
- hbool_t add_req_to_tag)
+send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag)
{
- const char * fcn_name = "send_mssg()";
- hbool_t success = TRUE;
- int mssg_tag = CACHE_TEST_TAG;
- int result;
+ const char *fcn_name = "send_mssg()";
+ hbool_t success = TRUE;
+ int mssg_tag = CACHE_TEST_TAG;
+ int result;
static long mssg_num = 0;
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_ptr->src != world_mpi_rank ) ||
- ( mssg_ptr->dest < 0 ) ||
- ( mssg_ptr->dest == mssg_ptr->src ) ||
- ( mssg_ptr->dest >= world_mpi_size ) ||
- ( mssg_ptr->req < 0 ) ||
- ( mssg_ptr->req > MAX_REQ_CODE ) ||
- ( mssg_ptr->magic != MSSG_MAGIC ) ) {
+ if ((mssg_ptr == NULL) || (mssg_ptr->src != world_mpi_rank) || (mssg_ptr->dest < 0) ||
+ (mssg_ptr->dest == mssg_ptr->src) || (mssg_ptr->dest >= world_mpi_size) || (mssg_ptr->req < 0) ||
+ (mssg_ptr->req > MAX_REQ_CODE) || (mssg_ptr->magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Invalid mssg on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Invalid mssg on entry.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
mssg_ptr->mssg_num = mssg_num++;
- if ( add_req_to_tag ) {
+ if (add_req_to_tag) {
- mssg_tag += mssg_ptr->req;
- }
+ mssg_tag += mssg_ptr->req;
+ }
- result = MPI_Send((void *)mssg_ptr, 1, mpi_mssg_t,
- mssg_ptr->dest, mssg_tag, world_mpi_comm);
+ result = MPI_Send((void *)mssg_ptr, 1, mpi_mssg_t, mssg_ptr->dest, mssg_tag, world_mpi_comm);
- if ( result != MPI_SUCCESS ) {
+ if (result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: MPI_Send() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Send() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- return(success);
+ return (success);
} /* send_mssg() */
-
/*****************************************************************************
*
- * Function: setup_derived_types()
+ * Function: setup_derived_types()
*
- * Purpose: Set up the derived types used by the test bed. At present,
- * only the mpi_mssg derived type is needed.
+ * Purpose: Set up the derived types used by the test bed. At present,
+ * only the mpi_mssg derived type is needed.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 12/22/05
+ * Programmer: JRM -- 12/22/05
*
*****************************************************************************/
static hbool_t
setup_derived_types(void)
{
- const char * fcn_name = "setup_derived_types()";
- hbool_t success = TRUE;
- int i;
- int result;
- MPI_Datatype mpi_types[9] = {MPI_INT, MPI_INT, MPI_INT, MPI_LONG,
- HADDR_AS_MPI_TYPE, MPI_INT, MPI_INT,
- MPI_INT, MPI_UNSIGNED};
- int block_len[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
- MPI_Aint displs[9];
+ const char * fcn_name = "setup_derived_types()";
+ hbool_t success = TRUE;
+ int i;
+ int result;
+ MPI_Datatype mpi_types[9] = {MPI_INT, MPI_INT, MPI_INT, MPI_LONG, HADDR_AS_MPI_TYPE,
+ MPI_INT, MPI_INT, MPI_INT, MPI_UNSIGNED};
+ int block_len[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
+ MPI_Aint displs[9];
struct mssg_t sample; /* used to compute displacements */
/* setup the displacements array */
- if ( ( MPI_SUCCESS != MPI_Address(&sample.req, &displs[0]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.src, &displs[1]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.dest, &displs[2]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.mssg_num, &displs[3]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.base_addr, &displs[4]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.len, &displs[5]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.ver, &displs[6]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.count, &displs[7]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.magic, &displs[8]) ) ) {
+ if ((MPI_SUCCESS != MPI_Get_address(&sample.req, &displs[0])) ||
+ (MPI_SUCCESS != MPI_Get_address(&sample.src, &displs[1])) ||
+ (MPI_SUCCESS != MPI_Get_address(&sample.dest, &displs[2])) ||
+ (MPI_SUCCESS != MPI_Get_address(&sample.mssg_num, &displs[3])) ||
+ (MPI_SUCCESS != MPI_Get_address(&sample.base_addr, &displs[4])) ||
+ (MPI_SUCCESS != MPI_Get_address(&sample.len, &displs[5])) ||
+ (MPI_SUCCESS != MPI_Get_address(&sample.ver, &displs[6])) ||
+ (MPI_SUCCESS != MPI_Get_address(&sample.count, &displs[7])) ||
+ (MPI_SUCCESS != MPI_Get_address(&sample.magic, &displs[8]))) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: MPI_Address() call failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Address() call failed.\n", world_mpi_rank, fcn_name);
}
-
- } else {
+ }
+ else {
/* Now calculate the actual displacements */
- for ( i = 8; i >= 0; --i)
- {
+ for (i = 8; i >= 0; --i) {
displs[i] -= displs[0];
}
}
- if ( success ) {
+ if (success) {
- result = MPI_Type_struct(9, block_len, displs, mpi_types, &mpi_mssg_t);
+ result = MPI_Type_create_struct(9, block_len, displs, mpi_types, &mpi_mssg_t);
- if ( result != MPI_SUCCESS ) {
+ if (result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: MPI_Type_struct() call failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Type_struct() call failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( success ) {
+ if (success) {
result = MPI_Type_commit(&mpi_mssg_t);
- if ( result != MPI_SUCCESS) {
+ if (result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: MPI_Type_commit() call failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Type_commit() call failed.\n", world_mpi_rank, fcn_name);
}
}
}
- return(success);
+ return (success);
} /* setup_derived_types */
-
/*****************************************************************************
*
- * Function: takedown_derived_types()
- *
- * Purpose: take down the derived types used by the test bed. At present,
- * only the mpi_mssg derived type is needed.
+ * Function: takedown_derived_types()
*
- * Return: Success: TRUE
+ * Purpose: take down the derived types used by the test bed. At present,
+ * only the mpi_mssg derived type is needed.
*
- * Failure: FALSE
+ * Return: Success: TRUE
*
- * Programmer: JRM -- 12/22/05
- *
- * Modifications:
+ * Failure: FALSE
*
- * None.
+ * Programmer: JRM -- 12/22/05
*
*****************************************************************************/
-
static hbool_t
takedown_derived_types(void)
{
- const char * fcn_name = "takedown_derived_types()";
- hbool_t success = TRUE;
- int result;
+ const char *fcn_name = "takedown_derived_types()";
+ hbool_t success = TRUE;
+ int result;
result = MPI_Type_free(&mpi_mssg_t);
- if ( result != MPI_SUCCESS ) {
+ if (result != MPI_SUCCESS) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: MPI_Type_free() call failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: MPI_Type_free() call failed.\n", world_mpi_rank, fcn_name);
}
}
- return(success);
+ return (success);
} /* takedown_derived_types() */
-
/*****************************************************************************/
/***************************** server functions ******************************/
/*****************************************************************************/
/*****************************************************************************
*
- * Function: reset_server_counters()
+ * Function: reset_server_counters()
*
- * Purpose: Reset the counters maintained by the server, doing a
- * sanity check in passing.
+ * Purpose: Reset the counters maintained by the server, doing a
+ * sanity check in passing.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/5/10
- *
- * Modifications:
- *
- * None.
+ * Programmer: JRM -- 5/5/10
*
*****************************************************************************/
-
static hbool_t
reset_server_counters(void)
{
- const char * fcn_name = "reset_server_counters()";
- hbool_t success = TRUE;
- int i;
- long actual_total_reads = 0;
- long actual_total_writes = 0;
+ const char *fcn_name = "reset_server_counters()";
+ hbool_t success = TRUE;
+ int i;
+ long actual_total_reads = 0;
+ long actual_total_writes = 0;
- for ( i = 0; i < NUM_DATA_ENTRIES; i++ )
- {
- if ( data[i].reads > 0 ) {
+ for (i = 0; i < NUM_DATA_ENTRIES; i++) {
+ if (data[i].reads > 0) {
actual_total_reads += data[i].reads;
data[i].reads = 0;
}
- if ( data[i].writes > 0 ) {
+ if (data[i].writes > 0) {
actual_total_writes += data[i].writes;
data[i].writes = 0;
}
}
- if ( actual_total_reads != total_reads ) {
+ if (actual_total_reads != total_reads) {
success = FALSE;
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: actual/total reads mismatch (%ld/%ld).\n",
- world_mpi_rank, fcn_name,
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: actual/total reads mismatch (%ld/%ld).\n", world_mpi_rank, fcn_name,
actual_total_reads, total_reads);
}
}
- if ( actual_total_writes != total_writes ) {
+ if (actual_total_writes != total_writes) {
success = FALSE;
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: actual/total writes mismatch (%ld/%ld).\n",
- world_mpi_rank, fcn_name,
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: actual/total writes mismatch (%ld/%ld).\n", world_mpi_rank, fcn_name,
actual_total_writes, total_writes);
}
}
- total_reads = 0;
+ total_reads = 0;
total_writes = 0;
- return(success);
+ return (success);
} /* reset_server_counters() */
-
/*****************************************************************************
*
- * Function: server_main()
+ * Function: server_main()
*
- * Purpose: Main function for the server process. This process exists
- * to provide an independant view of the data array.
+ * Purpose: Main function for the server process. This process exists
+ * to provide an independant view of the data array.
*
- * The function handles request from the other processes in
- * the test until the count of done messages received equals
- * the number of client processes.
+ * The function handles request from the other processes in
+ * the test until the count of done messages received equals
+ * the number of client processes.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 12/22/05
+ * Programmer: JRM -- 12/22/05
*
* Modifications:
*
- * JRM -- 5/10/06
- * Updated for sync message.
+ * JRM -- 5/10/06
+ * Updated for sync message.
*
*****************************************************************************/
-
static hbool_t
server_main(void)
{
- const char * fcn_name = "server_main()";
- hbool_t done = FALSE;
- hbool_t success = TRUE;
- int done_count = 0;
+ const char * fcn_name = "server_main()";
+ hbool_t done = FALSE;
+ hbool_t success = TRUE;
+ int done_count = 0;
struct mssg_t mssg;
- if ( world_mpi_rank != world_server_mpi_rank ) {
+ if (world_mpi_rank != world_server_mpi_rank) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: This isn't the server process?!?!?\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: This isn't the server process?!?!?\n", world_mpi_rank, fcn_name);
}
}
-
- while ( ( success ) && ( ! done ) )
- {
+ while ((success) && (!done)) {
success = recv_mssg(&mssg, 0);
- if ( success ) {
+ if (success) {
- switch ( mssg.req )
- {
- case WRITE_REQ_CODE:
- success = serve_write_request(&mssg);
- break;
+ switch (mssg.req) {
+ case WRITE_REQ_CODE:
+ success = serve_write_request(&mssg);
+ break;
- case WRITE_REQ_ACK_CODE:
+ case WRITE_REQ_ACK_CODE:
success = FALSE;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: Received write ack?!?.\n", fcn_name);
- break;
+ break;
- case READ_REQ_CODE:
+ case READ_REQ_CODE:
success = serve_read_request(&mssg);
- break;
+ break;
- case READ_REQ_REPLY_CODE:
+ case READ_REQ_REPLY_CODE:
success = FALSE;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: Received read req reply?!?.\n", fcn_name);
- break;
+ break;
- case SYNC_REQ_CODE:
+ case SYNC_REQ_CODE:
success = serve_sync_request(&mssg);
- break;
+ break;
- case SYNC_ACK_CODE:
+ case SYNC_ACK_CODE:
success = FALSE;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: Received sync ack?!?.\n", fcn_name);
- break;
+ break;
- case REQ_TTL_WRITES_CODE:
- success = serve_total_writes_request(&mssg);
- break;
+ case REQ_TTL_WRITES_CODE:
+ success = serve_total_writes_request(&mssg);
+ break;
- case REQ_TTL_WRITES_RPLY_CODE:
+ case REQ_TTL_WRITES_RPLY_CODE:
success = FALSE;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: Received total writes reply?!?.\n", fcn_name);
- break;
+ break;
- case REQ_TTL_READS_CODE:
- success = serve_total_reads_request(&mssg);
- break;
+ case REQ_TTL_READS_CODE:
+ success = serve_total_reads_request(&mssg);
+ break;
- case REQ_TTL_READS_RPLY_CODE:
+ case REQ_TTL_READS_RPLY_CODE:
success = FALSE;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: Received total reads reply?!?.\n", fcn_name);
- break;
+ break;
- case REQ_ENTRY_WRITES_CODE:
- success = serve_entry_writes_request(&mssg);
- break;
+ case REQ_ENTRY_WRITES_CODE:
+ success = serve_entry_writes_request(&mssg);
+ break;
- case REQ_ENTRY_WRITES_RPLY_CODE:
+ case REQ_ENTRY_WRITES_RPLY_CODE:
success = FALSE;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: Received entry writes reply?!?.\n", fcn_name);
- break;
+ break;
- case REQ_ENTRY_READS_CODE:
- success = serve_entry_reads_request(&mssg);
- break;
+ case REQ_ENTRY_READS_CODE:
+ success = serve_entry_reads_request(&mssg);
+ break;
- case REQ_ENTRY_READS_RPLY_CODE:
+ case REQ_ENTRY_READS_RPLY_CODE:
success = FALSE;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: Received entry reads reply?!?.\n", fcn_name);
- break;
+ break;
- case REQ_RW_COUNT_RESET_CODE:
- success = serve_rw_count_reset_request(&mssg);
- break;
+ case REQ_RW_COUNT_RESET_CODE:
+ success = serve_rw_count_reset_request(&mssg);
+ break;
- case REQ_RW_COUNT_RESET_RPLY_CODE:
+ case REQ_RW_COUNT_RESET_RPLY_CODE:
success = FALSE;
- if(verbose)
+ if (verbose)
HDfprintf(stdout, "%s: Received RW count reset reply?!?.\n", fcn_name);
- break;
+ break;
- case DONE_REQ_CODE:
- done_count++;
- if(done_count >= file_mpi_size)
- done = TRUE;
- break;
+ case DONE_REQ_CODE:
+ done_count++;
+ if (done_count >= file_mpi_size)
+ done = TRUE;
+ break;
- default:
+ default:
nerrors++;
success = FALSE;
- if(verbose)
- HDfprintf(stdout, "%d:%s: Unknown request code.\n", world_mpi_rank, fcn_name);
- break;
+ if (verbose)
+ HDfprintf(stdout, "%d:%s: Unknown request code.\n", world_mpi_rank, fcn_name);
+ break;
}
}
}
- return(success);
+ return (success);
} /* server_main() */
-
/*****************************************************************************
*
- * Function: serve_read_request()
+ * Function: serve_read_request()
*
- * Purpose: Serve a read request.
+ * Purpose: Serve a read request.
*
- * The function accepts a pointer to an instance of struct
- * mssg_t as input. If all sanity checks pass, it sends
- * a copy of the indicated datum from the data array to
- * the requesting process.
+ * The function accepts a pointer to an instance of struct
+ * mssg_t as input. If all sanity checks pass, it sends
+ * a copy of the indicated datum from the data array to
+ * the requesting process.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 12/22/05
+ * Programmer: JRM -- 12/22/05
*
*****************************************************************************/
static hbool_t
-serve_read_request(struct mssg_t * mssg_ptr)
+serve_read_request(struct mssg_t *mssg_ptr)
{
- const char * fcn_name = "serve_read_request()";
- hbool_t report_mssg = FALSE;
- hbool_t success = TRUE;
- int target_index;
- haddr_t target_addr;
+ const char * fcn_name = "serve_read_request()";
+ hbool_t report_mssg = FALSE;
+ hbool_t success = TRUE;
+ int target_index;
+ haddr_t target_addr;
struct mssg_t reply;
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_ptr->req != READ_REQ_CODE ) ||
- ( mssg_ptr->magic != MSSG_MAGIC ) ) {
+ if ((mssg_ptr == NULL) || (mssg_ptr->req != READ_REQ_CODE) || (mssg_ptr->magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
- target_addr = mssg_ptr->base_addr;
+ target_addr = mssg_ptr->base_addr;
target_index = addr_to_datum_index(target_addr);
- if ( target_index < 0 ) {
+ if (target_index < 0) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n",
- world_mpi_rank, fcn_name, target_addr);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n", world_mpi_rank, fcn_name,
+ target_addr);
}
- } else if ( data[target_index].len != mssg_ptr->len ) {
+ }
+ else if (data[target_index].len != mssg_ptr->len) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: data[i].len = %Zu != mssg->len = %d.\n",
- world_mpi_rank, fcn_name,
- data[target_index].len, mssg_ptr->len);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: data[i].len = %Zu != mssg->len = %d.\n", world_mpi_rank, fcn_name,
+ data[target_index].len, mssg_ptr->len);
}
- } else if ( ! (data[target_index].valid) ) {
+ }
+ else if (!(data[target_index].valid)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: proc %d read invalid entry. idx/base_addr = %d/0x%llx.\n",
- world_mpi_rank, fcn_name,
- mssg_ptr->src,
- target_index,
- (long long)(data[target_index].base_addr));
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: proc %d read invalid entry. idx/base_addr = %d/0x%llx.\n",
+ world_mpi_rank, fcn_name, mssg_ptr->src, target_index,
+ (long long)(data[target_index].base_addr));
}
- } else {
+ }
+ else {
/* compose the reply message */
reply.req = READ_REQ_REPLY_CODE;
@@ -1606,93 +1463,79 @@ serve_read_request(struct mssg_t * mssg_ptr)
reply.base_addr = data[target_index].base_addr;
reply.len = data[target_index].len;
reply.ver = data[target_index].ver;
- reply.count = 0;
+ reply.count = 0;
reply.magic = MSSG_MAGIC;
- /* and update the counters */
- total_reads++;
+ /* and update the counters */
+ total_reads++;
(data[target_index].reads)++;
}
}
- if ( success ) {
+ if (success) {
success = send_mssg(&reply, TRUE);
}
- if ( report_mssg ) {
+ if (report_mssg) {
- if ( success ) {
+ if (success) {
- HDfprintf(stdout, "%d read 0x%llx. len = %d. ver = %d.\n",
- (int)(mssg_ptr->src),
- (long long)(data[target_index].base_addr),
- (int)(data[target_index].len),
+ HDfprintf(stdout, "%d read 0x%llx. len = %d. ver = %d.\n", (int)(mssg_ptr->src),
+ (long long)(data[target_index].base_addr), (int)(data[target_index].len),
(int)(data[target_index].ver));
+ }
+ else {
- } else {
-
- HDfprintf(stdout, "%d read 0x%llx FAILED. len = %d. ver = %d.\n",
- (int)(mssg_ptr->src),
- (long long)(data[target_index].base_addr),
- (int)(data[target_index].len),
+ HDfprintf(stdout, "%d read 0x%llx FAILED. len = %d. ver = %d.\n", (int)(mssg_ptr->src),
+ (long long)(data[target_index].base_addr), (int)(data[target_index].len),
(int)(data[target_index].ver));
-
}
- }
+ }
- return(success);
+ return (success);
} /* serve_read_request() */
-
/*****************************************************************************
*
- * Function: serve_sync_request()
- *
- * Purpose: Serve a sync request.
+ * Function: serve_sync_request()
*
- * The function accepts a pointer to an instance of struct
- * mssg_t as input. If all sanity checks pass, it sends a
- * sync ack to the requesting process.
+ * Purpose: Serve a sync request.
*
- * This service exist to allow the sending process to ensure
- * that all previous messages have been processed before
- * proceeding.
+ * The function accepts a pointer to an instance of struct
+ * mssg_t as input. If all sanity checks pass, it sends a
+ * sync ack to the requesting process.
*
- * Return: Success: TRUE
+ * This service exist to allow the sending process to ensure
+ * that all previous messages have been processed before
+ * proceeding.
*
- * Failure: FALSE
+ * Return: Success: TRUE
*
- * Programmer: JRM -- 5/10/06
- *
- * Modifications:
+ * Failure: FALSE
*
- * None.
+ * Programmer: JRM -- 5/10/06
*
*****************************************************************************/
-
static hbool_t
-serve_sync_request(struct mssg_t * mssg_ptr)
+serve_sync_request(struct mssg_t *mssg_ptr)
{
- const char * fcn_name = "serve_sync_request()";
- hbool_t report_mssg = FALSE;
- hbool_t success = TRUE;
+ const char * fcn_name = "serve_sync_request()";
+ hbool_t report_mssg = FALSE;
+ hbool_t success = TRUE;
struct mssg_t reply;
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_ptr->req != SYNC_REQ_CODE ) ||
- ( mssg_ptr->magic != MSSG_MAGIC ) ) {
+ if ((mssg_ptr == NULL) || (mssg_ptr->req != SYNC_REQ_CODE) || (mssg_ptr->magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
/* compose the reply message */
reply.req = SYNC_ACK_CODE;
@@ -1702,127 +1545,120 @@ serve_sync_request(struct mssg_t * mssg_ptr)
reply.base_addr = 0;
reply.len = 0;
reply.ver = 0;
- reply.count = 0;
+ reply.count = 0;
reply.magic = MSSG_MAGIC;
}
- if ( success ) {
+ if (success) {
success = send_mssg(&reply, TRUE);
}
- if ( report_mssg ) {
+ if (report_mssg) {
- if ( success ) {
+ if (success) {
HDfprintf(stdout, "%d sync.\n", (int)(mssg_ptr->src));
-
- } else {
+ }
+ else {
HDfprintf(stdout, "%d sync FAILED.\n", (int)(mssg_ptr->src));
-
}
- }
+ }
- return(success);
+ return (success);
} /* serve_sync_request() */
-
/*****************************************************************************
*
- * Function: serve_write_request()
+ * Function: serve_write_request()
*
- * Purpose: Serve a write request.
+ * Purpose: Serve a write request.
*
- * The function accepts a pointer to an instance of struct
- * mssg_t as input. If all sanity checks pass, it updates
- * the version number of the target data array entry as
- * specified in the message.
+ * The function accepts a pointer to an instance of struct
+ * mssg_t as input. If all sanity checks pass, it updates
+ * the version number of the target data array entry as
+ * specified in the message.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 12/21/05
+ * Programmer: JRM -- 12/21/05
*
*****************************************************************************/
static hbool_t
-serve_write_request(struct mssg_t * mssg_ptr)
+serve_write_request(struct mssg_t *mssg_ptr)
{
- const char * fcn_name = "serve_write_request()";
- hbool_t report_mssg = FALSE;
- hbool_t success = TRUE;
- int target_index;
- int new_ver_num;
- haddr_t target_addr;
+ const char *fcn_name = "serve_write_request()";
+ hbool_t report_mssg = FALSE;
+ hbool_t success = TRUE;
+ int target_index;
+ int new_ver_num;
+ haddr_t target_addr;
#if DO_WRITE_REQ_ACK
struct mssg_t reply;
#endif /* DO_WRITE_REQ_ACK */
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_ptr->req != WRITE_REQ_CODE ) ||
- ( mssg_ptr->magic != MSSG_MAGIC ) ) {
+ if ((mssg_ptr == NULL) || (mssg_ptr->req != WRITE_REQ_CODE) || (mssg_ptr->magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
- target_addr = mssg_ptr->base_addr;
+ target_addr = mssg_ptr->base_addr;
target_index = addr_to_datum_index(target_addr);
- if ( target_index < 0 ) {
+ if (target_index < 0) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n",
- world_mpi_rank, fcn_name, target_addr);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n", world_mpi_rank, fcn_name,
+ target_addr);
}
- } else if ( data[target_index].len != mssg_ptr->len ) {
+ }
+ else if (data[target_index].len != mssg_ptr->len) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: data[i].len = %Zu != mssg->len = %d.\n",
- world_mpi_rank, fcn_name,
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: data[i].len = %Zu != mssg->len = %d.\n", world_mpi_rank, fcn_name,
data[target_index].len, mssg_ptr->len);
}
}
}
- if ( success ) {
+ if (success) {
new_ver_num = mssg_ptr->ver;
/* this check should catch duplicate writes */
- if ( new_ver_num <= data[target_index].ver ) {
+ if (new_ver_num <= data[target_index].ver) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: new ver = %d <= old ver = %d.\n",
- world_mpi_rank, fcn_name,
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: new ver = %d <= old ver = %d.\n", world_mpi_rank, fcn_name,
new_ver_num, data[target_index].ver);
}
}
}
- if ( success ) {
+ if (success) {
- /* process the write */
- data[target_index].ver = new_ver_num;
+ /* process the write */
+ data[target_index].ver = new_ver_num;
data[target_index].valid = TRUE;
/* and update the counters */
- total_writes++;
+ total_writes++;
(data[target_index].writes)++;
#if DO_WRITE_REQ_ACK
@@ -1838,79 +1674,69 @@ serve_write_request(struct mssg_t * mssg_ptr)
reply.count = 0;
reply.magic = MSSG_MAGIC;
- /* and send it */
+ /* and send it */
success = send_mssg(&reply, TRUE);
#endif /* DO_WRITE_REQ_ACK */
-
}
- if ( report_mssg ) {
+ if (report_mssg) {
- if ( success ) {
+ if (success) {
- HDfprintf(stdout, "%d write 0x%llx. len = %d. ver = %d.\n",
- (int)(mssg_ptr->src),
- (long long)(data[target_index].base_addr),
- (int)(data[target_index].len),
+ HDfprintf(stdout, "%d write 0x%llx. len = %d. ver = %d.\n", (int)(mssg_ptr->src),
+ (long long)(data[target_index].base_addr), (int)(data[target_index].len),
(int)(data[target_index].ver));
+ }
+ else {
- } else {
-
- HDfprintf(stdout, "%d write 0x%llx FAILED. len = %d. ver = %d.\n",
- (int)(mssg_ptr->src),
- (long long)(data[target_index].base_addr),
- (int)(data[target_index].len),
+ HDfprintf(stdout, "%d write 0x%llx FAILED. len = %d. ver = %d.\n", (int)(mssg_ptr->src),
+ (long long)(data[target_index].base_addr), (int)(data[target_index].len),
(int)(data[target_index].ver));
-
}
- }
+ }
- return(success);
+ return (success);
} /* serve_write_request() */
-
/*****************************************************************************
*
- * Function: serve_total_writes_request()
+ * Function: serve_total_writes_request()
*
- * Purpose: Serve a request for the total number of writes recorded since
- * the last reset.
+ * Purpose: Serve a request for the total number of writes recorded since
+ * the last reset.
*
- * The function accepts a pointer to an instance of struct
- * mssg_t as input. If all sanity checks pass, it sends
- * the current value of the total_writes global variable to
- * the requesting process.
+ * The function accepts a pointer to an instance of struct
+ * mssg_t as input. If all sanity checks pass, it sends
+ * the current value of the total_writes global variable to
+ * the requesting process.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/5/10
+ * Programmer: JRM -- 5/5/10
*
*****************************************************************************/
static hbool_t
-serve_total_writes_request(struct mssg_t * mssg_ptr)
+serve_total_writes_request(struct mssg_t *mssg_ptr)
{
- const char * fcn_name = "serve_total_writes_request()";
- hbool_t report_mssg = FALSE;
- hbool_t success = TRUE;
+ const char * fcn_name = "serve_total_writes_request()";
+ hbool_t report_mssg = FALSE;
+ hbool_t success = TRUE;
struct mssg_t reply;
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_ptr->req != REQ_TTL_WRITES_CODE ) ||
- ( mssg_ptr->magic != MSSG_MAGIC ) ) {
+ if ((mssg_ptr == NULL) || (mssg_ptr->req != REQ_TTL_WRITES_CODE) || (mssg_ptr->magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
/* compose the reply message */
reply.req = REQ_TTL_WRITES_RPLY_CODE;
@@ -1924,73 +1750,64 @@ serve_total_writes_request(struct mssg_t * mssg_ptr)
reply.magic = MSSG_MAGIC;
}
- if ( success ) {
+ if (success) {
success = send_mssg(&reply, TRUE);
}
- if ( report_mssg ) {
-
- if ( success ) {
-
- HDfprintf(stdout, "%d request total writes %ld.\n",
- (int)(mssg_ptr->src),
- total_writes);
+ if (report_mssg) {
- } else {
+ if (success) {
- HDfprintf(stdout, "%d request total writes %ld -- FAILED.\n",
- (int)(mssg_ptr->src),
- total_writes);
+ HDfprintf(stdout, "%d request total writes %ld.\n", (int)(mssg_ptr->src), total_writes);
+ }
+ else {
+ HDfprintf(stdout, "%d request total writes %ld -- FAILED.\n", (int)(mssg_ptr->src), total_writes);
}
- }
+ }
- return(success);
+ return (success);
} /* serve_total_writes_request() */
-
/*****************************************************************************
*
- * Function: serve_total_reads_request()
+ * Function: serve_total_reads_request()
*
- * Purpose: Serve a request for the total number of reads recorded since
- * the last reset.
+ * Purpose: Serve a request for the total number of reads recorded since
+ * the last reset.
*
- * The function accepts a pointer to an instance of struct
- * mssg_t as input. If all sanity checks pass, it sends
- * the current value of the total_reads global variable to
- * the requesting process.
+ * The function accepts a pointer to an instance of struct
+ * mssg_t as input. If all sanity checks pass, it sends
+ * the current value of the total_reads global variable to
+ * the requesting process.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/5/10
+ * Programmer: JRM -- 5/5/10
*
*****************************************************************************/
static hbool_t
-serve_total_reads_request(struct mssg_t * mssg_ptr)
+serve_total_reads_request(struct mssg_t *mssg_ptr)
{
- const char * fcn_name = "serve_total_reads_request()";
- hbool_t report_mssg = FALSE;
- hbool_t success = TRUE;
+ const char * fcn_name = "serve_total_reads_request()";
+ hbool_t report_mssg = FALSE;
+ hbool_t success = TRUE;
struct mssg_t reply;
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_ptr->req != REQ_TTL_READS_CODE ) ||
- ( mssg_ptr->magic != MSSG_MAGIC ) ) {
+ if ((mssg_ptr == NULL) || (mssg_ptr->req != REQ_TTL_READS_CODE) || (mssg_ptr->magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
/* compose the reply message */
reply.req = REQ_TTL_READS_RPLY_CODE;
@@ -2004,88 +1821,80 @@ serve_total_reads_request(struct mssg_t * mssg_ptr)
reply.magic = MSSG_MAGIC;
}
- if ( success ) {
+ if (success) {
success = send_mssg(&reply, TRUE);
}
- if ( report_mssg ) {
-
- if ( success ) {
+ if (report_mssg) {
- HDfprintf(stdout, "%d request total reads %ld.\n",
- (int)(mssg_ptr->src),
- total_reads);
+ if (success) {
- } else {
-
- HDfprintf(stdout, "%d request total reads %ld -- FAILED.\n",
- (int)(mssg_ptr->src),
- total_reads);
+ HDfprintf(stdout, "%d request total reads %ld.\n", (int)(mssg_ptr->src), total_reads);
+ }
+ else {
+ HDfprintf(stdout, "%d request total reads %ld -- FAILED.\n", (int)(mssg_ptr->src), total_reads);
}
- }
+ }
- return(success);
+ return (success);
} /* serve_total_reads_request() */
-
/*****************************************************************************
*
- * Function: serve_entry_writes_request()
+ * Function: serve_entry_writes_request()
*
- * Purpose: Serve an entry writes request.
+ * Purpose: Serve an entry writes request.
*
- * The function accepts a pointer to an instance of struct
- * mssg_t as input. If all sanity checks pass, it sends
- * the number of times that the indicated datum has been
- * written since the last counter reset to the requesting
- * process.
+ * The function accepts a pointer to an instance of struct
+ * mssg_t as input. If all sanity checks pass, it sends
+ * the number of times that the indicated datum has been
+ * written since the last counter reset to the requesting
+ * process.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/5/10
+ * Programmer: JRM -- 5/5/10
*
*****************************************************************************/
static hbool_t
-serve_entry_writes_request(struct mssg_t * mssg_ptr)
+serve_entry_writes_request(struct mssg_t *mssg_ptr)
{
- const char * fcn_name = "serve_entry_writes_request()";
- hbool_t report_mssg = FALSE;
- hbool_t success = TRUE;
- int target_index;
- haddr_t target_addr;
+ const char * fcn_name = "serve_entry_writes_request()";
+ hbool_t report_mssg = FALSE;
+ hbool_t success = TRUE;
+ int target_index;
+ haddr_t target_addr;
struct mssg_t reply;
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_ptr->req != REQ_ENTRY_WRITES_CODE ) ||
- ( mssg_ptr->magic != MSSG_MAGIC ) ) {
+ if ((mssg_ptr == NULL) || (mssg_ptr->req != REQ_ENTRY_WRITES_CODE) || (mssg_ptr->magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
- target_addr = mssg_ptr->base_addr;
+ target_addr = mssg_ptr->base_addr;
target_index = addr_to_datum_index(target_addr);
- if ( target_index < 0 ) {
+ if (target_index < 0) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n",
- world_mpi_rank, fcn_name, target_addr);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n", world_mpi_rank, fcn_name,
+ target_addr);
}
- } else {
+ }
+ else {
/* compose the reply message */
reply.req = REQ_ENTRY_WRITES_RPLY_CODE;
@@ -2095,95 +1904,87 @@ serve_entry_writes_request(struct mssg_t * mssg_ptr)
reply.base_addr = target_addr;
reply.len = 0;
reply.ver = 0;
- reply.count = data[target_index].writes;
+ reply.count = data[target_index].writes;
reply.magic = MSSG_MAGIC;
}
}
- if ( success ) {
+ if (success) {
success = send_mssg(&reply, TRUE);
}
- if ( report_mssg ) {
-
- if ( success ) {
-
- HDfprintf(stdout, "%d request entry 0x%llx writes = %ld.\n",
- (int)(mssg_ptr->src),
- (long long)(data[target_index].base_addr),
- (long)(data[target_index].writes));
+ if (report_mssg) {
- } else {
+ if (success) {
- HDfprintf(stdout, "%d request entry 0x%llx writes = %ld FAILED.\n",
- (int)(mssg_ptr->src),
- (long long)(data[target_index].base_addr),
- (long)(data[target_index].writes));
+ HDfprintf(stdout, "%d request entry 0x%llx writes = %ld.\n", (int)(mssg_ptr->src),
+ (long long)(data[target_index].base_addr), (long)(data[target_index].writes));
+ }
+ else {
+ HDfprintf(stdout, "%d request entry 0x%llx writes = %ld FAILED.\n", (int)(mssg_ptr->src),
+ (long long)(data[target_index].base_addr), (long)(data[target_index].writes));
}
- }
+ }
- return(success);
+ return (success);
} /* serve_entry_writes_request() */
-
/*****************************************************************************
*
- * Function: serve_entry_reads_request()
+ * Function: serve_entry_reads_request()
*
- * Purpose: Serve an entry reads request.
+ * Purpose: Serve an entry reads request.
*
- * The function accepts a pointer to an instance of struct
- * mssg_t as input. If all sanity checks pass, it sends
- * the number of times that the indicated datum has been
- * read since the last counter reset to the requesting
- * process.
+ * The function accepts a pointer to an instance of struct
+ * mssg_t as input. If all sanity checks pass, it sends
+ * the number of times that the indicated datum has been
+ * read since the last counter reset to the requesting
+ * process.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/5/10
+ * Programmer: JRM -- 5/5/10
*
*****************************************************************************/
static hbool_t
-serve_entry_reads_request(struct mssg_t * mssg_ptr)
+serve_entry_reads_request(struct mssg_t *mssg_ptr)
{
- const char * fcn_name = "serve_entry_reads_request()";
- hbool_t report_mssg = FALSE;
- hbool_t success = TRUE;
- int target_index;
- haddr_t target_addr;
+ const char * fcn_name = "serve_entry_reads_request()";
+ hbool_t report_mssg = FALSE;
+ hbool_t success = TRUE;
+ int target_index;
+ haddr_t target_addr;
struct mssg_t reply;
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_ptr->req != REQ_ENTRY_READS_CODE ) ||
- ( mssg_ptr->magic != MSSG_MAGIC ) ) {
+ if ((mssg_ptr == NULL) || (mssg_ptr->req != REQ_ENTRY_READS_CODE) || (mssg_ptr->magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
- target_addr = mssg_ptr->base_addr;
+ target_addr = mssg_ptr->base_addr;
target_index = addr_to_datum_index(target_addr);
- if ( target_index < 0 ) {
+ if (target_index < 0) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n",
- world_mpi_rank, fcn_name, target_addr);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n", world_mpi_rank, fcn_name,
+ target_addr);
}
- } else {
+ }
+ else {
/* compose the reply message */
reply.req = REQ_ENTRY_READS_RPLY_CODE;
@@ -2193,84 +1994,75 @@ serve_entry_reads_request(struct mssg_t * mssg_ptr)
reply.base_addr = target_addr;
reply.len = 0;
reply.ver = 0;
- reply.count = (long)(data[target_index].reads);
+ reply.count = (long)(data[target_index].reads);
reply.magic = MSSG_MAGIC;
}
}
- if ( success ) {
+ if (success) {
success = send_mssg(&reply, TRUE);
}
- if ( report_mssg ) {
+ if (report_mssg) {
- if ( success ) {
+ if (success) {
- HDfprintf(stdout, "%d request entry 0x%llx reads = %ld.\n",
- (int)(mssg_ptr->src),
- (long long)(data[target_index].base_addr),
- (long)(data[target_index].reads));
-
- } else {
-
- HDfprintf(stdout, "%d request entry 0x%llx reads = %ld FAILED.\n",
- (int)(mssg_ptr->src),
- (long long)(data[target_index].base_addr),
- (long)(data[target_index].reads));
+ HDfprintf(stdout, "%d request entry 0x%llx reads = %ld.\n", (int)(mssg_ptr->src),
+ (long long)(data[target_index].base_addr), (long)(data[target_index].reads));
+ }
+ else {
+ HDfprintf(stdout, "%d request entry 0x%llx reads = %ld FAILED.\n", (int)(mssg_ptr->src),
+ (long long)(data[target_index].base_addr), (long)(data[target_index].reads));
}
- }
+ }
- return(success);
+ return (success);
} /* serve_entry_reads_request() */
-
/*****************************************************************************
*
- * Function: serve_rw_count_reset_request()
+ * Function: serve_rw_count_reset_request()
*
- * Purpose: Serve read/write count reset request.
+ * Purpose: Serve read/write count reset request.
*
- * The function accepts a pointer to an instance of struct
- * mssg_t as input. If all sanity checks pass, it resets the
- * read/write counters, and sends a confirmation message to
- * the calling process.
+ * The function accepts a pointer to an instance of struct
+ * mssg_t as input. If all sanity checks pass, it resets the
+ * read/write counters, and sends a confirmation message to
+ * the calling process.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/5/10
+ * Programmer: JRM -- 5/5/10
*
*****************************************************************************/
static hbool_t
-serve_rw_count_reset_request(struct mssg_t * mssg_ptr)
+serve_rw_count_reset_request(struct mssg_t *mssg_ptr)
{
- const char * fcn_name = "serve_rw_count_reset_request()";
- hbool_t report_mssg = FALSE;
- hbool_t success = TRUE;
+ const char * fcn_name = "serve_rw_count_reset_request()";
+ hbool_t report_mssg = FALSE;
+ hbool_t success = TRUE;
struct mssg_t reply;
- if ( ( mssg_ptr == NULL ) ||
- ( mssg_ptr->req != REQ_RW_COUNT_RESET_CODE ) ||
- ( mssg_ptr->magic != MSSG_MAGIC ) ) {
+ if ((mssg_ptr == NULL) || (mssg_ptr->req != REQ_RW_COUNT_RESET_CODE) || (mssg_ptr->magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad mssg on entry.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
success = reset_server_counters();
- }
+ }
- if ( success ) {
+ if (success) {
/* compose the reply message */
reply.req = REQ_RW_COUNT_RESET_RPLY_CODE;
@@ -2284,41 +2076,36 @@ serve_rw_count_reset_request(struct mssg_t * mssg_ptr)
reply.magic = MSSG_MAGIC;
}
- if ( success ) {
+ if (success) {
success = send_mssg(&reply, TRUE);
}
- if ( report_mssg ) {
-
- if ( success ) {
+ if (report_mssg) {
- HDfprintf(stdout, "%d request R/W counter reset.\n",
- (int)(mssg_ptr->src));
+ if (success) {
- } else {
-
- HDfprintf(stdout, "%d request R/w counter reset FAILED.\n",
- (int)(mssg_ptr->src));
+ HDfprintf(stdout, "%d request R/W counter reset.\n", (int)(mssg_ptr->src));
+ }
+ else {
+ HDfprintf(stdout, "%d request R/w counter reset FAILED.\n", (int)(mssg_ptr->src));
}
- }
+ }
- return(success);
+ return (success);
} /* serve_rw_count_reset_request() */
-
/*****************************************************************************/
/**************************** Call back functions ****************************/
/*****************************************************************************/
-
/*-------------------------------------------------------------------------
* Function: clear_datum
*
* Purpose: Mark the datum as clean and destroy it if requested.
- * Do not write it to the server, or increment the version.
+ * Do not write it to the server, or increment the version.
*
* Return: SUCCEED
*
@@ -2328,63 +2115,58 @@ serve_rw_count_reset_request(struct mssg_t * mssg_ptr)
*-------------------------------------------------------------------------
*/
static herr_t
-clear_datum(H5F_t * f,
- void * thing,
- hbool_t dest)
+clear_datum(H5F_t *f, void *thing, hbool_t dest)
{
- int idx;
- struct datum * entry_ptr;
+ int idx;
+ struct datum *entry_ptr;
- HDassert( thing );
+ HDassert(thing);
entry_ptr = (struct datum *)thing;
idx = addr_to_datum_index(entry_ptr->base_addr);
- HDassert( idx >= 0 );
- HDassert( idx < NUM_DATA_ENTRIES );
- HDassert( idx < virt_num_data_entries );
- HDassert( &(data[idx]) == entry_ptr );
+ HDassert(idx >= 0);
+ HDassert(idx < NUM_DATA_ENTRIES);
+ HDassert(idx < virt_num_data_entries);
+ HDassert(&(data[idx]) == entry_ptr);
- HDassert( entry_ptr->header.addr == entry_ptr->base_addr );
- HDassert( ( entry_ptr->header.size == entry_ptr->len ) ||
- ( entry_ptr->header.size == entry_ptr->local_len ) );
+ HDassert(entry_ptr->header.addr == entry_ptr->base_addr);
+ HDassert((entry_ptr->header.size == entry_ptr->len) || (entry_ptr->header.size == entry_ptr->local_len));
- HDassert( entry_ptr->header.is_dirty == entry_ptr->dirty );
+ HDassert(entry_ptr->header.is_dirty == entry_ptr->dirty);
- if ( entry_ptr->header.is_dirty ) {
+ if (entry_ptr->header.is_dirty) {
entry_ptr->cleared = TRUE;
}
entry_ptr->header.is_dirty = FALSE;
- entry_ptr->dirty = FALSE;
+ entry_ptr->dirty = FALSE;
- if ( dest ) {
+ if (dest) {
destroy_datum(f, thing);
-
}
datum_clears++;
- if ( entry_ptr->header.is_pinned ) {
+ if (entry_ptr->header.is_pinned) {
datum_pinned_clears++;
- HDassert( entry_ptr->global_pinned || entry_ptr->local_pinned );
+ HDassert(entry_ptr->global_pinned || entry_ptr->local_pinned);
}
- return(SUCCEED);
+ return (SUCCEED);
} /* clear_datum() */
-
/*-------------------------------------------------------------------------
* Function: destroy_datum()
*
* Purpose: Destroy the entry. At present, this means do nothing other
- * than verify that the entry is clean. In particular, do not
- * write it to the server process.
+ * than verify that the entry is clean. In particular, do not
+ * write it to the server process.
*
* Return: SUCCEED
*
@@ -2394,45 +2176,42 @@ clear_datum(H5F_t * f,
*-------------------------------------------------------------------------
*/
static herr_t
-destroy_datum(H5F_t H5_ATTR_UNUSED * f,
- void * thing)
+destroy_datum(H5F_t H5_ATTR_UNUSED *f, void *thing)
{
- int idx;
- struct datum * entry_ptr;
+ int idx;
+ struct datum *entry_ptr;
- HDassert( thing );
+ HDassert(thing);
entry_ptr = (struct datum *)thing;
idx = addr_to_datum_index(entry_ptr->base_addr);
- HDassert( idx >= 0 );
- HDassert( idx < NUM_DATA_ENTRIES );
- HDassert( idx < virt_num_data_entries );
- HDassert( &(data[idx]) == entry_ptr );
+ HDassert(idx >= 0);
+ HDassert(idx < NUM_DATA_ENTRIES);
+ HDassert(idx < virt_num_data_entries);
+ HDassert(&(data[idx]) == entry_ptr);
- HDassert( entry_ptr->header.addr == entry_ptr->base_addr );
- HDassert( ( entry_ptr->header.size == entry_ptr->len ) ||
- ( entry_ptr->header.size == entry_ptr->local_len ) );
+ HDassert(entry_ptr->header.addr == entry_ptr->base_addr);
+ HDassert((entry_ptr->header.size == entry_ptr->len) || (entry_ptr->header.size == entry_ptr->local_len));
- HDassert( !(entry_ptr->dirty) );
- HDassert( !(entry_ptr->header.is_dirty) );
- HDassert( !(entry_ptr->global_pinned) );
- HDassert( !(entry_ptr->local_pinned) );
- HDassert( !(entry_ptr->header.is_pinned) );
+ HDassert(!(entry_ptr->dirty));
+ HDassert(!(entry_ptr->header.is_dirty));
+ HDassert(!(entry_ptr->global_pinned));
+ HDassert(!(entry_ptr->local_pinned));
+ HDassert(!(entry_ptr->header.is_pinned));
datum_destroys++;
- return(SUCCEED);
+ return (SUCCEED);
} /* destroy_datum() */
-
/*-------------------------------------------------------------------------
* Function: flush_datum
*
* Purpose: Flush the entry to the server process and mark it as clean.
- * Then destroy the entry if requested.
+ * Then destroy the entry if requested.
*
* Return: SUCCEED if successful, and FAIL otherwise.
*
@@ -2442,67 +2221,58 @@ destroy_datum(H5F_t H5_ATTR_UNUSED * f,
*-------------------------------------------------------------------------
*/
static herr_t
-flush_datum(H5F_t *f,
- hid_t H5_ATTR_UNUSED dxpl_id,
- hbool_t dest,
- haddr_t H5_ATTR_UNUSED addr,
- void *thing)
+flush_datum(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t dest, haddr_t H5_ATTR_UNUSED addr, void *thing)
{
- const char * fcn_name = "flush_datum()";
- hbool_t was_dirty = FALSE;
- herr_t ret_value = SUCCEED;
- int idx;
- struct datum * entry_ptr;
- struct mssg_t mssg;
- H5C_t * cache_ptr;
- struct H5AC_aux_t * aux_ptr;
+ const char * fcn_name = "flush_datum()";
+ hbool_t was_dirty = FALSE;
+ herr_t ret_value = SUCCEED;
+ int idx;
+ struct datum * entry_ptr;
+ struct mssg_t mssg;
+ H5C_t * cache_ptr;
+ struct H5AC_aux_t *aux_ptr;
- HDassert( thing );
+ HDassert(thing);
entry_ptr = (struct datum *)thing;
- HDassert( f );
- HDassert( f->shared );
- HDassert( f->shared->cache );
-
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->cache);
+
cache_ptr = f->shared->cache;
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->aux_ptr );
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->aux_ptr);
aux_ptr = (H5AC_aux_t *)(f->shared->cache->aux_ptr);
- HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC );
+ HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
idx = addr_to_datum_index(entry_ptr->base_addr);
- HDassert( idx >= 0 );
- HDassert( idx < NUM_DATA_ENTRIES );
- HDassert( idx < virt_num_data_entries );
- HDassert( &(data[idx]) == entry_ptr );
+ HDassert(idx >= 0);
+ HDassert(idx < NUM_DATA_ENTRIES);
+ HDassert(idx < virt_num_data_entries);
+ HDassert(&(data[idx]) == entry_ptr);
- HDassert( entry_ptr->header.addr == entry_ptr->base_addr );
- HDassert( ( entry_ptr->header.size == entry_ptr->len ) ||
- ( entry_ptr->header.size == entry_ptr->local_len ) );
+ HDassert(entry_ptr->header.addr == entry_ptr->base_addr);
+ HDassert((entry_ptr->header.size == entry_ptr->len) || (entry_ptr->header.size == entry_ptr->local_len));
- HDassert( entry_ptr->header.is_dirty == entry_ptr->dirty );
+ HDassert(entry_ptr->header.is_dirty == entry_ptr->dirty);
- if ( ( file_mpi_rank != 0 ) &&
- ( entry_ptr->dirty ) &&
- ( aux_ptr->metadata_write_strategy ==
- H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY ) ) {
+ if ((file_mpi_rank != 0) && (entry_ptr->dirty) &&
+ (aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY)) {
ret_value = FAIL;
- HDfprintf(stdout,
- "%d:%s: Flushed dirty entry from non-zero file process.",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: Flushed dirty entry from non-zero file process.", world_mpi_rank, fcn_name);
}
- if ( ret_value == SUCCEED ) {
+ if (ret_value == SUCCEED) {
- if ( entry_ptr->header.is_dirty ) {
+ if (entry_ptr->header.is_dirty) {
- was_dirty = TRUE; /* so we will receive the ack if requested */
+ was_dirty = TRUE; /* so we will receive the ack if requested */
/* compose the message */
mssg.req = WRITE_REQ_CODE;
@@ -2515,58 +2285,51 @@ flush_datum(H5F_t *f,
mssg.count = 0;
mssg.magic = MSSG_MAGIC;
- if ( ! send_mssg(&mssg, FALSE) ) {
+ if (!send_mssg(&mssg, FALSE)) {
nerrors++;
ret_value = FAIL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
- else
- {
+ else {
entry_ptr->header.is_dirty = FALSE;
- entry_ptr->dirty = FALSE;
- entry_ptr->flushed = TRUE;
+ entry_ptr->dirty = FALSE;
+ entry_ptr->flushed = TRUE;
}
}
}
#if DO_WRITE_REQ_ACK
- if ( ( ret_value == SUCCEED ) && ( was_dirty ) ) {
+ if ((ret_value == SUCCEED) && (was_dirty)) {
- if ( ! recv_mssg(&mssg, WRITE_REQ_ACK_CODE) ) {
+ if (!recv_mssg(&mssg, WRITE_REQ_ACK_CODE)) {
nerrors++;
ret_value = FAIL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
- } else if ( ( mssg.req != WRITE_REQ_ACK_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.base_addr != entry_ptr->base_addr ) ||
- ( mssg.len != entry_ptr->len ) ||
- ( mssg.ver != entry_ptr->ver ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ }
+ else if ((mssg.req != WRITE_REQ_ACK_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.base_addr != entry_ptr->base_addr) ||
+ (mssg.len != entry_ptr->len) || (mssg.ver != entry_ptr->ver) || (mssg.magic != MSSG_MAGIC)) {
nerrors++;
ret_value = FAIL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", world_mpi_rank, fcn_name);
}
}
}
#endif /* DO_WRITE_REQ_ACK */
- if ( ret_value == SUCCEED ) {
+ if (ret_value == SUCCEED) {
- if ( dest ) {
+ if (dest) {
ret_value = destroy_datum(f, thing);
}
@@ -2574,13 +2337,13 @@ flush_datum(H5F_t *f,
datum_flushes++;
- if ( entry_ptr->header.is_pinned ) {
+ if (entry_ptr->header.is_pinned) {
datum_pinned_flushes++;
- HDassert( entry_ptr->global_pinned || entry_ptr->local_pinned );
+ HDassert(entry_ptr->global_pinned || entry_ptr->local_pinned);
}
- return(ret_value);
+ return (ret_value);
} /* flush_datum() */
@@ -2601,28 +2364,25 @@ flush_datum(H5F_t *f,
*/
static void *
-load_datum(H5F_t H5_ATTR_UNUSED *f,
- hid_t H5_ATTR_UNUSED dxpl_id,
- haddr_t addr,
- void H5_ATTR_UNUSED *udata)
+load_datum(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, void H5_ATTR_UNUSED *udata)
{
- const char * fcn_name = "load_datum()";
- hbool_t success = TRUE;
- int idx;
- struct datum * entry_ptr = NULL;
+ const char * fcn_name = "load_datum()";
+ hbool_t success = TRUE;
+ int idx;
+ struct datum *entry_ptr = NULL;
struct mssg_t mssg;
idx = addr_to_datum_index(addr);
- HDassert( idx >= 0 );
- HDassert( idx < NUM_DATA_ENTRIES );
- HDassert( idx < virt_num_data_entries );
+ HDassert(idx >= 0);
+ HDassert(idx < NUM_DATA_ENTRIES);
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert( addr == entry_ptr->base_addr );
- HDassert( ! entry_ptr->global_pinned );
- HDassert( ! entry_ptr->local_pinned );
+ HDassert(addr == entry_ptr->base_addr);
+ HDassert(!entry_ptr->global_pinned);
+ HDassert(!entry_ptr->local_pinned);
/* compose the read message */
mssg.req = READ_REQ_CODE;
@@ -2635,114 +2395,107 @@ load_datum(H5F_t H5_ATTR_UNUSED *f,
mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( ! send_mssg(&mssg, FALSE) ) {
+ if (!send_mssg(&mssg, FALSE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
- if ( success ) {
+ if (success) {
- if ( ! recv_mssg(&mssg, READ_REQ_REPLY_CODE) ) {
+ if (!recv_mssg(&mssg, READ_REQ_REPLY_CODE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( success ) {
+ if (success) {
- if ( ( mssg.req != READ_REQ_REPLY_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.base_addr != entry_ptr->base_addr ) ||
- ( mssg.len != entry_ptr->len ) ||
- ( mssg.ver < entry_ptr->ver ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ if ((mssg.req != READ_REQ_REPLY_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.base_addr != entry_ptr->base_addr) ||
+ (mssg.len != entry_ptr->len) || (mssg.ver < entry_ptr->ver) || (mssg.magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad data in read req reply.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in read req reply.\n", world_mpi_rank, fcn_name);
}
-#if 0 /* This has been useful debugging code -- keep it for now. */
- if ( mssg.req != READ_REQ_REPLY_CODE ) {
+#if 0 /* This has been useful debugging code -- keep it for now. */
+ if ( mssg.req != READ_REQ_REPLY_CODE ) {
- HDfprintf(stdout, "%d:%s: mssg.req != READ_REQ_REPLY_CODE.\n",
- world_mpi_rank, fcn_name);
- HDfprintf(stdout, "%d:%s: mssg.req = %d.\n",
- world_mpi_rank, fcn_name, (int)(mssg.req));
- }
+ HDfprintf(stdout, "%d:%s: mssg.req != READ_REQ_REPLY_CODE.\n",
+ world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: mssg.req = %d.\n",
+ world_mpi_rank, fcn_name, (int)(mssg.req));
+ }
- if ( mssg.src != world_server_mpi_rank ) {
+ if ( mssg.src != world_server_mpi_rank ) {
- HDfprintf(stdout, "%d:%s: mssg.src != world_server_mpi_rank.\n",
- world_mpi_rank, fcn_name);
- }
+ HDfprintf(stdout, "%d:%s: mssg.src != world_server_mpi_rank.\n",
+ world_mpi_rank, fcn_name);
+ }
- if ( mssg.dest != world_mpi_rank ) {
+ if ( mssg.dest != world_mpi_rank ) {
- HDfprintf(stdout, "%d:%s: mssg.dest != world_mpi_rank.\n",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: mssg.dest != world_mpi_rank.\n",
+ world_mpi_rank, fcn_name);
}
- if ( mssg.base_addr != entry_ptr->base_addr ) {
+ if ( mssg.base_addr != entry_ptr->base_addr ) {
- HDfprintf(stdout,
- "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n",
- world_mpi_rank, fcn_name);
- HDfprintf(stdout, "%d:%s: mssg.base_addr = %a.\n",
- world_mpi_rank, fcn_name, mssg.base_addr);
- HDfprintf(stdout, "%d:%s: entry_ptr->base_addr = %a.\n",
- world_mpi_rank, fcn_name, entry_ptr->base_addr);
+ HDfprintf(stdout,
+ "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n",
+ world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: mssg.base_addr = %a.\n",
+ world_mpi_rank, fcn_name, mssg.base_addr);
+ HDfprintf(stdout, "%d:%s: entry_ptr->base_addr = %a.\n",
+ world_mpi_rank, fcn_name, entry_ptr->base_addr);
}
- if ( mssg.len != entry_ptr->len ) {
+ if ( mssg.len != entry_ptr->len ) {
- HDfprintf(stdout, "%d:%s: mssg.len != entry_ptr->len.\n",
- world_mpi_rank, fcn_name);
- HDfprintf(stdout, "%d:%s: mssg.len = %a.\n",
- world_mpi_rank, fcn_name, mssg.len);
+ HDfprintf(stdout, "%d:%s: mssg.len != entry_ptr->len.\n",
+ world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: mssg.len = %a.\n",
+ world_mpi_rank, fcn_name, mssg.len);
}
- if ( mssg.ver < entry_ptr->ver ) {
+ if ( mssg.ver < entry_ptr->ver ) {
- HDfprintf(stdout, "%d:%s: mssg.ver < entry_ptr->ver.\n",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: mssg.ver < entry_ptr->ver.\n",
+ world_mpi_rank, fcn_name);
}
- if ( mssg.magic != MSSG_MAGIC ) {
+ if ( mssg.magic != MSSG_MAGIC ) {
- HDfprintf(stdout, "%d:%s: mssg.magic != MSSG_MAGIC.\n",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: mssg.magic != MSSG_MAGIC.\n",
+ world_mpi_rank, fcn_name);
}
#endif /* JRM */
- } else {
+ }
+ else {
- entry_ptr->ver = mssg.ver;
+ entry_ptr->ver = mssg.ver;
entry_ptr->header.is_dirty = FALSE;
- entry_ptr->dirty = FALSE;
+ entry_ptr->dirty = FALSE;
}
}
- if ( ! success ) {
+ if (!success) {
entry_ptr = NULL;
-
}
datum_loads++;
- return(entry_ptr);
+ return (entry_ptr);
} /* load_datum() */
@@ -2750,7 +2503,7 @@ load_datum(H5F_t H5_ATTR_UNUSED *f,
* Function: size_datum
*
* Purpose: Get the size of the specified entry. Just look at the
- * local copy, as size can't change.
+ * local copy, as size can't change.
*
* Return: SUCCEED
*
@@ -2759,48 +2512,45 @@ load_datum(H5F_t H5_ATTR_UNUSED *f,
*
* Modifications:
*
- * JRM -- 7/11/06
- * Modified function to return the local_len field instead
- * of the len field. These two fields usually contain the
- * same value, but if the size of an entry is changed, we
- * store the altered size in local_len without changing
- * len. Note that local_len must be positive, and may
- * not exceed len.
+ * JRM -- 7/11/06
+ * Modified function to return the local_len field instead
+ * of the len field. These two fields usually contain the
+ * same value, but if the size of an entry is changed, we
+ * store the altered size in local_len without changing
+ * len. Note that local_len must be positive, and may
+ * not exceed len.
*
*-------------------------------------------------------------------------
*/
static herr_t
-size_datum(H5F_t H5_ATTR_UNUSED * f,
- void * thing,
- size_t * size_ptr)
+size_datum(H5F_t H5_ATTR_UNUSED *f, void *thing, size_t *size_ptr)
{
- int idx;
- struct datum * entry_ptr;
+ int idx;
+ struct datum *entry_ptr;
- HDassert( thing );
- HDassert( size_ptr );
+ HDassert(thing);
+ HDassert(size_ptr);
entry_ptr = (struct datum *)thing;
idx = addr_to_datum_index(entry_ptr->base_addr);
- HDassert( idx >= 0 );
- HDassert( idx < NUM_DATA_ENTRIES );
- HDassert( idx < virt_num_data_entries );
- HDassert( &(data[idx]) == entry_ptr );
- HDassert( entry_ptr->local_len > 0 );
- HDassert( entry_ptr->local_len <= entry_ptr->len );
+ HDassert(idx >= 0);
+ HDassert(idx < NUM_DATA_ENTRIES);
+ HDassert(idx < virt_num_data_entries);
+ HDassert(&(data[idx]) == entry_ptr);
+ HDassert(entry_ptr->local_len > 0);
+ HDassert(entry_ptr->local_len <= entry_ptr->len);
- HDassert( entry_ptr->header.addr == entry_ptr->base_addr );
+ HDassert(entry_ptr->header.addr == entry_ptr->base_addr);
*size_ptr = entry_ptr->local_len;
- return(SUCCEED);
+ return (SUCCEED);
} /* size_datum() */
-
/*****************************************************************************/
/************************** test utility functions ***************************/
/*****************************************************************************/
@@ -2809,73 +2559,64 @@ size_datum(H5F_t H5_ATTR_UNUSED * f,
* Function: expunge_entry()
*
* Purpose: Expunge the entry indicated by the type and index, mark it
- * as clean, and don't increment its version number.
+ * as clean, and don't increment its version number.
*
- * Do nothing if nerrors is non-zero on entry.
+ * Do nothing if nerrors is non-zero on entry.
*
* Return: void
*
* Programmer: John Mainzer
* 07/11/06
*
- * Modifications:
- *
- * None.
- *
*****************************************************************************/
-
static void
-expunge_entry(H5F_t * file_ptr,
- int32_t idx)
+expunge_entry(H5F_t *file_ptr, int32_t idx)
{
- const char * fcn_name = "expunge_entry()";
- hbool_t in_cache;
- herr_t result;
- struct datum * entry_ptr;
+ const char * fcn_name = "expunge_entry()";
+ hbool_t in_cache;
+ herr_t result;
+ struct datum *entry_ptr;
- HDassert( file_ptr );
- HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
- HDassert( idx < virt_num_data_entries );
+ HDassert(file_ptr);
+ HDassert((0 <= idx) && (idx < NUM_DATA_ENTRIES));
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert( !(entry_ptr->locked) );
- HDassert( !(entry_ptr->global_pinned) );
- HDassert( !(entry_ptr->local_pinned) );
+ HDassert(!(entry_ptr->locked));
+ HDassert(!(entry_ptr->global_pinned));
+ HDassert(!(entry_ptr->local_pinned));
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- result = H5AC_expunge_entry(file_ptr, (hid_t)-1, &(types[0]),
- entry_ptr->header.addr, H5AC__NO_FLAGS_SET);
+ result =
+ H5AC_expunge_entry(file_ptr, (hid_t)-1, &(types[0]), entry_ptr->header.addr, H5AC__NO_FLAGS_SET);
- if ( result < 0 ) {
+ if (result < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Error in H5AC_expunge_entry().\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Error in H5AC_expunge_entry().\n", world_mpi_rank, fcn_name);
}
}
- HDassert( ((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
- HDassert( ! ((entry_ptr->header).is_dirty) );
+ HDassert(((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE);
+ HDassert(!((entry_ptr->header).is_dirty));
- result = H5C_get_entry_status(file_ptr, entry_ptr->base_addr,
- NULL, &in_cache, NULL, NULL, NULL);
+ result = H5C_get_entry_status(file_ptr, entry_ptr->base_addr, NULL, &in_cache, NULL, NULL, NULL);
- if ( result < 0 ) {
+ if (result < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Error in H5C_get_entry_status().\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Error in H5C_get_entry_status().\n", world_mpi_rank, fcn_name);
}
- } else if ( in_cache ) {
+ }
+ else if (in_cache) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Expunged entry still in cache?!?\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Expunged entry still in cache?!?\n", world_mpi_rank, fcn_name);
}
}
}
@@ -2884,14 +2625,13 @@ expunge_entry(H5F_t * file_ptr,
} /* expunge_entry() */
-
/*****************************************************************************
* Function: insert_entry()
*
* Purpose: Insert the entry indicated by the type and index, mark it
- * as dirty, and increment its version number.
+ * as dirty, and increment its version number.
*
- * Do nothing if nerrors is non-zero on entry.
+ * Do nothing if nerrors is non-zero on entry.
*
* Return: void
*
@@ -2906,96 +2646,85 @@ expunge_entry(H5F_t * file_ptr,
* any pins must be global pins.
*
*****************************************************************************/
-
static void
-insert_entry(H5C_t * cache_ptr,
- H5F_t * file_ptr,
- int32_t idx,
- unsigned int flags)
+insert_entry(H5C_t *cache_ptr, H5F_t *file_ptr, int32_t idx, unsigned int flags)
{
- const char * fcn_name = "insert_entry()";
- hbool_t insert_pinned;
- herr_t result;
- struct datum * entry_ptr;
+ const char * fcn_name = "insert_entry()";
+ hbool_t insert_pinned;
+ herr_t result;
+ struct datum *entry_ptr;
- HDassert( cache_ptr );
- HDassert( file_ptr );
- HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
- HDassert( idx < virt_num_data_entries );
+ HDassert(cache_ptr);
+ HDassert(file_ptr);
+ HDassert((0 <= idx) && (idx < NUM_DATA_ENTRIES));
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert( !(entry_ptr->locked) );
+ HDassert(!(entry_ptr->locked));
- insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0 );
+ insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0);
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
(entry_ptr->ver)++;
entry_ptr->dirty = TRUE;
- result = H5AC_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]),
- entry_ptr->base_addr, (void *)(&(entry_ptr->header)), flags);
+ result = H5AC_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->base_addr,
+ (void *)(&(entry_ptr->header)), flags);
- if ( ( result < 0 ) ||
- ( entry_ptr->header.type != &(types[0]) ) ||
- ( entry_ptr->len != entry_ptr->header.size ) ||
- ( entry_ptr->base_addr != entry_ptr->header.addr ) ) {
+ if ((result < 0) || (entry_ptr->header.type != &(types[0])) ||
+ (entry_ptr->len != entry_ptr->header.size) || (entry_ptr->base_addr != entry_ptr->header.addr)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Error in H5AC_insert_entry().\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Error in H5AC_insert_entry().\n", world_mpi_rank, fcn_name);
}
}
- if ( ! (entry_ptr->header.is_dirty) ) {
+ if (!(entry_ptr->header.is_dirty)) {
- /* it is possible that we just exceeded the dirty bytes
- * threshold, triggering a write of the newly inserted
- * entry. Test for this, and only flag an error if this
- * is not the case.
- */
+ /* it is possible that we just exceeded the dirty bytes
+ * threshold, triggering a write of the newly inserted
+ * entry. Test for this, and only flag an error if this
+ * is not the case.
+ */
- struct H5AC_aux_t * aux_ptr;
+ struct H5AC_aux_t *aux_ptr;
- aux_ptr = ((H5AC_aux_t *)(cache_ptr->aux_ptr));
+ aux_ptr = ((H5AC_aux_t *)(cache_ptr->aux_ptr));
- if ( ! ( ( aux_ptr != NULL ) &&
- ( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ) &&
- ( aux_ptr->dirty_bytes == 0 ) ) ) {
+ if (!((aux_ptr != NULL) && (aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC) &&
+ (aux_ptr->dirty_bytes == 0))) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: data[%d].header.is_dirty = %d.\n",
- world_mpi_rank, fcn_name, idx,
- (int)(data[idx].header.is_dirty));
- }
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: data[%d].header.is_dirty = %d.\n", world_mpi_rank, fcn_name,
+ idx, (int)(data[idx].header.is_dirty));
+ }
}
}
- if ( insert_pinned ) {
+ if (insert_pinned) {
- HDassert( entry_ptr->header.is_pinned );
+ HDassert(entry_ptr->header.is_pinned);
entry_ptr->global_pinned = TRUE;
- global_pins++;
-
- } else {
+ global_pins++;
+ }
+ else {
- HDassert( ! ( entry_ptr->header.is_pinned ) );
+ HDassert(!(entry_ptr->header.is_pinned));
entry_ptr->global_pinned = FALSE;
-
}
/* HDassert( entry_ptr->header.is_dirty ); */
- HDassert( ((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
+ HDassert(((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE);
}
return;
} /* insert_entry() */
-
/*****************************************************************************
* Function: local_pin_and_unpin_random_entries()
*
@@ -3009,65 +2738,55 @@ insert_entry(H5C_t * cache_ptr,
* Programmer: John Mainzer
* 4/12/06
*
- * Modifications:
- *
*****************************************************************************/
-
static void
-local_pin_and_unpin_random_entries(H5F_t * file_ptr,
- int min_idx,
- int max_idx,
- int min_count,
- int max_count)
+local_pin_and_unpin_random_entries(H5F_t *file_ptr, int min_idx, int max_idx, int min_count, int max_count)
{
/* const char * fcn_name = "local_pin_and_unpin_random_entries()"; */
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
hbool_t via_unprotect;
- int count;
- int i;
- int idx;
-
- HDassert( file_ptr );
- HDassert( 0 <= min_idx );
- HDassert( min_idx < max_idx );
- HDassert( max_idx < NUM_DATA_ENTRIES );
- HDassert( max_idx < virt_num_data_entries );
- HDassert( 0 <= min_count );
- HDassert( min_count < max_count );
+ int count;
+ int i;
+ int idx;
+
+ HDassert(file_ptr);
+ HDassert(0 <= min_idx);
+ HDassert(min_idx < max_idx);
+ HDassert(max_idx < NUM_DATA_ENTRIES);
+ HDassert(max_idx < virt_num_data_entries);
+ HDassert(0 <= min_count);
+ HDassert(min_count < max_count);
- count = (HDrand() % (max_count - min_count)) + min_count;
+ count = (HDrand() % (max_count - min_count)) + min_count;
- HDassert( min_count <= count );
- HDassert( count <= max_count );
+ HDassert(min_count <= count);
+ HDassert(count <= max_count);
- for ( i = 0; i < count; i++ )
- {
+ for (i = 0; i < count; i++) {
local_pin_random_entry(file_ptr, min_idx, max_idx);
- }
+ }
- count = (HDrand() % (max_count - min_count)) + min_count;
+ count = (HDrand() % (max_count - min_count)) + min_count;
- HDassert( min_count <= count );
- HDassert( count <= max_count );
+ HDassert(min_count <= count);
+ HDassert(count <= max_count);
- i = 0;
- idx = 0;
+ i = 0;
+ idx = 0;
- while ( ( i < count ) && ( idx >= 0 ) )
- {
- via_unprotect = ( (((unsigned)i) & 0x0001) == 0 );
- idx = local_unpin_next_pinned_entry(file_ptr, idx, via_unprotect);
- i++;
- }
+ while ((i < count) && (idx >= 0)) {
+ via_unprotect = ((((unsigned)i) & 0x0001) == 0);
+ idx = local_unpin_next_pinned_entry(file_ptr, idx, via_unprotect);
+ i++;
+ }
}
return;
} /* local_pin_and_unpin_random_entries() */
-
/*****************************************************************************
* Function: local_pin_random_entry()
*
@@ -3085,28 +2804,24 @@ local_pin_and_unpin_random_entries(H5F_t * file_ptr,
*
*****************************************************************************/
static void
-local_pin_random_entry(H5F_t * file_ptr,
- int min_idx,
- int max_idx)
+local_pin_random_entry(H5F_t *file_ptr, int min_idx, int max_idx)
{
/* const char * fcn_name = "local_pin_random_entry()"; */
int idx;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( file_ptr );
- HDassert( 0 <= min_idx );
- HDassert( min_idx < max_idx );
- HDassert( max_idx < NUM_DATA_ENTRIES );
- HDassert( max_idx < virt_num_data_entries );
+ HDassert(file_ptr);
+ HDassert(0 <= min_idx);
+ HDassert(min_idx < max_idx);
+ HDassert(max_idx < NUM_DATA_ENTRIES);
+ HDassert(max_idx < virt_num_data_entries);
- do
- {
- idx = (HDrand() % (max_idx - min_idx)) + min_idx;
- HDassert( min_idx <= idx );
- HDassert( idx <= max_idx );
- }
- while ( data[idx].global_pinned || data[idx].local_pinned );
+ do {
+ idx = (HDrand() % (max_idx - min_idx)) + min_idx;
+ HDassert(min_idx <= idx);
+ HDassert(idx <= max_idx);
+ } while (data[idx].global_pinned || data[idx].local_pinned);
pin_entry(file_ptr, idx, FALSE, FALSE);
}
@@ -3115,7 +2830,6 @@ local_pin_random_entry(H5F_t * file_ptr,
} /* local_pin_random_entry() */
-
/*****************************************************************************
* Function: local_unpin_all_entries()
*
@@ -3128,41 +2842,34 @@ local_pin_random_entry(H5F_t * file_ptr,
* Programmer: John Mainzer
* 4/12/06
*
- * Modifications:
- *
*****************************************************************************/
-
static void
-local_unpin_all_entries(H5F_t * file_ptr,
- hbool_t via_unprotect)
+local_unpin_all_entries(H5F_t *file_ptr, hbool_t via_unprotect)
{
/* const char * fcn_name = "local_unpin_all_entries()"; */
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
int idx;
- HDassert( file_ptr );
+ HDassert(file_ptr);
- idx = 0;
+ idx = 0;
- while ( idx >= 0 )
- {
- idx = local_unpin_next_pinned_entry(file_ptr,
- idx, via_unprotect);
- }
+ while (idx >= 0) {
+ idx = local_unpin_next_pinned_entry(file_ptr, idx, via_unprotect);
+ }
}
return;
} /* local_unpin_all_entries() */
-
/*****************************************************************************
* Function: local_unpin_next_pinned_entry()
*
* Purpose: Find the next locally pinned entry after the specified
- * starting point, and unpin it.
+ * starting point, and unpin it.
*
* Do nothing if nerrors is non-zero on entry.
*
@@ -3173,59 +2880,51 @@ local_unpin_all_entries(H5F_t * file_ptr,
* Programmer: John Mainzer
* 4/12/06
*
- * Modifications:
- *
*****************************************************************************/
-
static int
-local_unpin_next_pinned_entry(H5F_t * file_ptr,
- int start_idx,
- hbool_t via_unprotect)
+local_unpin_next_pinned_entry(H5F_t *file_ptr, int start_idx, hbool_t via_unprotect)
{
/* const char * fcn_name = "local_unpin_next_pinned_entry()"; */
- int i = 0;
+ int i = 0;
int idx = -1;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( file_ptr );
- HDassert( 0 <= start_idx );
- HDassert( start_idx < NUM_DATA_ENTRIES );
- HDassert( start_idx < virt_num_data_entries );
+ HDassert(file_ptr);
+ HDassert(0 <= start_idx);
+ HDassert(start_idx < NUM_DATA_ENTRIES);
+ HDassert(start_idx < virt_num_data_entries);
- idx = start_idx;
+ idx = start_idx;
- while ( ( i < virt_num_data_entries ) &&
- ( ! ( data[idx].local_pinned ) ) )
- {
- i++;
- idx++;
- if ( idx >= virt_num_data_entries ) {
- idx = 0;
- }
- }
-
- if ( data[idx].local_pinned ) {
+ while ((i < virt_num_data_entries) && (!(data[idx].local_pinned))) {
+ i++;
+ idx++;
+ if (idx >= virt_num_data_entries) {
+ idx = 0;
+ }
+ }
- unpin_entry(file_ptr, idx, FALSE, FALSE, via_unprotect);
+ if (data[idx].local_pinned) {
- } else {
+ unpin_entry(file_ptr, idx, FALSE, FALSE, via_unprotect);
+ }
+ else {
- idx = -1;
- }
+ idx = -1;
+ }
}
- return(idx);
+ return (idx);
} /* local_unpin_next_pinned_entry() */
-
/*****************************************************************************
* Function: lock_and_unlock_random_entries()
*
* Purpose: Obtain a random number in the closed interval [min_count,
- * max_count]. Then protect and unprotect that number of
- * random entries.
+ * max_count]. Then protect and unprotect that number of
+ * random entries.
*
* Do nothing if nerrors is non-zero on entry.
*
@@ -3234,34 +2933,26 @@ local_unpin_next_pinned_entry(H5F_t * file_ptr,
* Programmer: John Mainzer
* 1/12/06
*
- * Modifications:
- *
*****************************************************************************/
-
static void
-lock_and_unlock_random_entries(H5F_t * file_ptr,
- int min_idx,
- int max_idx,
- int min_count,
- int max_count)
+lock_and_unlock_random_entries(H5F_t *file_ptr, int min_idx, int max_idx, int min_count, int max_count)
{
/* const char * fcn_name = "lock_and_unlock_random_entries()"; */
int count;
int i;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( file_ptr );
- HDassert( 0 <= min_count );
- HDassert( min_count < max_count );
+ HDassert(file_ptr);
+ HDassert(0 <= min_count);
+ HDassert(min_count < max_count);
count = (HDrand() % (max_count - min_count)) + min_count;
- HDassert( min_count <= count );
- HDassert( count <= max_count );
+ HDassert(min_count <= count);
+ HDassert(count <= max_count);
- for ( i = 0; i < count; i++ )
- {
+ for (i = 0; i < count; i++) {
lock_and_unlock_random_entry(file_ptr, min_idx, max_idx);
}
}
@@ -3270,12 +2961,11 @@ lock_and_unlock_random_entries(H5F_t * file_ptr,
} /* lock_and_unlock_random_entries() */
-
/*****************************************************************************
* Function: lock_and_unlock_random_entry()
*
* Purpose: Protect and then unprotect a random entry with index in
- * the data[] array in the close interval [min_idx, max_idx].
+ * the data[] array in the close interval [min_idx, max_idx].
*
* Do nothing if nerrors is non-zero on entry.
*
@@ -3284,40 +2974,34 @@ lock_and_unlock_random_entries(H5F_t * file_ptr,
* Programmer: John Mainzer
* 1/4/06
*
- * Modifications:
- *
*****************************************************************************/
-
static void
-lock_and_unlock_random_entry(H5F_t * file_ptr,
- int min_idx,
- int max_idx)
+lock_and_unlock_random_entry(H5F_t *file_ptr, int min_idx, int max_idx)
{
/* const char * fcn_name = "lock_and_unlock_random_entry()"; */
int idx;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( file_ptr );
- HDassert( 0 <= min_idx );
- HDassert( min_idx < max_idx );
- HDassert( max_idx < NUM_DATA_ENTRIES );
- HDassert( max_idx < virt_num_data_entries );
+ HDassert(file_ptr);
+ HDassert(0 <= min_idx);
+ HDassert(min_idx < max_idx);
+ HDassert(max_idx < NUM_DATA_ENTRIES);
+ HDassert(max_idx < virt_num_data_entries);
idx = (HDrand() % (max_idx - min_idx)) + min_idx;
- HDassert( min_idx <= idx );
- HDassert( idx <= max_idx );
+ HDassert(min_idx <= idx);
+ HDassert(idx <= max_idx);
- lock_entry(file_ptr, idx);
- unlock_entry(file_ptr, idx, H5AC__NO_FLAGS_SET);
+ lock_entry(file_ptr, idx);
+ unlock_entry(file_ptr, idx, H5AC__NO_FLAGS_SET);
}
return;
} /* lock_and_unlock_random_entry() */
-
/*****************************************************************************
* Function: lock_entry()
*
@@ -3332,57 +3016,52 @@ lock_and_unlock_random_entry(H5F_t * file_ptr,
*
* Modifications:
*
- * JRM -- 7/11/06
- * Modified asserts to handle the new local_len field in
- * datum.
+ * JRM -- 7/11/06
+ * Modified asserts to handle the new local_len field in
+ * datum.
*
*****************************************************************************/
-
static void
-lock_entry(H5F_t * file_ptr,
- int32_t idx)
+lock_entry(H5F_t *file_ptr, int32_t idx)
{
- const char * fcn_name = "lock_entry()";
- struct datum * entry_ptr;
- H5C_cache_entry_t * cache_entry_ptr;
+ const char * fcn_name = "lock_entry()";
+ struct datum * entry_ptr;
+ H5C_cache_entry_t *cache_entry_ptr;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
- HDassert( idx < virt_num_data_entries );
+ HDassert((0 <= idx) && (idx < NUM_DATA_ENTRIES));
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert( ! (entry_ptr->locked) );
+ HDassert(!(entry_ptr->locked));
- cache_entry_ptr = (H5C_cache_entry_t *)H5AC_protect(file_ptr, -1, &(types[0]),
- entry_ptr->base_addr, NULL, H5AC_WRITE);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5AC_protect(file_ptr, -1, &(types[0]), entry_ptr->base_addr,
+ NULL, H5AC_WRITE);
- if ( ( cache_entry_ptr != (void *)(&(entry_ptr->header)) ) ||
- ( entry_ptr->header.type != &(types[0]) ) ||
- ( ( entry_ptr->len != entry_ptr->header.size ) &&
- ( entry_ptr->local_len != entry_ptr->header.size ) ) ||
- ( entry_ptr->base_addr != entry_ptr->header.addr ) ) {
+ if ((cache_entry_ptr != (void *)(&(entry_ptr->header))) || (entry_ptr->header.type != &(types[0])) ||
+ ((entry_ptr->len != entry_ptr->header.size) &&
+ (entry_ptr->local_len != entry_ptr->header.size)) ||
+ (entry_ptr->base_addr != entry_ptr->header.addr)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: error in H5AC_protect().\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: error in H5AC_protect().\n", world_mpi_rank, fcn_name);
}
- } else {
-
- entry_ptr->locked = TRUE;
+ }
+ else {
- }
+ entry_ptr->locked = TRUE;
+ }
- HDassert( ((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
+ HDassert(((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE);
}
return;
} /* lock_entry() */
-
/*****************************************************************************
* Function: mark_entry_dirty()
*
@@ -3396,49 +3075,44 @@ lock_entry(H5F_t * file_ptr,
* 4/14/06
*
*****************************************************************************/
-
static void
mark_entry_dirty(int32_t idx)
{
- const char * fcn_name = "mark_entry_dirty()";
- herr_t result;
- struct datum * entry_ptr;
+ const char * fcn_name = "mark_entry_dirty()";
+ herr_t result;
+ struct datum *entry_ptr;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
- HDassert( idx < virt_num_data_entries );
+ HDassert((0 <= idx) && (idx < NUM_DATA_ENTRIES));
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert ( entry_ptr->locked || entry_ptr->global_pinned );
- HDassert ( ! (entry_ptr->local_pinned) );
+ HDassert(entry_ptr->locked || entry_ptr->global_pinned);
+ HDassert(!(entry_ptr->local_pinned));
(entry_ptr->ver)++;
entry_ptr->dirty = TRUE;
- result = H5AC_mark_entry_dirty( (void *)entry_ptr);
+ result = H5AC_mark_entry_dirty((void *)entry_ptr);
- if ( result < 0 ) {
+ if (result < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: error in H5AC_mark_entry_dirty().\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: error in H5AC_mark_entry_dirty().\n", world_mpi_rank, fcn_name);
}
}
- else if ( ! ( entry_ptr->locked ) )
- {
- global_dirty_pins++;
- }
+ else if (!(entry_ptr->locked)) {
+ global_dirty_pins++;
+ }
}
return;
} /* mark_entry_dirty() */
-
/*****************************************************************************
* Function: pin_entry()
*
@@ -3451,133 +3125,114 @@ mark_entry_dirty(int32_t idx)
* Programmer: John Mainzer
* 4/11/06
*
- * Modifications:
- *
*****************************************************************************/
-
static void
-pin_entry(H5F_t * file_ptr,
- int32_t idx,
- hbool_t global,
- hbool_t dirty)
+pin_entry(H5F_t *file_ptr, int32_t idx, hbool_t global, hbool_t dirty)
{
/* const char * fcn_name = "pin_entry()"; */
- unsigned int flags = H5AC__PIN_ENTRY_FLAG;
- struct datum * entry_ptr;
+ unsigned int flags = H5AC__PIN_ENTRY_FLAG;
+ struct datum *entry_ptr;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( file_ptr );
- HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
- HDassert( idx < virt_num_data_entries );
+ HDassert(file_ptr);
+ HDassert((0 <= idx) && (idx < NUM_DATA_ENTRIES));
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert ( ! (entry_ptr->global_pinned) );
- HDassert ( ! (entry_ptr->local_pinned) );
- HDassert ( ! ( dirty && ( ! global ) ) );
+ HDassert(!(entry_ptr->global_pinned));
+ HDassert(!(entry_ptr->local_pinned));
+ HDassert(!(dirty && (!global)));
- lock_entry(file_ptr, idx);
+ lock_entry(file_ptr, idx);
- if ( dirty ) {
+ if (dirty) {
- flags |= H5AC__DIRTIED_FLAG;
- }
-
- unlock_entry(file_ptr, idx, flags);
-
- HDassert( (entry_ptr->header).is_pinned );
- HDassert( ( ! dirty ) || ( (entry_ptr->header).is_dirty ) );
+ flags |= H5AC__DIRTIED_FLAG;
+ }
- if ( global ) {
+ unlock_entry(file_ptr, idx, flags);
- entry_ptr->global_pinned = TRUE;
+ HDassert((entry_ptr->header).is_pinned);
+ HDassert((!dirty) || ((entry_ptr->header).is_dirty));
- global_pins++;
+ if (global) {
- } else {
+ entry_ptr->global_pinned = TRUE;
- entry_ptr->local_pinned = TRUE;
+ global_pins++;
+ }
+ else {
- local_pins++;
+ entry_ptr->local_pinned = TRUE;
- }
+ local_pins++;
+ }
}
return;
} /* pin_entry() */
-
#ifdef H5_METADATA_TRACE_FILE
/*****************************************************************************
* Function: pin_protected_entry()
*
* Purpose: Insert the entry indicated by the type and index, mark it
- * as dirty, and increment its version number.
+ * as dirty, and increment its version number.
*
- * Do nothing if nerrors is non-zero on entry.
+ * Do nothing if nerrors is non-zero on entry.
*
* Return: void
*
* Programmer: John Mainzer
* 01/04/06
*
- * Modifications:
- *
- * None.
- *
*****************************************************************************/
-
static void
-pin_protected_entry(int32_t idx,
- hbool_t global)
+pin_protected_entry(int32_t idx, hbool_t global)
{
- const char * fcn_name = "pin_protected_entry()";
- herr_t result;
- struct datum * entry_ptr;
+ const char * fcn_name = "pin_protected_entry()";
+ herr_t result;
+ struct datum *entry_ptr;
- HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
- HDassert( idx < virt_num_data_entries );
+ HDassert((0 <= idx) && (idx < NUM_DATA_ENTRIES));
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert( entry_ptr->locked );
+ HDassert(entry_ptr->locked);
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- result = H5AC_pin_protected_entry((void *)entry_ptr);
+ result = H5AC_pin_protected_entry((void *)entry_ptr);
- if ( ( result < 0 ) ||
- ( entry_ptr->header.type != &(types[0]) ) ||
- ( ( entry_ptr->len != entry_ptr->header.size ) &&
- ( entry_ptr->local_len != entry_ptr->header.size ) )||
- ( entry_ptr->base_addr != entry_ptr->header.addr ) ||
- ( ! ( (entry_ptr->header).is_pinned ) ) ) {
+ if ((result < 0) || (entry_ptr->header.type != &(types[0])) ||
+ ((entry_ptr->len != entry_ptr->header.size) &&
+ (entry_ptr->local_len != entry_ptr->header.size)) ||
+ (entry_ptr->base_addr != entry_ptr->header.addr) || (!((entry_ptr->header).is_pinned))) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: Error in H5AC_pin_protected entry().\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Error in H5AC_pin_protected entry().\n", world_mpi_rank, fcn_name);
}
}
- if ( global ) {
-
- entry_ptr->global_pinned = TRUE;
-
- global_pins++;
+ if (global) {
- } else {
+ entry_ptr->global_pinned = TRUE;
- entry_ptr->local_pinned = TRUE;
+ global_pins++;
+ }
+ else {
- local_pins++;
+ entry_ptr->local_pinned = TRUE;
- }
+ local_pins++;
+ }
- HDassert( ((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
+ HDassert(((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE);
}
return;
@@ -3585,16 +3240,15 @@ pin_protected_entry(int32_t idx,
} /* pin_protected_entry() */
#endif /* H5_METADATA_TRACE_FILE */
-
/*****************************************************************************
* Function: move_entry()
*
* Purpose: Move the entry indicated old_idx to the entry indicated
- * by new_idex. Touch up the data array so that flush will
- * not choke.
+ * by new_idex. Touch up the data array so that flush will
+ * not choke.
*
- * Do nothing if nerrors isn't zero, or if old_idx equals
- * new_idx.
+ * Do nothing if nerrors isn't zero, or if old_idx equals
+ * new_idx.
*
* Return: void
*
@@ -3603,34 +3257,32 @@ pin_protected_entry(int32_t idx,
*
*****************************************************************************/
static void
-move_entry(H5F_t * file_ptr,
- int32_t old_idx,
- int32_t new_idx)
+move_entry(H5F_t *file_ptr, int32_t old_idx, int32_t new_idx)
{
- const char * fcn_name = "move_entry()";
- herr_t result;
- int tmp;
- size_t tmp_len;
- haddr_t old_addr = HADDR_UNDEF;
- haddr_t new_addr = HADDR_UNDEF;
- struct datum * old_entry_ptr;
- struct datum * new_entry_ptr;
-
- if ( ( nerrors == 0 ) && ( old_idx != new_idx ) ) {
-
- HDassert( file_ptr );
- HDassert( ( 0 <= old_idx ) && ( old_idx < NUM_DATA_ENTRIES ) );
- HDassert( old_idx < virt_num_data_entries );
- HDassert( ( 0 <= new_idx ) && ( new_idx < NUM_DATA_ENTRIES ) );
- HDassert( new_idx < virt_num_data_entries );
+ const char * fcn_name = "move_entry()";
+ herr_t result;
+ int tmp;
+ size_t tmp_len;
+ haddr_t old_addr = HADDR_UNDEF;
+ haddr_t new_addr = HADDR_UNDEF;
+ struct datum *old_entry_ptr;
+ struct datum *new_entry_ptr;
+
+ if ((nerrors == 0) && (old_idx != new_idx)) {
+
+ HDassert(file_ptr);
+ HDassert((0 <= old_idx) && (old_idx < NUM_DATA_ENTRIES));
+ HDassert(old_idx < virt_num_data_entries);
+ HDassert((0 <= new_idx) && (new_idx < NUM_DATA_ENTRIES));
+ HDassert(new_idx < virt_num_data_entries);
old_entry_ptr = &(data[old_idx]);
new_entry_ptr = &(data[new_idx]);
- HDassert( ((old_entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
- HDassert( !(old_entry_ptr->header.is_protected) );
- HDassert( !(old_entry_ptr->locked) );
- HDassert( old_entry_ptr->len == new_entry_ptr->len );
+ HDassert(((old_entry_ptr->header).type)->id == DATUM_ENTRY_TYPE);
+ HDassert(!(old_entry_ptr->header.is_protected));
+ HDassert(!(old_entry_ptr->locked));
+ HDassert(old_entry_ptr->len == new_entry_ptr->len);
old_addr = old_entry_ptr->base_addr;
new_addr = new_entry_ptr->base_addr;
@@ -3638,12 +3290,12 @@ move_entry(H5F_t * file_ptr,
/* Moving will mark the entry dirty if it is not already */
old_entry_ptr->dirty = TRUE;
- /* touch up versions, base_addrs, and data_index. Do this
- * now as it is possible that the rename will trigger a
+ /* touch up versions, base_addrs, and data_index. Do this
+ * now as it is possible that the rename will trigger a
* sync point.
*/
- if(old_entry_ptr->ver < new_entry_ptr->ver)
- old_entry_ptr->ver = new_entry_ptr->ver;
+ if (old_entry_ptr->ver < new_entry_ptr->ver)
+ old_entry_ptr->ver = new_entry_ptr->ver;
else
(old_entry_ptr->ver)++;
@@ -3657,82 +3309,78 @@ move_entry(H5F_t * file_ptr,
old_entry_ptr->index = new_entry_ptr->index;
new_entry_ptr->index = tmp;
- if(old_entry_ptr->local_len != new_entry_ptr->local_len) {
- tmp_len = old_entry_ptr->local_len;
- old_entry_ptr->local_len = new_entry_ptr->local_len;
- new_entry_ptr->local_len = tmp_len;
- } /* end if */
+ if (old_entry_ptr->local_len != new_entry_ptr->local_len) {
+ tmp_len = old_entry_ptr->local_len;
+ old_entry_ptr->local_len = new_entry_ptr->local_len;
+ new_entry_ptr->local_len = tmp_len;
+ } /* end if */
result = H5AC_move_entry(file_ptr, &(types[0]), old_addr, new_addr);
- if ( ( result < 0 ) || ( old_entry_ptr->header.addr != new_addr ) ) {
+ if ((result < 0) || (old_entry_ptr->header.addr != new_addr)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5AC_move_entry() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5AC_move_entry() failed.\n", world_mpi_rank, fcn_name);
}
+ }
+ else {
- } else {
-
- HDassert( ((old_entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
+ HDassert(((old_entry_ptr->header).type)->id == DATUM_ENTRY_TYPE);
- if ( ! (old_entry_ptr->header.is_dirty) ) {
+ if (!(old_entry_ptr->header.is_dirty)) {
- /* it is possible that we just exceeded the dirty bytes
- * threshold, triggering a write of the newly inserted
- * entry. Test for this, and only flag an error if this
- * is not the case.
- */
+ /* it is possible that we just exceeded the dirty bytes
+ * threshold, triggering a write of the newly inserted
+ * entry. Test for this, and only flag an error if this
+ * is not the case.
+ */
- struct H5AC_aux_t * aux_ptr;
+ struct H5AC_aux_t *aux_ptr;
- aux_ptr = ((H5AC_aux_t *)(file_ptr->shared->cache->aux_ptr));
+ aux_ptr = ((H5AC_aux_t *)(file_ptr->shared->cache->aux_ptr));
- if ( ! ( ( aux_ptr != NULL ) &&
- ( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ) &&
- ( aux_ptr->dirty_bytes == 0 ) ) ) {
+ if (!((aux_ptr != NULL) && (aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC) &&
+ (aux_ptr->dirty_bytes == 0))) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: data[%d].header.is_dirty = %d.\n",
- world_mpi_rank, fcn_name, new_idx,
- (int)(data[new_idx].header.is_dirty));
- }
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: data[%d].header.is_dirty = %d.\n", world_mpi_rank, fcn_name,
+ new_idx, (int)(data[new_idx].header.is_dirty));
+ }
}
- } else {
+ }
+ else {
- HDassert( old_entry_ptr->header.is_dirty );
+ HDassert(old_entry_ptr->header.is_dirty);
}
}
}
} /* move_entry() */
-
/*****************************************************************************
*
- * Function: reset_server_counts()
+ * Function: reset_server_counts()
*
- * Purpose: Send a message to the server process requesting it to reset
- * its counters. Await confirmation message.
+ * Purpose: Send a message to the server process requesting it to reset
+ * its counters. Await confirmation message.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/6/10
+ * Programmer: JRM -- 5/6/10
*
*****************************************************************************/
static hbool_t
reset_server_counts(void)
{
- const char * fcn_name = "reset_server_counts()";
- hbool_t success = TRUE; /* will set to FALSE if appropriate. */
+ const char * fcn_name = "reset_server_counts()";
+ hbool_t success = TRUE; /* will set to FALSE if appropriate. */
struct mssg_t mssg;
- if ( success ) {
+ if (success) {
/* compose the message */
mssg.req = REQ_RW_COUNT_RESET_CODE;
@@ -3745,113 +3393,97 @@ reset_server_counts(void)
mssg.count = 0;
mssg.magic = MSSG_MAGIC;
- if ( ! send_mssg(&mssg, FALSE) ) {
+ if (!send_mssg(&mssg, FALSE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( success ) {
+ if (success) {
- if ( ! recv_mssg(&mssg, REQ_RW_COUNT_RESET_RPLY_CODE) ) {
+ if (!recv_mssg(&mssg, REQ_RW_COUNT_RESET_RPLY_CODE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
- } else if ( ( mssg.req != REQ_RW_COUNT_RESET_RPLY_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.base_addr != 0 ) ||
- ( mssg.len != 0 ) ||
- ( mssg.ver != 0 ) ||
- ( mssg.count != 0 ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ }
+ else if ((mssg.req != REQ_RW_COUNT_RESET_RPLY_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.base_addr != 0) || (mssg.len != 0) ||
+ (mssg.ver != 0) || (mssg.count != 0) || (mssg.magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: Bad data in req r/w counter reset reply.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in req r/w counter reset reply.\n", world_mpi_rank,
+ fcn_name);
}
}
}
- return(success);
+ return (success);
} /* reset_server_counts() */
-
/*****************************************************************************
* Function: resize_entry()
*
* Purpose: Resize the pinned entry indicated by idx to the new_size.
- * Note that new_size must be greater than 0, and must be
- * less than or equal to the original size of the entry.
+ * Note that new_size must be greater than 0, and must be
+ * less than or equal to the original size of the entry.
*
- * Do nothing if nerrors isn't zero.
+ * Do nothing if nerrors isn't zero.
*
* Return: void
*
* Programmer: John Mainzer
* 7/11/06
*
- * Modifications:
- *
- * None
- *
*****************************************************************************/
-
static void
-resize_entry(int32_t idx,
- size_t new_size)
+resize_entry(int32_t idx, size_t new_size)
{
- const char * fcn_name = "resize_entry()";
- herr_t result;
- struct datum * entry_ptr;
+ const char * fcn_name = "resize_entry()";
+ herr_t result;
+ struct datum *entry_ptr;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
- HDassert( idx < virt_num_data_entries );
+ HDassert((0 <= idx) && (idx < NUM_DATA_ENTRIES));
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert( ((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
- HDassert( !(entry_ptr->locked) );
- HDassert( ( entry_ptr->global_pinned ) &&
- ( ! entry_ptr->local_pinned ) );
- HDassert( ( entry_ptr->header.size == entry_ptr->len ) ||
- ( entry_ptr->header.size == entry_ptr->local_len ) );
- HDassert( new_size > 0 );
- HDassert( new_size <= entry_ptr->len );
+ HDassert(((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE);
+ HDassert(!(entry_ptr->locked));
+ HDassert((entry_ptr->global_pinned) && (!entry_ptr->local_pinned));
+ HDassert((entry_ptr->header.size == entry_ptr->len) ||
+ (entry_ptr->header.size == entry_ptr->local_len));
+ HDassert(new_size > 0);
+ HDassert(new_size <= entry_ptr->len);
- result = H5AC_resize_entry((void *)entry_ptr, new_size);
+ result = H5AC_resize_entry((void *)entry_ptr, new_size);
- if ( result < 0 ) {
+ if (result < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5AC_resize_entry() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5AC_resize_entry() failed.\n", world_mpi_rank, fcn_name);
}
+ }
+ else {
- } else {
+ HDassert(((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE);
+ HDassert(entry_ptr->header.is_dirty);
+ HDassert(entry_ptr->header.size == new_size);
- HDassert( ((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
- HDassert( entry_ptr->header.is_dirty );
- HDassert( entry_ptr->header.size == new_size );
-
- entry_ptr->dirty = TRUE;
- entry_ptr->local_len = new_size;
+ entry_ptr->dirty = TRUE;
+ entry_ptr->local_len = new_size;
/* touch up version. */
@@ -3863,120 +3495,111 @@ resize_entry(int32_t idx,
} /* resize_entry() */
-
/*****************************************************************************
*
- * Function: setup_cache_for_test()
+ * Function: setup_cache_for_test()
*
- * Purpose: Setup the parallel cache for a test, and return the file id
- * and a pointer to the cache's internal data structures.
+ * Purpose: Setup the parallel cache for a test, and return the file id
+ * and a pointer to the cache's internal data structures.
*
- * To do this, we must create a file, flush it (so that we
- * don't have to worry about entries in the metadata cache),
- * look up the address of the metadata cache, and then instruct
- * the cache to omit sanity checks on dxpl IDs.
+ * To do this, we must create a file, flush it (so that we
+ * don't have to worry about entries in the metadata cache),
+ * look up the address of the metadata cache, and then instruct
+ * the cache to omit sanity checks on dxpl IDs.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 1/4/06
+ * Programmer: JRM -- 1/4/06
*
*****************************************************************************/
static hbool_t
-setup_cache_for_test(hid_t * fid_ptr,
- H5F_t ** file_ptr_ptr,
- H5C_t ** cache_ptr_ptr,
- int metadata_write_strategy)
+setup_cache_for_test(hid_t *fid_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr, int metadata_write_strategy)
{
- const char * fcn_name = "setup_cache_for_test()";
- hbool_t success = FALSE; /* will set to TRUE if appropriate. */
- hbool_t enable_rpt_fcn = FALSE;
- hid_t fid = -1;
+ const char * fcn_name = "setup_cache_for_test()";
+ hbool_t success = FALSE; /* will set to TRUE if appropriate. */
+ hbool_t enable_rpt_fcn = FALSE;
+ hid_t fid = -1;
H5AC_cache_config_t config;
H5AC_cache_config_t test_config;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
- HDassert ( fid_ptr != NULL );
- HDassert ( file_ptr_ptr != NULL );
- HDassert ( cache_ptr_ptr != NULL );
+ HDassert(fid_ptr != NULL);
+ HDassert(file_ptr_ptr != NULL);
+ HDassert(cache_ptr_ptr != NULL);
fid = H5Fcreate(filenames[0], H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ( fid < 0 ) {
+ if (fid < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Fcreate() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Fcreate() failed.\n", world_mpi_rank, fcn_name);
}
- } else if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
+ }
+ else if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE);
}
- if ( file_ptr == NULL ) {
+ if (file_ptr == NULL) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Can't get file_ptr.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Can't get file_ptr.\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
cache_ptr = file_ptr->shared->cache;
}
- if ( cache_ptr == NULL ) {
+ if (cache_ptr == NULL) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Can't get cache_ptr.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Can't get cache_ptr.\n", world_mpi_rank, fcn_name);
}
- } else if ( cache_ptr->magic != H5C__H5C_T_MAGIC ) {
+ }
+ else if (cache_ptr->magic != H5C__H5C_T_MAGIC) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad cache_ptr magic.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad cache_ptr magic.\n", world_mpi_rank, fcn_name);
}
- } else {
- *fid_ptr = fid;
- *file_ptr_ptr = file_ptr;
+ }
+ else {
+ *fid_ptr = fid;
+ *file_ptr_ptr = file_ptr;
*cache_ptr_ptr = cache_ptr;
H5C_stats__reset(cache_ptr);
success = TRUE;
}
- if ( success ) {
+ if (success) {
config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- if ( H5AC_get_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
-
- HDfprintf(stdout,
- "%d:%s: H5AC_get_cache_auto_resize_config(1) failed.\n",
- world_mpi_rank, fcn_name);
+ if (H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
- } else {
+ HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config(1) failed.\n", world_mpi_rank,
+ fcn_name);
+ }
+ else {
config.rpt_fcn_enabled = enable_rpt_fcn;
config.metadata_write_strategy = metadata_write_strategy;
- if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
+ if (H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
- HDfprintf(stdout,
- "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n",
- world_mpi_rank, fcn_name);
-
- } else if ( enable_rpt_fcn ) {
+ HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank,
+ fcn_name);
+ }
+ else if (enable_rpt_fcn) {
- HDfprintf(stdout, "%d:%s: rpt_fcn enabled.\n",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: rpt_fcn enabled.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -3986,166 +3609,146 @@ setup_cache_for_test(hid_t * fid_ptr,
* we can't do our usual checks in the serial case.
*/
- if ( success ) /* verify that the metadata write strategy is as expected */
+ if (success) /* verify that the metadata write strategy is as expected */
{
- if ( cache_ptr->aux_ptr == NULL ) {
+ if (cache_ptr->aux_ptr == NULL) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: cache_ptr->aux_ptr == NULL.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: cache_ptr->aux_ptr == NULL.\n", world_mpi_rank, fcn_name);
}
- } else if ( ((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic !=
- H5AC__H5AC_AUX_T_MAGIC ) {
+ }
+ else if (((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic != H5AC__H5AC_AUX_T_MAGIC) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: cache_ptr->aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: cache_ptr->aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC.\n",
+ world_mpi_rank, fcn_name);
}
- } else if( ((H5AC_aux_t *)(cache_ptr->aux_ptr))->metadata_write_strategy
- != metadata_write_strategy ) {
+ }
+ else if (((H5AC_aux_t *)(cache_ptr->aux_ptr))->metadata_write_strategy != metadata_write_strategy) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: bad cache_ptr->aux_ptr->metadata_write_strategy\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: bad cache_ptr->aux_ptr->metadata_write_strategy\n", world_mpi_rank,
+ fcn_name);
}
}
}
- /* also verify that the expected metadata write strategy is reported
+ /* also verify that the expected metadata write strategy is reported
* when we get the current configuration.
*/
- if ( success ) {
+ if (success) {
test_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- if ( H5AC_get_cache_auto_resize_config(cache_ptr, &test_config)
- != SUCCEED ) {
+ if (H5AC_get_cache_auto_resize_config(cache_ptr, &test_config) != SUCCEED) {
- HDfprintf(stdout,
- "%d:%s: H5AC_get_cache_auto_resize_config(2) failed.\n",
- world_mpi_rank, fcn_name);
-
- } else if ( test_config.metadata_write_strategy !=
- metadata_write_strategy ) {
+ HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config(2) failed.\n", world_mpi_rank,
+ fcn_name);
+ }
+ else if (test_config.metadata_write_strategy != metadata_write_strategy) {
nerrors++;
- if ( verbose ) {
+ if (verbose) {
- HDfprintf(stdout,
- "%d:%s: unexpected metadata_write_strategy.\n",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: unexpected metadata_write_strategy.\n", world_mpi_rank, fcn_name);
}
}
}
-
#if DO_SYNC_AFTER_WRITE
- if ( success ) {
+ if (success) {
- if ( H5AC_set_write_done_callback(cache_ptr, do_sync) != SUCCEED ) {
+ if (H5AC_set_write_done_callback(cache_ptr, do_sync) != SUCCEED) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: H5C_set_write_done_callback failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5C_set_write_done_callback failed.\n", world_mpi_rank, fcn_name);
}
- }
+ }
}
#endif /* DO_SYNC_AFTER_WRITE */
- if ( success ) {
+ if (success) {
- if ( H5AC_set_sync_point_done_callback(cache_ptr, verify_writes) !=
- SUCCEED ) {
+ if (H5AC_set_sync_point_done_callback(cache_ptr, verify_writes) != SUCCEED) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: H5AC_set_sync_point_done_callback failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5AC_set_sync_point_done_callback failed.\n", world_mpi_rank,
+ fcn_name);
}
- }
+ }
}
- return(success);
+ return (success);
} /* setup_cache_for_test() */
-
/*****************************************************************************
*
- * Function: verify_writes()
+ * Function: verify_writes()
*
- * Purpose: Verify that the indicated entries have been written exactly
- * once each, and that the indicated total number of writes
- * has been processed by the server process. Flag an error if
- * discrepency is noted. Finally reset the counters maintained
- * by the server process.
+ * Purpose: Verify that the indicated entries have been written exactly
+ * once each, and that the indicated total number of writes
+ * has been processed by the server process. Flag an error if
+ * discrepency is noted. Finally reset the counters maintained
+ * by the server process.
*
- * This function should only be called by the metadata cache
- * as the "sync point done" function, as it must do some
- * synchronization to avoid false positives.
+ * This function should only be called by the metadata cache
+ * as the "sync point done" function, as it must do some
+ * synchronization to avoid false positives.
*
- * Note that at present, this function does not allow for the
- * case in which one or more of the indicated entries should
- * have been written more than once since the last time the
- * server process's counters were reset. That is fine for now,
- * as with the current metadata write strategies, no entry
- * should be written more than once per sync point. If this
- * changes this limitation will have to be revisited.
+ * Note that at present, this function does not allow for the
+ * case in which one or more of the indicated entries should
+ * have been written more than once since the last time the
+ * server process's counters were reset. That is fine for now,
+ * as with the current metadata write strategies, no entry
+ * should be written more than once per sync point. If this
+ * changes this limitation will have to be revisited.
*
- * Return: void.
+ * Return: void.
*
- * Programmer: JRM -- 5/9/10
+ * Programmer: JRM -- 5/9/10
*
*****************************************************************************/
static void
-verify_writes(int num_writes,
- haddr_t * written_entries_tbl)
+verify_writes(int num_writes, haddr_t *written_entries_tbl)
{
- const char * fcn_name = "verify_writes()";
- const hbool_t report = FALSE;
- hbool_t proceed = TRUE;
- int i = 0;
+ const char * fcn_name = "verify_writes()";
+ const hbool_t report = FALSE;
+ hbool_t proceed = TRUE;
+ int i = 0;
- HDassert( world_mpi_rank != world_server_mpi_rank );
- HDassert( num_writes >= 0 );
- HDassert( ( num_writes == 0 ) ||
- ( written_entries_tbl != NULL ) );
+ HDassert(world_mpi_rank != world_server_mpi_rank);
+ HDassert(num_writes >= 0);
+ HDassert((num_writes == 0) || (written_entries_tbl != NULL));
/* barrier to ensure that all other processes are ready to leave
* the sync point as well.
*/
- if ( proceed ) {
+ if (proceed) {
- if ( MPI_SUCCESS != MPI_Barrier(file_mpi_comm) ) {
+ if (MPI_SUCCESS != MPI_Barrier(file_mpi_comm)) {
proceed = FALSE;
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: barrier 1 failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: barrier 1 failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( proceed ) {
-
+ if (proceed)
proceed = verify_total_writes(num_writes);
- }
- while ( ( proceed ) && ( i < num_writes ) )
- {
+ while ((proceed) && (i < num_writes)) {
proceed = verify_entry_writes(written_entries_tbl[i], 1);
i++;
}
@@ -4153,55 +3756,50 @@ verify_writes(int num_writes,
/* barrier to ensure that all other processes have finished verifying
* the number of writes before we reset the counters.
*/
- if ( proceed ) {
+ if (proceed) {
- if ( MPI_SUCCESS != MPI_Barrier(file_mpi_comm) ) {
+ if (MPI_SUCCESS != MPI_Barrier(file_mpi_comm)) {
proceed = FALSE;
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: barrier 2 failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: barrier 2 failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( proceed ) {
+ if (proceed) {
proceed = reset_server_counts();
}
/* if requested, display status of check to stdout */
- if ( ( report ) && ( file_mpi_rank == 0 ) ) {
+ if ((report) && (file_mpi_rank == 0)) {
- if ( proceed ) {
+ if (proceed) {
- HDfprintf(stdout, "%d:%s: verified %d writes.\n",
- world_mpi_rank, fcn_name, num_writes);
-
- } else {
-
- HDfprintf(stdout, "%d:%s: FAILED to verify %d writes.\n",
- world_mpi_rank, fcn_name, num_writes);
+ HDfprintf(stdout, "%d:%s: verified %d writes.\n", world_mpi_rank, fcn_name, num_writes);
+ }
+ else {
+ HDfprintf(stdout, "%d:%s: FAILED to verify %d writes.\n", world_mpi_rank, fcn_name, num_writes);
}
}
/* final barrier to ensure that all processes think that the server
- * counters have been reset before we leave the sync point. This
+ * counters have been reset before we leave the sync point. This
* barrier is probaby not necessary at this point in time (5/9/10),
* but I can think of at least one likely change to the metadata write
* strategies that will require it -- hence its insertion now.
*/
- if ( proceed ) {
+ if (proceed) {
- if ( MPI_SUCCESS != MPI_Barrier(file_mpi_comm) ) {
+ if (MPI_SUCCESS != MPI_Barrier(file_mpi_comm)) {
proceed = FALSE;
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: barrier 3 failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: barrier 3 failed.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -4210,63 +3808,58 @@ verify_writes(int num_writes,
} /* verify_writes() */
-
/*****************************************************************************
*
- * Function: setup_rand()
+ * Function: setup_rand()
*
- * Purpose: Use gettimeofday() to obtain a seed for rand(), print the
- * seed to stdout, and then pass it to srand().
+ * Purpose: Use gettimeofday() to obtain a seed for rand(), print the
+ * seed to stdout, and then pass it to srand().
*
- * Increment nerrors if any errors are detected.
+ * Increment nerrors if any errors are detected.
*
- * Return: void.
+ * Return: void.
*
- * Programmer: JRM -- 1/12/06
+ * Programmer: JRM -- 1/12/06
*
* Modifications:
*
- * JRM -- 5/9/06
- * Modified function to facilitate setting predefined seeds.
+ * JRM -- 5/9/06
+ * Modified function to facilitate setting predefined seeds.
*
*****************************************************************************/
-
static void
setup_rand(void)
{
- const char * fcn_name = "setup_rand()";
- hbool_t use_predefined_seeds = FALSE;
- int num_predefined_seeds = 3;
- unsigned predefined_seeds[3] = {33402, 33505, 33422};
- unsigned seed;
+ const char * fcn_name = "setup_rand()";
+ hbool_t use_predefined_seeds = FALSE;
+ int num_predefined_seeds = 3;
+ unsigned predefined_seeds[3] = {33402, 33505, 33422};
+ unsigned seed;
struct timeval tv;
- if ( ( use_predefined_seeds ) &&
- ( world_mpi_size == num_predefined_seeds ) ) {
-
- HDassert( world_mpi_rank >= 0 );
- HDassert( world_mpi_rank < world_mpi_size );
+ if ((use_predefined_seeds) && (world_mpi_size == num_predefined_seeds)) {
- seed = predefined_seeds[world_mpi_rank];
- HDfprintf(stdout, "%d:%s: predefined_seed = %d.\n",
- world_mpi_rank, fcn_name, seed);
- fflush(stdout);
- HDsrand(seed);
+ HDassert(world_mpi_rank >= 0);
+ HDassert(world_mpi_rank < world_mpi_size);
- } else {
+ seed = predefined_seeds[world_mpi_rank];
+ HDfprintf(stdout, "%d:%s: predefined_seed = %d.\n", world_mpi_rank, fcn_name, seed);
+ fflush(stdout);
+ HDsrand(seed);
+ }
+ else {
- if ( HDgettimeofday(&tv, NULL) != 0 ) {
+ if (HDgettimeofday(&tv, NULL) != 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: gettimeofday() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: gettimeofday() failed.\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
seed = (unsigned)tv.tv_usec;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: seed = %d.\n",
- world_mpi_rank, fcn_name, seed);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: seed = %d.\n", world_mpi_rank, fcn_name, seed);
fflush(stdout);
}
HDsrand(seed);
@@ -4277,78 +3870,71 @@ setup_rand(void)
} /* setup_rand() */
-
/*****************************************************************************
*
- * Function: take_down_cache()
- *
- * Purpose: Take down the parallel cache after a test.
- *
- * To do this, we must close the file, and delete if if
- * possible.
+ * Function: take_down_cache()
*
- * Return: Success: TRUE
+ * Purpose: Take down the parallel cache after a test.
*
- * Failure: FALSE
+ * To do this, we must close the file, and delete if if
+ * possible.
*
- * Programmer: JRM -- 1/4/06
+ * Return: Success: TRUE
*
- * Modifications:
+ * Failure: FALSE
*
- * None.
+ * Programmer: JRM -- 1/4/06
*
*****************************************************************************/
-
static hbool_t
take_down_cache(hid_t fid)
{
- const char * fcn_name = "take_down_cache()";
- hbool_t success = FALSE; /* will set to TRUE if appropriate. */
+ const char *fcn_name = "take_down_cache()";
+ hbool_t success = FALSE; /* will set to TRUE if appropriate. */
/* close the file and delete it */
- if ( H5Fclose(fid) < 0 ) {
+ if (H5Fclose(fid) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Fclose() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Fclose() failed.\n", world_mpi_rank, fcn_name);
}
+ }
+ else if (world_mpi_rank == world_server_mpi_rank) {
- } else if ( world_mpi_rank == world_server_mpi_rank ) {
-
- if ( HDremove(filenames[0]) < 0 ) {
+ if (HDremove(filenames[0]) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: HDremove() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: HDremove() failed.\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
- success = TRUE;
+ success = TRUE;
}
- } else {
+ }
+ else {
success = TRUE;
}
- return(success);
+ return (success);
} /* take_down_cache() */
-
/*****************************************************************************
* Function: verify_entry_reads
*
- * Purpose: Query the server to determine the number of times the
- * indicated entry has been read since the last time the
- * server counters were reset.
+ * Purpose: Query the server to determine the number of times the
+ * indicated entry has been read since the last time the
+ * server counters were reset.
*
- * Return TRUE if successful, and if the supplied expected
- * number of reads matches the number of reads reported by
- * the server process.
+ * Return TRUE if successful, and if the supplied expected
+ * number of reads matches the number of reads reported by
+ * the server process.
*
- * Return FALSE and flag an error otherwise.
+ * Return FALSE and flag an error otherwise.
*
* Return: TRUE if successful, FALSE otherwise.
*
@@ -4358,15 +3944,14 @@ take_down_cache(hid_t fid)
*-------------------------------------------------------------------------
*/
static hbool_t
-verify_entry_reads(haddr_t addr,
- int expected_entry_reads)
+verify_entry_reads(haddr_t addr, int expected_entry_reads)
{
- const char * fcn_name = "verify_entry_reads()";
- hbool_t success = TRUE;
- int reported_entry_reads;
+ const char * fcn_name = "verify_entry_reads()";
+ hbool_t success = TRUE;
+ int reported_entry_reads;
struct mssg_t mssg;
- if ( success ) {
+ if (success) {
/* compose the message */
mssg.req = REQ_ENTRY_READS_CODE;
@@ -4379,84 +3964,75 @@ verify_entry_reads(haddr_t addr,
mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( ! send_mssg(&mssg, FALSE) ) {
+ if (!send_mssg(&mssg, FALSE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( success ) {
+ if (success) {
- if ( ! recv_mssg(&mssg, REQ_ENTRY_READS_RPLY_CODE) ) {
+ if (!recv_mssg(&mssg, REQ_ENTRY_READS_RPLY_CODE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( success ) {
+ if (success) {
- if ( ( mssg.req != REQ_ENTRY_READS_RPLY_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.base_addr != addr ) ||
- ( mssg.len != 0 ) ||
- ( mssg.ver != 0 ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ if ((mssg.req != REQ_ENTRY_READS_RPLY_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.base_addr != addr) || (mssg.len != 0) || (mssg.ver != 0) ||
+ (mssg.magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad data in req entry reads reply.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in req entry reads reply.\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
reported_entry_reads = mssg.count;
}
}
- if ( ! success ) {
+ if (!success) {
- if ( reported_entry_reads != expected_entry_reads ) {
+ if (reported_entry_reads != expected_entry_reads) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: rep/exp entry 0x%llx reads mismatch (%ld/%ld).\n",
- world_mpi_rank, fcn_name, (long long)addr,
- reported_entry_reads, expected_entry_reads);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: rep/exp entry 0x%llx reads mismatch (%ld/%ld).\n", world_mpi_rank,
+ fcn_name, (long long)addr, reported_entry_reads, expected_entry_reads);
}
- }
+ }
}
- return(success);
+ return (success);
} /* verify_entry_reads() */
-
/*****************************************************************************
* Function: verify_entry_writes
*
- * Purpose: Query the server to determine the number of times the
- * indicated entry has been written since the last time the
- * server counters were reset.
+ * Purpose: Query the server to determine the number of times the
+ * indicated entry has been written since the last time the
+ * server counters were reset.
*
- * Return TRUE if successful, and if the supplied expected
- * number of reads matches the number of reads reported by
- * the server process.
+ * Return TRUE if successful, and if the supplied expected
+ * number of reads matches the number of reads reported by
+ * the server process.
*
- * Return FALSE and flag an error otherwise.
+ * Return FALSE and flag an error otherwise.
*
* Return: TRUE if successful, FALSE otherwise.
*
@@ -4466,15 +4042,14 @@ verify_entry_reads(haddr_t addr,
*-------------------------------------------------------------------------
*/
static hbool_t
-verify_entry_writes(haddr_t addr,
- int expected_entry_writes)
+verify_entry_writes(haddr_t addr, int expected_entry_writes)
{
- const char * fcn_name = "verify_entry_writes()";
- hbool_t success = TRUE;
- int reported_entry_writes;
+ const char * fcn_name = "verify_entry_writes()";
+ hbool_t success = TRUE;
+ int reported_entry_writes;
struct mssg_t mssg;
- if ( success ) {
+ if (success) {
/* compose the message */
mssg.req = REQ_ENTRY_WRITES_CODE;
@@ -4487,100 +4062,91 @@ verify_entry_writes(haddr_t addr,
mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( ! send_mssg(&mssg, FALSE) ) {
+ if (!send_mssg(&mssg, FALSE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( success ) {
+ if (success) {
- if ( ! recv_mssg(&mssg, REQ_ENTRY_WRITES_RPLY_CODE) ) {
+ if (!recv_mssg(&mssg, REQ_ENTRY_WRITES_RPLY_CODE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( success ) {
+ if (success) {
- if ( ( mssg.req != REQ_ENTRY_WRITES_RPLY_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.base_addr != addr ) ||
- ( mssg.len != 0 ) ||
- ( mssg.ver != 0 ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ if ((mssg.req != REQ_ENTRY_WRITES_RPLY_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.base_addr != addr) || (mssg.len != 0) || (mssg.ver != 0) ||
+ (mssg.magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad data in req entry writes reply.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in req entry writes reply.\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
reported_entry_writes = mssg.count;
}
}
- if ( ! success ) {
+ if (!success) {
- if ( reported_entry_writes != expected_entry_writes ) {
+ if (reported_entry_writes != expected_entry_writes) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: rep/exp entry 0x%llx writes mismatch (%ld/%ld).\n",
- world_mpi_rank, fcn_name, (long long)addr,
- reported_entry_writes, expected_entry_writes);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: rep/exp entry 0x%llx writes mismatch (%ld/%ld).\n", world_mpi_rank,
+ fcn_name, (long long)addr, reported_entry_writes, expected_entry_writes);
}
- }
+ }
}
- return(success);
+ return (success);
} /* verify_entry_writes() */
-
/*****************************************************************************
*
- * Function: verify_total_reads()
+ * Function: verify_total_reads()
*
- * Purpose: Query the server to obtain the total reads since the last
- * server counter reset, and compare this value with the supplied
- * expected value.
+ * Purpose: Query the server to obtain the total reads since the last
+ * server counter reset, and compare this value with the supplied
+ * expected value.
*
- * If the values match, return TRUE.
+ * If the values match, return TRUE.
*
- * If the values don't match, flag an error and return FALSE.
+ * If the values don't match, flag an error and return FALSE.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/6/10
+ * Programmer: JRM -- 5/6/10
*
*****************************************************************************/
static hbool_t
verify_total_reads(int expected_total_reads)
{
- const char * fcn_name = "verify_total_reads()";
- hbool_t success = TRUE; /* will set to FALSE if appropriate. */
- long reported_total_reads;
+ const char * fcn_name = "verify_total_reads()";
+ hbool_t success = TRUE; /* will set to FALSE if appropriate. */
+ long reported_total_reads;
struct mssg_t mssg;
- if ( success ) {
+ if (success) {
/* compose the message */
mssg.req = REQ_TTL_READS_CODE;
@@ -4593,96 +4159,87 @@ verify_total_reads(int expected_total_reads)
mssg.count = 0;
mssg.magic = MSSG_MAGIC;
- if ( ! send_mssg(&mssg, FALSE) ) {
+ if (!send_mssg(&mssg, FALSE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( success ) {
+ if (success) {
- if ( ! recv_mssg(&mssg, REQ_TTL_READS_RPLY_CODE) ) {
+ if (!recv_mssg(&mssg, REQ_TTL_READS_RPLY_CODE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
- } else if ( ( mssg.req != REQ_TTL_READS_RPLY_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.base_addr != 0 ) ||
- ( mssg.len != 0 ) ||
- ( mssg.ver != 0 ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ }
+ else if ((mssg.req != REQ_TTL_READS_RPLY_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.base_addr != 0) || (mssg.len != 0) ||
+ (mssg.ver != 0) || (mssg.magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad data in req total reads reply.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in req total reads reply.\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
reported_total_reads = mssg.count;
}
}
- if ( success ) {
+ if (success) {
- if ( reported_total_reads != expected_total_reads ) {
+ if (reported_total_reads != expected_total_reads) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: reported/expected total reads mismatch (%ld/%ld).\n",
- world_mpi_rank, fcn_name,
- reported_total_reads, expected_total_reads);
-
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: reported/expected total reads mismatch (%ld/%ld).\n",
+ world_mpi_rank, fcn_name, reported_total_reads, expected_total_reads);
}
}
}
- return(success);
+ return (success);
} /* verify_total_reads() */
-
/*****************************************************************************
*
- * Function: verify_total_writes()
+ * Function: verify_total_writes()
*
- * Purpose: Query the server to obtain the total writes since the last
- * server counter reset, and compare this value with the supplied
- * expected value.
+ * Purpose: Query the server to obtain the total writes since the last
+ * server counter reset, and compare this value with the supplied
+ * expected value.
*
- * If the values match, return TRUE.
+ * If the values match, return TRUE.
*
- * If the values don't match, flag an error and return FALSE.
+ * If the values don't match, flag an error and return FALSE.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/6/10
+ * Programmer: JRM -- 5/6/10
*
*****************************************************************************/
static hbool_t
verify_total_writes(int expected_total_writes)
{
- const char * fcn_name = "verify_total_writes()";
- hbool_t success = TRUE; /* will set to FALSE if appropriate. */
- long reported_total_writes;
+ const char * fcn_name = "verify_total_writes()";
+ hbool_t success = TRUE; /* will set to FALSE if appropriate. */
+ long reported_total_writes;
struct mssg_t mssg;
- if ( success ) {
+ if (success) {
/* compose the message */
mssg.req = REQ_TTL_WRITES_CODE;
@@ -4695,67 +4252,59 @@ verify_total_writes(int expected_total_writes)
mssg.count = 0;
mssg.magic = MSSG_MAGIC;
- if ( ! send_mssg(&mssg, FALSE) ) {
+ if (!send_mssg(&mssg, FALSE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
- if ( success ) {
+ if (success) {
- if ( ! recv_mssg(&mssg, REQ_TTL_WRITES_RPLY_CODE) ) {
+ if (!recv_mssg(&mssg, REQ_TTL_WRITES_RPLY_CODE)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
- } else if ( ( mssg.req != REQ_TTL_WRITES_RPLY_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.base_addr != 0 ) ||
- ( mssg.len != 0 ) ||
- ( mssg.ver != 0 ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ }
+ else if ((mssg.req != REQ_TTL_WRITES_RPLY_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.base_addr != 0) || (mssg.len != 0) ||
+ (mssg.ver != 0) || (mssg.magic != MSSG_MAGIC)) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad data in req total reads reply.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in req total reads reply.\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
reported_total_writes = mssg.count;
}
}
- if ( success ) {
+ if (success) {
- if ( reported_total_writes != expected_total_writes ) {
+ if (reported_total_writes != expected_total_writes) {
nerrors++;
success = FALSE;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: reported/expected total writes mismatch (%ld/%ld).\n",
- world_mpi_rank, fcn_name,
- reported_total_writes, expected_total_writes);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: reported/expected total writes mismatch (%ld/%ld).\n",
+ world_mpi_rank, fcn_name, reported_total_writes, expected_total_writes);
}
}
}
- return(success);
+ return (success);
} /* verify_total_writes() */
-
/*****************************************************************************
* Function: unlock_entry()
*
@@ -4770,71 +4319,62 @@ verify_total_writes(int expected_total_writes)
*
* Modifications:
*
- * 7/11/06
- * Updated for the new local_len field in datum.
+ * 7/11/06
+ * Updated for the new local_len field in datum.
*
*****************************************************************************/
void
-unlock_entry(H5F_t * file_ptr,
- int32_t idx,
- unsigned int flags)
+unlock_entry(H5F_t *file_ptr, int32_t idx, unsigned int flags)
{
- const char * fcn_name = "unlock_entry()";
- herr_t dirtied;
- herr_t result;
- struct datum * entry_ptr;
+ const char * fcn_name = "unlock_entry()";
+ herr_t dirtied;
+ herr_t result;
+ struct datum *entry_ptr;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( file_ptr );
- HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
- HDassert( idx < virt_num_data_entries );
+ HDassert(file_ptr);
+ HDassert((0 <= idx) && (idx < NUM_DATA_ENTRIES));
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert( entry_ptr->locked );
+ HDassert(entry_ptr->locked);
- dirtied = ((flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG );
+ dirtied = ((flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG);
- if ( dirtied ) {
+ if (dirtied) {
(entry_ptr->ver)++;
entry_ptr->dirty = TRUE;
}
- result = H5AC_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]),
- entry_ptr->base_addr, (void *)(&(entry_ptr->header)), flags);
+ result = H5AC_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->base_addr,
+ (void *)(&(entry_ptr->header)), flags);
- if ( ( result < 0 ) ||
- ( entry_ptr->header.type != &(types[0]) ) ||
- ( ( entry_ptr->len != entry_ptr->header.size ) &&
- ( entry_ptr->local_len != entry_ptr->header.size ) ) ||
- ( entry_ptr->base_addr != entry_ptr->header.addr ) ) {
+ if ((result < 0) || (entry_ptr->header.type != &(types[0])) ||
+ ((entry_ptr->len != entry_ptr->header.size) &&
+ (entry_ptr->local_len != entry_ptr->header.size)) ||
+ (entry_ptr->base_addr != entry_ptr->header.addr)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: error in H5C_unprotect().\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: error in H5C_unprotect().\n", world_mpi_rank, fcn_name);
}
- } else {
+ }
+ else {
entry_ptr->locked = FALSE;
+ }
- }
-
- HDassert( ((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
+ HDassert(((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE);
- if ( ( (flags & H5AC__DIRTIED_FLAG) != 0 ) &&
- ( (flags & H5C__DELETED_FLAG) == 0 ) &&
- ( ! ( ( ( world_mpi_rank == 0 ) && ( entry_ptr->flushed ) )
- ||
- ( ( world_mpi_rank != 0 ) && ( entry_ptr->cleared ) )
- )
- )
- ) {
- HDassert( entry_ptr->header.is_dirty );
- HDassert( entry_ptr->dirty );
+ if (((flags & H5AC__DIRTIED_FLAG) != 0) && ((flags & H5C__DELETED_FLAG) == 0) &&
+ (!(((world_mpi_rank == 0) && (entry_ptr->flushed)) ||
+ ((world_mpi_rank != 0) && (entry_ptr->cleared))))) {
+ HDassert(entry_ptr->header.is_dirty);
+ HDassert(entry_ptr->dirty);
}
}
@@ -4842,7 +4382,6 @@ unlock_entry(H5F_t * file_ptr,
} /* unlock_entry() */
-
/*****************************************************************************
* Function: unpin_entry()
*
@@ -4857,113 +4396,102 @@ unlock_entry(H5F_t * file_ptr,
*
* Modifications:
*
- * JRM -- 8/15/06
- * Added assertion that entry is pinned on entry.
+ * JRM -- 8/15/06
+ * Added assertion that entry is pinned on entry.
*
*****************************************************************************/
-
static void
-unpin_entry(H5F_t * file_ptr,
- int32_t idx,
- hbool_t global,
- hbool_t dirty,
- hbool_t via_unprotect)
+unpin_entry(H5F_t *file_ptr, int32_t idx, hbool_t global, hbool_t dirty, hbool_t via_unprotect)
{
- const char * fcn_name = "unpin_entry()";
- herr_t result;
- unsigned int flags = H5AC__UNPIN_ENTRY_FLAG;
- struct datum * entry_ptr;
+ const char * fcn_name = "unpin_entry()";
+ herr_t result;
+ unsigned int flags = H5AC__UNPIN_ENTRY_FLAG;
+ struct datum *entry_ptr;
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
- HDassert( file_ptr );
- HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) );
- HDassert( idx < virt_num_data_entries );
+ HDassert(file_ptr);
+ HDassert((0 <= idx) && (idx < NUM_DATA_ENTRIES));
+ HDassert(idx < virt_num_data_entries);
entry_ptr = &(data[idx]);
- HDassert( (entry_ptr->header).is_pinned );
- HDassert ( ! ( entry_ptr->global_pinned && entry_ptr->local_pinned) );
- HDassert ( ( global && entry_ptr->global_pinned ) ||
- ( ! global && entry_ptr->local_pinned ) );
- HDassert ( ! ( dirty && ( ! global ) ) );
-
- if ( via_unprotect ) {
+ HDassert((entry_ptr->header).is_pinned);
+ HDassert(!(entry_ptr->global_pinned && entry_ptr->local_pinned));
+ HDassert((global && entry_ptr->global_pinned) || (!global && entry_ptr->local_pinned));
+ HDassert(!(dirty && (!global)));
- lock_entry(file_ptr, idx);
+ if (via_unprotect) {
- if ( dirty ) {
+ lock_entry(file_ptr, idx);
- flags |= H5AC__DIRTIED_FLAG;
- }
+ if (dirty) {
- unlock_entry(file_ptr, idx, flags);
-
- } else {
+ flags |= H5AC__DIRTIED_FLAG;
+ }
- if ( dirty ) {
+ unlock_entry(file_ptr, idx, flags);
+ }
+ else {
- mark_entry_dirty(idx);
+ if (dirty) {
- }
+ mark_entry_dirty(idx);
+ }
- result = H5AC_unpin_entry(entry_ptr);
+ result = H5AC_unpin_entry(entry_ptr);
- if ( result < 0 ) {
+ if (result < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: error in H5AC_unpin_entry().\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: error in H5AC_unpin_entry().\n", world_mpi_rank, fcn_name);
}
- }
- }
-
- HDassert( ! ((entry_ptr->header).is_pinned) );
-
- if ( global ) {
+ }
+ }
- entry_ptr->global_pinned = FALSE;
+ HDassert(!((entry_ptr->header).is_pinned));
- } else {
+ if (global) {
- entry_ptr->local_pinned = FALSE;
+ entry_ptr->global_pinned = FALSE;
+ }
+ else {
- }
+ entry_ptr->local_pinned = FALSE;
+ }
}
return;
} /* unpin_entry() */
-
/*****************************************************************************/
/****************************** test functions *******************************/
/*****************************************************************************/
-
/*****************************************************************************
*
- * Function: server_smoke_check()
+ * Function: server_smoke_check()
*
- * Purpose: Quick smoke check for the server process.
+ * Purpose: Quick smoke check for the server process.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 12/21/05
+ * Programmer: JRM -- 12/21/05
*
*****************************************************************************/
static hbool_t
server_smoke_check(void)
{
- const char * fcn_name = "server_smoke_check()";
- hbool_t success = TRUE;
- int max_nerrors;
+ const char * fcn_name = "server_smoke_check()";
+ hbool_t success = TRUE;
+ int max_nerrors;
struct mssg_t mssg;
- if ( world_mpi_rank == 0 ) {
+ if (world_mpi_rank == 0) {
TESTING("server smoke check");
}
@@ -4972,15 +4500,14 @@ server_smoke_check(void)
init_data();
reset_stats();
- if ( world_mpi_rank == world_server_mpi_rank ) {
+ if (world_mpi_rank == world_server_mpi_rank) {
- if ( ! server_main() ) {
+ if (!server_main()) {
/* some error occured in the server -- report failure */
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: server_main() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -4997,97 +4524,89 @@ server_smoke_check(void)
mssg.count = 0;
mssg.magic = MSSG_MAGIC;
- if ( ! ( success = send_mssg(&mssg, FALSE) ) ) {
+ if (!(success = send_mssg(&mssg, FALSE))) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on write.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on write.\n", world_mpi_rank, fcn_name);
}
}
#if DO_WRITE_REQ_ACK
/* try to receive the write ack from the server */
- if ( success ) {
+ if (success) {
success = recv_mssg(&mssg, WRITE_REQ_ACK_CODE);
- if ( ! success ) {
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
/* verify that we received the expected ack message */
- if ( success ) {
+ if (success) {
- if ( ( mssg.req != WRITE_REQ_ACK_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.base_addr != data[world_mpi_rank].base_addr ) ||
- ( mssg.len != data[world_mpi_rank].len ) ||
- ( mssg.ver != data[world_mpi_rank].ver ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ if ((mssg.req != WRITE_REQ_ACK_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.base_addr != data[world_mpi_rank].base_addr) ||
+ (mssg.len != data[world_mpi_rank].len) || (mssg.ver != data[world_mpi_rank].ver) ||
+ (mssg.magic != MSSG_MAGIC)) {
success = FALSE;
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", world_mpi_rank, fcn_name);
}
}
}
#endif /* DO_WRITE_REQ_ACK */
- do_sync();
+ do_sync();
- /* barrier to allow all writes to complete */
- if ( MPI_SUCCESS != MPI_Barrier(file_mpi_comm) ) {
+ /* barrier to allow all writes to complete */
+ if (MPI_SUCCESS != MPI_Barrier(file_mpi_comm)) {
success = FALSE;
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: barrier 1 failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: barrier 1 failed.\n", world_mpi_rank, fcn_name);
}
}
/* verify that the expected entries have been written, the total */
- if ( success ) {
+ if (success) {
success = verify_entry_writes(data[world_mpi_rank].base_addr, 1);
- }
+ }
- if ( success ) {
+ if (success) {
success = verify_entry_reads(data[world_mpi_rank].base_addr, 0);
- }
+ }
- if ( success ) {
+ if (success) {
success = verify_total_writes(world_mpi_size - 1);
}
- if ( success ) {
+ if (success) {
success = verify_total_reads(0);
}
- /* barrier to allow all writes to complete */
- if ( MPI_SUCCESS != MPI_Barrier(file_mpi_comm) ) {
+ /* barrier to allow all writes to complete */
+ if (MPI_SUCCESS != MPI_Barrier(file_mpi_comm)) {
success = FALSE;
nerrors++;
- if ( verbose ) {
+ if (verbose) {
- HDfprintf(stdout, "%d:%s: barrier 2 failed.\n",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: barrier 2 failed.\n", world_mpi_rank, fcn_name);
}
}
@@ -5102,144 +4621,134 @@ server_smoke_check(void)
mssg.count = 0;
mssg.magic = MSSG_MAGIC;
- if ( success ) {
+ if (success) {
success = send_mssg(&mssg, FALSE);
- if ( ! success ) {
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on write.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on write.\n", world_mpi_rank, fcn_name);
}
}
}
/* try to receive the reply from the server */
- if ( success ) {
+ if (success) {
success = recv_mssg(&mssg, READ_REQ_REPLY_CODE);
- if ( ! success ) {
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name);
}
}
}
/* verify that we got the expected result */
- if ( success ) {
+ if (success) {
- if ( ( mssg.req != READ_REQ_REPLY_CODE ) ||
- ( mssg.src != world_server_mpi_rank ) ||
- ( mssg.dest != world_mpi_rank ) ||
- ( mssg.base_addr != data[world_mpi_rank].base_addr ) ||
- ( mssg.len != data[world_mpi_rank].len ) ||
- ( mssg.ver != data[world_mpi_rank].ver ) ||
- ( mssg.magic != MSSG_MAGIC ) ) {
+ if ((mssg.req != READ_REQ_REPLY_CODE) || (mssg.src != world_server_mpi_rank) ||
+ (mssg.dest != world_mpi_rank) || (mssg.base_addr != data[world_mpi_rank].base_addr) ||
+ (mssg.len != data[world_mpi_rank].len) || (mssg.ver != data[world_mpi_rank].ver) ||
+ (mssg.magic != MSSG_MAGIC)) {
success = FALSE;
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: Bad data in read req reply.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Bad data in read req reply.\n", world_mpi_rank, fcn_name);
}
}
}
- /* barrier to allow all writes to complete */
- if ( MPI_SUCCESS != MPI_Barrier(file_mpi_comm) ) {
+ /* barrier to allow all writes to complete */
+ if (MPI_SUCCESS != MPI_Barrier(file_mpi_comm)) {
success = FALSE;
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: barrier 3 failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: barrier 3 failed.\n", world_mpi_rank, fcn_name);
}
}
/* verify that the expected entries have been read, and the total */
- if ( success ) {
+ if (success) {
success = verify_entry_writes(data[world_mpi_rank].base_addr, 1);
- }
+ }
- if ( success ) {
+ if (success) {
success = verify_entry_reads(data[world_mpi_rank].base_addr, 1);
- }
+ }
- if ( success ) {
+ if (success) {
success = verify_total_writes(world_mpi_size - 1);
}
- if ( success ) {
+ if (success) {
success = verify_total_reads(world_mpi_size - 1);
}
- if ( MPI_SUCCESS != MPI_Barrier(file_mpi_comm) ) {
+ if (MPI_SUCCESS != MPI_Barrier(file_mpi_comm)) {
success = FALSE;
nerrors++;
- if ( verbose ) {
+ if (verbose) {
- HDfprintf(stdout, "%d:%s: barrier 4 failed.\n",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: barrier 4 failed.\n", world_mpi_rank, fcn_name);
}
}
/* reset the counters */
- if ( success ) {
+ if (success) {
success = reset_server_counts();
}
- if ( MPI_SUCCESS != MPI_Barrier(file_mpi_comm) ) {
+ if (MPI_SUCCESS != MPI_Barrier(file_mpi_comm)) {
success = FALSE;
nerrors++;
- if ( verbose ) {
+ if (verbose) {
- HDfprintf(stdout, "%d:%s: barrier 5 failed.\n",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: barrier 5 failed.\n", world_mpi_rank, fcn_name);
}
}
/* verify that the counters have been reset */
- if ( success ) {
+ if (success) {
success = verify_entry_writes(data[world_mpi_rank].base_addr, 0);
- }
+ }
- if ( success ) {
+ if (success) {
success = verify_entry_reads(data[world_mpi_rank].base_addr, 0);
- }
+ }
- if ( success ) {
+ if (success) {
success = verify_total_writes(0);
}
- if ( success ) {
+ if (success) {
success = verify_total_reads(0);
}
- if ( MPI_SUCCESS != MPI_Barrier(file_mpi_comm) ) {
+ if (MPI_SUCCESS != MPI_Barrier(file_mpi_comm)) {
success = FALSE;
nerrors++;
- if ( verbose ) {
+ if (verbose) {
- HDfprintf(stdout, "%d:%s: barrier 6 failed.\n",
- world_mpi_rank, fcn_name);
+ HDfprintf(stdout, "%d:%s: barrier 6 failed.\n", world_mpi_rank, fcn_name);
}
}
@@ -5248,22 +4757,21 @@ server_smoke_check(void)
mssg.src = world_mpi_rank;
mssg.dest = world_server_mpi_rank;
mssg.mssg_num = -1; /* set by send function */
- mssg.base_addr = 0; /* not used */
- mssg.len = 0; /* not used */
- mssg.ver = 0; /* not used */
+ mssg.base_addr = 0; /* not used */
+ mssg.len = 0; /* not used */
+ mssg.ver = 0; /* not used */
mssg.count = 0;
mssg.magic = MSSG_MAGIC;
- if ( success ) {
+ if (success) {
success = send_mssg(&mssg, FALSE);
- if ( ! success ) {
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -5271,137 +4779,128 @@ server_smoke_check(void)
max_nerrors = get_max_nerrors();
- if ( world_mpi_rank == 0 ) {
+ if (world_mpi_rank == 0) {
- if ( max_nerrors == 0 ) {
+ if (max_nerrors == 0) {
- PASSED();
-
- } else {
+ PASSED();
+ }
+ else {
failures++;
H5_FAILED();
}
}
- success = ( ( success ) && ( max_nerrors == 0 ) );
+ success = ((success) && (max_nerrors == 0));
- return(success);
+ return (success);
} /* server_smoke_check() */
-
/*****************************************************************************
*
- * Function: smoke_check_1()
+ * Function: smoke_check_1()
*
- * Purpose: First smoke check for the parallel cache.
+ * Purpose: First smoke check for the parallel cache.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 1/4/06
+ * Programmer: JRM -- 1/4/06
*
*****************************************************************************/
static hbool_t
smoke_check_1(int metadata_write_strategy)
{
- const char * fcn_name = "smoke_check_1()";
- hbool_t success = TRUE;
- int i;
- int max_nerrors;
- hid_t fid = -1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ const char * fcn_name = "smoke_check_1()";
+ hbool_t success = TRUE;
+ int i;
+ int max_nerrors;
+ hid_t fid = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
struct mssg_t mssg;
- switch ( metadata_write_strategy ) {
+ switch (metadata_write_strategy) {
- case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #1 -- process 0 only md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #1 -- process 0 only md write strategy");
}
- break;
+ break;
- case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #1 -- distributed md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #1 -- distributed md write strategy");
}
- break;
+ break;
default:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #1 -- unknown md write strategy");
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #1 -- unknown md write strategy");
}
- break;
+ break;
}
nerrors = 0;
init_data();
reset_stats();
- if ( world_mpi_rank == world_server_mpi_rank ) {
+ if (world_mpi_rank == world_server_mpi_rank) {
- if ( ! server_main() ) {
+ if (!server_main()) {
/* some error occured in the server -- report failure */
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: server_main() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, fcn_name);
}
}
}
else /* run the clients */
{
- if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr,
- metadata_write_strategy) ) {
+ if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
- fid = -1;
+ fid = -1;
cache_ptr = NULL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, fcn_name);
}
}
- for ( i = 0; i < (virt_num_data_entries / 2); i++ )
- {
+ for (i = 0; i < (virt_num_data_entries / 2); i++) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
}
- for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ for (i = (virt_num_data_entries / 2) - 1; i >= 0; i--) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
}
/* Move the first half of the entries... */
- for ( i = 0; i < (virt_num_data_entries / 2); i++ )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ for (i = 0; i < (virt_num_data_entries / 2); i++) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
}
/* ...and then move them back. */
- for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ for (i = (virt_num_data_entries / 2) - 1; i >= 0; i--) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
}
- if ( fid >= 0 ) {
+ if (fid >= 0) {
- if ( ! take_down_cache(fid) ) {
+ if (!take_down_cache(fid)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -5410,10 +4909,9 @@ smoke_check_1(int metadata_write_strategy)
* and are clean.
*/
- for ( i = 0; i < NUM_DATA_ENTRIES; i++ )
- {
- HDassert( data_index[i] == i );
- HDassert( ! (data[i].dirty) );
+ for (i = 0; i < NUM_DATA_ENTRIES; i++) {
+ HDassert(data_index[i] == i);
+ HDassert(!(data[i].dirty));
}
/* compose the done message */
@@ -5421,22 +4919,21 @@ smoke_check_1(int metadata_write_strategy)
mssg.src = world_mpi_rank;
mssg.dest = world_server_mpi_rank;
mssg.mssg_num = -1; /* set by send function */
- mssg.base_addr = 0; /* not used */
- mssg.len = 0; /* not used */
- mssg.ver = 0; /* not used */
- mssg.count = 0; /* not used */
+ mssg.base_addr = 0; /* not used */
+ mssg.len = 0; /* not used */
+ mssg.ver = 0; /* not used */
+ mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( success ) {
+ if (success) {
success = send_mssg(&mssg, FALSE);
- if ( ! success ) {
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -5444,187 +4941,165 @@ smoke_check_1(int metadata_write_strategy)
max_nerrors = get_max_nerrors();
- if ( world_mpi_rank == 0 ) {
+ if (world_mpi_rank == 0) {
- if ( max_nerrors == 0 ) {
+ if (max_nerrors == 0) {
- PASSED();
-
- } else {
+ PASSED();
+ }
+ else {
failures++;
H5_FAILED();
}
}
- success = ( ( success ) && ( max_nerrors == 0 ) );
+ success = ((success) && (max_nerrors == 0));
- return(success);
+ return (success);
} /* smoke_check_1() */
-
/*****************************************************************************
*
- * Function: smoke_check_2()
+ * Function: smoke_check_2()
*
- * Purpose: Second smoke check for the parallel cache.
+ * Purpose: Second smoke check for the parallel cache.
*
- * Introduce random reads, but keep all processes with roughly
- * the same work load.
+ * Introduce random reads, but keep all processes with roughly
+ * the same work load.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 1/12/06
+ * Programmer: JRM -- 1/12/06
*
*****************************************************************************/
static hbool_t
smoke_check_2(int metadata_write_strategy)
{
- const char * fcn_name = "smoke_check_2()";
- hbool_t success = TRUE;
- int i;
- int max_nerrors;
- hid_t fid = -1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ const char * fcn_name = "smoke_check_2()";
+ hbool_t success = TRUE;
+ int i;
+ int max_nerrors;
+ hid_t fid = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
struct mssg_t mssg;
- switch ( metadata_write_strategy ) {
+ switch (metadata_write_strategy) {
- case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #2 -- process 0 only md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #2 -- process 0 only md write strategy");
}
- break;
+ break;
- case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #2 -- distributed md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #2 -- distributed md write strategy");
}
- break;
+ break;
default:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #2 -- unknown md write strategy");
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #2 -- unknown md write strategy");
}
- break;
+ break;
}
nerrors = 0;
init_data();
reset_stats();
- if ( world_mpi_rank == world_server_mpi_rank ) {
+ if (world_mpi_rank == world_server_mpi_rank) {
- if ( ! server_main() ) {
+ if (!server_main()) {
/* some error occured in the server -- report failure */
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: server_main() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, fcn_name);
}
}
}
else /* run the clients */
{
- if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr,
- metadata_write_strategy) ) {
+ if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
- fid = -1;
+ fid = -1;
cache_ptr = NULL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, fcn_name);
}
}
- for ( i = 0; i < (virt_num_data_entries / 2); i++ )
- {
+ for (i = 0; i < (virt_num_data_entries / 2); i++) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- if ( i > 100 ) {
+ if (i > 100) {
- lock_and_unlock_random_entries(file_ptr, (i - 100), i, 0, 10);
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i, 0, 10);
}
}
- for ( i = 0; i < (virt_num_data_entries / 2); i+=61 )
- {
- /* Make sure we don't step on any locally pinned entries */
- if ( data[i].local_pinned ) {
- unpin_entry(file_ptr, i, FALSE, FALSE, FALSE);
- }
+ for (i = 0; i < (virt_num_data_entries / 2); i += 61) {
+ /* Make sure we don't step on any locally pinned entries */
+ if (data[i].local_pinned) {
+ unpin_entry(file_ptr, i, FALSE, FALSE, FALSE);
+ }
- pin_entry(file_ptr, i, TRUE, FALSE);
- }
+ pin_entry(file_ptr, i, TRUE, FALSE);
+ }
- for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-=2 )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
- lock_and_unlock_random_entries(file_ptr, 0,
- (virt_num_data_entries / 20),
- 0, 100);
- local_pin_and_unpin_random_entries(file_ptr, 0,
- (virt_num_data_entries / 4),
- 0, 3);
+ for (i = (virt_num_data_entries / 2) - 1; i >= 0; i -= 2) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ lock_and_unlock_random_entries(file_ptr, 0, (virt_num_data_entries / 20), 0, 100);
+ local_pin_and_unpin_random_entries(file_ptr, 0, (virt_num_data_entries / 4), 0, 3);
}
- for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
- lock_and_unlock_random_entries(file_ptr, 0,
- (virt_num_data_entries / 10),
- 0, 100);
+ for (i = 0; i < (virt_num_data_entries / 2); i += 2) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_and_unlock_random_entries(file_ptr, 0, (virt_num_data_entries / 10), 0, 100);
}
- /* we can't move pinned entries, so release any local pins now. */
- local_unpin_all_entries(file_ptr, FALSE);
+ /* we can't move pinned entries, so release any local pins now. */
+ local_unpin_all_entries(file_ptr, FALSE);
/* Move the first half of the entries... */
- for ( i = 0; i < (virt_num_data_entries / 2); i++ )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(file_ptr, 0,
- ((virt_num_data_entries / 50) - 1),
- 0, 100);
+ for (i = 0; i < (virt_num_data_entries / 2); i++) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0, ((virt_num_data_entries / 50) - 1), 0, 100);
}
/* ...and then move them back. */
- for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
- move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(file_ptr, 0,
- (virt_num_data_entries / 100),
- 0, 100);
+ for (i = (virt_num_data_entries / 2) - 1; i >= 0; i--) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0, (virt_num_data_entries / 100), 0, 100);
}
- for ( i = 0; i < (virt_num_data_entries / 2); i+=61 )
- {
- hbool_t via_unprotect = ( (((unsigned)i) & 0x01) == 0 );
- hbool_t dirty = ( (((unsigned)i) & 0x02) == 0 );
+ for (i = 0; i < (virt_num_data_entries / 2); i += 61) {
+ hbool_t via_unprotect = ((((unsigned)i) & 0x01) == 0);
+ hbool_t dirty = ((((unsigned)i) & 0x02) == 0);
- unpin_entry(file_ptr, i, TRUE, dirty, via_unprotect);
- }
+ unpin_entry(file_ptr, i, TRUE, dirty, via_unprotect);
+ }
- if ( fid >= 0 ) {
+ if (fid >= 0) {
- if ( ! take_down_cache(fid) ) {
+ if (!take_down_cache(fid)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -5633,10 +5108,9 @@ smoke_check_2(int metadata_write_strategy)
* and are clean.
*/
- for ( i = 0; i < NUM_DATA_ENTRIES; i++ )
- {
- HDassert( data_index[i] == i );
- HDassert( ! (data[i].dirty) );
+ for (i = 0; i < NUM_DATA_ENTRIES; i++) {
+ HDassert(data_index[i] == i);
+ HDassert(!(data[i].dirty));
}
/* compose the done message */
@@ -5644,22 +5118,21 @@ smoke_check_2(int metadata_write_strategy)
mssg.src = world_mpi_rank;
mssg.dest = world_server_mpi_rank;
mssg.mssg_num = -1; /* set by send function */
- mssg.base_addr = 0; /* not used */
- mssg.len = 0; /* not used */
- mssg.ver = 0; /* not used */
- mssg.count = 0; /* not used */
+ mssg.base_addr = 0; /* not used */
+ mssg.len = 0; /* not used */
+ mssg.ver = 0; /* not used */
+ mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( success ) {
+ if (success) {
success = send_mssg(&mssg, FALSE);
- if ( ! success ) {
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -5667,258 +5140,252 @@ smoke_check_2(int metadata_write_strategy)
max_nerrors = get_max_nerrors();
- if ( world_mpi_rank == 0 ) {
-
- if ( max_nerrors == 0 ) {
+ if (world_mpi_rank == 0) {
- PASSED();
+ if (max_nerrors == 0) {
- } else {
+ PASSED();
+ }
+ else {
failures++;
H5_FAILED();
}
}
- success = ( ( success ) && ( max_nerrors == 0 ) );
+ success = ((success) && (max_nerrors == 0));
- return(success);
+ return (success);
} /* smoke_check_2() */
-
/*****************************************************************************
*
- * Function: smoke_check_3()
+ * Function: smoke_check_3()
*
- * Purpose: Third smoke check for the parallel cache.
+ * Purpose: Third smoke check for the parallel cache.
*
- * Use random reads to vary the loads on the diffferent
- * processors. Also force different cache size adjustments.
+ * Use random reads to vary the loads on the diffferent
+ * processors. Also force different cache size adjustments.
*
- * In this test, load process 0 heavily, and the other
- * processes lightly.
+ * In this test, load process 0 heavily, and the other
+ * processes lightly.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 1/13/06
+ * Programmer: JRM -- 1/13/06
*
*****************************************************************************/
static hbool_t
smoke_check_3(int metadata_write_strategy)
{
- const char * fcn_name = "smoke_check_3()";
- hbool_t success = TRUE;
- hbool_t verbose = FALSE;
- int cp = 0;
- int i;
- int max_nerrors;
- int min_count;
- int max_count;
- int min_idx;
- int max_idx;
- hid_t fid = -1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ const char * fcn_name = "smoke_check_3()";
+ hbool_t success = TRUE;
+ int cp = 0;
+ int i;
+ int max_nerrors;
+ int min_count;
+ int max_count;
+ int min_idx;
+ int max_idx;
+ hid_t fid = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
struct mssg_t mssg;
- switch ( metadata_write_strategy ) {
+ switch (metadata_write_strategy) {
- case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #3 -- process 0 only md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #3 -- process 0 only md write strategy");
}
- break;
+ break;
- case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #3 -- distributed md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #3 -- distributed md write strategy");
}
- break;
+ break;
default:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #3 -- unknown md write strategy");
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #3 -- unknown md write strategy");
}
- break;
+ break;
}
/* 0 */
- if ( verbose ) { HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); }
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
nerrors = 0;
init_data();
reset_stats();
- if ( world_mpi_rank == world_server_mpi_rank ) {
+ if (world_mpi_rank == world_server_mpi_rank) {
/* 1 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
- if ( ! server_main() ) {
+ if (!server_main()) {
/* some error occured in the server -- report failure */
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: server_main() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, fcn_name);
}
}
/* 2 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
}
else /* run the clients */
{
/* 1 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
- if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr,
- metadata_write_strategy) ) {
+ if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
- fid = -1;
+ fid = -1;
cache_ptr = NULL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, fcn_name);
}
}
/* 2 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
min_count = 100 / ((file_mpi_rank + 1) * (file_mpi_rank + 1));
max_count = min_count + 50;
- for ( i = 0; i < (virt_num_data_entries / 4); i++ )
- {
+ for (i = 0; i < (virt_num_data_entries / 4); i++) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- if ( i > 100 ) {
+ if (i > 100) {
- lock_and_unlock_random_entries(file_ptr, (i - 100), i,
- min_count, max_count);
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i, min_count, max_count);
}
}
/* 3 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
-
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
min_count = 100 / ((file_mpi_rank + 2) * (file_mpi_rank + 2));
max_count = min_count + 50;
- for ( i = (virt_num_data_entries / 4);
- i < (virt_num_data_entries / 2);
- i++ )
- {
+ for (i = (virt_num_data_entries / 4); i < (virt_num_data_entries / 2); i++) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- if ( i % 59 == 0 ) {
+ if (i % 59 == 0) {
- hbool_t dirty = ( (i % 2) == 0);
+ hbool_t dirty = ((i % 2) == 0);
- if ( data[i].local_pinned ) {
- unpin_entry(file_ptr, i, FALSE, FALSE, FALSE);
- }
+ if (data[i].local_pinned) {
+ unpin_entry(file_ptr, i, FALSE, FALSE, FALSE);
+ }
- pin_entry(file_ptr, i, TRUE, dirty);
+ pin_entry(file_ptr, i, TRUE, dirty);
- HDassert( !dirty || data[i].header.is_dirty );
- HDassert( data[i].header.is_pinned );
- HDassert( data[i].global_pinned );
- HDassert( ! data[i].local_pinned );
- }
+ HDassert(!dirty || data[i].header.is_dirty);
+ HDassert(data[i].header.is_pinned);
+ HDassert(data[i].global_pinned);
+ HDassert(!data[i].local_pinned);
+ }
- if ( i > 100 ) {
+ if (i > 100) {
- lock_and_unlock_random_entries(file_ptr, (i - 100), i,
- min_count, max_count);
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i, min_count, max_count);
}
- local_pin_and_unpin_random_entries(file_ptr, 0,
- virt_num_data_entries / 4,
- 0, (file_mpi_rank + 2));
-
- }
+ local_pin_and_unpin_random_entries(file_ptr, 0, virt_num_data_entries / 4, 0,
+ (file_mpi_rank + 2));
+ }
/* 4 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
-
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
- /* flush the file to be sure that we have no problems flushing
- * pinned entries
- */
- if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
+ /* flush the file to be sure that we have no problems flushing
+ * pinned entries
+ */
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, fcn_name);
}
}
/* 5 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
-
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
min_idx = 0;
- max_idx = ((virt_num_data_entries / 10) /
- ((file_mpi_rank + 1) * (file_mpi_rank + 1))) - 1;
- if ( max_idx <= min_idx ) {
+ max_idx = ((virt_num_data_entries / 10) / ((file_mpi_rank + 1) * (file_mpi_rank + 1))) - 1;
+ if (max_idx <= min_idx) {
max_idx = min_idx + 10;
}
- for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
- {
- if ( ( i >= (virt_num_data_entries / 4) ) && ( i % 59 == 0 ) ) {
+ for (i = (virt_num_data_entries / 2) - 1; i >= 0; i--) {
+ if ((i >= (virt_num_data_entries / 4)) && (i % 59 == 0)) {
- hbool_t via_unprotect = ( (((unsigned)i) & 0x02) == 0 );
- hbool_t dirty = ( (((unsigned)i) & 0x04) == 0 );
+ hbool_t via_unprotect = ((((unsigned)i) & 0x02) == 0);
+ hbool_t dirty = ((((unsigned)i) & 0x04) == 0);
- HDassert( data[i].global_pinned );
- HDassert( ! data[i].local_pinned );
+ HDassert(data[i].global_pinned);
+ HDassert(!data[i].local_pinned);
- unpin_entry(file_ptr, i, TRUE, dirty,
- via_unprotect);
- }
- if ( i % 2 == 0 ) {
+ unpin_entry(file_ptr, i, TRUE, dirty, via_unprotect);
+ }
+ if (i % 2 == 0) {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
- local_pin_and_unpin_random_entries(file_ptr, 0,
- virt_num_data_entries / 2,
- 0, 2);
- lock_and_unlock_random_entries(file_ptr,
- min_idx, max_idx, 0, 100);
- }
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ local_pin_and_unpin_random_entries(file_ptr, 0, virt_num_data_entries / 2, 0, 2);
+ lock_and_unlock_random_entries(file_ptr, min_idx, max_idx, 0, 100);
+ }
}
/* 6 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
min_idx = 0;
- max_idx = ((virt_num_data_entries / 10) /
- ((file_mpi_rank + 3) * (file_mpi_rank + 3))) - 1;
- if ( max_idx <= min_idx ) {
+ max_idx = ((virt_num_data_entries / 10) / ((file_mpi_rank + 3) * (file_mpi_rank + 3))) - 1;
+ if (max_idx <= min_idx) {
max_idx = min_idx + 10;
}
- for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
- lock_and_unlock_random_entries(file_ptr,
- min_idx, max_idx, 0, 100);
+ for (i = 0; i < (virt_num_data_entries / 2); i += 2) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_and_unlock_random_entries(file_ptr, min_idx, max_idx, 0, 100);
}
/* 7 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
/* we can't move pinned entries, so release any local pins now. */
local_unpin_all_entries(file_ptr, FALSE);
@@ -5927,32 +5394,30 @@ smoke_check_3(int metadata_write_strategy)
max_count = min_count + 100;
/* move the first half of the entries... */
- for ( i = 0; i < (virt_num_data_entries / 2); i++ )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(file_ptr, 0,
- (virt_num_data_entries / 20),
- min_count, max_count);
+ for (i = 0; i < (virt_num_data_entries / 2); i++) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0, (virt_num_data_entries / 20), min_count, max_count);
}
/* 8 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
/* ...and then move them back. */
- for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
- move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(file_ptr, 0,
- (virt_num_data_entries / 40),
- min_count, max_count);
+ for (i = (virt_num_data_entries / 2) - 1; i >= 0; i--) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0, (virt_num_data_entries / 40), min_count, max_count);
}
/* 9 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
/* finally, do some dirty lock/unlocks while we give the cache
* a chance t reduce its size.
@@ -5960,51 +5425,49 @@ smoke_check_3(int metadata_write_strategy)
min_count = 200 / ((file_mpi_rank + 1) * (file_mpi_rank + 1));
max_count = min_count + 100;
- for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
- {
- local_pin_and_unpin_random_entries(file_ptr, 0,
- (virt_num_data_entries / 2),
- 0, 5);
+ for (i = 0; i < (virt_num_data_entries / 2); i += 2) {
+ local_pin_and_unpin_random_entries(file_ptr, 0, (virt_num_data_entries / 2), 0, 5);
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
- if ( i > 100 ) {
+ if (i > 100) {
- lock_and_unlock_random_entries(file_ptr, (i - 100), i,
- min_count, max_count);
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i, min_count, max_count);
}
}
/* 10 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
/* release any local pins before we take down the cache. */
local_unpin_all_entries(file_ptr, FALSE);
- if ( fid >= 0 ) {
+ if (fid >= 0) {
- if ( ! take_down_cache(fid) ) {
+ if (!take_down_cache(fid)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, fcn_name);
}
}
}
/* 11 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
/* verify that all instances of datum are back where the started
* and are clean.
*/
- for ( i = 0; i < NUM_DATA_ENTRIES; i++ )
- {
- HDassert( data_index[i] == i );
- HDassert( ! (data[i].dirty) );
+ for (i = 0; i < NUM_DATA_ENTRIES; i++) {
+ HDassert(data_index[i] == i);
+ HDassert(!(data[i].dirty));
}
/* compose the done message */
@@ -6012,280 +5475,253 @@ smoke_check_3(int metadata_write_strategy)
mssg.src = world_mpi_rank;
mssg.dest = world_server_mpi_rank;
mssg.mssg_num = -1; /* set by send function */
- mssg.base_addr = 0; /* not used */
- mssg.len = 0; /* not used */
- mssg.ver = 0; /* not used */
- mssg.count = 0; /* not used */
+ mssg.base_addr = 0; /* not used */
+ mssg.len = 0; /* not used */
+ mssg.ver = 0; /* not used */
+ mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( success ) {
-
+ if (success) {
success = send_mssg(&mssg, FALSE);
- if ( ! success ) {
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, fcn_name);
}
}
}
/* 12 */
- if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);}
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
}
max_nerrors = get_max_nerrors();
- if ( world_mpi_rank == 0 ) {
-
- if ( max_nerrors == 0 ) {
+ if (world_mpi_rank == 0) {
- PASSED();
+ if (max_nerrors == 0) {
- } else {
+ PASSED();
+ }
+ else {
failures++;
H5_FAILED();
}
}
- success = ( ( success ) && ( max_nerrors == 0 ) );
+ success = ((success) && (max_nerrors == 0));
- return(success);
+ return (success);
} /* smoke_check_3() */
-
/*****************************************************************************
*
- * Function: smoke_check_4()
+ * Function: smoke_check_4()
*
- * Purpose: Fourth smoke check for the parallel cache.
+ * Purpose: Fourth smoke check for the parallel cache.
*
- * Use random reads to vary the loads on the diffferent
- * processors. Also force different cache size adjustments.
+ * Use random reads to vary the loads on the diffferent
+ * processors. Also force different cache size adjustments.
*
- * In this test, load process 0 lightly, and the other
- * processes heavily.
+ * In this test, load process 0 lightly, and the other
+ * processes heavily.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 1/13/06
+ * Programmer: JRM -- 1/13/06
*
*****************************************************************************/
static hbool_t
smoke_check_4(int metadata_write_strategy)
{
- const char * fcn_name = "smoke_check_4()";
- hbool_t success = TRUE;
- int i;
- int max_nerrors;
- int min_count;
- int max_count;
- int min_idx;
- int max_idx;
- hid_t fid = -1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ const char * fcn_name = "smoke_check_4()";
+ hbool_t success = TRUE;
+ int i;
+ int max_nerrors;
+ int min_count;
+ int max_count;
+ int min_idx;
+ int max_idx;
+ hid_t fid = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
struct mssg_t mssg;
- switch ( metadata_write_strategy ) {
+ switch (metadata_write_strategy) {
- case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #4 -- process 0 only md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #4 -- process 0 only md write strategy");
}
- break;
+ break;
- case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #4 -- distributed md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #4 -- distributed md write strategy");
}
- break;
+ break;
default:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #4 -- unknown md write strategy");
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #4 -- unknown md write strategy");
}
- break;
+ break;
}
nerrors = 0;
init_data();
reset_stats();
- if ( world_mpi_rank == world_server_mpi_rank ) {
+ if (world_mpi_rank == world_server_mpi_rank) {
- if ( ! server_main() ) {
+ if (!server_main()) {
/* some error occured in the server -- report failure */
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: server_main() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, fcn_name);
}
}
}
else /* run the clients */
{
- if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr,
- metadata_write_strategy) ) {
+ if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
- fid = -1;
+ fid = -1;
cache_ptr = NULL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, fcn_name);
}
}
-
min_count = 100 * (file_mpi_rank % 4);
max_count = min_count + 50;
- for ( i = 0; i < (virt_num_data_entries / 4); i++ )
- {
+ for (i = 0; i < (virt_num_data_entries / 4); i++) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
- if ( i > 100 ) {
+ if (i > 100) {
- lock_and_unlock_random_entries(file_ptr, (i - 100), i,
- min_count, max_count);
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i, min_count, max_count);
}
}
min_count = 10 * (file_mpi_rank % 4);
max_count = min_count + 100;
- for ( i = (virt_num_data_entries / 4);
- i < (virt_num_data_entries / 2);
- i++ )
- {
- if ( i % 2 == 0 ) {
+ for (i = (virt_num_data_entries / 4); i < (virt_num_data_entries / 2); i++) {
+ if (i % 2 == 0) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
+ }
+ else {
- } else {
-
- /* Insert some entries pinned, and then unpin them
- * immediately. We have tested pinned entries elsewhere,
- * so it should be sufficient to verify that the
- * entries are in fact pinned (which unpin_entry() should do).
- */
+ /* Insert some entries pinned, and then unpin them
+ * immediately. We have tested pinned entries elsewhere,
+ * so it should be sufficient to verify that the
+ * entries are in fact pinned (which unpin_entry() should do).
+ */
insert_entry(cache_ptr, file_ptr, i, H5C__PIN_ENTRY_FLAG);
unpin_entry(file_ptr, i, TRUE, FALSE, FALSE);
- }
+ }
- if ( i % 59 == 0 ) {
+ if (i % 59 == 0) {
- hbool_t dirty = ( (i % 2) == 0);
+ hbool_t dirty = ((i % 2) == 0);
- if ( data[i].local_pinned ) {
+ if (data[i].local_pinned) {
unpin_entry(file_ptr, i, FALSE, FALSE, FALSE);
}
pin_entry(file_ptr, i, TRUE, dirty);
- HDassert( !dirty || data[i].header.is_dirty );
- HDassert( data[i].header.is_pinned );
- HDassert( data[i].global_pinned );
- HDassert( ! data[i].local_pinned );
+ HDassert(!dirty || data[i].header.is_dirty);
+ HDassert(data[i].header.is_pinned);
+ HDassert(data[i].global_pinned);
+ HDassert(!data[i].local_pinned);
}
- if ( i > 100 ) {
+ if (i > 100) {
- lock_and_unlock_random_entries(file_ptr, (i - 100), i,
- min_count, max_count);
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i, min_count, max_count);
}
- local_pin_and_unpin_random_entries(file_ptr, 0,
- (virt_num_data_entries / 4),
- 0, (file_mpi_rank + 2));
+ local_pin_and_unpin_random_entries(file_ptr, 0, (virt_num_data_entries / 4), 0,
+ (file_mpi_rank + 2));
}
-
/* flush the file to be sure that we have no problems flushing
- * pinned entries
- */
- if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
+ * pinned entries
+ */
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, fcn_name);
}
}
-
min_idx = 0;
- max_idx = (((virt_num_data_entries / 10) / 4) *
- ((file_mpi_rank % 4) + 1)) - 1;
+ max_idx = (((virt_num_data_entries / 10) / 4) * ((file_mpi_rank % 4) + 1)) - 1;
- for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
- {
- if ( ( i >= (virt_num_data_entries / 4) ) && ( i % 59 == 0 ) ) {
+ for (i = (virt_num_data_entries / 2) - 1; i >= 0; i--) {
+ if ((i >= (virt_num_data_entries / 4)) && (i % 59 == 0)) {
- hbool_t via_unprotect = ( (((unsigned)i) & 0x02) == 0 );
- hbool_t dirty = ( (((unsigned)i) & 0x04) == 0 );
+ hbool_t via_unprotect = ((((unsigned)i) & 0x02) == 0);
+ hbool_t dirty = ((((unsigned)i) & 0x04) == 0);
- HDassert( data[i].global_pinned );
- HDassert( ! data[i].local_pinned );
+ HDassert(data[i].global_pinned);
+ HDassert(!data[i].local_pinned);
unpin_entry(file_ptr, i, TRUE, dirty, via_unprotect);
}
- if ( i % 2 == 0 ) {
+ if (i % 2 == 0) {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
- lock_and_unlock_random_entries(file_ptr,
- min_idx, max_idx, 0, 100);
- }
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ lock_and_unlock_random_entries(file_ptr, min_idx, max_idx, 0, 100);
+ }
}
min_idx = 0;
- max_idx = (((virt_num_data_entries / 10) / 8) *
- ((file_mpi_rank % 4) + 1)) - 1;
+ max_idx = (((virt_num_data_entries / 10) / 8) * ((file_mpi_rank % 4) + 1)) - 1;
- for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
- lock_and_unlock_random_entries(file_ptr,
- min_idx, max_idx, 0, 100);
+ for (i = 0; i < (virt_num_data_entries / 2); i += 2) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ lock_and_unlock_random_entries(file_ptr, min_idx, max_idx, 0, 100);
}
- /* we can't move pinned entries, so release any local pins now. */
- local_unpin_all_entries(file_ptr, FALSE);
+ /* we can't move pinned entries, so release any local pins now. */
+ local_unpin_all_entries(file_ptr, FALSE);
min_count = 10 * (file_mpi_rank % 4);
max_count = min_count + 100;
/* move the first half of the entries... */
- for ( i = 0; i < (virt_num_data_entries / 2); i++ )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
- move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(file_ptr, 0,
- (virt_num_data_entries / 20),
- min_count, max_count);
+ for (i = 0; i < (virt_num_data_entries / 2); i++) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0, (virt_num_data_entries / 20), min_count, max_count);
}
/* ...and then move them back. */
- for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
- move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
- lock_and_unlock_random_entries(file_ptr, 0,
- (virt_num_data_entries / 40),
- min_count, max_count);
+ for (i = (virt_num_data_entries / 2) - 1; i >= 0; i--) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ move_entry(file_ptr, i, (i + (virt_num_data_entries / 2)));
+ lock_and_unlock_random_entries(file_ptr, 0, (virt_num_data_entries / 40), min_count, max_count);
}
/* finally, do some dirty lock/unlocks while we give the cache
@@ -6294,26 +5730,23 @@ smoke_check_4(int metadata_write_strategy)
min_count = 100 * (file_mpi_rank % 4);
max_count = min_count + 100;
- for ( i = 0; i < (virt_num_data_entries / 2); i+=2 )
- {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ for (i = 0; i < (virt_num_data_entries / 2); i += 2) {
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
- if ( i > 100 ) {
+ if (i > 100) {
- lock_and_unlock_random_entries(file_ptr, (i - 100), i,
- min_count, max_count);
+ lock_and_unlock_random_entries(file_ptr, (i - 100), i, min_count, max_count);
}
}
- if ( fid >= 0 ) {
+ if (fid >= 0) {
- if ( ! take_down_cache(fid) ) {
+ if (!take_down_cache(fid)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -6322,10 +5755,9 @@ smoke_check_4(int metadata_write_strategy)
* and are clean.
*/
- for ( i = 0; i < NUM_DATA_ENTRIES; i++ )
- {
- HDassert( data_index[i] == i );
- HDassert( ! (data[i].dirty) );
+ for (i = 0; i < NUM_DATA_ENTRIES; i++) {
+ HDassert(data_index[i] == i);
+ HDassert(!(data[i].dirty));
}
/* compose the done message */
@@ -6333,23 +5765,21 @@ smoke_check_4(int metadata_write_strategy)
mssg.src = world_mpi_rank;
mssg.dest = world_server_mpi_rank;
mssg.mssg_num = -1; /* set by send function */
- mssg.base_addr = 0; /* not used */
- mssg.len = 0; /* not used */
- mssg.ver = 0; /* not used */
- mssg.count = 0; /* not used */
+ mssg.base_addr = 0; /* not used */
+ mssg.len = 0; /* not used */
+ mssg.ver = 0; /* not used */
+ mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( success ) {
-
+ if (success) {
success = send_mssg(&mssg, FALSE);
- if ( ! success ) {
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -6357,241 +5787,226 @@ smoke_check_4(int metadata_write_strategy)
max_nerrors = get_max_nerrors();
- if ( world_mpi_rank == 0 ) {
-
- if ( max_nerrors == 0 ) {
+ if (world_mpi_rank == 0) {
- PASSED();
+ if (max_nerrors == 0) {
- } else {
+ PASSED();
+ }
+ else {
failures++;
H5_FAILED();
}
}
- success = ( ( success ) && ( max_nerrors == 0 ) );
+ success = ((success) && (max_nerrors == 0));
- return(success);
+ return (success);
} /* smoke_check_4() */
-
/*****************************************************************************
*
- * Function: smoke_check_5()
+ * Function: smoke_check_5()
*
- * Purpose: Similar to smoke check 1, but modified to verify that
- * H5AC_mark_entry_dirty() works in the parallel case.
+ * Purpose: Similar to smoke check 1, but modified to verify that
+ * H5AC_mark_entry_dirty() works in the parallel case.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 5/18/06
+ * Programmer: JRM -- 5/18/06
*
*****************************************************************************/
static hbool_t
smoke_check_5(int metadata_write_strategy)
{
- const char * fcn_name = "smoke_check_5()";
- hbool_t success = TRUE;
- hbool_t verbose = FALSE;
- int cp = 0;
- int i;
- int max_nerrors;
- hid_t fid = -1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
+ const char * fcn_name = "smoke_check_5()";
+ hbool_t success = TRUE;
+ int cp = 0;
+ int i;
+ int max_nerrors;
+ hid_t fid = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
struct mssg_t mssg;
- switch ( metadata_write_strategy ) {
+ switch (metadata_write_strategy) {
- case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #5 -- process 0 only md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #5 -- process 0 only md write strategy");
}
- break;
+ break;
- case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #5 -- distributed md write strategy");
+ case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #5 -- distributed md write strategy");
}
- break;
+ break;
default:
- if ( world_mpi_rank == 0 ) {
- TESTING("smoke check #5 -- unknown md write strategy");
+ if (world_mpi_rank == 0) {
+ TESTING("smoke check #5 -- unknown md write strategy");
}
- break;
+ break;
}
-
/* 0 */
- if ( verbose ) { HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); }
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ }
nerrors = 0;
init_data();
reset_stats();
- if ( world_mpi_rank == world_server_mpi_rank ) {
+ if (world_mpi_rank == world_server_mpi_rank) {
/* 1 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
- if ( ! server_main() ) {
+ if (!server_main()) {
/* some error occured in the server -- report failure */
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: server_main() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, fcn_name);
}
}
/* 2 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
}
else /* run the clients */
{
/* 1 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
- if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr,
- metadata_write_strategy) ) {
+ if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
- fid = -1;
+ fid = -1;
cache_ptr = NULL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, fcn_name);
}
}
/* 2 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
- for ( i = 0; i < (virt_num_data_entries / 2); i++ )
- {
+ for (i = 0; i < (virt_num_data_entries / 2); i++) {
insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET);
}
/* 3 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
- /* flush the file so we can lock known clean entries. */
- if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
+ /* flush the file so we can lock known clean entries. */
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, fcn_name);
}
}
/* 4 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
- for ( i = 0; i < (virt_num_data_entries / 4); i++ )
- {
- lock_entry(file_ptr, i);
+ for (i = 0; i < (virt_num_data_entries / 4); i++) {
+ lock_entry(file_ptr, i);
- if ( i % 2 == 0 )
- {
- mark_entry_dirty(i);
- }
+ if (i % 2 == 0) {
+ mark_entry_dirty(i);
+ }
- unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
+ unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET);
- if ( i % 2 == 1 )
- {
- if ( i % 4 == 1 ) {
+ if (i % 2 == 1) {
+ if (i % 4 == 1) {
- lock_entry(file_ptr, i);
- unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
- }
+ lock_entry(file_ptr, i);
+ unlock_entry(file_ptr, i, H5AC__DIRTIED_FLAG);
+ }
- expunge_entry(file_ptr, i);
- }
+ expunge_entry(file_ptr, i);
+ }
}
/* 5 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
- for ( i = (virt_num_data_entries / 2) - 1;
- i >= (virt_num_data_entries / 4);
- i-- )
- {
- pin_entry(file_ptr, i, TRUE, FALSE);
+ for (i = (virt_num_data_entries / 2) - 1; i >= (virt_num_data_entries / 4); i--) {
+ pin_entry(file_ptr, i, TRUE, FALSE);
- if ( i % 2 == 0 )
- {
- if ( i % 8 <= 4 ) {
+ if (i % 2 == 0) {
+ if (i % 8 <= 4) {
- resize_entry(i, data[i].len / 2);
- }
+ resize_entry(i, data[i].len / 2);
+ }
mark_entry_dirty(i);
- if ( i % 8 <= 4 ) {
+ if (i % 8 <= 4) {
- resize_entry(i, data[i].len);
- }
- }
+ resize_entry(i, data[i].len);
+ }
+ }
- unpin_entry(file_ptr, i, TRUE, FALSE, FALSE);
+ unpin_entry(file_ptr, i, TRUE, FALSE, FALSE);
}
/* 6 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
- if ( fid >= 0 ) {
+ if (fid >= 0) {
- if ( ! take_down_cache(fid) ) {
+ if (!take_down_cache(fid)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, fcn_name);
}
}
}
/* 7 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
/* verify that all instance of datum are back where the started
* and are clean.
*/
- for ( i = 0; i < NUM_DATA_ENTRIES; i++ )
- {
- HDassert( data_index[i] == i );
- HDassert( ! (data[i].dirty) );
+ for (i = 0; i < NUM_DATA_ENTRIES; i++) {
+ HDassert(data_index[i] == i);
+ HDassert(!(data[i].dirty));
}
/* 8 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
/* compose the done message */
@@ -6599,57 +6014,55 @@ smoke_check_5(int metadata_write_strategy)
mssg.src = world_mpi_rank;
mssg.dest = world_server_mpi_rank;
mssg.mssg_num = -1; /* set by send function */
- mssg.base_addr = 0; /* not used */
- mssg.len = 0; /* not used */
- mssg.ver = 0; /* not used */
- mssg.count = 0; /* not used */
+ mssg.base_addr = 0; /* not used */
+ mssg.len = 0; /* not used */
+ mssg.ver = 0; /* not used */
+ mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( success ) {
+ if (success) {
success = send_mssg(&mssg, FALSE);
- if ( ! success ) {
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, fcn_name);
}
}
}
/* 9 */
- if ( verbose ) {
- HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
+ if (verbose) {
+ HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);
}
}
max_nerrors = get_max_nerrors();
- if ( world_mpi_rank == 0 ) {
+ if (world_mpi_rank == 0) {
- if ( max_nerrors == 0 ) {
+ if (max_nerrors == 0) {
- PASSED();
-
- } else {
+ PASSED();
+ }
+ else {
failures++;
H5_FAILED();
}
}
- success = ( ( success ) && ( max_nerrors == 0 ) );
+ success = ((success) && (max_nerrors == 0));
- return(success);
+ return (success);
} /* smoke_check_5() */
-
/*****************************************************************************
*
- * Function: trace_file_check()
+ * Function: trace_file_check()
*
* Purpose: A basic test of the trace file capability. In essence,
* we invoke all operations that generate trace file output,
@@ -6679,11 +6092,11 @@ smoke_check_5(int metadata_write_strategy)
*
* This test is skipped if H5_METADATA_TRACE_FILE is undefined.
*
- * Return: Success: TRUE
+ * Return: Success: TRUE
*
- * Failure: FALSE
+ * Failure: FALSE
*
- * Programmer: JRM -- 6/13/06
+ * Programmer: JRM -- 6/13/06
*
*****************************************************************************/
static hbool_t
@@ -6693,101 +6106,97 @@ trace_file_check(int metadata_write_strategy)
#ifdef H5_METADATA_TRACE_FILE
- const char * fcn_name = "trace_file_check()";
- const char *((* expected_output)[]) = NULL;
- const char * expected_output_0[] =
- {
- "### HDF5 metadata cache trace file version 1 ###\n",
- "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0 0\n",
- "H5AC_insert_entry 0x200 25 0x0 2 0\n",
- "H5AC_insert_entry 0x202 25 0x0 2 0\n",
- "H5AC_insert_entry 0x204 25 0x0 4 0\n",
- "H5AC_insert_entry 0x208 25 0x0 6 0\n",
- "H5AC_protect 0x200 25 H5AC_WRITE 2 1\n",
- "H5AC_mark_entry_dirty 0x200 0\n",
- "H5AC_unprotect 0x200 25 0 0 0\n",
- "H5AC_protect 0x202 25 H5AC_WRITE 2 1\n",
- "H5AC_pin_protected_entry 0x202 0\n",
- "H5AC_unprotect 0x202 25 0 0 0\n",
- "H5AC_unpin_entry 0x202 0\n",
- "H5AC_expunge_entry 0x202 25 0\n",
- "H5AC_protect 0x204 25 H5AC_WRITE 4 1\n",
- "H5AC_pin_protected_entry 0x204 0\n",
- "H5AC_unprotect 0x204 25 0 0 0\n",
- "H5AC_mark_entry_dirty 0x204 0 0 0\n",
- "H5AC_resize_entry 0x204 2 0\n",
- "H5AC_resize_entry 0x204 4 0\n",
- "H5AC_unpin_entry 0x204 0\n",
- "H5AC_move_entry 0x200 0x8c65 25 0\n",
- "H5AC_move_entry 0x8c65 0x200 25 0\n",
- "H5AC_flush 0\n",
- NULL
- };
- const char * expected_output_1[] =
- {
- "### HDF5 metadata cache trace file version 1 ###\n",
- "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 1 0\n",
- "H5AC_insert_entry 0x200 25 0x0 2 0\n",
- "H5AC_insert_entry 0x202 25 0x0 2 0\n",
- "H5AC_insert_entry 0x204 25 0x0 4 0\n",
- "H5AC_insert_entry 0x208 25 0x0 6 0\n",
- "H5AC_protect 0x200 25 H5AC_WRITE 2 1\n",
- "H5AC_mark_entry_dirty 0x200 0\n",
- "H5AC_unprotect 0x200 25 0 0 0\n",
- "H5AC_protect 0x202 25 H5AC_WRITE 2 1\n",
- "H5AC_pin_protected_entry 0x202 0\n",
- "H5AC_unprotect 0x202 25 0 0 0\n",
- "H5AC_unpin_entry 0x202 0\n",
- "H5AC_expunge_entry 0x202 25 0\n",
- "H5AC_protect 0x204 25 H5AC_WRITE 4 1\n",
- "H5AC_pin_protected_entry 0x204 0\n",
- "H5AC_unprotect 0x204 25 0 0 0\n",
- "H5AC_mark_entry_dirty 0x204 0 0 0\n",
- "H5AC_resize_pinned_entry 0x204 2 0\n",
- "H5AC_resize_pinned_entry 0x204 4 0\n",
- "H5AC_unpin_entry 0x204 0\n",
- "H5AC_move_entry 0x200 0x8c65 25 0\n",
- "H5AC_move_entry 0x8c65 0x200 25 0\n",
- "H5AC_flush 0\n",
- NULL
- };
- char buffer[256];
- char trace_file_name[64];
- hbool_t done = FALSE;
- int i;
- int max_nerrors;
- int expected_line_len;
- int actual_line_len;
- hid_t fid = -1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- FILE * trace_file_ptr = NULL;
+ const char *fcn_name = "trace_file_check()";
+ const char *((*expected_output)[]) = NULL;
+ const char *expected_output_0[] = {
+ "### HDF5 metadata cache trace file version 1 ###\n",
+ "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 "
+ "1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 "
+ "0.100000 262144 0 0\n",
+ "H5AC_insert_entry 0x200 25 0x0 2 0\n",
+ "H5AC_insert_entry 0x202 25 0x0 2 0\n",
+ "H5AC_insert_entry 0x204 25 0x0 4 0\n",
+ "H5AC_insert_entry 0x208 25 0x0 6 0\n",
+ "H5AC_protect 0x200 25 H5AC_WRITE 2 1\n",
+ "H5AC_mark_entry_dirty 0x200 0\n",
+ "H5AC_unprotect 0x200 25 0 0 0\n",
+ "H5AC_protect 0x202 25 H5AC_WRITE 2 1\n",
+ "H5AC_pin_protected_entry 0x202 0\n",
+ "H5AC_unprotect 0x202 25 0 0 0\n",
+ "H5AC_unpin_entry 0x202 0\n",
+ "H5AC_expunge_entry 0x202 25 0\n",
+ "H5AC_protect 0x204 25 H5AC_WRITE 4 1\n",
+ "H5AC_pin_protected_entry 0x204 0\n",
+ "H5AC_unprotect 0x204 25 0 0 0\n",
+ "H5AC_mark_entry_dirty 0x204 0 0 0\n",
+ "H5AC_resize_entry 0x204 2 0\n",
+ "H5AC_resize_entry 0x204 4 0\n",
+ "H5AC_unpin_entry 0x204 0\n",
+ "H5AC_move_entry 0x200 0x8c65 25 0\n",
+ "H5AC_move_entry 0x8c65 0x200 25 0\n",
+ "H5AC_flush 0\n",
+ NULL};
+ const char *expected_output_1[] = {
+ "### HDF5 metadata cache trace file version 1 ###\n",
+ "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 "
+ "1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 "
+ "0.100000 262144 1 0\n",
+ "H5AC_insert_entry 0x200 25 0x0 2 0\n",
+ "H5AC_insert_entry 0x202 25 0x0 2 0\n",
+ "H5AC_insert_entry 0x204 25 0x0 4 0\n",
+ "H5AC_insert_entry 0x208 25 0x0 6 0\n",
+ "H5AC_protect 0x200 25 H5AC_WRITE 2 1\n",
+ "H5AC_mark_entry_dirty 0x200 0\n",
+ "H5AC_unprotect 0x200 25 0 0 0\n",
+ "H5AC_protect 0x202 25 H5AC_WRITE 2 1\n",
+ "H5AC_pin_protected_entry 0x202 0\n",
+ "H5AC_unprotect 0x202 25 0 0 0\n",
+ "H5AC_unpin_entry 0x202 0\n",
+ "H5AC_expunge_entry 0x202 25 0\n",
+ "H5AC_protect 0x204 25 H5AC_WRITE 4 1\n",
+ "H5AC_pin_protected_entry 0x204 0\n",
+ "H5AC_unprotect 0x204 25 0 0 0\n",
+ "H5AC_mark_entry_dirty 0x204 0 0 0\n",
+ "H5AC_resize_pinned_entry 0x204 2 0\n",
+ "H5AC_resize_pinned_entry 0x204 4 0\n",
+ "H5AC_unpin_entry 0x204 0\n",
+ "H5AC_move_entry 0x200 0x8c65 25 0\n",
+ "H5AC_move_entry 0x8c65 0x200 25 0\n",
+ "H5AC_flush 0\n",
+ NULL};
+ char buffer[256];
+ char trace_file_name[64];
+ hbool_t done = FALSE;
+ int i;
+ int max_nerrors;
+ int expected_line_len;
+ int actual_line_len;
+ hid_t fid = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ FILE * trace_file_ptr = NULL;
H5AC_cache_config_t config;
- struct mssg_t mssg;
+ struct mssg_t mssg;
#endif /* H5_METADATA_TRACE_FILE */
- switch ( metadata_write_strategy ) {
+ switch (metadata_write_strategy) {
- case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
+ case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
#ifdef H5_METADATA_TRACE_FILE
expected_output = &expected_output_0;
#endif /* H5_METADATA_TRACE_FILE */
- if ( world_mpi_rank == 0 ) {
- TESTING(
- "trace file collection -- process 0 only md write strategy");
- }
- break;
+ if (world_mpi_rank == 0)
+ TESTING("trace file collection -- process 0 only md write strategy");
+ break;
- case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
+ case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
#ifdef H5_METADATA_TRACE_FILE
expected_output = &expected_output_1;
#endif /* H5_METADATA_TRACE_FILE */
- if ( world_mpi_rank == 0 ) {
- TESTING(
- "trace file collection -- distributed md write strategy");
- }
- break;
+ if (world_mpi_rank == 0)
+ TESTING("trace file collection -- distributed md write strategy");
+ break;
default:
#ifdef H5_METADATA_TRACE_FILE
@@ -6796,11 +6205,10 @@ trace_file_check(int metadata_write_strategy)
*/
expected_output = &expected_output_0;
#endif /* H5_METADATA_TRACE_FILE */
- if ( world_mpi_rank == 0 ) {
- TESTING("trace file collection -- unknown md write strategy");
- }
- break;
- }
+ if (world_mpi_rank == 0)
+ TESTING("trace file collection -- unknown md write strategy");
+ break;
+ } /* end switch */
#ifdef H5_METADATA_TRACE_FILE
@@ -6808,145 +6216,119 @@ trace_file_check(int metadata_write_strategy)
init_data();
reset_stats();
- if ( world_mpi_rank == world_server_mpi_rank ) {
+ if (world_mpi_rank == world_server_mpi_rank) {
- if ( ! server_main() ) {
+ if (!server_main()) {
/* some error occured in the server -- report failure */
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: server_main() failed.\n",
- world_mpi_rank, fcn_name);
- }
+ if (verbose)
+ HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, fcn_name);
}
}
- else /* run the clients */
- {
+ else {
+ /* run the clients */
- if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr,
- metadata_write_strategy) ) {
+ if (!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy)) {
nerrors++;
- fid = -1;
+ fid = -1;
cache_ptr = NULL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n",
- world_mpi_rank, fcn_name);
- }
+ if (verbose)
+ HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, fcn_name);
}
- if ( nerrors == 0 ) {
+ if (nerrors == 0) {
config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- if ( H5AC_get_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
-
- nerrors++;
- HDfprintf(stdout,
- "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n",
- world_mpi_rank, fcn_name);
-
- } else {
-
+ if (H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
+ nerrors++;
+ HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", world_mpi_rank,
+ fcn_name);
+ }
+ else {
config.open_trace_file = TRUE;
- strcpy(config.trace_file_name, "t_cache_trace.txt");
+ strcpy(config.trace_file_name, "t_cache_trace.txt");
- if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
-
- nerrors++;
- HDfprintf(stdout,
- "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n",
- world_mpi_rank, fcn_name);
+ if (H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
+ nerrors++;
+ HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank,
+ fcn_name);
}
}
- }
+ } /* end if */
- insert_entry(cache_ptr, file_ptr, 0, H5AC__NO_FLAGS_SET);
- insert_entry(cache_ptr, file_ptr, 1, H5AC__NO_FLAGS_SET);
- insert_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET);
- insert_entry(cache_ptr, file_ptr, 3, H5AC__NO_FLAGS_SET);
+ insert_entry(cache_ptr, file_ptr, 0, H5AC__NO_FLAGS_SET);
+ insert_entry(cache_ptr, file_ptr, 1, H5AC__NO_FLAGS_SET);
+ insert_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET);
+ insert_entry(cache_ptr, file_ptr, 3, H5AC__NO_FLAGS_SET);
- lock_entry(file_ptr, 0);
- mark_entry_dirty(0);
- unlock_entry(file_ptr, 0, H5AC__NO_FLAGS_SET);
+ lock_entry(file_ptr, 0);
+ mark_entry_dirty(0);
+ unlock_entry(file_ptr, 0, H5AC__NO_FLAGS_SET);
- lock_entry(file_ptr, 1);
+ lock_entry(file_ptr, 1);
pin_protected_entry(1, TRUE);
- unlock_entry(file_ptr, 1, H5AC__NO_FLAGS_SET);
+ unlock_entry(file_ptr, 1, H5AC__NO_FLAGS_SET);
unpin_entry(file_ptr, 1, TRUE, FALSE, FALSE);
expunge_entry(file_ptr, 1);
- lock_entry(file_ptr, 2);
+ lock_entry(file_ptr, 2);
pin_protected_entry(2, TRUE);
- unlock_entry(file_ptr, 2, H5AC__NO_FLAGS_SET);
- mark_entry_dirty(2);
+ unlock_entry(file_ptr, 2, H5AC__NO_FLAGS_SET);
+ mark_entry_dirty(2);
resize_entry(2, data[2].len / 2);
resize_entry(2, data[2].len);
unpin_entry(file_ptr, 2, TRUE, FALSE, FALSE);
- move_entry(file_ptr, 0, 20);
- move_entry(file_ptr, 0, 20);
+ move_entry(file_ptr, 0, 20);
+ move_entry(file_ptr, 0, 20);
- if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
+ if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n",
- world_mpi_rank, fcn_name);
- }
+ if (verbose)
+ HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, fcn_name);
}
- if ( nerrors == 0 ) {
-
+ if (nerrors == 0) {
config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- if ( H5AC_get_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
-
- nerrors++;
- HDfprintf(stdout,
- "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n",
- world_mpi_rank, fcn_name);
-
- } else {
-
- config.open_trace_file = FALSE;
- config.close_trace_file = TRUE;
- config.trace_file_name[0] = '\0';
-
- if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
+ if (H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
+ nerrors++;
+ HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", world_mpi_rank,
+ fcn_name);
+ }
+ else {
+ config.open_trace_file = FALSE;
+ config.close_trace_file = TRUE;
+ config.trace_file_name[0] = '\0';
- nerrors++;
- HDfprintf(stdout,
- "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n",
- world_mpi_rank, fcn_name);
+ if (H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
+ nerrors++;
+ HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank,
+ fcn_name);
}
}
- }
-
- if ( fid >= 0 ) {
+ } /* end if */
- if ( ! take_down_cache(fid) ) {
+ if (fid >= 0) {
+ if (!take_down_cache(fid)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n",
- world_mpi_rank, fcn_name);
- }
+ if (verbose)
+ HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, fcn_name);
}
- }
+ } /* end if */
/* verify that all instance of datum are back where the started
* and are clean.
*/
- for ( i = 0; i < NUM_DATA_ENTRIES; i++ )
- {
- HDassert( data_index[i] == i );
- HDassert( ! (data[i].dirty) );
+ for (i = 0; i < NUM_DATA_ENTRIES; i++) {
+ HDassert(data_index[i] == i);
+ HDassert(!(data[i].dirty));
}
/* compose the done message */
@@ -6954,208 +6336,186 @@ trace_file_check(int metadata_write_strategy)
mssg.src = world_mpi_rank;
mssg.dest = world_server_mpi_rank;
mssg.mssg_num = -1; /* set by send function */
- mssg.base_addr = 0; /* not used */
- mssg.len = 0; /* not used */
- mssg.ver = 0; /* not used */
- mssg.count = 0; /* not used */
+ mssg.base_addr = 0; /* not used */
+ mssg.len = 0; /* not used */
+ mssg.ver = 0; /* not used */
+ mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( success ) {
-
+ if (success) {
success = send_mssg(&mssg, FALSE);
- if ( ! success ) {
-
+ if (!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n",
- world_mpi_rank, fcn_name);
- }
+ if (verbose)
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, fcn_name);
}
- }
+ } /* end if */
- if ( nerrors == 0 ) {
+ nerrors++;
+ if (verbose)
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, fcn_name);
- sprintf(trace_file_name, "t_cache_trace.txt.%d",
- (int)file_mpi_rank);
+ if (nerrors == 0) {
+ HDsprintf(trace_file_name, "t_cache_trace.txt.%d", (int)file_mpi_rank);
- if ( (trace_file_ptr = HDfopen(trace_file_name, "r")) == NULL ) {
+ if ((trace_file_ptr = HDfopen(trace_file_name, "r")) == NULL) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: HDfopen failed.\n",
- world_mpi_rank, fcn_name);
- }
+ if (verbose)
+ HDfprintf(stdout, "%d:%s: HDfopen failed.\n", world_mpi_rank, fcn_name);
}
- }
-
- i = 0;
- while ( ( nerrors == 0 ) && ( ! done ) )
- {
- if ( (*expected_output)[i] == NULL ) {
-
- expected_line_len = 0;
-
- } else {
-
- expected_line_len = HDstrlen((*expected_output)[i]);
- }
-
- if ( HDfgets(buffer, 255, trace_file_ptr) != NULL ) {
-
- actual_line_len = strlen(buffer);
-
- } else {
-
- actual_line_len = 0;
- }
+ }
- if ( ( actual_line_len == 0 ) && ( expected_line_len == 0 ) ) {
+ i = 0;
+ while ((nerrors == 0) && (!done)) {
+ /* Get lines of actual and expected data */
+ if ((*expected_output)[i] == NULL)
+ expected_line_len = (size_t)0;
+ else
+ expected_line_len = HDstrlen((*expected_output)[i]);
- done = TRUE;
+ if (HDfgets(buffer, 255, trace_file_ptr) != NULL)
+ actual_line_len = HDstrlen(buffer);
+ else
+ actual_line_len = (size_t)0;
- } else if ( ( actual_line_len != expected_line_len ) ||
- ( HDstrcmp(buffer, (*expected_output)[i]) != 0 ) ) {
+ /* Compare the lines */
+ /* Handle running out of data */
+ if ((actual_line_len == 0) || (expected_line_len == 0)) {
+ done = TRUE;
+ }
+ else if ((actual_line_len != expected_line_len) ||
+ (HDstrcmp(buffer, (*expected_output)[i]) != 0)) {
- nerrors++;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: Unexpected data in trace file line %d.\n",
- world_mpi_rank, fcn_name, i);
- HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n",
- world_mpi_rank, fcn_name, (*expected_output)[i],
- expected_line_len);
- HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n",
- world_mpi_rank, fcn_name, buffer,
- actual_line_len);
+ nerrors++;
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank,
+ fcn_name, i);
+ HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, fcn_name,
+ (*expected_output)[i], expected_line_len);
+ HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, fcn_name, buffer,
+ actual_line_len);
}
- } else {
- i++;
- }
- }
-
- if ( trace_file_ptr != NULL ) {
+ }
+ else {
+ i++;
+ }
+ }
- HDfclose(trace_file_ptr);
- trace_file_ptr = NULL;
+ /* Clean up the trace file */
+ if (trace_file_ptr != NULL) {
+ HDfclose(trace_file_ptr);
+ trace_file_ptr = NULL;
#if 1
- HDremove(trace_file_name);
+ HDremove(trace_file_name);
#endif
}
}
max_nerrors = get_max_nerrors();
- if ( world_mpi_rank == 0 ) {
-
- if ( max_nerrors == 0 ) {
-
- PASSED();
-
- } else {
+ if (world_mpi_rank == 0) {
+ if (max_nerrors == 0) {
+ PASSED();
+ }
+ else {
failures++;
H5_FAILED();
}
}
- success = ( ( success ) && ( max_nerrors == 0 ) );
+ success = ((success) && (max_nerrors == 0));
#else /* H5_METADATA_TRACE_FILE */
- if ( world_mpi_rank == 0 ) {
-
+ if (world_mpi_rank == 0) {
SKIPPED();
-
HDfprintf(stdout, " trace file support disabled.\n");
}
#endif /* H5_METADATA_TRACE_FILE */
- return(success);
+ return (success);
} /* trace_file_check() */
-
/*****************************************************************************
*
- * Function: main()
- *
- * Purpose: Main function for the parallel cache test.
+ * Function: main()
*
- * Return: Success: 0
+ * Purpose: Main function for the parallel cache test.
*
- * Failure: 1
+ * Return: Success: 0
*
- * Programmer: JRM -- 12/23/05
+ * Failure: 1
*
- * Modifications:
- *
- * None.
+ * Programmer: JRM -- 12/23/05
*
*****************************************************************************/
-
int
main(int argc, char **argv)
{
- const char * fcn_name = "main()";
- int express_test;
- unsigned u;
- int mpi_size;
- int mpi_rank;
- int max_nerrors;
+ const char *fcn_name = "main()";
+ int express_test;
+ unsigned u;
+ int mpi_size;
+ int mpi_rank;
+ int max_nerrors;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- world_mpi_size = mpi_size;
- world_mpi_rank = mpi_rank;
+ world_mpi_size = mpi_size;
+ world_mpi_rank = mpi_rank;
world_server_mpi_rank = mpi_size - 1;
- world_mpi_comm = MPI_COMM_WORLD;
+ world_mpi_comm = MPI_COMM_WORLD;
/* Attempt to turn off atexit post processing so that in case errors
* happen during the test and the process is aborted, it will not get
* hang in the atexit post processing in which it may try to make MPI
* calls. By then, MPI calls may not work.
*/
- if (H5dont_atexit() < 0){
- printf("Failed to turn off atexit processing. Continue.\n", mpi_rank);
+ if (H5dont_atexit() < 0) {
+ HDprintf("%d:Failed to turn off atexit processing. Continue.\n", mpi_rank);
};
H5open();
express_test = do_express_test();
-#if 0 /* JRM */
+#if 0 /* JRM */
express_test = 0;
#endif /* JRM */
- if ( express_test ) {
+ if (express_test) {
- virt_num_data_entries = EXPRESS_VIRT_NUM_DATA_ENTRIES;
-
- } else {
+ virt_num_data_entries = EXPRESS_VIRT_NUM_DATA_ENTRIES;
+ }
+ else {
- virt_num_data_entries = STD_VIRT_NUM_DATA_ENTRIES;
+ virt_num_data_entries = STD_VIRT_NUM_DATA_ENTRIES;
}
#ifdef H5_HAVE_MPE
- if ( MAINPROCESS ) { printf(" Tests compiled for MPE.\n"); }
+ if (MAINPROCESS) {
+ HDprintf(" Tests compiled for MPE.\n");
+ }
virt_num_data_entries = MPE_VIRT_NUM_DATA_ENTIES;
#endif /* H5_HAVE_MPE */
-
- if (MAINPROCESS){
- printf("===================================\n");
- printf("Parallel metadata cache tests\n");
- printf(" mpi_size = %d\n", mpi_size);
- printf(" express_test = %d\n", express_test);
- printf("===================================\n");
+ if (MAINPROCESS) {
+ HDprintf("===================================\n");
+ HDprintf("Parallel metadata cache tests\n");
+ HDprintf(" mpi_size = %d\n", mpi_size);
+ HDprintf(" express_test = %d\n", express_test);
+ HDprintf("===================================\n");
}
- if ( mpi_size < 3 ) {
+ if (mpi_size < 3) {
- if ( MAINPROCESS ) {
+ if (MAINPROCESS) {
- printf(" Need at least 3 processes. Exiting.\n");
+ HDprintf(" Need at least 3 processes. Exiting.\n");
}
goto finish;
}
@@ -7172,65 +6532,57 @@ main(int argc, char **argv)
*/
/* setup file access property list with the world communicator */
- if ( FAIL == (fapl = H5Pcreate(H5P_FILE_ACCESS)) ) {
+ if (FAIL == (fapl = H5Pcreate(H5P_FILE_ACCESS))) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Pcreate() failed 1.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Pcreate() failed 1.\n", world_mpi_rank, fcn_name);
}
}
- if ( H5Pset_fapl_mpio(fapl, world_mpi_comm, MPI_INFO_NULL) < 0 ) {
+ if (H5Pset_fapl_mpio(fapl, world_mpi_comm, MPI_INFO_NULL) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 1.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 1.\n", world_mpi_rank, fcn_name);
}
}
/* fix the file names */
- for ( u = 0; u < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++u )
- {
- if ( h5_fixname(FILENAME[u], fapl, filenames[u],
- sizeof(filenames[u])) == NULL ) {
+ for (u = 0; u < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++u) {
+ if (h5_fixname(FILENAME[u], fapl, filenames[u], sizeof(filenames[u])) == NULL) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: h5_fixname() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: h5_fixname() failed.\n", world_mpi_rank, fcn_name);
}
break;
}
}
/* close the fapl before we set it up again */
- if ( H5Pclose(fapl) < 0 ) {
+ if (H5Pclose(fapl) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Pclose() failed.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Pclose() failed.\n", world_mpi_rank, fcn_name);
}
}
/* now create the fapl again, excluding the server process. */
- if ( world_mpi_rank != world_server_mpi_rank ) {
+ if (world_mpi_rank != world_server_mpi_rank) {
/* setup file access property list */
- if ( FAIL == (fapl = H5Pcreate(H5P_FILE_ACCESS)) ) {
- nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Pcreate() failed 2.\n",
- world_mpi_rank, fcn_name);
+ if (FAIL == (fapl = H5Pcreate(H5P_FILE_ACCESS))) {
+ nerrors++;
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Pcreate() failed 2.\n", world_mpi_rank, fcn_name);
}
}
- if ( H5Pset_fapl_mpio(fapl, file_mpi_comm, MPI_INFO_NULL) < 0 ) {
+ if (H5Pset_fapl_mpio(fapl, file_mpi_comm, MPI_INFO_NULL) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 2.\n",
- world_mpi_rank, fcn_name);
+ if (verbose) {
+ HDfprintf(stdout, "%d:%s: H5Pset_fapl_mpio() failed 2.\n", world_mpi_rank, fcn_name);
}
}
}
@@ -7239,15 +6591,15 @@ main(int argc, char **argv)
max_nerrors = get_max_nerrors();
- if ( max_nerrors != 0 ) {
+ if (max_nerrors != 0) {
/* errors in setup -- no point in continuing */
- if ( world_mpi_rank == 0 ) {
+ if (world_mpi_rank == 0) {
HDfprintf(stdout, "Errors in test initialization. Exiting.\n");
}
- goto finish;
+ goto finish;
}
/* run the tests */
@@ -7284,16 +6636,15 @@ finish:
* and exit.
*/
MPI_Barrier(MPI_COMM_WORLD);
- if (MAINPROCESS){ /* only process 0 reports */
- printf("===================================\n");
- if (failures){
- printf("***metadata cache tests detected %d failures***\n",
- failures);
- }
- else{
- printf("metadata cache tests finished with no failures\n");
- }
- printf("===================================\n");
+ if (MAINPROCESS) { /* only process 0 reports */
+ HDprintf("===================================\n");
+ if (failures) {
+ HDprintf("***metadata cache tests detected %d failures***\n", failures);
+ }
+ else {
+ HDprintf("metadata cache tests finished with no failures\n");
+ }
+ HDprintf("===================================\n");
}
takedown_derived_types();
@@ -7305,6 +6656,5 @@ finish:
MPI_Finalize();
/* cannot just return (failures) because exit code is limited to 1byte */
- return(failures != 0);
+ return (failures != 0);
}
-
diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c
index 8b3ede5..b530d5f 100644
--- a/testpar/t_chunk_alloc.c
+++ b/testpar/t_chunk_alloc.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -20,23 +20,22 @@
*/
#include "testphdf5.h"
-static int mpi_size, mpi_rank;
+static int mpi_size, mpi_rank;
-#define DSET_NAME "ExtendibleArray"
-#define CHUNK_SIZE 1000 /* #elements per chunk */
-#define CHUNK_FACTOR 200 /* default dataset size in terms of chunks */
-#define CLOSE 1
-#define NO_CLOSE 0
+#define DSET_NAME "ExtendibleArray"
+#define CHUNK_SIZE 1000 /* #elements per chunk */
+#define CHUNK_FACTOR 200 /* default dataset size in terms of chunks */
+#define CLOSE 1
+#define NO_CLOSE 0
static MPI_Offset
get_filesize(const char *filename)
{
- int mpierr;
- MPI_File fd;
- MPI_Offset filesize;
+ int mpierr;
+ MPI_File fd;
+ MPI_Offset filesize;
- mpierr = MPI_File_open(MPI_COMM_SELF, (char*)filename, MPI_MODE_RDONLY,
- MPI_INFO_NULL, &fd);
+ mpierr = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fd);
VRFY((mpierr == MPI_SUCCESS), "");
mpierr = MPI_File_get_size(fd, &filesize);
@@ -45,21 +44,12 @@ get_filesize(const char *filename)
mpierr = MPI_File_close(&fd);
VRFY((mpierr == MPI_SUCCESS), "");
- return(filesize);
+ return (filesize);
}
-typedef enum write_pattern {
- none,
- sec_last,
- all
-} write_type;
-
-typedef enum access_ {
- write_all,
- open_only,
- extend_only
-} access_type;
+typedef enum write_pattern { none, sec_last, all } write_type;
+typedef enum access_ { write_all, open_only, extend_only } access_type;
/*
* This creates a dataset serially with chunks, each of CHUNK_SIZE
@@ -69,44 +59,43 @@ typedef enum access_ {
static void
create_chunked_dataset(const char *filename, int chunk_factor, write_type write_pattern)
{
- hid_t file_id, dataset; /* handles */
- hid_t dataspace,memspace;
- hid_t cparms;
- hsize_t dims[1];
- hsize_t maxdims[1] = {H5S_UNLIMITED};
-
- hsize_t chunk_dims[1] ={CHUNK_SIZE};
- hsize_t count[1];
- hsize_t stride[1];
- hsize_t block[1];
- hsize_t offset[1]; /* Selection offset within dataspace */
+ hid_t file_id, dataset; /* handles */
+ hid_t dataspace, memspace;
+ hid_t cparms;
+ hsize_t dims[1];
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+
+ hsize_t chunk_dims[1] = {CHUNK_SIZE};
+ hsize_t count[1];
+ hsize_t stride[1];
+ hsize_t block[1];
+ hsize_t offset[1]; /* Selection offset within dataspace */
/* Variables used in reading data back */
- char buffer[CHUNK_SIZE];
- long nchunks;
- herr_t hrc;
+ char buffer[CHUNK_SIZE];
+ long nchunks;
+ herr_t hrc;
- MPI_Offset filesize, /* actual file size */
- est_filesize; /* estimated file size */
+ MPI_Offset filesize, /* actual file size */
+ est_filesize; /* estimated file size */
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* Only MAINPROCESS should create the file. Others just wait. */
if (MAINPROCESS) {
- nchunks=chunk_factor*mpi_size;
- dims[0]=nchunks*CHUNK_SIZE;
+ nchunks = chunk_factor * mpi_size;
+ dims[0] = nchunks * CHUNK_SIZE;
/* Create the data space with unlimited dimensions. */
- dataspace = H5Screate_simple (1, dims, maxdims);
+ dataspace = H5Screate_simple(1, dims, maxdims);
VRFY((dataspace >= 0), "");
memspace = H5Screate_simple(1, chunk_dims, NULL);
VRFY((memspace >= 0), "");
- /* Create a new file. If file exists its contents will be overwritten. */
- file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT);
- VRFY((file_id >= 0), "H5Fcreate");
+ /* Create a new file. If file exists its contents will be overwritten. */
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((file_id >= 0), "H5Fcreate");
/* Modify dataset creation properties, i.e. enable chunking */
cparms = H5Pcreate(H5P_DATASET_CREATE);
@@ -119,16 +108,17 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_
VRFY((hrc >= 0), "");
/* Create a new dataset within the file using cparms creation properties. */
- dataset = H5Dcreate2(file_id, DSET_NAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ dataset =
+ H5Dcreate2(file_id, DSET_NAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
VRFY((dataset >= 0), "");
- if(write_pattern == sec_last) {
+ if (write_pattern == sec_last) {
HDmemset(buffer, 100, CHUNK_SIZE);
- count[0] = 1;
+ count[0] = 1;
stride[0] = 1;
- block[0] = chunk_dims[0];
- offset[0] = (nchunks-2)*chunk_dims[0];
+ block[0] = chunk_dims[0];
+ offset[0] = (nchunks - 2) * chunk_dims[0];
hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
VRFY((hrc >= 0), "");
@@ -139,28 +129,27 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_
} /* end if */
/* Close resources */
- hrc = H5Dclose (dataset);
+ hrc = H5Dclose(dataset);
VRFY((hrc >= 0), "");
dataset = -1;
- hrc = H5Sclose (dataspace);
+ hrc = H5Sclose(dataspace);
VRFY((hrc >= 0), "");
- hrc = H5Sclose (memspace);
+ hrc = H5Sclose(memspace);
VRFY((hrc >= 0), "");
- hrc = H5Pclose (cparms);
+ hrc = H5Pclose(cparms);
VRFY((hrc >= 0), "");
- hrc = H5Fclose (file_id);
+ hrc = H5Fclose(file_id);
VRFY((hrc >= 0), "");
file_id = -1;
/* verify file size */
- filesize = get_filesize(filename);
+ filesize = get_filesize(filename);
est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char);
VRFY((filesize >= est_filesize), "file size check");
-
}
/* Make sure all processes are done before exiting this routine. Otherwise,
@@ -171,7 +160,6 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_
MPI_Barrier(MPI_COMM_WORLD);
}
-
/*
* This program performs three different types of parallel access. It writes on
* the entire dataset, it extends the dataset to nchunks*CHUNK_SIZE, and it only
@@ -179,51 +167,52 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_
* consistent with argument 'chunk_factor'.
*/
static void
-parallel_access_dataset(const char *filename, int chunk_factor, access_type action, hid_t *file_id, hid_t *dataset)
+parallel_access_dataset(const char *filename, int chunk_factor, access_type action, hid_t *file_id,
+ hid_t *dataset)
{
/* HDF5 gubbins */
- hid_t memspace, dataspace; /* HDF5 file identifier */
- hid_t access_plist; /* HDF5 ID for file access property list */
- herr_t hrc; /* HDF5 return code */
- hsize_t size[1];
-
- hsize_t chunk_dims[1] ={CHUNK_SIZE};
- hsize_t count[1];
- hsize_t stride[1];
- hsize_t block[1];
- hsize_t offset[1]; /* Selection offset within dataspace */
- hsize_t dims[1];
- hsize_t maxdims[1];
+ hid_t memspace, dataspace; /* HDF5 file identifier */
+ hid_t access_plist; /* HDF5 ID for file access property list */
+ herr_t hrc; /* HDF5 return code */
+ hsize_t size[1];
+
+ hsize_t chunk_dims[1] = {CHUNK_SIZE};
+ hsize_t count[1];
+ hsize_t stride[1];
+ hsize_t block[1];
+ hsize_t offset[1]; /* Selection offset within dataspace */
+ hsize_t dims[1];
+ hsize_t maxdims[1];
/* Variables used in reading data back */
- char buffer[CHUNK_SIZE];
- int i;
- long nchunks;
+ char buffer[CHUNK_SIZE];
+ int i;
+ long nchunks;
/* MPI Gubbins */
- MPI_Offset filesize, /* actual file size */
- est_filesize; /* estimated file size */
+ MPI_Offset filesize, /* actual file size */
+ est_filesize; /* estimated file size */
/* Initialize MPI */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- nchunks=chunk_factor*mpi_size;
+ nchunks = chunk_factor * mpi_size;
/* Set up MPIO file access property lists */
- access_plist = H5Pcreate(H5P_FILE_ACCESS);
+ access_plist = H5Pcreate(H5P_FILE_ACCESS);
VRFY((access_plist >= 0), "");
hrc = H5Pset_fapl_mpio(access_plist, MPI_COMM_WORLD, MPI_INFO_NULL);
VRFY((hrc >= 0), "");
/* Open the file */
- if (*file_id<0){
+ if (*file_id < 0) {
*file_id = H5Fopen(filename, H5F_ACC_RDWR, access_plist);
VRFY((*file_id >= 0), "");
}
/* Open dataset*/
- if (*dataset<0){
+ if (*dataset < 0) {
*dataset = H5Dopen2(*file_id, DSET_NAME, H5P_DEFAULT);
VRFY((*dataset >= 0), "");
}
@@ -234,26 +223,26 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
dataspace = H5Dget_space(*dataset);
VRFY((dataspace >= 0), "");
- size[0] = nchunks*CHUNK_SIZE;
+ size[0] = nchunks * CHUNK_SIZE;
switch (action) {
/* all chunks are written by all the processes in an interleaved way*/
case write_all:
- memset(buffer, mpi_rank+1, CHUNK_SIZE);
- count[0] = 1;
- stride[0] = 1;
- block[0] = chunk_dims[0];
- for (i=0; i<nchunks/mpi_size; i++){
- offset[0] = (i*mpi_size+mpi_rank)*chunk_dims[0];
+ HDmemset(buffer, mpi_rank + 1, CHUNK_SIZE);
+ count[0] = 1;
+ stride[0] = 1;
+ block[0] = chunk_dims[0];
+ for (i = 0; i < nchunks / mpi_size; i++) {
+ offset[0] = (i * mpi_size + mpi_rank) * chunk_dims[0];
- hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
- VRFY((hrc >= 0), "");
+ hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
+ VRFY((hrc >= 0), "");
- /* Write the buffer out */
- hrc = H5Dwrite(*dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer);
- VRFY((hrc >= 0), "H5Dwrite");
+ /* Write the buffer out */
+ hrc = H5Dwrite(*dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
}
break;
@@ -273,8 +262,9 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
/* only opens the *dataset */
case open_only:
-
break;
+ default:
+ HDassert(0);
}
/* Close up */
@@ -282,10 +272,10 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
VRFY((hrc >= 0), "");
*dataset = -1;
- hrc = H5Sclose (dataspace);
+ hrc = H5Sclose(dataspace);
VRFY((hrc >= 0), "");
- hrc = H5Sclose (memspace);
+ hrc = H5Sclose(memspace);
VRFY((hrc >= 0), "");
hrc = H5Fclose(*file_id);
@@ -293,8 +283,8 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
*file_id = -1;
/* verify file size */
- filesize = get_filesize(filename);
- est_filesize = nchunks*CHUNK_SIZE*sizeof(unsigned char);
+ filesize = get_filesize(filename);
+ est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char);
VRFY((filesize >= est_filesize), "file size check");
/* Can close some plists */
@@ -317,44 +307,45 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
* interleaved pattern.
*/
static void
-verify_data(const char *filename, int chunk_factor, write_type write_pattern, int close, hid_t *file_id, hid_t *dataset)
+verify_data(const char *filename, int chunk_factor, write_type write_pattern, int vclose, hid_t *file_id,
+ hid_t *dataset)
{
/* HDF5 gubbins */
- hid_t dataspace, memspace; /* HDF5 file identifier */
- hid_t access_plist; /* HDF5 ID for file access property list */
- herr_t hrc; /* HDF5 return code */
-
- hsize_t chunk_dims[1] ={CHUNK_SIZE};
- hsize_t count[1];
- hsize_t stride[1];
- hsize_t block[1];
- hsize_t offset[1]; /* Selection offset within dataspace */
+ hid_t dataspace, memspace; /* HDF5 file identifier */
+ hid_t access_plist; /* HDF5 ID for file access property list */
+ herr_t hrc; /* HDF5 return code */
+
+ hsize_t chunk_dims[1] = {CHUNK_SIZE};
+ hsize_t count[1];
+ hsize_t stride[1];
+ hsize_t block[1];
+ hsize_t offset[1]; /* Selection offset within dataspace */
/* Variables used in reading data back */
- char buffer[CHUNK_SIZE];
- int value, i;
- int index;
- long nchunks;
+ char buffer[CHUNK_SIZE];
+ int value, i;
+ int index_l;
+ long nchunks;
/* Initialize MPI */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- nchunks=chunk_factor*mpi_size;
+ nchunks = chunk_factor * mpi_size;
/* Set up MPIO file access property lists */
- access_plist = H5Pcreate(H5P_FILE_ACCESS);
+ access_plist = H5Pcreate(H5P_FILE_ACCESS);
VRFY((access_plist >= 0), "");
hrc = H5Pset_fapl_mpio(access_plist, MPI_COMM_WORLD, MPI_INFO_NULL);
VRFY((hrc >= 0), "");
/* Open the file */
- if (*file_id<0){
+ if (*file_id < 0) {
*file_id = H5Fopen(filename, H5F_ACC_RDWR, access_plist);
VRFY((*file_id >= 0), "");
}
/* Open dataset*/
- if (*dataset<0){
+ if (*dataset < 0) {
*dataset = H5Dopen2(*file_id, DSET_NAME, H5P_DEFAULT);
VRFY((*dataset >= 0), "");
}
@@ -366,14 +357,14 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in
VRFY((dataspace >= 0), "");
/* all processes check all chunks. */
- count[0] = 1;
+ count[0] = 1;
stride[0] = 1;
- block[0] = chunk_dims[0];
- for (i=0; i<nchunks; i++){
- /* reset buffer values */
- memset(buffer, -1, CHUNK_SIZE);
+ block[0] = chunk_dims[0];
+ for (i = 0; i < nchunks; i++) {
+ /* reset buffer values */
+ HDmemset(buffer, -1, CHUNK_SIZE);
- offset[0] = i*chunk_dims[0];
+ offset[0] = i * chunk_dims[0];
hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block);
VRFY((hrc >= 0), "");
@@ -383,37 +374,40 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in
VRFY((hrc >= 0), "H5Dread");
/* set expected value according the write pattern */
- switch (write_pattern) {
- case all:
- value = i%mpi_size + 1;
- break;
- case none:
- value = 0;
- break;
+ switch (write_pattern) {
+ case all:
+ value = i % mpi_size + 1;
+ break;
+ case none:
+ value = 0;
+ break;
case sec_last:
- if (i==nchunks-2)
- value = 100;
- else
- value = 0;
- }
+ if (i == nchunks - 2)
+ value = 100;
+ else
+ value = 0;
+ break;
+ default:
+ HDassert(0);
+ }
/* verify content of the chunk */
- for (index = 0; index < CHUNK_SIZE; index++)
- VRFY((buffer[index] == value), "data verification");
+ for (index_l = 0; index_l < CHUNK_SIZE; index_l++)
+ VRFY((buffer[index_l] == value), "data verification");
}
- hrc = H5Sclose (dataspace);
- VRFY((hrc >= 0), "");
+ hrc = H5Sclose(dataspace);
+ VRFY((hrc >= 0), "");
- hrc = H5Sclose (memspace);
- VRFY((hrc >= 0), "");
+ hrc = H5Sclose(memspace);
+ VRFY((hrc >= 0), "");
/* Can close some plists */
hrc = H5Pclose(access_plist);
VRFY((hrc >= 0), "");
/* Close up */
- if (close){
+ if (vclose) {
hrc = H5Dclose(*dataset);
VRFY((hrc >= 0), "");
*dataset = -1;
@@ -430,8 +424,6 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in
MPI_Barrier(MPI_COMM_WORLD);
}
-
-
/*
* Test following possible scenarios,
* Case 1:
@@ -454,17 +446,17 @@ void
test_chunk_alloc(void)
{
const char *filename;
- hid_t file_id, dataset;
+ hid_t file_id, dataset;
file_id = dataset = -1;
/* Initialize MPI */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- filename = GetTestParameters();
+ filename = (const char *)GetTestParameters();
if (VERBOSE_MED)
- printf("Extend Chunked allocation test on file %s\n", filename);
+ HDprintf("Extend Chunked allocation test on file %s\n", filename);
/* Case 1 */
/* Create chunked dataset without writing anything.*/
@@ -491,5 +483,4 @@ test_chunk_alloc(void)
parallel_access_dataset(filename, CHUNK_FACTOR, write_all, &file_id, &dataset);
/* reopen dataset in parallel, read and verify the data */
verify_data(filename, CHUNK_FACTOR, all, CLOSE, &file_id, &dataset);
-
}
diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c
index c6fa3d4..fc117e3 100644
--- a/testpar/t_coll_chunk.c
+++ b/testpar/t_coll_chunk.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -16,26 +16,23 @@
#define HYPER 1
#define POINT 2
-#define ALL 3
+#define ALL 3
/* some commonly used routines for collective chunk IO tests*/
-static void ccslab_set(int mpi_rank,int mpi_size,hsize_t start[],hsize_t count[],
- hsize_t stride[],hsize_t block[],int mode);
+static void ccslab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], hsize_t stride[],
+ hsize_t block[], int mode);
-static void ccdataset_fill(hsize_t start[],hsize_t count[],
- hsize_t stride[],hsize_t block[],DATATYPE*dataset,
- int mem_selection);
+static void ccdataset_fill(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[],
+ DATATYPE *dataset, int mem_selection);
-static void ccdataset_print(hsize_t start[],hsize_t block[],DATATYPE*dataset);
+static void ccdataset_print(hsize_t start[], hsize_t block[], DATATYPE *dataset);
-static int ccdataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[],
- hsize_t block[], DATATYPE *dataset, DATATYPE *original,
- int mem_selection);
-
-static void coll_chunktest(const char* filename, int chunk_factor, int select_factor,
- int api_option, int file_selection, int mem_selection, int mode);
+static int ccdataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[],
+ DATATYPE *dataset, DATATYPE *original, int mem_selection);
+static void coll_chunktest(const char *filename, int chunk_factor, int select_factor, int api_option,
+ int file_selection, int mem_selection, int mode);
/*-------------------------------------------------------------------------
* Function: coll_chunk1
@@ -88,7 +85,6 @@ coll_chunk1(void)
coll_chunktest(filename, 1, BYROW_CONT, API_NONE, POINT, HYPER, IN_ORDER);
}
-
/*-------------------------------------------------------------------------
* Function: coll_chunk2
*
@@ -107,7 +103,7 @@ coll_chunk1(void)
*-------------------------------------------------------------------------
*/
- /* ------------------------------------------------------------------------
+/* ------------------------------------------------------------------------
* Descriptions for the selection: many disjoint selections inside one chunk
* Two dimensions,
*
@@ -140,7 +136,6 @@ coll_chunk2(void)
coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, POINT, HYPER, IN_ORDER);
}
-
/*-------------------------------------------------------------------------
* Function: coll_chunk3
*
@@ -181,7 +176,7 @@ void
coll_chunk3(void)
{
const char *filename = GetTestParameters();
- int mpi_size;
+ int mpi_size;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER);
@@ -496,17 +491,17 @@ coll_chunk8(void)
void
coll_chunk9(void)
{
- const char *filename = GetTestParameters();
+ const char *filename = GetTestParameters();
- coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, HYPER, HYPER, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, HYPER, POINT, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, ALL, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, POINT, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, HYPER, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, HYPER, HYPER, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, HYPER, POINT, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, ALL, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, POINT, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, HYPER, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, ALL, IN_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, POINT, IN_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, HYPER, IN_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, ALL, IN_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, POINT, IN_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, HYPER, IN_ORDER);
}
/*-------------------------------------------------------------------------
@@ -548,28 +543,27 @@ coll_chunk9(void)
void
coll_chunk10(void)
{
- const char *filename = GetTestParameters();
+ const char *filename = GetTestParameters();
- coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, HYPER, HYPER, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, HYPER, POINT, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, ALL, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, POINT, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, HYPER, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, HYPER, HYPER, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, HYPER, POINT, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, ALL, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, POINT, OUT_OF_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, HYPER, OUT_OF_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, ALL, IN_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, POINT, IN_ORDER);
- coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, HYPER, IN_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, ALL, IN_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, POINT, IN_ORDER);
+ coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, HYPER, IN_ORDER);
}
-
/*-------------------------------------------------------------------------
* Function: coll_chunktest
*
* Purpose: The real testing routine for regular selection of collective
chunking storage
testing both write and read,
- If anything fails, it may be read or write. There is no
- separation test between read and write.
+ If anything fails, it may be read or write. There is no
+ separation test between read and write.
*
* Return: Success: 0
*
@@ -590,573 +584,564 @@ coll_chunk10(void)
*/
static void
-coll_chunktest(const char* filename,
- int chunk_factor,
- int select_factor,
- int api_option,
- int file_selection,
- int mem_selection,
- int mode)
+coll_chunktest(const char *filename, int chunk_factor, int select_factor, int api_option, int file_selection,
+ int mem_selection, int mode)
{
- hid_t file, dataset, file_dataspace, mem_dataspace;
- hid_t acc_plist,xfer_plist,crp_plist;
+ hid_t file, dataset, file_dataspace, mem_dataspace;
+ hid_t acc_plist, xfer_plist, crp_plist;
- hsize_t dims[RANK], chunk_dims[RANK];
- int* data_array1 = NULL;
- int* data_origin1 = NULL;
+ hsize_t dims[RANK], chunk_dims[RANK];
+ int * data_array1 = NULL;
+ int * data_origin1 = NULL;
- hsize_t start[RANK],count[RANK],stride[RANK],block[RANK];
+ hsize_t start[RANK], count[RANK], stride[RANK], block[RANK];
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
- unsigned prop_value;
+ unsigned prop_value;
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
- int mpi_size,mpi_rank;
+ int mpi_size, mpi_rank;
+
+ herr_t status;
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
+
+ size_t num_points; /* for point selection */
+ hsize_t *coords = NULL; /* for point selection */
+ hsize_t current_dims; /* for point selection */
+ int i;
+
+ /* set up MPI parameters */
+ MPI_Comm_size(comm, &mpi_size);
+ MPI_Comm_rank(comm, &mpi_rank);
+
+ /* Create the data space */
+
+ acc_plist = create_faccess_plist(comm, info, facc_type);
+ VRFY((acc_plist >= 0), "");
+
+ file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_plist);
+ VRFY((file >= 0), "H5Fcreate succeeded");
+
+ status = H5Pclose(acc_plist);
+ VRFY((status >= 0), "");
+
+ /* setup dimensionality object */
+ dims[0] = SPACE_DIM1 * mpi_size;
+ dims[1] = SPACE_DIM2;
+
+ /* allocate memory for data buffer */
+ data_array1 = (int *)HDmalloc(dims[0] * dims[1] * sizeof(int));
+ VRFY((data_array1 != NULL), "data_array1 malloc succeeded");
+
+ /* set up dimensions of the slab this process accesses */
+ ccslab_set(mpi_rank, mpi_size, start, count, stride, block, select_factor);
+
+ /* set up the coords array selection */
+ num_points = block[0] * block[1] * count[0] * count[1];
+ coords = (hsize_t *)HDmalloc(num_points * RANK * sizeof(hsize_t));
+ VRFY((coords != NULL), "coords malloc succeeded");
+ point_set(start, count, stride, block, num_points, coords, mode);
+
+ file_dataspace = H5Screate_simple(2, dims, NULL);
+ VRFY((file_dataspace >= 0), "file dataspace created succeeded");
+
+ if (ALL != mem_selection) {
+ mem_dataspace = H5Screate_simple(2, dims, NULL);
+ VRFY((mem_dataspace >= 0), "mem dataspace created succeeded");
+ }
+ else {
+ current_dims = num_points;
+ mem_dataspace = H5Screate_simple(1, &current_dims, NULL);
+ VRFY((mem_dataspace >= 0), "mem_dataspace create succeeded");
+ }
+
+ crp_plist = H5Pcreate(H5P_DATASET_CREATE);
+ VRFY((crp_plist >= 0), "");
+
+ /* Set up chunk information. */
+ chunk_dims[0] = dims[0] / chunk_factor;
+
+ /* to decrease the testing time, maintain bigger chunk size */
+ (chunk_factor == 1) ? (chunk_dims[1] = SPACE_DIM2) : (chunk_dims[1] = SPACE_DIM2 / 2);
+ status = H5Pset_chunk(crp_plist, 2, chunk_dims);
+ VRFY((status >= 0), "chunk creation property list succeeded");
+
+ dataset = H5Dcreate2(file, DSET_COLLECTIVE_CHUNK_NAME, H5T_NATIVE_INT, file_dataspace, H5P_DEFAULT,
+ crp_plist, H5P_DEFAULT);
+ VRFY((dataset >= 0), "dataset created succeeded");
+
+ status = H5Pclose(crp_plist);
+ VRFY((status >= 0), "");
+
+ /*put some trivial data in the data array */
+ ccdataset_fill(start, stride, count, block, data_array1, mem_selection);
- herr_t status;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
-
- size_t num_points; /* for point selection */
- hsize_t *coords = NULL; /* for point selection */
- hsize_t current_dims; /* for point selection */
- int i;
-
- /* set up MPI parameters */
- MPI_Comm_size(comm,&mpi_size);
- MPI_Comm_rank(comm,&mpi_rank);
-
- /* Create the data space */
-
- acc_plist = create_faccess_plist(comm,info,facc_type);
- VRFY((acc_plist >= 0),"");
-
- file = H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_plist);
- VRFY((file >= 0),"H5Fcreate succeeded");
-
- status = H5Pclose(acc_plist);
- VRFY((status >= 0),"");
-
- /* setup dimensionality object */
- dims[0] = SPACE_DIM1*mpi_size;
- dims[1] = SPACE_DIM2;
-
- /* allocate memory for data buffer */
- data_array1 = (int *)HDmalloc(dims[0] * dims[1] * sizeof(int));
- VRFY((data_array1 != NULL), "data_array1 malloc succeeded");
-
- /* set up dimensions of the slab this process accesses */
- ccslab_set(mpi_rank, mpi_size, start, count, stride, block, select_factor);
-
- /* set up the coords array selection */
- num_points = block[0] * block[1] * count[0] * count[1];
- coords = (hsize_t *)HDmalloc(num_points * RANK * sizeof(hsize_t));
- VRFY((coords != NULL), "coords malloc succeeded");
- point_set(start, count, stride, block, num_points, coords, mode);
-
- file_dataspace = H5Screate_simple(2, dims, NULL);
- VRFY((file_dataspace >= 0), "file dataspace created succeeded");
-
- if(ALL != mem_selection) {
- mem_dataspace = H5Screate_simple(2, dims, NULL);
- VRFY((mem_dataspace >= 0), "mem dataspace created succeeded");
- }
- else {
- current_dims = num_points;
- mem_dataspace = H5Screate_simple (1, &current_dims, NULL);
- VRFY((mem_dataspace >= 0), "mem_dataspace create succeeded");
- }
-
- crp_plist = H5Pcreate(H5P_DATASET_CREATE);
- VRFY((crp_plist >= 0),"");
-
- /* Set up chunk information. */
- chunk_dims[0] = dims[0]/chunk_factor;
-
- /* to decrease the testing time, maintain bigger chunk size */
- (chunk_factor == 1) ? (chunk_dims[1] = SPACE_DIM2) : (chunk_dims[1] = SPACE_DIM2/2);
- status = H5Pset_chunk(crp_plist, 2, chunk_dims);
- VRFY((status >= 0),"chunk creation property list succeeded");
-
- dataset = H5Dcreate2(file, DSET_COLLECTIVE_CHUNK_NAME, H5T_NATIVE_INT,
- file_dataspace, H5P_DEFAULT, crp_plist, H5P_DEFAULT);
- VRFY((dataset >= 0),"dataset created succeeded");
-
- status = H5Pclose(crp_plist);
- VRFY((status >= 0), "");
-
- /*put some trivial data in the data array */
- ccdataset_fill(start, stride, count,block, data_array1, mem_selection);
-
- MESG("data_array initialized");
-
- switch (file_selection) {
- case HYPER:
- status = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((status >= 0),"hyperslab selection succeeded");
- break;
-
- case POINT:
- if (num_points) {
- status = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords);
- VRFY((status >= 0),"Element selection succeeded");
- }
- else {
- status = H5Sselect_none(file_dataspace);
- VRFY((status >= 0),"none selection succeeded");
- }
- break;
-
- case ALL:
- status = H5Sselect_all(file_dataspace);
- VRFY((status >= 0), "H5Sselect_all succeeded");
- break;
- }
-
- switch (mem_selection) {
- case HYPER:
- status = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((status >= 0),"hyperslab selection succeeded");
- break;
-
- case POINT:
- if (num_points) {
- status = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords);
- VRFY((status >= 0),"Element selection succeeded");
- }
- else {
- status = H5Sselect_none(mem_dataspace);
- VRFY((status >= 0),"none selection succeeded");
- }
- break;
-
- case ALL:
- status = H5Sselect_all(mem_dataspace);
- VRFY((status >= 0), "H5Sselect_all succeeded");
- break;
- }
-
- /* set up the collective transfer property list */
- xfer_plist = H5Pcreate(H5P_DATASET_XFER);
- VRFY((xfer_plist >= 0), "");
-
- status = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
- VRFY((status>= 0),"MPIO collective transfer property succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- status = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((status>= 0),"set independent IO collectively succeeded");
- }
-
- switch(api_option){
- case API_LINK_HARD:
- status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist,H5FD_MPIO_CHUNK_ONE_IO);
- VRFY((status>= 0),"collective chunk optimization succeeded");
- break;
-
- case API_MULTI_HARD:
- status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist,H5FD_MPIO_CHUNK_MULTI_IO);
- VRFY((status>= 0),"collective chunk optimization succeeded ");
- break;
-
- case API_LINK_TRUE:
- status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,2);
- VRFY((status>= 0),"collective chunk optimization set chunk number succeeded");
- break;
-
- case API_LINK_FALSE:
- status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,6);
- VRFY((status>= 0),"collective chunk optimization set chunk number succeeded");
- break;
-
- case API_MULTI_COLL:
- status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,8);/* make sure it is using multi-chunk IO */
- VRFY((status>= 0),"collective chunk optimization set chunk number succeeded");
- status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist,50);
- VRFY((status>= 0),"collective chunk optimization set chunk ratio succeeded");
- break;
-
- case API_MULTI_IND:
- status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,8);/* make sure it is using multi-chunk IO */
- VRFY((status>= 0),"collective chunk optimization set chunk number succeeded");
- status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist,100);
- VRFY((status>= 0),"collective chunk optimization set chunk ratio succeeded");
- break;
-
- default:
- ;
- }
+ MESG("data_array initialized");
+
+ switch (file_selection) {
+ case HYPER:
+ status = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((status >= 0), "hyperslab selection succeeded");
+ break;
+
+ case POINT:
+ if (num_points) {
+ status = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords);
+ VRFY((status >= 0), "Element selection succeeded");
+ }
+ else {
+ status = H5Sselect_none(file_dataspace);
+ VRFY((status >= 0), "none selection succeeded");
+ }
+ break;
+
+ case ALL:
+ status = H5Sselect_all(file_dataspace);
+ VRFY((status >= 0), "H5Sselect_all succeeded");
+ break;
+ }
+
+ switch (mem_selection) {
+ case HYPER:
+ status = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((status >= 0), "hyperslab selection succeeded");
+ break;
+
+ case POINT:
+ if (num_points) {
+ status = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords);
+ VRFY((status >= 0), "Element selection succeeded");
+ }
+ else {
+ status = H5Sselect_none(mem_dataspace);
+ VRFY((status >= 0), "none selection succeeded");
+ }
+ break;
+
+ case ALL:
+ status = H5Sselect_all(mem_dataspace);
+ VRFY((status >= 0), "H5Sselect_all succeeded");
+ break;
+ }
+
+ /* set up the collective transfer property list */
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
+ VRFY((xfer_plist >= 0), "");
+
+ status = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
+ VRFY((status >= 0), "MPIO collective transfer property succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ status = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((status >= 0), "set independent IO collectively succeeded");
+ }
+
+ switch (api_option) {
+ case API_LINK_HARD:
+ status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist, H5FD_MPIO_CHUNK_ONE_IO);
+ VRFY((status >= 0), "collective chunk optimization succeeded");
+ break;
+
+ case API_MULTI_HARD:
+ status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist, H5FD_MPIO_CHUNK_MULTI_IO);
+ VRFY((status >= 0), "collective chunk optimization succeeded ");
+ break;
+
+ case API_LINK_TRUE:
+ status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist, 2);
+ VRFY((status >= 0), "collective chunk optimization set chunk number succeeded");
+ break;
+
+ case API_LINK_FALSE:
+ status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist, 6);
+ VRFY((status >= 0), "collective chunk optimization set chunk number succeeded");
+ break;
+
+ case API_MULTI_COLL:
+ status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist, 8); /* make sure it is using multi-chunk IO */
+ VRFY((status >= 0), "collective chunk optimization set chunk number succeeded");
+ status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist, 50);
+ VRFY((status >= 0), "collective chunk optimization set chunk ratio succeeded");
+ break;
+
+ case API_MULTI_IND:
+ status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist, 8); /* make sure it is using multi-chunk IO */
+ VRFY((status >= 0), "collective chunk optimization set chunk number succeeded");
+ status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist, 100);
+ VRFY((status >= 0), "collective chunk optimization set chunk ratio succeeded");
+ break;
+
+ default:;
+ }
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
- if(facc_type == FACC_MPIO) {
- switch(api_option) {
+ if (facc_type == FACC_MPIO) {
+ switch (api_option) {
case API_LINK_HARD:
- prop_value = H5D_XFER_COLL_CHUNK_DEF;
- status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value,
- NULL, NULL, NULL, NULL, NULL, NULL);
- VRFY((status >= 0),"testing property list inserted succeeded");
- break;
+ prop_value = H5D_XFER_COLL_CHUNK_DEF;
+ status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, H5D_XFER_COLL_CHUNK_SIZE,
+ &prop_value, NULL, NULL, NULL, NULL, NULL, NULL);
+ VRFY((status >= 0), "testing property list inserted succeeded");
+ break;
case API_MULTI_HARD:
- prop_value = H5D_XFER_COLL_CHUNK_DEF;
- status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value,
- NULL, NULL, NULL, NULL, NULL, NULL);
- VRFY((status >= 0),"testing property list inserted succeeded");
- break;
+ prop_value = H5D_XFER_COLL_CHUNK_DEF;
+ status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, H5D_XFER_COLL_CHUNK_SIZE,
+ &prop_value, NULL, NULL, NULL, NULL, NULL, NULL);
+ VRFY((status >= 0), "testing property list inserted succeeded");
+ break;
case API_LINK_TRUE:
- prop_value = H5D_XFER_COLL_CHUNK_DEF;
- status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value,
- NULL, NULL, NULL, NULL, NULL, NULL);
- VRFY((status >= 0),"testing property list inserted succeeded");
- break;
+ prop_value = H5D_XFER_COLL_CHUNK_DEF;
+ status =
+ H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, H5D_XFER_COLL_CHUNK_SIZE,
+ &prop_value, NULL, NULL, NULL, NULL, NULL, NULL);
+ VRFY((status >= 0), "testing property list inserted succeeded");
+ break;
case API_LINK_FALSE:
- prop_value = H5D_XFER_COLL_CHUNK_DEF;
- status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value,
- NULL, NULL, NULL, NULL, NULL, NULL);
- VRFY((status >= 0),"testing property list inserted succeeded");
- break;
+ prop_value = H5D_XFER_COLL_CHUNK_DEF;
+ status =
+ H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, H5D_XFER_COLL_CHUNK_SIZE,
+ &prop_value, NULL, NULL, NULL, NULL, NULL, NULL);
+ VRFY((status >= 0), "testing property list inserted succeeded");
+ break;
case API_MULTI_COLL:
- prop_value = H5D_XFER_COLL_CHUNK_DEF;
- status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value,
- NULL, NULL, NULL, NULL, NULL, NULL);
- VRFY((status >= 0),"testing property list inserted succeeded");
- break;
+ prop_value = H5D_XFER_COLL_CHUNK_DEF;
+ status =
+ H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME,
+ H5D_XFER_COLL_CHUNK_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL);
+ VRFY((status >= 0), "testing property list inserted succeeded");
+ break;
case API_MULTI_IND:
- prop_value = H5D_XFER_COLL_CHUNK_DEF;
- status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value,
- NULL, NULL, NULL, NULL, NULL, NULL);
- VRFY((status >= 0),"testing property list inserted succeeded");
- break;
-
- default:
- ;
- }
- }
+ prop_value = H5D_XFER_COLL_CHUNK_DEF;
+ status =
+ H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, H5D_XFER_COLL_CHUNK_SIZE,
+ &prop_value, NULL, NULL, NULL, NULL, NULL, NULL);
+ VRFY((status >= 0), "testing property list inserted succeeded");
+ break;
+
+ default:;
+ }
+ }
#endif
- /* write data collectively */
- status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
- VRFY((status >= 0),"dataset write succeeded");
+ /* write data collectively */
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
+ VRFY((status >= 0), "dataset write succeeded");
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
- if(facc_type == FACC_MPIO) {
- switch(api_option){
+ if (facc_type == FACC_MPIO) {
+ switch (api_option) {
case API_LINK_HARD:
- status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_HARD_NAME,&prop_value);
- VRFY((status >= 0),"testing property list get succeeded");
- VRFY((prop_value == 0),"API to set LINK COLLECTIVE IO directly succeeded");
- break;
+ status = H5Pget(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, &prop_value);
+ VRFY((status >= 0), "testing property list get succeeded");
+ VRFY((prop_value == 0), "API to set LINK COLLECTIVE IO directly succeeded");
+ break;
case API_MULTI_HARD:
- status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME,&prop_value);
- VRFY((status >= 0),"testing property list get succeeded");
- VRFY((prop_value == 0),"API to set MULTI-CHUNK COLLECTIVE IO optimization succeeded");
- break;
+ status = H5Pget(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, &prop_value);
+ VRFY((status >= 0), "testing property list get succeeded");
+ VRFY((prop_value == 0), "API to set MULTI-CHUNK COLLECTIVE IO optimization succeeded");
+ break;
case API_LINK_TRUE:
- status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME,&prop_value);
- VRFY((status >= 0),"testing property list get succeeded");
- VRFY((prop_value == 0),"API to set LINK COLLECTIVE IO succeeded");
- break;
+ status = H5Pget(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, &prop_value);
+ VRFY((status >= 0), "testing property list get succeeded");
+ VRFY((prop_value == 0), "API to set LINK COLLECTIVE IO succeeded");
+ break;
case API_LINK_FALSE:
- status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME,&prop_value);
- VRFY((status >= 0),"testing property list get succeeded");
- VRFY((prop_value == 0),"API to set LINK IO transferring to multi-chunk IO succeeded");
- break;
+ status = H5Pget(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, &prop_value);
+ VRFY((status >= 0), "testing property list get succeeded");
+ VRFY((prop_value == 0), "API to set LINK IO transferring to multi-chunk IO succeeded");
+ break;
case API_MULTI_COLL:
- status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME,&prop_value);
- VRFY((status >= 0),"testing property list get succeeded");
- VRFY((prop_value == 0),"API to set MULTI-CHUNK COLLECTIVE IO with optimization succeeded");
- break;
+ status = H5Pget(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, &prop_value);
+ VRFY((status >= 0), "testing property list get succeeded");
+ VRFY((prop_value == 0), "API to set MULTI-CHUNK COLLECTIVE IO with optimization succeeded");
+ break;
case API_MULTI_IND:
- status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME,&prop_value);
- VRFY((status >= 0),"testing property list get succeeded");
- VRFY((prop_value == 0),"API to set MULTI-CHUNK IO transferring to independent IO succeeded");
- break;
-
- default:
- ;
- }
- }
+ status = H5Pget(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, &prop_value);
+ VRFY((status >= 0), "testing property list get succeeded");
+ VRFY((prop_value == 0),
+ "API to set MULTI-CHUNK IO transferring to independent IO succeeded");
+ break;
+
+ default:;
+ }
+ }
#endif
- status = H5Dclose(dataset);
- VRFY((status >= 0),"");
-
- status = H5Pclose(xfer_plist);
- VRFY((status >= 0),"property list closed");
-
- status = H5Sclose(file_dataspace);
- VRFY((status >= 0),"");
-
- status = H5Sclose(mem_dataspace);
- VRFY((status >= 0),"");
-
-
- status = H5Fclose(file);
- VRFY((status >= 0),"");
-
- if (data_array1) HDfree(data_array1);
-
- /* Use collective read to verify the correctness of collective write. */
-
- /* allocate memory for data buffer */
- data_array1 = (int *)HDmalloc(dims[0]*dims[1]*sizeof(int));
- VRFY((data_array1 != NULL), "data_array1 malloc succeeded");
-
- /* allocate memory for data buffer */
- data_origin1 = (int *)HDmalloc(dims[0]*dims[1]*sizeof(int));
- VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded");
-
- acc_plist = create_faccess_plist(comm, info, facc_type);
- VRFY((acc_plist >= 0),"MPIO creation property list succeeded");
-
- file = H5Fopen(filename,H5F_ACC_RDONLY,acc_plist);
- VRFY((file >= 0),"H5Fcreate succeeded");
-
- status = H5Pclose(acc_plist);
- VRFY((status >= 0),"");
-
- /* open the collective dataset*/
- dataset = H5Dopen2(file, DSET_COLLECTIVE_CHUNK_NAME, H5P_DEFAULT);
- VRFY((dataset >= 0), "");
-
- /* set up dimensions of the slab this process accesses */
- ccslab_set(mpi_rank, mpi_size, start, count, stride, block, select_factor);
-
- /* obtain the file and mem dataspace*/
- file_dataspace = H5Dget_space (dataset);
- VRFY((file_dataspace >= 0), "");
-
- if (ALL != mem_selection) {
- mem_dataspace = H5Dget_space (dataset);
- VRFY((mem_dataspace >= 0), "");
- }
- else {
- current_dims = num_points;
- mem_dataspace = H5Screate_simple (1, &current_dims, NULL);
- VRFY((mem_dataspace >= 0), "mem_dataspace create succeeded");
- }
-
- switch (file_selection) {
- case HYPER:
- status = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((status >= 0),"hyperslab selection succeeded");
- break;
-
- case POINT:
- if (num_points) {
- status = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords);
- VRFY((status >= 0),"Element selection succeeded");
- }
- else {
- status = H5Sselect_none(file_dataspace);
- VRFY((status >= 0),"none selection succeeded");
- }
- break;
-
- case ALL:
- status = H5Sselect_all(file_dataspace);
- VRFY((status >= 0), "H5Sselect_all succeeded");
- break;
- }
-
- switch (mem_selection) {
- case HYPER:
- status = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((status >= 0),"hyperslab selection succeeded");
- break;
-
- case POINT:
- if (num_points) {
- status = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords);
- VRFY((status >= 0),"Element selection succeeded");
- }
- else {
- status = H5Sselect_none(mem_dataspace);
- VRFY((status >= 0),"none selection succeeded");
- }
- break;
-
- case ALL:
- status = H5Sselect_all(mem_dataspace);
- VRFY((status >= 0), "H5Sselect_all succeeded");
- break;
- }
-
- /* fill dataset with test data */
- ccdataset_fill(start, stride,count,block, data_origin1, mem_selection);
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
- VRFY((xfer_plist >= 0),"");
-
- status = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
- VRFY((status>= 0),"MPIO collective transfer property succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- status = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((status>= 0),"set independent IO collectively succeeded");
- }
-
- status = H5Dread(dataset, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
- VRFY((status >=0),"dataset read succeeded");
-
- /* verify the read data with original expected data */
- status = ccdataset_vrfy(start, count, stride, block, data_array1, data_origin1, mem_selection);
- if (status) nerrors++;
-
- status = H5Pclose(xfer_plist);
- VRFY((status >= 0),"property list closed");
-
- /* close dataset collectively */
- status=H5Dclose(dataset);
- VRFY((status >= 0), "H5Dclose");
-
- /* release all IDs created */
- status = H5Sclose(file_dataspace);
- VRFY((status >= 0),"H5Sclose");
-
- status = H5Sclose(mem_dataspace);
- VRFY((status >= 0),"H5Sclose");
-
- /* close the file collectively */
- status = H5Fclose(file);
- VRFY((status >= 0),"H5Fclose");
-
- /* release data buffers */
- if(coords) HDfree(coords);
- if(data_array1) HDfree(data_array1);
- if(data_origin1) HDfree(data_origin1);
+ status = H5Dclose(dataset);
+ VRFY((status >= 0), "");
-}
+ status = H5Pclose(xfer_plist);
+ VRFY((status >= 0), "property list closed");
+
+ status = H5Sclose(file_dataspace);
+ VRFY((status >= 0), "");
+
+ status = H5Sclose(mem_dataspace);
+ VRFY((status >= 0), "");
+ status = H5Fclose(file);
+ VRFY((status >= 0), "");
+
+ if (data_array1)
+ HDfree(data_array1);
+
+ /* Use collective read to verify the correctness of collective write. */
+
+ /* allocate memory for data buffer */
+ data_array1 = (int *)HDmalloc(dims[0] * dims[1] * sizeof(int));
+ VRFY((data_array1 != NULL), "data_array1 malloc succeeded");
+
+ /* allocate memory for data buffer */
+ data_origin1 = (int *)HDmalloc(dims[0] * dims[1] * sizeof(int));
+ VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded");
+
+ acc_plist = create_faccess_plist(comm, info, facc_type);
+ VRFY((acc_plist >= 0), "MPIO creation property list succeeded");
+
+ file = H5Fopen(filename, H5F_ACC_RDONLY, acc_plist);
+ VRFY((file >= 0), "H5Fcreate succeeded");
+
+ status = H5Pclose(acc_plist);
+ VRFY((status >= 0), "");
+
+ /* open the collective dataset*/
+ dataset = H5Dopen2(file, DSET_COLLECTIVE_CHUNK_NAME, H5P_DEFAULT);
+ VRFY((dataset >= 0), "");
+
+ /* set up dimensions of the slab this process accesses */
+ ccslab_set(mpi_rank, mpi_size, start, count, stride, block, select_factor);
+
+ /* obtain the file and mem dataspace*/
+ file_dataspace = H5Dget_space(dataset);
+ VRFY((file_dataspace >= 0), "");
+
+ if (ALL != mem_selection) {
+ mem_dataspace = H5Dget_space(dataset);
+ VRFY((mem_dataspace >= 0), "");
+ }
+ else {
+ current_dims = num_points;
+ mem_dataspace = H5Screate_simple(1, &current_dims, NULL);
+ VRFY((mem_dataspace >= 0), "mem_dataspace create succeeded");
+ }
+
+ switch (file_selection) {
+ case HYPER:
+ status = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((status >= 0), "hyperslab selection succeeded");
+ break;
+
+ case POINT:
+ if (num_points) {
+ status = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords);
+ VRFY((status >= 0), "Element selection succeeded");
+ }
+ else {
+ status = H5Sselect_none(file_dataspace);
+ VRFY((status >= 0), "none selection succeeded");
+ }
+ break;
+
+ case ALL:
+ status = H5Sselect_all(file_dataspace);
+ VRFY((status >= 0), "H5Sselect_all succeeded");
+ break;
+ }
+
+ switch (mem_selection) {
+ case HYPER:
+ status = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((status >= 0), "hyperslab selection succeeded");
+ break;
+
+ case POINT:
+ if (num_points) {
+ status = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords);
+ VRFY((status >= 0), "Element selection succeeded");
+ }
+ else {
+ status = H5Sselect_none(mem_dataspace);
+ VRFY((status >= 0), "none selection succeeded");
+ }
+ break;
+
+ case ALL:
+ status = H5Sselect_all(mem_dataspace);
+ VRFY((status >= 0), "H5Sselect_all succeeded");
+ break;
+ }
+
+ /* fill dataset with test data */
+ ccdataset_fill(start, stride, count, block, data_origin1, mem_selection);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
+ VRFY((xfer_plist >= 0), "");
+
+ status = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
+ VRFY((status >= 0), "MPIO collective transfer property succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ status = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((status >= 0), "set independent IO collectively succeeded");
+ }
+
+ status = H5Dread(dataset, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
+ VRFY((status >= 0), "dataset read succeeded");
+
+ /* verify the read data with original expected data */
+ status = ccdataset_vrfy(start, count, stride, block, data_array1, data_origin1, mem_selection);
+ if (status)
+ nerrors++;
+
+ status = H5Pclose(xfer_plist);
+ VRFY((status >= 0), "property list closed");
+
+ /* close dataset collectively */
+ status = H5Dclose(dataset);
+ VRFY((status >= 0), "H5Dclose");
+
+ /* release all IDs created */
+ status = H5Sclose(file_dataspace);
+ VRFY((status >= 0), "H5Sclose");
+
+ status = H5Sclose(mem_dataspace);
+ VRFY((status >= 0), "H5Sclose");
+
+ /* close the file collectively */
+ status = H5Fclose(file);
+ VRFY((status >= 0), "H5Fclose");
+
+ /* release data buffers */
+ if (coords)
+ HDfree(coords);
+ if (data_array1)
+ HDfree(data_array1);
+ if (data_origin1)
+ HDfree(data_origin1);
+}
/* Set up the selection */
static void
-ccslab_set(int mpi_rank,
- int mpi_size,
- hsize_t start[],
- hsize_t count[],
- hsize_t stride[],
- hsize_t block[],
- int mode)
+ccslab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[],
+ int mode)
{
- switch (mode){
-
- case BYROW_CONT:
- /* Each process takes a slabs of rows. */
- block[0] = 1;
- block[1] = 1;
- stride[0] = 1;
- stride[1] = 1;
- count[0] = SPACE_DIM1;
- count[1] = SPACE_DIM2;
- start[0] = mpi_rank*count[0];
- start[1] = 0;
-
- break;
-
- case BYROW_DISCONT:
- /* Each process takes several disjoint blocks. */
- block[0] = 1;
- block[1] = 1;
- stride[0] = 3;
- stride[1] = 3;
- count[0] = SPACE_DIM1/(stride[0]*block[0]);
- count[1] = (SPACE_DIM2)/(stride[1]*block[1]);
- start[0] = SPACE_DIM1*mpi_rank;
- start[1] = 0;
-
- break;
-
- case BYROW_SELECTNONE:
- /* Each process takes a slabs of rows, there are
- no selections for the last process. */
- block[0] = 1;
- block[1] = 1;
- stride[0] = 1;
- stride[1] = 1;
- count[0] = ((mpi_rank >= MAX(1,(mpi_size-2)))?0:SPACE_DIM1);
- count[1] = SPACE_DIM2;
- start[0] = mpi_rank*count[0];
- start[1] = 0;
-
- break;
-
- case BYROW_SELECTUNBALANCE:
- /* The first one-third of the number of processes only
- select top half of the domain, The rest will select the bottom
- half of the domain. */
-
- block[0] = 1;
- count[0] = 2;
- stride[0] = SPACE_DIM1*mpi_size/4+1;
- block[1] = SPACE_DIM2;
- count[1] = 1;
- start[1] = 0;
- stride[1] = 1;
- if((mpi_rank *3)<(mpi_size*2)) start[0] = mpi_rank;
- else start[0] = 1 + SPACE_DIM1*mpi_size/2 + (mpi_rank-2*mpi_size/3);
- break;
-
- case BYROW_SELECTINCHUNK:
- /* Each process will only select one chunk */
-
- block[0] = 1;
- count[0] = 1;
- start[0] = mpi_rank*SPACE_DIM1;
- stride[0]= 1;
- block[1] = SPACE_DIM2;
- count[1] = 1;
- stride[1]= 1;
- start[1] = 0;
-
- break;
-
- default:
- /* Unknown mode. Set it to cover the whole dataset. */
- block[0] = SPACE_DIM1*mpi_size;
- block[1] = SPACE_DIM2;
- stride[0] = block[0];
- stride[1] = block[1];
- count[0] = 1;
- count[1] = 1;
- start[0] = 0;
- start[1] = 0;
-
- break;
+ switch (mode) {
+
+ case BYROW_CONT:
+ /* Each process takes a slabs of rows. */
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = SPACE_DIM1;
+ count[1] = SPACE_DIM2;
+ start[0] = mpi_rank * count[0];
+ start[1] = 0;
+
+ break;
+
+ case BYROW_DISCONT:
+ /* Each process takes several disjoint blocks. */
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 3;
+ stride[1] = 3;
+ count[0] = SPACE_DIM1 / (stride[0] * block[0]);
+ count[1] = (SPACE_DIM2) / (stride[1] * block[1]);
+ start[0] = SPACE_DIM1 * mpi_rank;
+ start[1] = 0;
+
+ break;
+
+ case BYROW_SELECTNONE:
+ /* Each process takes a slabs of rows, there are
+ no selections for the last process. */
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = ((mpi_rank >= MAX(1, (mpi_size - 2))) ? 0 : SPACE_DIM1);
+ count[1] = SPACE_DIM2;
+ start[0] = mpi_rank * count[0];
+ start[1] = 0;
+
+ break;
+
+ case BYROW_SELECTUNBALANCE:
+ /* The first one-third of the number of processes only
+ select top half of the domain, The rest will select the bottom
+ half of the domain. */
+
+ block[0] = 1;
+ count[0] = 2;
+ stride[0] = SPACE_DIM1 * mpi_size / 4 + 1;
+ block[1] = SPACE_DIM2;
+ count[1] = 1;
+ start[1] = 0;
+ stride[1] = 1;
+ if ((mpi_rank * 3) < (mpi_size * 2))
+ start[0] = mpi_rank;
+ else
+ start[0] = 1 + SPACE_DIM1 * mpi_size / 2 + (mpi_rank - 2 * mpi_size / 3);
+ break;
+
+ case BYROW_SELECTINCHUNK:
+ /* Each process will only select one chunk */
+
+ block[0] = 1;
+ count[0] = 1;
+ start[0] = mpi_rank * SPACE_DIM1;
+ stride[0] = 1;
+ block[1] = SPACE_DIM2;
+ count[1] = 1;
+ stride[1] = 1;
+ start[1] = 0;
+
+ break;
+
+ default:
+ /* Unknown mode. Set it to cover the whole dataset. */
+ block[0] = SPACE_DIM1 * mpi_size;
+ block[1] = SPACE_DIM2;
+ stride[0] = block[0];
+ stride[1] = block[1];
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = 0;
+ start[1] = 0;
+
+ break;
}
- if (VERBOSE_MED){
- printf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n",
- (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1],
- (unsigned long)(block[0]*block[1]*count[0]*count[1]));
+ if (VERBOSE_MED) {
+ HDprintf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total "
+ "datapoints=%lu\n",
+ (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0],
+ (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1],
+ (unsigned long)block[0], (unsigned long)block[1],
+ (unsigned long)(block[0] * block[1] * count[0] * count[1]));
}
}
-
/*
* Fill the dataset with trivial data for testing.
* Assume dimension rank is 2.
*/
static void
-ccdataset_fill(hsize_t start[],
- hsize_t stride[],
- hsize_t count[],
- hsize_t block[],
- DATATYPE * dataset,
+ccdataset_fill(hsize_t start[], hsize_t stride[], hsize_t count[], hsize_t block[], DATATYPE *dataset,
int mem_selection)
{
DATATYPE *dataptr = dataset;
DATATYPE *tmptr;
- hsize_t i,j,k1,k2,k=0;
+ hsize_t i, j, k1, k2, k = 0;
/* put some trivial data in the data_array */
tmptr = dataptr;
@@ -1164,23 +1149,23 @@ ccdataset_fill(hsize_t start[],
through the pointer */
for (k1 = 0; k1 < count[0]; k1++) {
- for(i = 0; i < block[0]; i++) {
- for(k2 = 0; k2 < count[1]; k2++) {
- for(j = 0;j < block[1]; j++) {
+ for (i = 0; i < block[0]; i++) {
+ for (k2 = 0; k2 < count[1]; k2++) {
+ for (j = 0; j < block[1]; j++) {
- if (ALL != mem_selection) {
- dataptr = tmptr + ((start[0]+k1*stride[0]+i)*SPACE_DIM2+
- start[1]+k2*stride[1]+j);
- }
- else {
- dataptr = tmptr + k;
- k++;
- }
+ if (ALL != mem_selection) {
+ dataptr = tmptr + ((start[0] + k1 * stride[0] + i) * SPACE_DIM2 + start[1] +
+ k2 * stride[1] + j);
+ }
+ else {
+ dataptr = tmptr + k;
+ k++;
+ }
- *dataptr = (DATATYPE)(k1+k2+i+j);
- }
+ *dataptr = (DATATYPE)(k1 + k2 + i + j);
+ }
+ }
}
- }
}
}
@@ -1188,83 +1173,75 @@ ccdataset_fill(hsize_t start[],
* Print the first block of the content of the dataset.
*/
static void
-ccdataset_print(hsize_t start[],
- hsize_t block[],
- DATATYPE * dataset)
+ccdataset_print(hsize_t start[], hsize_t block[], DATATYPE *dataset)
{
DATATYPE *dataptr = dataset;
- hsize_t i, j;
+ hsize_t i, j;
/* print the column heading */
- printf("Print only the first block of the dataset\n");
- printf("%-8s", "Cols:");
- for (j=0; j < block[1]; j++){
- printf("%3lu ", (unsigned long)(start[1]+j));
+ HDprintf("Print only the first block of the dataset\n");
+ HDprintf("%-8s", "Cols:");
+ for (j = 0; j < block[1]; j++) {
+ HDprintf("%3lu ", (unsigned long)(start[1] + j));
}
- printf("\n");
+ HDprintf("\n");
/* print the slab data */
- for (i=0; i < block[0]; i++){
- printf("Row %2lu: ", (unsigned long)(i+start[0]));
- for (j=0; j < block[1]; j++){
- printf("%03d ", *dataptr++);
- }
- printf("\n");
+ for (i = 0; i < block[0]; i++) {
+ HDprintf("Row %2lu: ", (unsigned long)(i + start[0]));
+ for (j = 0; j < block[1]; j++) {
+ HDprintf("%03d ", *dataptr++);
+ }
+ HDprintf("\n");
}
}
-
/*
* Print the content of the dataset.
*/
static int
-ccdataset_vrfy(hsize_t start[],
- hsize_t count[],
- hsize_t stride[],
- hsize_t block[],
- DATATYPE *dataset,
- DATATYPE *original,
- int mem_selection)
+ccdataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset,
+ DATATYPE *original, int mem_selection)
{
- hsize_t i, j,k1,k2,k=0;
- int vrfyerrs;
- DATATYPE *dataptr,*oriptr;
+ hsize_t i, j, k1, k2, k = 0;
+ int vrfyerrs;
+ DATATYPE *dataptr, *oriptr;
/* print it if VERBOSE_MED */
if (VERBOSE_MED) {
- printf("dataset_vrfy dumping:::\n");
- printf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n",
- (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]);
- printf("original values:\n");
- ccdataset_print(start, block, original);
- printf("compared values:\n");
- ccdataset_print(start, block, dataset);
+ HDprintf("dataset_vrfy dumping:::\n");
+ HDprintf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n",
+ (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0],
+ (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1],
+ (unsigned long)block[0], (unsigned long)block[1]);
+ HDprintf("original values:\n");
+ ccdataset_print(start, block, original);
+ HDprintf("compared values:\n");
+ ccdataset_print(start, block, dataset);
}
vrfyerrs = 0;
- for (k1=0;k1<count[0];k1++) {
- for(i=0;i<block[0];i++) {
- for(k2=0; k2<count[1];k2++) {
- for(j=0;j<block[1];j++) {
+ for (k1 = 0; k1 < count[0]; k1++) {
+ for (i = 0; i < block[0]; i++) {
+ for (k2 = 0; k2 < count[1]; k2++) {
+ for (j = 0; j < block[1]; j++) {
if (ALL != mem_selection) {
- dataptr = dataset + ((start[0]+k1*stride[0]+i)*SPACE_DIM2+
- start[1]+k2*stride[1]+j);
- oriptr = original + ((start[0]+k1*stride[0]+i)*SPACE_DIM2+
- start[1]+k2*stride[1]+j);
+ dataptr = dataset + ((start[0] + k1 * stride[0] + i) * SPACE_DIM2 + start[1] +
+ k2 * stride[1] + j);
+ oriptr = original + ((start[0] + k1 * stride[0] + i) * SPACE_DIM2 + start[1] +
+ k2 * stride[1] + j);
}
else {
dataptr = dataset + k;
- oriptr = original + k;
+ oriptr = original + k;
k++;
}
- if (*dataptr != *oriptr){
- if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){
- printf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n",
- (unsigned long)i, (unsigned long)j,
- *(oriptr), *(dataptr));
+ if (*dataptr != *oriptr) {
+ if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED) {
+ HDprintf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n",
+ (unsigned long)i, (unsigned long)j, *(oriptr), *(dataptr));
}
}
}
@@ -1272,8 +1249,8 @@ ccdataset_vrfy(hsize_t start[],
}
}
if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
- printf("[more errors ...]\n");
+ HDprintf("[more errors ...]\n");
if (vrfyerrs)
- printf("%d errors found in ccdataset_vrfy\n", vrfyerrs);
- return(vrfyerrs);
+ HDprintf("%d errors found in ccdataset_vrfy\n", vrfyerrs);
+ return (vrfyerrs);
}
diff --git a/testpar/t_dset.c b/testpar/t_dset.c
index 29d6dcf..b841cd3 100644
--- a/testpar/t_dset.c
+++ b/testpar/t_dset.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -36,130 +36,135 @@
* Setup the dimensions of the hyperslab.
* Two modes--by rows or by columns.
* Assume dimension rank is 2.
- * BYROW divide into slabs of rows
- * BYCOL divide into blocks of columns
- * ZROW same as BYROW except process 0 gets 0 rows
- * ZCOL same as BYCOL except process 0 gets 0 columns
+ * BYROW divide into slabs of rows
+ * BYCOL divide into blocks of columns
+ * ZROW same as BYROW except process 0 gets 0 rows
+ * ZCOL same as BYCOL except process 0 gets 0 columns
*/
static void
-slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[],
- hsize_t stride[], hsize_t block[], int mode)
+slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[],
+ int mode)
{
- switch (mode){
- case BYROW:
- /* Each process takes a slabs of rows. */
- block[0] = dim0/mpi_size;
- block[1] = dim1;
- stride[0] = block[0];
- stride[1] = block[1];
- count[0] = 1;
- count[1] = 1;
- start[0] = mpi_rank*block[0];
- start[1] = 0;
-if(VERBOSE_MED) printf("slab_set BYROW\n");
- break;
- case BYCOL:
- /* Each process takes a block of columns. */
- block[0] = dim0;
- block[1] = dim1/mpi_size;
- stride[0] = block[0];
- stride[1] = block[1];
- count[0] = 1;
- count[1] = 1;
- start[0] = 0;
- start[1] = mpi_rank*block[1];
-if(VERBOSE_MED) printf("slab_set BYCOL\n");
- break;
- case ZROW:
- /* Similar to BYROW except process 0 gets 0 row */
- block[0] = (mpi_rank ? dim0/mpi_size : 0);
- block[1] = dim1;
- stride[0] = (mpi_rank ? block[0] : 1); /* avoid setting stride to 0 */
- stride[1] = block[1];
- count[0] = 1;
- count[1] = 1;
- start[0] = (mpi_rank? mpi_rank*block[0] : 0);
- start[1] = 0;
-if(VERBOSE_MED) printf("slab_set ZROW\n");
- break;
- case ZCOL:
- /* Similar to BYCOL except process 0 gets 0 column */
- block[0] = dim0;
- block[1] = (mpi_rank ? dim1/mpi_size : 0);
- stride[0] = block[0];
- stride[1] = (mpi_rank ? block[1] : 1); /* avoid setting stride to 0 */
- count[0] = 1;
- count[1] = 1;
- start[0] = 0;
- start[1] = (mpi_rank? mpi_rank*block[1] : 0);
-if(VERBOSE_MED) printf("slab_set ZCOL\n");
- break;
- default:
- /* Unknown mode. Set it to cover the whole dataset. */
- printf("unknown slab_set mode (%d)\n", mode);
- block[0] = dim0;
- block[1] = dim1;
- stride[0] = block[0];
- stride[1] = block[1];
- count[0] = 1;
- count[1] = 1;
- start[0] = 0;
- start[1] = 0;
-if(VERBOSE_MED) printf("slab_set wholeset\n");
- break;
+ switch (mode) {
+ case BYROW:
+ /* Each process takes a slabs of rows. */
+ block[0] = dim0 / mpi_size;
+ block[1] = dim1;
+ stride[0] = block[0];
+ stride[1] = block[1];
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = mpi_rank * block[0];
+ start[1] = 0;
+ if (VERBOSE_MED)
+ HDprintf("slab_set BYROW\n");
+ break;
+ case BYCOL:
+ /* Each process takes a block of columns. */
+ block[0] = dim0;
+ block[1] = dim1 / mpi_size;
+ stride[0] = block[0];
+ stride[1] = block[1];
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = 0;
+ start[1] = mpi_rank * block[1];
+ if (VERBOSE_MED)
+ HDprintf("slab_set BYCOL\n");
+ break;
+ case ZROW:
+ /* Similar to BYROW except process 0 gets 0 row */
+ block[0] = (mpi_rank ? dim0 / mpi_size : 0);
+ block[1] = dim1;
+ stride[0] = (mpi_rank ? block[0] : 1); /* avoid setting stride to 0 */
+ stride[1] = block[1];
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = (mpi_rank ? mpi_rank * block[0] : 0);
+ start[1] = 0;
+ if (VERBOSE_MED)
+ HDprintf("slab_set ZROW\n");
+ break;
+ case ZCOL:
+ /* Similar to BYCOL except process 0 gets 0 column */
+ block[0] = dim0;
+ block[1] = (mpi_rank ? dim1 / mpi_size : 0);
+ stride[0] = block[0];
+ stride[1] = (mpi_rank ? block[1] : 1); /* avoid setting stride to 0 */
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = 0;
+ start[1] = (mpi_rank ? mpi_rank * block[1] : 0);
+ if (VERBOSE_MED)
+ HDprintf("slab_set ZCOL\n");
+ break;
+ default:
+ /* Unknown mode. Set it to cover the whole dataset. */
+ HDprintf("unknown slab_set mode (%d)\n", mode);
+ block[0] = dim0;
+ block[1] = dim1;
+ stride[0] = block[0];
+ stride[1] = block[1];
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = 0;
+ start[1] = 0;
+ if (VERBOSE_MED)
+ HDprintf("slab_set wholeset\n");
+ break;
}
-if(VERBOSE_MED){
- printf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n",
- (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1],
- (unsigned long)(block[0]*block[1]*count[0]*count[1]));
+ if (VERBOSE_MED) {
+ HDprintf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total "
+ "datapoints=%lu\n",
+ (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0],
+ (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1],
+ (unsigned long)block[0], (unsigned long)block[1],
+ (unsigned long)(block[0] * block[1] * count[0] * count[1]));
}
}
/*
* Setup the coordinates for point selection.
*/
-void point_set(hsize_t start[],
- hsize_t count[],
- hsize_t stride[],
- hsize_t block[],
- size_t num_points,
- hsize_t coords[],
- int order)
+void
+point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points,
+ hsize_t coords[], int order)
{
- hsize_t i,j, k = 0, m ,n, s1 ,s2;
+ hsize_t i, j, k = 0, m, n, s1, s2;
HDcompile_assert(RANK == 2);
- if(OUT_OF_ORDER == order)
+ if (OUT_OF_ORDER == order)
k = (num_points * RANK) - 1;
- else if(IN_ORDER == order)
+ else if (IN_ORDER == order)
k = 0;
s1 = start[0];
s2 = start[1];
- for(i = 0 ; i < count[0]; i++)
- for(j = 0 ; j < count[1]; j++)
- for(m = 0 ; m < block[0]; m++)
- for(n = 0 ; n < block[1]; n++)
- if(OUT_OF_ORDER == order) {
+ for (i = 0; i < count[0]; i++)
+ for (j = 0; j < count[1]; j++)
+ for (m = 0; m < block[0]; m++)
+ for (n = 0; n < block[1]; n++)
+ if (OUT_OF_ORDER == order) {
coords[k--] = s2 + (stride[1] * j) + n;
coords[k--] = s1 + (stride[0] * i) + m;
}
- else if(IN_ORDER == order) {
+ else if (IN_ORDER == order) {
coords[k++] = s1 + stride[0] * i + m;
coords[k++] = s2 + stride[1] * j + n;
}
- if(VERBOSE_MED) {
- printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total datapoints=%lu\n",
- (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1],
- (unsigned long)(block[0] * block[1] * count[0] * count[1]));
+ if (VERBOSE_MED) {
+ HDprintf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total "
+ "datapoints=%lu\n",
+ (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0],
+ (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1],
+ (unsigned long)block[0], (unsigned long)block[1],
+ (unsigned long)(block[0] * block[1] * count[0] * count[1]));
k = 0;
- for(i = 0; i < num_points ; i++) {
- printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]);
+ for (i = 0; i < num_points; i++) {
+ HDprintf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]);
k += 2;
}
}
@@ -170,92 +175,90 @@ void point_set(hsize_t start[],
* Assume dimension rank is 2 and data is stored contiguous.
*/
static void
-dataset_fill(hsize_t start[], hsize_t block[], DATATYPE * dataset)
+dataset_fill(hsize_t start[], hsize_t block[], DATATYPE *dataset)
{
DATATYPE *dataptr = dataset;
- hsize_t i, j;
+ hsize_t i, j;
/* put some trivial data in the data_array */
- for (i=0; i < block[0]; i++){
- for (j=0; j < block[1]; j++){
- *dataptr = (DATATYPE)((i+start[0])*100 + (j+start[1]+1));
- dataptr++;
- }
+ for (i = 0; i < block[0]; i++) {
+ for (j = 0; j < block[1]; j++) {
+ *dataptr = (DATATYPE)((i + start[0]) * 100 + (j + start[1] + 1));
+ dataptr++;
+ }
}
}
-
/*
* Print the content of the dataset.
*/
static void
-dataset_print(hsize_t start[], hsize_t block[], DATATYPE * dataset)
+dataset_print(hsize_t start[], hsize_t block[], DATATYPE *dataset)
{
DATATYPE *dataptr = dataset;
- hsize_t i, j;
+ hsize_t i, j;
/* print the column heading */
- printf("%-8s", "Cols:");
- for (j=0; j < block[1]; j++){
- printf("%3lu ", (unsigned long)(start[1]+j));
+ HDprintf("%-8s", "Cols:");
+ for (j = 0; j < block[1]; j++) {
+ HDprintf("%3lu ", (unsigned long)(start[1] + j));
}
- printf("\n");
+ HDprintf("\n");
/* print the slab data */
- for (i=0; i < block[0]; i++){
- printf("Row %2lu: ", (unsigned long)(i+start[0]));
- for (j=0; j < block[1]; j++){
- printf("%03d ", *dataptr++);
- }
- printf("\n");
+ for (i = 0; i < block[0]; i++) {
+ HDprintf("Row %2lu: ", (unsigned long)(i + start[0]));
+ for (j = 0; j < block[1]; j++) {
+ HDprintf("%03d ", *dataptr++);
+ }
+ HDprintf("\n");
}
}
-
/*
* Print the content of the dataset.
*/
int
-dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original)
+dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset,
+ DATATYPE *original)
{
hsize_t i, j;
- int vrfyerrs;
+ int vrfyerrs;
/* print it if VERBOSE_MED */
- if(VERBOSE_MED) {
- printf("dataset_vrfy dumping:::\n");
- printf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n",
- (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1],
- (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]);
- printf("original values:\n");
- dataset_print(start, block, original);
- printf("compared values:\n");
- dataset_print(start, block, dataset);
+ if (VERBOSE_MED) {
+ HDprintf("dataset_vrfy dumping:::\n");
+ HDprintf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n",
+ (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0],
+ (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1],
+ (unsigned long)block[0], (unsigned long)block[1]);
+ HDprintf("original values:\n");
+ dataset_print(start, block, original);
+ HDprintf("compared values:\n");
+ dataset_print(start, block, dataset);
}
vrfyerrs = 0;
- for (i=0; i < block[0]; i++){
- for (j=0; j < block[1]; j++){
- if(*dataset != *original){
- if(vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){
- printf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n",
- (unsigned long)i, (unsigned long)j,
- (unsigned long)(i+start[0]), (unsigned long)(j+start[1]),
- *(original), *(dataset));
- }
- dataset++;
- original++;
- }
- }
+ for (i = 0; i < block[0]; i++) {
+ for (j = 0; j < block[1]; j++) {
+ if (*dataset != *original) {
+ if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED) {
+ HDprintf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n",
+ (unsigned long)i, (unsigned long)j, (unsigned long)(i + start[0]),
+ (unsigned long)(j + start[1]), *(original), *(dataset));
+ }
+ dataset++;
+ original++;
+ }
+ }
}
- if(vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
- printf("[more errors ...]\n");
- if(vrfyerrs)
- printf("%d errors found in dataset_vrfy\n", vrfyerrs);
- return(vrfyerrs);
+ if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
+ HDprintf("[more errors ...]\n");
+ if (vrfyerrs)
+ HDprintf("%d errors found in dataset_vrfy\n", vrfyerrs);
+ return (vrfyerrs);
}
-
/*
* Part 1.a--Independent read/write for fixed dimension datasets.
*/
@@ -271,36 +274,36 @@ dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[]
void
dataset_writeInd(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t sid; /* Dataspace ID */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
- hsize_t dims[RANK]; /* dataset dim sizes */
- DATATYPE *data_array1 = NULL; /* data buffer */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t sid; /* Dataspace ID */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
+ hsize_t dims[RANK]; /* dataset dim sizes */
+ DATATYPE * data_array1 = NULL; /* data buffer */
const char *filename;
- hsize_t start[RANK]; /* for hyperslab setting */
- hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
- hsize_t block[RANK]; /* for hyperslab setting */
+ hsize_t start[RANK]; /* for hyperslab setting */
+ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
+ hsize_t block[RANK]; /* for hyperslab setting */
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Independent write test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Independent write test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* allocate memory for data buffer */
- data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded");
/* ----------------------------------------
@@ -318,7 +321,6 @@ dataset_writeInd(void)
ret = H5Pclose(acc_tpl);
VRFY((ret >= 0), "");
-
/* ---------------------------------------------
* Define the dimensions of the overall datasets
* and the slabs local to the MPI process.
@@ -326,21 +328,17 @@ dataset_writeInd(void)
/* setup dimensionality object */
dims[0] = dim0;
dims[1] = dim1;
- sid = H5Screate_simple (RANK, dims, NULL);
+ sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded");
-
/* create a dataset collectively */
- dataset1 = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset1 = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dataset1 >= 0), "H5Dcreate2 succeeded");
/* create another dataset collectively */
- dataset2 = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset2 = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dataset2 >= 0), "H5Dcreate2 succeeded");
-
/*
* To test the independent orders of writes between processes, all
* even number processes write to dataset1 first, then dataset2.
@@ -355,43 +353,40 @@ dataset_writeInd(void)
MESG("data_array initialized");
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* write data independently */
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset1 succeeded");
/* write data independently */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset2 succeeded");
/* setup dimensions again to write with zero rows for process 0 */
- if(VERBOSE_MED)
- printf("writeInd by some with zero row\n");
+ if (VERBOSE_MED)
+ HDprintf("writeInd by some with zero row\n");
slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW);
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* need to make mem_dataspace to match for process 0 */
- if(MAINPROCESS){
- ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
+ if (MAINPROCESS) {
+ ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
}
MESG("writeInd by some with zero row");
-if((mpi_rank/2)*2 != mpi_rank){
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
- VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded");
-}
+ if ((mpi_rank / 2) * 2 != mpi_rank) {
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
+ VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded");
+ }
#ifdef BARRIER_CHECKS
-MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Barrier(MPI_COMM_WORLD);
#endif /* BARRIER_CHECKS */
/* release dataspace ID */
@@ -410,44 +405,45 @@ MPI_Barrier(MPI_COMM_WORLD);
H5Fclose(fid);
/* release data buffers */
- if(data_array1) HDfree(data_array1);
+ if (data_array1)
+ HDfree(data_array1);
}
/* Example of using the parallel HDF5 library to read a dataset */
void
dataset_readInd(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
- DATATYPE *data_array1 = NULL; /* data buffer */
- DATATYPE *data_origin1 = NULL; /* expected data buffer */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
+ DATATYPE * data_array1 = NULL; /* data buffer */
+ DATATYPE * data_origin1 = NULL; /* expected data buffer */
const char *filename;
- hsize_t start[RANK]; /* for hyperslab setting */
- hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
- hsize_t block[RANK]; /* for hyperslab setting */
+ hsize_t start[RANK]; /* for hyperslab setting */
+ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
+ hsize_t block[RANK]; /* for hyperslab setting */
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Independent read test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Independent read test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* allocate memory for data buffer */
- data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded");
- data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_origin1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded");
/* setup file access template */
@@ -455,7 +451,7 @@ dataset_readInd(void)
VRFY((acc_tpl >= 0), "");
/* open the file collectively */
- fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
+ fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl);
VRFY((fid >= 0), "");
/* Release file-access template */
@@ -470,40 +466,39 @@ dataset_readInd(void)
dataset2 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT);
VRFY((dataset2 >= 0), "");
-
/* set up dimensions of the slab this process accesses */
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, block, data_origin1);
/* read data independently */
- ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
VRFY((ret >= 0), "");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
/* read data independently */
- ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
VRFY((ret >= 0), "");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
/* close dataset collectively */
ret = H5Dclose(dataset1);
@@ -518,11 +513,12 @@ dataset_readInd(void)
H5Fclose(fid);
/* release data buffers */
- if(data_array1) HDfree(data_array1);
- if(data_origin1) HDfree(data_origin1);
+ if (data_array1)
+ HDfree(data_array1);
+ if (data_origin1)
+ HDfree(data_origin1);
}
-
/*
* Part 1.b--Collective read/write for fixed dimension datasets.
*/
@@ -539,49 +535,49 @@ dataset_readInd(void)
void
dataset_writeAll(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t xfer_plist; /* Dataset transfer properties list */
- hid_t sid; /* Dataspace ID */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2, dataset3, dataset4; /* Dataset ID */
- hid_t dataset5, dataset6, dataset7; /* Dataset ID */
- hid_t datatype; /* Datatype ID */
- hsize_t dims[RANK]; /* dataset dim sizes */
- DATATYPE *data_array1 = NULL; /* data buffer */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t xfer_plist; /* Dataset transfer properties list */
+ hid_t sid; /* Dataspace ID */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2, dataset3, dataset4; /* Dataset ID */
+ hid_t dataset5, dataset6, dataset7; /* Dataset ID */
+ hid_t datatype; /* Datatype ID */
+ hsize_t dims[RANK]; /* dataset dim sizes */
+ DATATYPE * data_array1 = NULL; /* data buffer */
const char *filename;
- hsize_t start[RANK]; /* for hyperslab setting */
- hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
- hsize_t block[RANK]; /* for hyperslab setting */
+ hsize_t start[RANK]; /* for hyperslab setting */
+ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
+ hsize_t block[RANK]; /* for hyperslab setting */
- size_t num_points; /* for point selection */
- hsize_t *coords = NULL; /* for point selection */
- hsize_t current_dims; /* for point selection */
- int i;
+ size_t num_points; /* for point selection */
+ hsize_t *coords = NULL; /* for point selection */
+ hsize_t current_dims; /* for point selection */
+ int i;
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Collective write test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Collective write test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* set up the coords array selection */
num_points = dim1;
- coords = (hsize_t *)HDmalloc(dim1 * RANK * sizeof(hsize_t));
+ coords = (hsize_t *)HDmalloc(dim1 * RANK * sizeof(hsize_t));
VRFY((coords != NULL), "coords malloc succeeded");
/* allocate memory for data buffer */
- data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded");
/* -------------------
@@ -599,7 +595,6 @@ dataset_writeAll(void)
ret = H5Pclose(acc_tpl);
VRFY((ret >= 0), "");
-
/* --------------------------
* Define the dimensions of the overall datasets
* and create the dataset
@@ -607,17 +602,16 @@ dataset_writeAll(void)
/* setup 2-D dimensionality object */
dims[0] = dim0;
dims[1] = dim1;
- sid = H5Screate_simple (RANK, dims, NULL);
+ sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded");
-
/* create a dataset collectively */
dataset1 = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dataset1 >= 0), "H5Dcreate2 succeeded");
/* create another dataset collectively */
datatype = H5Tcopy(H5T_NATIVE_INT);
- ret = H5Tset_order(datatype, H5T_ORDER_LE);
+ ret = H5Tset_order(datatype, H5T_ORDER_LE);
VRFY((ret >= 0), "H5Tset_order succeeded");
dataset2 = H5Dcreate2(fid, DATASETNAME2, datatype, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -656,54 +650,51 @@ dataset_writeAll(void)
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* fill the local slab with some trivial data */
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* write data collectively */
MESG("writeAll by Row");
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset1 succeeded");
/* setup dimensions again to writeAll with zero rows for process 0 */
- if(VERBOSE_MED)
- printf("writeAll by some with zero row\n");
+ if (VERBOSE_MED)
+ HDprintf("writeAll by some with zero row\n");
slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW);
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* need to make mem_dataspace to match for process 0 */
- if(MAINPROCESS){
- ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
+ if (MAINPROCESS) {
+ ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
}
MESG("writeAll by some with zero row");
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded");
/* release all temporary handles. */
@@ -719,59 +710,56 @@ dataset_writeAll(void)
/* put some trivial data in the data_array */
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* fill the local slab with some trivial data */
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* write data independently */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset2 succeeded");
/* setup dimensions again to writeAll with zero columns for process 0 */
- if(VERBOSE_MED)
- printf("writeAll by some with zero col\n");
+ if (VERBOSE_MED)
+ HDprintf("writeAll by some with zero col\n");
slab_set(mpi_rank, mpi_size, start, count, stride, block, ZCOL);
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* need to make mem_dataspace to match for process 0 */
- if(MAINPROCESS){
- ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
+ if (MAINPROCESS) {
+ ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
}
MESG("writeAll by some with zero col");
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset1 by ZCOL succeeded");
/* release all temporary handles. */
@@ -781,16 +769,15 @@ dataset_writeAll(void)
H5Sclose(mem_dataspace);
H5Pclose(xfer_plist);
-
/* Dataset3: each process takes a block of rows, except process zero uses "none" selection. */
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset3);
+ file_dataspace = H5Dget_space(dataset3);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
- if(MAINPROCESS) {
- ret = H5Sselect_none(file_dataspace);
- VRFY((ret >= 0), "H5Sselect_none file_dataspace succeeded");
+ if (MAINPROCESS) {
+ ret = H5Sselect_none(file_dataspace);
+ VRFY((ret >= 0), "H5Sselect_none file_dataspace succeeded");
} /* end if */
else {
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
@@ -798,42 +785,39 @@ dataset_writeAll(void)
} /* end else */
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
- if(MAINPROCESS) {
- ret = H5Sselect_none(mem_dataspace);
- VRFY((ret >= 0), "H5Sselect_none mem_dataspace succeeded");
+ if (MAINPROCESS) {
+ ret = H5Sselect_none(mem_dataspace);
+ VRFY((ret >= 0), "H5Sselect_none mem_dataspace succeeded");
} /* end if */
/* fill the local slab with some trivial data */
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED) {
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
} /* end if */
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* write data collectively */
MESG("writeAll with none");
- ret = H5Dwrite(dataset3, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset3, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset3 succeeded");
/* write data collectively (with datatype conversion) */
MESG("writeAll with none");
- ret = H5Dwrite(dataset3, H5T_NATIVE_UCHAR, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset3, H5T_NATIVE_UCHAR, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset3 succeeded");
/* release all temporary handles. */
@@ -847,11 +831,11 @@ dataset_writeAll(void)
/* Additionally, these are in a scalar dataspace */
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset4);
+ file_dataspace = H5Dget_space(dataset4);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
- if(MAINPROCESS) {
- ret = H5Sselect_none(file_dataspace);
- VRFY((ret >= 0), "H5Sselect_all file_dataspace succeeded");
+ if (MAINPROCESS) {
+ ret = H5Sselect_none(file_dataspace);
+ VRFY((ret >= 0), "H5Sselect_all file_dataspace succeeded");
} /* end if */
else {
ret = H5Sselect_all(file_dataspace);
@@ -861,9 +845,9 @@ dataset_writeAll(void)
/* create a memory dataspace independently */
mem_dataspace = H5Screate(H5S_SCALAR);
VRFY((mem_dataspace >= 0), "");
- if(MAINPROCESS) {
- ret = H5Sselect_none(mem_dataspace);
- VRFY((ret >= 0), "H5Sselect_all mem_dataspace succeeded");
+ if (MAINPROCESS) {
+ ret = H5Sselect_none(mem_dataspace);
+ VRFY((ret >= 0), "H5Sselect_all mem_dataspace succeeded");
} /* end if */
else {
ret = H5Sselect_all(mem_dataspace);
@@ -873,31 +857,29 @@ dataset_writeAll(void)
/* fill the local slab with some trivial data */
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED) {
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
} /* end if */
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
/* write data collectively */
MESG("writeAll with scalar dataspace");
- ret = H5Dwrite(dataset4, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset4, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset4 succeeded");
/* write data collectively (with datatype conversion) */
MESG("writeAll with scalar dataspace");
- ret = H5Dwrite(dataset4, H5T_NATIVE_UCHAR, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset4, H5T_NATIVE_UCHAR, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset4 succeeded");
/* release all temporary handles. */
@@ -905,55 +887,54 @@ dataset_writeAll(void)
H5Sclose(mem_dataspace);
H5Pclose(xfer_plist);
-
- if(data_array1) free(data_array1);
- data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE));
+ if (data_array1)
+ free(data_array1);
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 malloc succeeded");
- block[0] = 1;
- block[1] = dim1;
+ block[0] = 1;
+ block[1] = dim1;
stride[0] = 1;
stride[1] = dim1;
- count[0] = 1;
- count[1] = 1;
- start[0] = dim0/mpi_size * mpi_rank;
- start[1] = 0;
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = dim0 / mpi_size * mpi_rank;
+ start[1] = 0;
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* Dataset5: point selection in File - Hyperslab selection in Memory*/
/* create a file dataspace independently */
- point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER);
- file_dataspace = H5Dget_space (dataset5);
- VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
+ point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER);
+ file_dataspace = H5Dget_space(dataset5);
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords);
VRFY((ret >= 0), "H5Sselect_elements succeeded");
- start[0] = 0;
- start[1] = 0;
- mem_dataspace = H5Dget_space (dataset5);
+ start[0] = 0;
+ start[1] = 0;
+ mem_dataspace = H5Dget_space(dataset5);
VRFY((mem_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
/* write data collectively */
- ret = H5Dwrite(dataset5, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset5, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset5 succeeded");
/* release all temporary handles. */
@@ -963,35 +944,34 @@ dataset_writeAll(void)
/* Dataset6: point selection in File - Point selection in Memory*/
/* create a file dataspace independently */
- start[0] = dim0/mpi_size * mpi_rank;
+ start[0] = dim0 / mpi_size * mpi_rank;
start[1] = 0;
- point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER);
- file_dataspace = H5Dget_space (dataset6);
+ point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER);
+ file_dataspace = H5Dget_space(dataset6);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords);
VRFY((ret >= 0), "H5Sselect_elements succeeded");
start[0] = 0;
start[1] = 0;
- point_set (start, count, stride, block, num_points, coords, IN_ORDER);
- mem_dataspace = H5Dget_space (dataset6);
+ point_set(start, count, stride, block, num_points, coords, IN_ORDER);
+ mem_dataspace = H5Dget_space(dataset6);
VRFY((mem_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords);
VRFY((ret >= 0), "H5Sselect_elements succeeded");
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
/* write data collectively */
- ret = H5Dwrite(dataset6, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset6, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset6 succeeded");
/* release all temporary handles. */
@@ -1001,34 +981,33 @@ dataset_writeAll(void)
/* Dataset7: point selection in File - All selection in Memory*/
/* create a file dataspace independently */
- start[0] = dim0/mpi_size * mpi_rank;
+ start[0] = dim0 / mpi_size * mpi_rank;
start[1] = 0;
- point_set (start, count, stride, block, num_points, coords, IN_ORDER);
- file_dataspace = H5Dget_space (dataset7);
- VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
+ point_set(start, count, stride, block, num_points, coords, IN_ORDER);
+ file_dataspace = H5Dget_space(dataset7);
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords);
VRFY((ret >= 0), "H5Sselect_elements succeeded");
- current_dims = num_points;
- mem_dataspace = H5Screate_simple (1, &current_dims, NULL);
+ current_dims = num_points;
+ mem_dataspace = H5Screate_simple(1, &current_dims, NULL);
VRFY((mem_dataspace >= 0), "mem_dataspace create succeeded");
ret = H5Sselect_all(mem_dataspace);
VRFY((ret >= 0), "H5Sselect_all succeeded");
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
/* write data collectively */
- ret = H5Dwrite(dataset7, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset7, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite dataset7 succeeded");
/* release all temporary handles. */
@@ -1058,8 +1037,10 @@ dataset_writeAll(void)
H5Fclose(fid);
/* release data buffers */
- if(coords) HDfree(coords);
- if(data_array1) HDfree(data_array1);
+ if (coords)
+ HDfree(coords);
+ if (data_array1)
+ HDfree(data_array1);
}
/*
@@ -1074,48 +1055,48 @@ dataset_writeAll(void)
void
dataset_readAll(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t xfer_plist; /* Dataset transfer properties list */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2, dataset5, dataset6, dataset7; /* Dataset ID */
- DATATYPE *data_array1 = NULL; /* data buffer */
- DATATYPE *data_origin1 = NULL; /* expected data buffer */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t xfer_plist; /* Dataset transfer properties list */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2, dataset5, dataset6, dataset7; /* Dataset ID */
+ DATATYPE * data_array1 = NULL; /* data buffer */
+ DATATYPE * data_origin1 = NULL; /* expected data buffer */
const char *filename;
- hsize_t start[RANK]; /* for hyperslab setting */
- hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
- hsize_t block[RANK]; /* for hyperslab setting */
+ hsize_t start[RANK]; /* for hyperslab setting */
+ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
+ hsize_t block[RANK]; /* for hyperslab setting */
- size_t num_points; /* for point selection */
- hsize_t *coords = NULL; /* for point selection */
- hsize_t current_dims; /* for point selection */
- int i,j,k;
+ size_t num_points; /* for point selection */
+ hsize_t *coords = NULL; /* for point selection */
+ hsize_t current_dims; /* for point selection */
+ int i, j, k;
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Collective read test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Collective read test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* set up the coords array selection */
num_points = dim1;
- coords = (hsize_t *)HDmalloc(dim0 * dim1 * RANK * sizeof(hsize_t));
+ coords = (hsize_t *)HDmalloc(dim0 * dim1 * RANK * sizeof(hsize_t));
VRFY((coords != NULL), "coords malloc succeeded");
/* allocate memory for data buffer */
- data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded");
- data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_origin1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded");
/* -------------------
@@ -1126,14 +1107,13 @@ dataset_readAll(void)
VRFY((acc_tpl >= 0), "");
/* open the file collectively */
- fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
+ fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl);
VRFY((fid >= 0), "H5Fopen succeeded");
/* Release file-access template */
ret = H5Pclose(acc_tpl);
VRFY((ret >= 0), "");
-
/* --------------------------
* Open the datasets in it
* ------------------------- */
@@ -1161,62 +1141,61 @@ dataset_readAll(void)
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, block, data_origin1);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_origin1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_origin1);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* read data collectively */
- ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dread dataset1 succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
/* setup dimensions again to readAll with zero columns for process 0 */
- if(VERBOSE_MED)
- printf("readAll by some with zero col\n");
+ if (VERBOSE_MED)
+ HDprintf("readAll by some with zero col\n");
slab_set(mpi_rank, mpi_size, start, count, stride, block, ZCOL);
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* need to make mem_dataspace to match for process 0 */
- if(MAINPROCESS){
- ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
+ if (MAINPROCESS) {
+ ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
}
MESG("readAll by some with zero col");
- ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dread dataset1 by ZCOL succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
/* release all temporary handles. */
/* Could have used them for dataset2 but it is cleaner */
@@ -1229,219 +1208,221 @@ dataset_readAll(void)
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, block, data_origin1);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_origin1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_origin1);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* read data collectively */
- ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dread dataset2 succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
/* setup dimensions again to readAll with zero rows for process 0 */
- if(VERBOSE_MED)
- printf("readAll by some with zero row\n");
+ if (VERBOSE_MED)
+ HDprintf("readAll by some with zero row\n");
slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW);
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* need to make mem_dataspace to match for process 0 */
- if(MAINPROCESS){
- ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
+ if (MAINPROCESS) {
+ ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded");
}
MESG("readAll by some with zero row");
- ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dread dataset1 by ZROW succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
/* release all temporary handles. */
H5Sclose(file_dataspace);
H5Sclose(mem_dataspace);
H5Pclose(xfer_plist);
- if(data_array1) free(data_array1);
- if(data_origin1) free(data_origin1);
- data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE));
+ if (data_array1)
+ free(data_array1);
+ if (data_origin1)
+ free(data_origin1);
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 malloc succeeded");
- data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE));
+ data_origin1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded");
- block[0] = 1;
- block[1] = dim1;
+ block[0] = 1;
+ block[1] = dim1;
stride[0] = 1;
stride[1] = dim1;
- count[0] = 1;
- count[1] = 1;
- start[0] = dim0/mpi_size * mpi_rank;
- start[1] = 0;
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = dim0 / mpi_size * mpi_rank;
+ start[1] = 0;
dataset_fill(start, block, data_origin1);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_origin1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_origin1);
}
/* Dataset5: point selection in memory - Hyperslab selection in file*/
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset5);
+ file_dataspace = H5Dget_space(dataset5);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
start[0] = 0;
start[1] = 0;
- point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER);
- mem_dataspace = H5Dget_space (dataset5);
+ point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER);
+ mem_dataspace = H5Dget_space(dataset5);
VRFY((mem_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords);
VRFY((ret >= 0), "H5Sselect_elements succeeded");
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
/* read data collectively */
- ret = H5Dread(dataset5, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset5, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dread dataset5 succeeded");
-
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
/* release all temporary handles. */
H5Sclose(file_dataspace);
H5Sclose(mem_dataspace);
H5Pclose(xfer_plist);
-
- if(data_array1) free(data_array1);
- data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE));
+ if (data_array1)
+ free(data_array1);
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 malloc succeeded");
/* Dataset6: point selection in File - Point selection in Memory*/
/* create a file dataspace independently */
- start[0] = dim0/mpi_size * mpi_rank;
+ start[0] = dim0 / mpi_size * mpi_rank;
start[1] = 0;
- point_set (start, count, stride, block, num_points, coords, IN_ORDER);
- file_dataspace = H5Dget_space (dataset6);
+ point_set(start, count, stride, block, num_points, coords, IN_ORDER);
+ file_dataspace = H5Dget_space(dataset6);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords);
VRFY((ret >= 0), "H5Sselect_elements succeeded");
start[0] = 0;
start[1] = 0;
- point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER);
- mem_dataspace = H5Dget_space (dataset6);
+ point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER);
+ mem_dataspace = H5Dget_space(dataset6);
VRFY((mem_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords);
VRFY((ret >= 0), "H5Sselect_elements succeeded");
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
/* read data collectively */
- ret = H5Dread(dataset6, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset6, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dread dataset6 succeeded");
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
/* release all temporary handles. */
H5Sclose(file_dataspace);
H5Sclose(mem_dataspace);
H5Pclose(xfer_plist);
- if(data_array1) free(data_array1);
- data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE));
+ if (data_array1)
+ free(data_array1);
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 malloc succeeded");
/* Dataset7: point selection in memory - All selection in file*/
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset7);
+ file_dataspace = H5Dget_space(dataset7);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_all(file_dataspace);
VRFY((ret >= 0), "H5Sselect_all succeeded");
num_points = dim0 * dim1;
- k=0;
- for (i=0 ; i<dim0; i++) {
- for (j=0 ; j<dim1; j++) {
+ k = 0;
+ for (i = 0; i < dim0; i++) {
+ for (j = 0; j < dim1; j++) {
coords[k++] = i;
coords[k++] = j;
}
}
- mem_dataspace = H5Dget_space (dataset7);
+ mem_dataspace = H5Dget_space(dataset7);
VRFY((mem_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords);
VRFY((ret >= 0), "H5Sselect_elements succeeded");
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
/* read data collectively */
- ret = H5Dread(dataset7, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset7, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dread dataset7 succeeded");
- start[0] = dim0/mpi_size * mpi_rank;
+ start[0] = dim0 / mpi_size * mpi_rank;
start[1] = 0;
- ret = dataset_vrfy(start, count, stride, block, data_array1+(dim0/mpi_size * dim1 * mpi_rank), data_origin1);
- if(ret) nerrors++;
+ ret = dataset_vrfy(start, count, stride, block, data_array1 + (dim0 / mpi_size * dim1 * mpi_rank),
+ data_origin1);
+ if (ret)
+ nerrors++;
/* release all temporary handles. */
H5Sclose(file_dataspace);
@@ -1466,12 +1447,14 @@ dataset_readAll(void)
H5Fclose(fid);
/* release data buffers */
- if(coords) HDfree(coords);
- if(data_array1) HDfree(data_array1);
- if(data_origin1) HDfree(data_origin1);
+ if (coords)
+ HDfree(coords);
+ if (data_array1)
+ HDfree(data_array1);
+ if (data_origin1)
+ HDfree(data_origin1);
}
-
/*
* Part 2--Independent read/write for extendible datasets.
*/
@@ -1487,45 +1470,44 @@ dataset_readAll(void)
void
extend_writeInd(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t sid; /* Dataspace ID */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t sid; /* Dataspace ID */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
const char *filename;
- hsize_t dims[RANK]; /* dataset dim sizes */
- hsize_t max_dims[RANK] =
- {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */
- DATATYPE *data_array1 = NULL; /* data buffer */
- hsize_t chunk_dims[RANK]; /* chunk sizes */
- hid_t dataset_pl; /* dataset create prop. list */
+ hsize_t dims[RANK]; /* dataset dim sizes */
+ hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */
+ DATATYPE * data_array1 = NULL; /* data buffer */
+ hsize_t chunk_dims[RANK]; /* chunk sizes */
+ hid_t dataset_pl; /* dataset create prop. list */
- hsize_t start[RANK]; /* for hyperslab setting */
- hsize_t count[RANK]; /* for hyperslab setting */
- hsize_t stride[RANK]; /* for hyperslab setting */
- hsize_t block[RANK]; /* for hyperslab setting */
+ hsize_t start[RANK]; /* for hyperslab setting */
+ hsize_t count[RANK]; /* for hyperslab setting */
+ hsize_t stride[RANK]; /* for hyperslab setting */
+ hsize_t block[RANK]; /* for hyperslab setting */
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Extend independent write test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Extend independent write test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* setup chunk-size. Make sure sizes are > 0 */
chunk_dims[0] = chunkdim0;
chunk_dims[1] = chunkdim1;
/* allocate memory for data buffer */
- data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded");
/* -------------------
@@ -1535,22 +1517,22 @@ extend_writeInd(void)
acc_tpl = create_faccess_plist(comm, info, facc_type);
VRFY((acc_tpl >= 0), "");
-/* Reduce the number of metadata cache slots, so that there are cache
- * collisions during the raw data I/O on the chunked dataset. This stresses
- * the metadata cache and tests for cache bugs. -QAK
- */
-{
- int mdc_nelmts;
- size_t rdcc_nelmts;
- size_t rdcc_nbytes;
- double rdcc_w0;
-
- ret = H5Pget_cache(acc_tpl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0);
- VRFY((ret >= 0), "H5Pget_cache succeeded");
- mdc_nelmts=4;
- ret = H5Pset_cache(acc_tpl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
- VRFY((ret >= 0), "H5Pset_cache succeeded");
-}
+ /* Reduce the number of metadata cache slots, so that there are cache
+ * collisions during the raw data I/O on the chunked dataset. This stresses
+ * the metadata cache and tests for cache bugs. -QAK
+ */
+ {
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ size_t rdcc_nbytes;
+ double rdcc_w0;
+
+ ret = H5Pget_cache(acc_tpl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0);
+ VRFY((ret >= 0), "H5Pget_cache succeeded");
+ mdc_nelmts = 4;
+ ret = H5Pset_cache(acc_tpl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0);
+ VRFY((ret >= 0), "H5Pset_cache succeeded");
+ }
/* create the file collectively */
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
@@ -1560,14 +1542,13 @@ extend_writeInd(void)
ret = H5Pclose(acc_tpl);
VRFY((ret >= 0), "");
-
/* --------------------------------------------------------------
* Define the dimensions of the overall datasets and create them.
* ------------------------------------------------------------- */
/* set up dataset storage chunk sizes and creation property list */
- if(VERBOSE_MED)
- printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]);
+ if (VERBOSE_MED)
+ HDprintf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]);
dataset_pl = H5Pcreate(H5P_DATASET_CREATE);
VRFY((dataset_pl >= 0), "H5Pcreate succeeded");
ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims);
@@ -1576,7 +1557,7 @@ extend_writeInd(void)
/* setup dimensionality object */
/* start out with no rows, extend it later. */
dims[0] = dims[1] = 0;
- sid = H5Screate_simple (RANK, dims, max_dims);
+ sid = H5Screate_simple(RANK, dims, max_dims);
VRFY((sid >= 0), "H5Screate_simple succeeded");
/* create an extendible dataset collectively */
@@ -1591,8 +1572,6 @@ extend_writeInd(void)
H5Sclose(sid);
H5Pclose(dataset_pl);
-
-
/* -------------------------
* Test writing to dataset1
* -------------------------*/
@@ -1602,37 +1581,35 @@ extend_writeInd(void)
/* put some trivial data in the data_array */
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED) {
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* Extend its current dim sizes before writing */
dims[0] = dim0;
dims[1] = dim1;
- ret = H5Dset_extent(dataset1, dims);
+ ret = H5Dset_extent(dataset1, dims);
VRFY((ret >= 0), "H5Dset_extent succeeded");
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently */
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
VRFY((ret >= 0), "H5Dwrite succeeded");
/* release resource */
H5Sclose(file_dataspace);
H5Sclose(mem_dataspace);
-
/* -------------------------
* Test writing to dataset2
* -------------------------*/
@@ -1642,13 +1619,13 @@ extend_writeInd(void)
/* put some trivial data in the data_array */
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* Try write to dataset2 beyond its current dim sizes. Should fail. */
@@ -1657,14 +1634,13 @@ extend_writeInd(void)
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset2);
+ file_dataspace = H5Dget_space(dataset2);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently. Should fail. */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
VRFY((ret < 0), "H5Dwrite failed as expected");
/* restore auto error reporting */
@@ -1674,18 +1650,17 @@ extend_writeInd(void)
/* Extend dataset2 and try again. Should succeed. */
dims[0] = dim0;
dims[1] = dim1;
- ret = H5Dset_extent(dataset2, dims);
+ ret = H5Dset_extent(dataset2, dims);
VRFY((ret >= 0), "H5Dset_extent succeeded");
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset2);
+ file_dataspace = H5Dget_space(dataset2);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
VRFY((ret >= 0), "H5Dwrite succeeded");
/* release resource */
@@ -1694,7 +1669,6 @@ extend_writeInd(void)
ret = H5Sclose(mem_dataspace);
VRFY((ret >= 0), "H5Sclose succeeded");
-
/* close dataset collectively */
ret = H5Dclose(dataset1);
VRFY((ret >= 0), "H5Dclose1 succeeded");
@@ -1705,7 +1679,8 @@ extend_writeInd(void)
H5Fclose(fid);
/* release data buffers */
- if(data_array1) HDfree(data_array1);
+ if (data_array1)
+ HDfree(data_array1);
}
/*
@@ -1718,30 +1693,30 @@ void
extend_writeInd2(void)
{
const char *filename;
- hid_t fid; /* HDF5 file ID */
- hid_t fapl; /* File access templates */
- hid_t fs; /* File dataspace ID */
- hid_t ms; /* Memory dataspace ID */
- hid_t dataset; /* Dataset ID */
- hsize_t orig_size=10; /* Original dataset dim size */
- hsize_t new_size=20; /* Extended dataset dim size */
- hsize_t one=1;
- hsize_t max_size = H5S_UNLIMITED; /* dataset maximum dim size */
- hsize_t chunk_size = 16384; /* chunk size */
- hid_t dcpl; /* dataset create prop. list */
- int written[10], /* Data to write */
- retrieved[10]; /* Data read in */
- int mpi_size, mpi_rank; /* MPI settings */
- int i; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fid; /* HDF5 file ID */
+ hid_t fapl; /* File access templates */
+ hid_t fs; /* File dataspace ID */
+ hid_t ms; /* Memory dataspace ID */
+ hid_t dataset; /* Dataset ID */
+ hsize_t orig_size = 10; /* Original dataset dim size */
+ hsize_t new_size = 20; /* Extended dataset dim size */
+ hsize_t one = 1;
+ hsize_t max_size = H5S_UNLIMITED; /* dataset maximum dim size */
+ hsize_t chunk_size = 16384; /* chunk size */
+ hid_t dcpl; /* dataset create prop. list */
+ int written[10], /* Data to write */
+ retrieved[10]; /* Data read in */
+ int mpi_size, mpi_rank; /* MPI settings */
+ int i; /* Local index variable */
+ herr_t ret; /* Generic return value */
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Extend independent write test #2 on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Extend independent write test #2 on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* -------------------
* START AN HDF5 FILE
@@ -1758,7 +1733,6 @@ extend_writeInd2(void)
ret = H5Pclose(fapl);
VRFY((ret >= 0), "H5Pclose succeeded");
-
/* --------------------------------------------------------------
* Define the dimensions of the overall datasets and create them.
* ------------------------------------------------------------- */
@@ -1770,7 +1744,7 @@ extend_writeInd2(void)
VRFY((ret >= 0), "H5Pset_chunk succeeded");
/* setup dimensionality object */
- fs = H5Screate_simple (1, &orig_size, &max_size);
+ fs = H5Screate_simple(1, &orig_size, &max_size);
VRFY((fs >= 0), "H5Screate_simple succeeded");
/* create an extendible dataset collectively */
@@ -1781,7 +1755,6 @@ extend_writeInd2(void)
ret = H5Pclose(dcpl);
VRFY((ret >= 0), "H5Pclose succeeded");
-
/* -------------------------
* Test writing to dataset
* -------------------------*/
@@ -1790,14 +1763,14 @@ extend_writeInd2(void)
VRFY((ms >= 0), "H5Screate_simple succeeded");
/* put some trivial data in the data_array */
- for(i = 0; i < (int)orig_size; i++)
+ for (i = 0; i < (int)orig_size; i++)
written[i] = i;
MESG("data array initialized");
- if(VERBOSE_MED) {
- MESG("writing at offset zero: ");
- for(i = 0; i < (int)orig_size; i++)
- printf("%s%d", i?", ":"", written[i]);
- printf("\n");
+ if (VERBOSE_MED) {
+ MESG("writing at offset zero: ");
+ for (i = 0; i < (int)orig_size; i++)
+ HDprintf("%s%d", i ? ", " : "", written[i]);
+ HDprintf("\n");
}
ret = H5Dwrite(dataset, H5T_NATIVE_INT, ms, fs, H5P_DEFAULT, written);
VRFY((ret >= 0), "H5Dwrite succeeded");
@@ -1807,17 +1780,17 @@ extend_writeInd2(void)
* -------------------------*/
ret = H5Dread(dataset, H5T_NATIVE_INT, ms, fs, H5P_DEFAULT, retrieved);
VRFY((ret >= 0), "H5Dread succeeded");
- for (i=0; i<(int)orig_size; i++)
- if(written[i]!=retrieved[i]) {
- printf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__,
- i,written[i], i,retrieved[i]);
+ for (i = 0; i < (int)orig_size; i++)
+ if (written[i] != retrieved[i]) {
+ HDprintf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n", __LINE__, i,
+ written[i], i, retrieved[i]);
nerrors++;
}
- if(VERBOSE_MED){
- MESG("read at offset zero: ");
- for (i=0; i<(int)orig_size; i++)
- printf("%s%d", i?", ":"", retrieved[i]);
- printf("\n");
+ if (VERBOSE_MED) {
+ MESG("read at offset zero: ");
+ for (i = 0; i < (int)orig_size; i++)
+ HDprintf("%s%d", i ? ", " : "", retrieved[i]);
+ HDprintf("\n");
}
/* -------------------------
@@ -1833,14 +1806,14 @@ extend_writeInd2(void)
/* -------------------------
* Write to the second half of the dataset
* -------------------------*/
- for (i=0; i<(int)orig_size; i++)
+ for (i = 0; i < (int)orig_size; i++)
written[i] = orig_size + i;
MESG("data array re-initialized");
- if(VERBOSE_MED) {
- MESG("writing at offset 10: ");
- for (i=0; i<(int)orig_size; i++)
- printf("%s%d", i?", ":"", written[i]);
- printf("\n");
+ if (VERBOSE_MED) {
+ MESG("writing at offset 10: ");
+ for (i = 0; i < (int)orig_size; i++)
+ HDprintf("%s%d", i ? ", " : "", written[i]);
+ HDprintf("\n");
}
ret = H5Sselect_hyperslab(fs, H5S_SELECT_SET, &orig_size, NULL, &one, &orig_size);
VRFY((ret >= 0), "H5Sselect_hyperslab succeeded");
@@ -1852,20 +1825,19 @@ extend_writeInd2(void)
* -------------------------*/
ret = H5Dread(dataset, H5T_NATIVE_INT, ms, fs, H5P_DEFAULT, retrieved);
VRFY((ret >= 0), "H5Dread succeeded");
- for (i=0; i<(int)orig_size; i++)
- if(written[i]!=retrieved[i]) {
- printf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__,
- i,written[i], i,retrieved[i]);
+ for (i = 0; i < (int)orig_size; i++)
+ if (written[i] != retrieved[i]) {
+ HDprintf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n", __LINE__, i,
+ written[i], i, retrieved[i]);
nerrors++;
}
- if(VERBOSE_MED){
- MESG("read at offset 10: ");
- for (i=0; i<(int)orig_size; i++)
- printf("%s%d", i?", ":"", retrieved[i]);
- printf("\n");
+ if (VERBOSE_MED) {
+ MESG("read at offset 10: ");
+ for (i = 0; i < (int)orig_size; i++)
+ HDprintf("%s%d", i ? ", " : "", retrieved[i]);
+ HDprintf("\n");
}
-
/* Close dataset collectively */
ret = H5Dclose(dataset);
VRFY((ret >= 0), "H5Dclose succeeded");
@@ -1879,41 +1851,41 @@ extend_writeInd2(void)
void
extend_readInd(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
- hsize_t dims[RANK]; /* dataset dim sizes */
- DATATYPE *data_array1 = NULL; /* data buffer */
- DATATYPE *data_array2 = NULL; /* data buffer */
- DATATYPE *data_origin1 = NULL; /* expected data buffer */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
+ hsize_t dims[RANK]; /* dataset dim sizes */
+ DATATYPE * data_array1 = NULL; /* data buffer */
+ DATATYPE * data_array2 = NULL; /* data buffer */
+ DATATYPE * data_origin1 = NULL; /* expected data buffer */
const char *filename;
- hsize_t start[RANK]; /* for hyperslab setting */
- hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
- hsize_t block[RANK]; /* for hyperslab setting */
+ hsize_t start[RANK]; /* for hyperslab setting */
+ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
+ hsize_t block[RANK]; /* for hyperslab setting */
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Extend independent read test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Extend independent read test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* allocate memory for data buffer */
- data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded");
- data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array2 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded");
- data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_origin1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded");
/* -------------------
@@ -1924,7 +1896,7 @@ extend_readInd(void)
VRFY((acc_tpl >= 0), "");
/* open the file collectively */
- fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
+ fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl);
VRFY((fid >= 0), "");
/* Release file-access template */
@@ -1944,7 +1916,7 @@ extend_readInd(void)
H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL);
VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded");
@@ -1956,72 +1928,70 @@ extend_readInd(void)
H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
-
/* Read dataset1 using BYROW pattern */
/* set up dimensions of the slab this process accesses */
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, block, data_origin1);
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* read data independently */
- ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
VRFY((ret >= 0), "H5Dread succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
VRFY((ret == 0), "dataset1 read verified correct");
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
H5Sclose(mem_dataspace);
H5Sclose(file_dataspace);
-
/* Read dataset2 using BYCOL pattern */
/* set up dimensions of the slab this process accesses */
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset2);
+ file_dataspace = H5Dget_space(dataset2);
VRFY((file_dataspace >= 0), "");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, block, data_origin1);
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* read data independently */
- ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array1);
+ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
VRFY((ret >= 0), "H5Dread succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
VRFY((ret == 0), "dataset2 read verified correct");
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
H5Sclose(mem_dataspace);
H5Sclose(file_dataspace);
@@ -2032,14 +2002,16 @@ extend_readInd(void)
ret = H5Dclose(dataset2);
VRFY((ret >= 0), "");
-
/* close the file collectively */
H5Fclose(fid);
/* release data buffers */
- if(data_array1) HDfree(data_array1);
- if(data_array2) HDfree(data_array2);
- if(data_origin1) HDfree(data_origin1);
+ if (data_array1)
+ HDfree(data_array1);
+ if (data_array2)
+ HDfree(data_array2);
+ if (data_origin1)
+ HDfree(data_origin1);
}
/*
@@ -2057,46 +2029,45 @@ extend_readInd(void)
void
extend_writeAll(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t xfer_plist; /* Dataset transfer properties list */
- hid_t sid; /* Dataspace ID */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t xfer_plist; /* Dataset transfer properties list */
+ hid_t sid; /* Dataspace ID */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
const char *filename;
- hsize_t dims[RANK]; /* dataset dim sizes */
- hsize_t max_dims[RANK] =
- {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */
- DATATYPE *data_array1 = NULL; /* data buffer */
- hsize_t chunk_dims[RANK]; /* chunk sizes */
- hid_t dataset_pl; /* dataset create prop. list */
+ hsize_t dims[RANK]; /* dataset dim sizes */
+ hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */
+ DATATYPE * data_array1 = NULL; /* data buffer */
+ hsize_t chunk_dims[RANK]; /* chunk sizes */
+ hid_t dataset_pl; /* dataset create prop. list */
- hsize_t start[RANK]; /* for hyperslab setting */
- hsize_t count[RANK]; /* for hyperslab setting */
- hsize_t stride[RANK]; /* for hyperslab setting */
- hsize_t block[RANK]; /* for hyperslab setting */
+ hsize_t start[RANK]; /* for hyperslab setting */
+ hsize_t count[RANK]; /* for hyperslab setting */
+ hsize_t stride[RANK]; /* for hyperslab setting */
+ hsize_t block[RANK]; /* for hyperslab setting */
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Extend independent write test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Extend independent write test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* setup chunk-size. Make sure sizes are > 0 */
chunk_dims[0] = chunkdim0;
chunk_dims[1] = chunkdim1;
/* allocate memory for data buffer */
- data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded");
/* -------------------
@@ -2106,22 +2077,22 @@ extend_writeAll(void)
acc_tpl = create_faccess_plist(comm, info, facc_type);
VRFY((acc_tpl >= 0), "");
-/* Reduce the number of metadata cache slots, so that there are cache
- * collisions during the raw data I/O on the chunked dataset. This stresses
- * the metadata cache and tests for cache bugs. -QAK
- */
-{
- int mdc_nelmts;
- size_t rdcc_nelmts;
- size_t rdcc_nbytes;
- double rdcc_w0;
-
- ret = H5Pget_cache(acc_tpl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0);
- VRFY((ret >= 0), "H5Pget_cache succeeded");
- mdc_nelmts=4;
- ret = H5Pset_cache(acc_tpl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
- VRFY((ret >= 0), "H5Pset_cache succeeded");
-}
+ /* Reduce the number of metadata cache slots, so that there are cache
+ * collisions during the raw data I/O on the chunked dataset. This stresses
+ * the metadata cache and tests for cache bugs. -QAK
+ */
+ {
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ size_t rdcc_nbytes;
+ double rdcc_w0;
+
+ ret = H5Pget_cache(acc_tpl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0);
+ VRFY((ret >= 0), "H5Pget_cache succeeded");
+ mdc_nelmts = 4;
+ ret = H5Pset_cache(acc_tpl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0);
+ VRFY((ret >= 0), "H5Pset_cache succeeded");
+ }
/* create the file collectively */
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
@@ -2131,14 +2102,13 @@ extend_writeAll(void)
ret = H5Pclose(acc_tpl);
VRFY((ret >= 0), "");
-
/* --------------------------------------------------------------
* Define the dimensions of the overall datasets and create them.
* ------------------------------------------------------------- */
/* set up dataset storage chunk sizes and creation property list */
- if(VERBOSE_MED)
- printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]);
+ if (VERBOSE_MED)
+ HDprintf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]);
dataset_pl = H5Pcreate(H5P_DATASET_CREATE);
VRFY((dataset_pl >= 0), "H5Pcreate succeeded");
ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims);
@@ -2147,7 +2117,7 @@ extend_writeAll(void)
/* setup dimensionality object */
/* start out with no rows, extend it later. */
dims[0] = dims[1] = 0;
- sid = H5Screate_simple (RANK, dims, max_dims);
+ sid = H5Screate_simple(RANK, dims, max_dims);
VRFY((sid >= 0), "H5Screate_simple succeeded");
/* create an extendible dataset collectively */
@@ -2162,8 +2132,6 @@ extend_writeAll(void)
H5Sclose(sid);
H5Pclose(dataset_pl);
-
-
/* -------------------------
* Test writing to dataset1
* -------------------------*/
@@ -2173,41 +2141,39 @@ extend_writeAll(void)
/* put some trivial data in the data_array */
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED) {
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* Extend its current dim sizes before writing */
dims[0] = dim0;
dims[1] = dim1;
- ret = H5Dset_extent(dataset1, dims);
+ ret = H5Dset_extent(dataset1, dims);
VRFY((ret >= 0), "H5Dset_extent succeeded");
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* write data collectively */
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite succeeded");
/* release resource */
@@ -2215,7 +2181,6 @@ extend_writeAll(void)
H5Sclose(mem_dataspace);
H5Pclose(xfer_plist);
-
/* -------------------------
* Test writing to dataset2
* -------------------------*/
@@ -2225,40 +2190,38 @@ extend_writeAll(void)
/* put some trivial data in the data_array */
dataset_fill(start, block, data_array1);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* Try write to dataset2 beyond its current dim sizes. Should fail. */
/* Temporary turn off auto error reporting */
H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset2);
+ file_dataspace = H5Dget_space(dataset2);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently. Should fail. */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret < 0), "H5Dwrite failed as expected");
/* restore auto error reporting */
@@ -2268,18 +2231,17 @@ extend_writeAll(void)
/* Extend dataset2 and try again. Should succeed. */
dims[0] = dim0;
dims[1] = dim1;
- ret = H5Dset_extent(dataset2, dims);
+ ret = H5Dset_extent(dataset2, dims);
VRFY((ret >= 0), "H5Dset_extent succeeded");
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset2);
+ file_dataspace = H5Dget_space(dataset2);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dwrite succeeded");
/* release resource */
@@ -2290,7 +2252,6 @@ extend_writeAll(void)
ret = H5Pclose(xfer_plist);
VRFY((ret >= 0), "H5Pclose succeeded");
-
/* close dataset collectively */
ret = H5Dclose(dataset1);
VRFY((ret >= 0), "H5Dclose1 succeeded");
@@ -2301,49 +2262,50 @@ extend_writeAll(void)
H5Fclose(fid);
/* release data buffers */
- if(data_array1) HDfree(data_array1);
+ if (data_array1)
+ HDfree(data_array1);
}
/* Example of using the parallel HDF5 library to read an extendible dataset */
void
extend_readAll(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t xfer_plist; /* Dataset transfer properties list */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t xfer_plist; /* Dataset transfer properties list */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
const char *filename;
- hsize_t dims[RANK]; /* dataset dim sizes */
- DATATYPE *data_array1 = NULL; /* data buffer */
- DATATYPE *data_array2 = NULL; /* data buffer */
- DATATYPE *data_origin1 = NULL; /* expected data buffer */
+ hsize_t dims[RANK]; /* dataset dim sizes */
+ DATATYPE * data_array1 = NULL; /* data buffer */
+ DATATYPE * data_array2 = NULL; /* data buffer */
+ DATATYPE * data_origin1 = NULL; /* expected data buffer */
- hsize_t start[RANK]; /* for hyperslab setting */
- hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
- hsize_t block[RANK]; /* for hyperslab setting */
+ hsize_t start[RANK]; /* for hyperslab setting */
+ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */
+ hsize_t block[RANK]; /* for hyperslab setting */
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Extend independent read test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Extend independent read test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* allocate memory for data buffer */
- data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array1 != NULL), "data_array1 HDmalloc succeeded");
- data_array2 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_array2 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_array2 != NULL), "data_array2 HDmalloc succeeded");
- data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE));
+ data_origin1 = (DATATYPE *)HDmalloc(dim0 * dim1 * sizeof(DATATYPE));
VRFY((data_origin1 != NULL), "data_origin1 HDmalloc succeeded");
/* -------------------
@@ -2354,7 +2316,7 @@ extend_readAll(void)
VRFY((acc_tpl >= 0), "");
/* open the file collectively */
- fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
+ fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl);
VRFY((fid >= 0), "");
/* Release file-access template */
@@ -2374,7 +2336,7 @@ extend_readAll(void)
H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL);
VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded");
@@ -2386,95 +2348,91 @@ extend_readAll(void)
H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
-
/* Read dataset1 using BYROW pattern */
/* set up dimensions of the slab this process accesses */
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, block, data_origin1);
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* read data collectively */
- ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dread succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
VRFY((ret == 0), "dataset1 read verified correct");
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
H5Sclose(mem_dataspace);
H5Sclose(file_dataspace);
H5Pclose(xfer_plist);
-
/* Read dataset2 using BYCOL pattern */
/* set up dimensions of the slab this process accesses */
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset2);
+ file_dataspace = H5Dget_space(dataset2);
VRFY((file_dataspace >= 0), "");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, block, data_origin1);
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(start, block, data_array1);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(start, block, data_array1);
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* read data collectively */
- ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_array1);
+ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
VRFY((ret >= 0), "H5Dread succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1);
VRFY((ret == 0), "dataset2 read verified correct");
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
H5Sclose(mem_dataspace);
H5Sclose(file_dataspace);
@@ -2486,14 +2444,16 @@ extend_readAll(void)
ret = H5Dclose(dataset2);
VRFY((ret >= 0), "");
-
/* close the file collectively */
H5Fclose(fid);
/* release data buffers */
- if(data_array1) HDfree(data_array1);
- if(data_array2) HDfree(data_array2);
- if(data_origin1) HDfree(data_origin1);
+ if (data_array1)
+ HDfree(data_array1);
+ if (data_array2)
+ HDfree(data_array2);
+ if (data_origin1)
+ HDfree(data_origin1);
}
/*
@@ -2504,44 +2464,44 @@ extend_readAll(void)
void
compress_readAll(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t dcpl; /* Dataset creation property list */
- hid_t xfer_plist; /* Dataset transfer properties list */
- hid_t dataspace; /* Dataspace ID */
- hid_t dataset; /* Dataset ID */
- int rank=1; /* Dataspace rank */
- hsize_t dim=dim0; /* Dataspace dimensions */
- unsigned u; /* Local index variable */
- DATATYPE *data_read = NULL; /* data buffer */
- DATATYPE *data_orig = NULL; /* expected data buffer */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t dcpl; /* Dataset creation property list */
+ hid_t xfer_plist; /* Dataset transfer properties list */
+ hid_t dataspace; /* Dataspace ID */
+ hid_t dataset; /* Dataset ID */
+ int rank = 1; /* Dataspace rank */
+ hsize_t dim = dim0; /* Dataspace dimensions */
+ unsigned u; /* Local index variable */
+ DATATYPE * data_read = NULL; /* data buffer */
+ DATATYPE * data_orig = NULL; /* expected data buffer */
const char *filename;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
- int mpi_size, mpi_rank;
- herr_t ret; /* Generic return value */
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
+ int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Collective chunked dataset read test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Collective chunked dataset read test on file %s\n", filename);
/* Retrieve MPI parameters */
- MPI_Comm_size(comm,&mpi_size);
- MPI_Comm_rank(comm,&mpi_rank);
+ MPI_Comm_size(comm, &mpi_size);
+ MPI_Comm_rank(comm, &mpi_rank);
/* Allocate data buffer */
- data_orig = (DATATYPE *)HDmalloc((size_t)dim*sizeof(DATATYPE));
+ data_orig = (DATATYPE *)HDmalloc((size_t)dim * sizeof(DATATYPE));
VRFY((data_orig != NULL), "data_origin1 HDmalloc succeeded");
- data_read = (DATATYPE *)HDmalloc((size_t)dim*sizeof(DATATYPE));
+ data_read = (DATATYPE *)HDmalloc((size_t)dim * sizeof(DATATYPE));
VRFY((data_read != NULL), "data_array1 HDmalloc succeeded");
/* Initialize data buffers */
- for(u=0; u<dim;u++)
- data_orig[u]=u;
+ for (u = 0; u < dim; u++)
+ data_orig[u] = u;
/* Process zero creates the file with a compressed, chunked dataset */
- if(mpi_rank==0) {
- hsize_t chunk_dim; /* Chunk dimensions */
+ if (mpi_rank == 0) {
+ hsize_t chunk_dim; /* Chunk dimensions */
/* Create the file */
fid = H5Fcreate(h5_rmprefix(filename), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2556,7 +2516,7 @@ compress_readAll(void)
/* Use eight chunks */
chunk_dim = dim / 8;
- ret = H5Pset_chunk(dcpl, rank, &chunk_dim);
+ ret = H5Pset_chunk(dcpl, rank, &chunk_dim);
VRFY((ret >= 0), "H5Pset_chunk succeeded");
ret = H5Pset_deflate(dcpl, 9);
@@ -2567,7 +2527,8 @@ compress_readAll(void)
VRFY((dataspace > 0), "H5Screate_simple succeeded");
/* Create dataset */
- dataset = H5Dcreate2(fid, "compressed_data", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ dataset =
+ H5Dcreate2(fid, "compressed_data", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
VRFY((dataset > 0), "H5Dcreate2 succeeded");
/* Write compressed data */
@@ -2597,48 +2558,45 @@ compress_readAll(void)
VRFY((acc_tpl >= 0), "");
/* open the file collectively */
- fid=H5Fopen(filename,H5F_ACC_RDWR,acc_tpl);
+ fid = H5Fopen(filename, H5F_ACC_RDWR, acc_tpl);
VRFY((fid > 0), "H5Fopen succeeded");
/* Release file-access template */
ret = H5Pclose(acc_tpl);
VRFY((ret >= 0), "H5Pclose succeeded");
-
/* Open dataset with compressed chunks */
dataset = H5Dopen2(fid, "compressed_data", H5P_DEFAULT);
VRFY((dataset > 0), "H5Dopen2 succeeded");
/* Try reading & writing data */
- if(dataset>0) {
+ if (dataset > 0) {
/* Create dataset transfer property list */
xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist > 0), "H5Pcreate succeeded");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* Try reading the data */
ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read);
- VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
+ VRFY((ret >= 0), "H5Dread succeeded");
/* Verify data read */
- for(u=0; u<dim; u++)
- if(data_orig[u]!=data_read[u]) {
- printf("Line #%d: written!=retrieved: data_orig[%u]=%d, data_read[%u]=%d\n",__LINE__,
- (unsigned)u,data_orig[u],(unsigned)u,data_read[u]);
+ for (u = 0; u < dim; u++)
+ if (data_orig[u] != data_read[u]) {
+ HDprintf("Line #%d: written!=retrieved: data_orig[%u]=%d, data_read[%u]=%d\n", __LINE__,
+ (unsigned)u, data_orig[u], (unsigned)u, data_read[u]);
nerrors++;
}
/* Writing to the compressed, chunked dataset in parallel should fail */
- H5E_BEGIN_TRY {
- ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read); }
+ H5E_END_TRY;
VRFY((ret < 0), "H5Dwrite failed");
ret = H5Pclose(xfer_plist);
@@ -2647,12 +2605,15 @@ compress_readAll(void)
VRFY((ret >= 0), "H5Dclose succeeded");
} /* end if */
+ /* Close file */
ret = H5Fclose(fid);
VRFY((ret >= 0), "H5Fclose succeeded");
/* release data buffers */
- if(data_read) HDfree(data_read);
- if(data_orig) HDfree(data_orig);
+ if (data_read)
+ HDfree(data_read);
+ if (data_orig)
+ HDfree(data_orig);
}
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -2671,39 +2632,39 @@ compress_readAll(void)
void
none_selection_chunk(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t xfer_plist; /* Dataset transfer properties list */
- hid_t sid; /* Dataspace ID */
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* memory dataspace ID */
- hid_t dataset1, dataset2; /* Dataset ID */
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t xfer_plist; /* Dataset transfer properties list */
+ hid_t sid; /* Dataspace ID */
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* memory dataspace ID */
+ hid_t dataset1, dataset2; /* Dataset ID */
const char *filename;
- hsize_t dims[RANK]; /* dataset dim sizes */
- DATATYPE *data_origin = NULL; /* data buffer */
- DATATYPE *data_array = NULL; /* data buffer */
- hsize_t chunk_dims[RANK]; /* chunk sizes */
- hid_t dataset_pl; /* dataset create prop. list */
+ hsize_t dims[RANK]; /* dataset dim sizes */
+ DATATYPE * data_origin = NULL; /* data buffer */
+ DATATYPE * data_array = NULL; /* data buffer */
+ hsize_t chunk_dims[RANK]; /* chunk sizes */
+ hid_t dataset_pl; /* dataset create prop. list */
- hsize_t start[RANK]; /* for hyperslab setting */
- hsize_t count[RANK]; /* for hyperslab setting */
- hsize_t stride[RANK]; /* for hyperslab setting */
- hsize_t block[RANK]; /* for hyperslab setting */
- hsize_t mstart[RANK]; /* for data buffer in memory */
+ hsize_t start[RANK]; /* for hyperslab setting */
+ hsize_t count[RANK]; /* for hyperslab setting */
+ hsize_t stride[RANK]; /* for hyperslab setting */
+ hsize_t block[RANK]; /* for hyperslab setting */
+ hsize_t mstart[RANK]; /* for data buffer in memory */
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Extend independent write test on file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Extend independent write test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* setup chunk-size. Make sure sizes are > 0 */
chunk_dims[0] = chunkdim0;
@@ -2729,8 +2690,8 @@ none_selection_chunk(void)
* ------------------------------------------------------------- */
/* set up dataset storage chunk sizes and creation property list */
- if(VERBOSE_MED)
- printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]);
+ if (VERBOSE_MED)
+ HDprintf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]);
dataset_pl = H5Pcreate(H5P_DATASET_CREATE);
VRFY((dataset_pl >= 0), "H5Pcreate succeeded");
ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims);
@@ -2739,7 +2700,7 @@ none_selection_chunk(void)
/* setup dimensionality object */
dims[0] = dim0;
dims[1] = dim1;
- sid = H5Screate_simple(RANK, dims, NULL);
+ sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded");
/* create an extendible dataset collectively */
@@ -2762,65 +2723,64 @@ none_selection_chunk(void)
/* allocate memory for data buffer. Only allocate enough buffer for
* each processor's data. */
- if(mpi_rank) {
- data_origin = (DATATYPE *)HDmalloc(block[0]*block[1]*sizeof(DATATYPE));
+ if (mpi_rank) {
+ data_origin = (DATATYPE *)HDmalloc(block[0] * block[1] * sizeof(DATATYPE));
VRFY((data_origin != NULL), "data_origin HDmalloc succeeded");
- data_array = (DATATYPE *)HDmalloc(block[0]*block[1]*sizeof(DATATYPE));
+ data_array = (DATATYPE *)HDmalloc(block[0] * block[1] * sizeof(DATATYPE));
VRFY((data_array != NULL), "data_array HDmalloc succeeded");
/* put some trivial data in the data_array */
mstart[0] = mstart[1] = 0;
dataset_fill(mstart, block, data_origin);
MESG("data_array initialized");
- if(VERBOSE_MED){
- MESG("data_array created");
- dataset_print(mstart, block, data_origin);
+ if (VERBOSE_MED) {
+ MESG("data_array created");
+ dataset_print(mstart, block, data_origin);
}
}
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* Process 0 has no selection */
- if(!mpi_rank) {
+ if (!mpi_rank) {
ret = H5Sselect_none(mem_dataspace);
VRFY((ret >= 0), "H5Sselect_none succeeded");
}
/* create a file dataspace independently */
- file_dataspace = H5Dget_space (dataset1);
+ file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* Process 0 has no selection */
- if(!mpi_rank) {
+ if (!mpi_rank) {
ret = H5Sselect_none(file_dataspace);
VRFY((ret >= 0), "H5Sselect_none succeeded");
}
/* set up the collective transfer properties list */
- xfer_plist = H5Pcreate (H5P_DATASET_XFER);
+ xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded");
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
/* write data collectively */
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_origin);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_origin);
VRFY((ret >= 0), "H5Dwrite succeeded");
/* read data independently */
- ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array);
+ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array);
VRFY((ret >= 0), "");
/* verify the read data with original expected data */
- if(mpi_rank) {
+ if (mpi_rank) {
ret = dataset_vrfy(mstart, count, stride, block, data_array, data_origin);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
}
/* -------------------------
@@ -2830,19 +2790,18 @@ none_selection_chunk(void)
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
/* write data collectively */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- xfer_plist, data_origin);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_origin);
VRFY((ret >= 0), "H5Dwrite succeeded");
/* read data independently */
- ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, data_array);
+ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array);
VRFY((ret >= 0), "");
/* verify the read data with original expected data */
- if(mpi_rank) {
+ if (mpi_rank) {
ret = dataset_vrfy(mstart, count, stride, block, data_array, data_origin);
- if(ret) nerrors++;
+ if (ret)
+ nerrors++;
}
/* release resource */
@@ -2853,7 +2812,6 @@ none_selection_chunk(void)
ret = H5Pclose(xfer_plist);
VRFY((ret >= 0), "H5Pclose succeeded");
-
/* close dataset collectively */
ret = H5Dclose(dataset1);
VRFY((ret >= 0), "H5Dclose1 succeeded");
@@ -2864,24 +2822,25 @@ none_selection_chunk(void)
H5Fclose(fid);
/* release data buffers */
- if(data_origin) HDfree(data_origin);
- if(data_array) HDfree(data_array);
+ if (data_origin)
+ HDfree(data_origin);
+ if (data_array)
+ HDfree(data_array);
}
-
/* Function: test_actual_io_mode
*
- * Purpose: tests one specific case of collective I/O and checks that the
+ * Purpose: tests one specific case of collective I/O and checks that the
* actual_chunk_opt_mode property and the actual_io_mode
* properties in the DXPL have the correct values.
*
* Input: selection_mode: changes the way processes select data from the space, as well
* as some dxpl flags to get collective I/O to break in different ways.
- *
+ *
* The relevant I/O function and expected response for each mode:
* TEST_ACTUAL_IO_MULTI_CHUNK_IND:
* H5D_mpi_chunk_collective_io, each process reports independent I/O
- *
+ *
* TEST_ACTUAL_IO_MULTI_CHUNK_COL:
* H5D_mpi_chunk_collective_io, each process reports collective I/O
*
@@ -2893,7 +2852,7 @@ none_selection_chunk(void)
* collective, the rest report independent I/O
*
* TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND:
- * Same test TEST_ACTUAL_IO_MULTI_CHUNK_IND.
+ * Same test TEST_ACTUAL_IO_MULTI_CHUNK_IND.
* Set directly go to multi-chunk-io without num threshold calc.
* TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL:
* Same test TEST_ACTUAL_IO_MULTI_CHUNK_COL.
@@ -2918,78 +2877,76 @@ none_selection_chunk(void)
*
* Note: DIRECT_MULTI_CHUNK_MIX and DIRECT_MULTI_CHUNK_MIX_DISAGREE
* is not needed as they are covered by DIRECT_CHUNK_MIX and
- * MULTI_CHUNK_MIX_DISAGREE cases. _DIRECT_ cases are only for testing
+ * MULTI_CHUNK_MIX_DISAGREE cases. _DIRECT_ cases are only for testing
* path way to multi-chunk-io by H5FD_MPIO_CHUNK_MULTI_IO insted of num-threshold.
*
* Modification:
- * - Refctore to remove multi-chunk-without-opimization test and update for
- * testing direct to multi-chunk-io
+ * - Refctore to remove multi-chunk-without-opimization test and update for
+ * testing direct to multi-chunk-io
* Programmer: Jonathan Kim
* Date: 2012-10-10
*
- *
+ *
* Programmer: Jacob Gruber
* Date: 2011-04-06
*/
-static void
-test_actual_io_mode(int selection_mode) {
- H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = -1;
- H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = -1;
- H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_expected = -1;
- H5D_mpio_actual_io_mode_t actual_io_mode_write = -1;
- H5D_mpio_actual_io_mode_t actual_io_mode_read = -1;
- H5D_mpio_actual_io_mode_t actual_io_mode_expected = -1;
- const char * filename;
- const char * test_name;
- hbool_t direct_multi_chunk_io;
- hbool_t multi_chunk_io;
- hbool_t is_chunked;
- hbool_t is_collective;
- int mpi_size = -1;
- int mpi_rank = -1;
- int length;
- int * buffer;
- int i;
- MPI_Comm mpi_comm = MPI_COMM_NULL;
- MPI_Info mpi_info = MPI_INFO_NULL;
- hid_t fid = -1;
- hid_t sid = -1;
- hid_t dataset = -1;
- hid_t data_type = H5T_NATIVE_INT;
- hid_t fapl = -1;
- hid_t mem_space = -1;
- hid_t file_space = -1;
- hid_t dcpl = -1;
- hid_t dxpl_write = -1;
- hid_t dxpl_read = -1;
- hsize_t dims[RANK];
- hsize_t chunk_dims[RANK];
- hsize_t start[RANK];
- hsize_t stride[RANK];
- hsize_t count[RANK];
- hsize_t block[RANK];
- char message[256];
- herr_t ret;
-
+static void
+test_actual_io_mode(int selection_mode)
+{
+ H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = -1;
+ H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = -1;
+ H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_expected = -1;
+ H5D_mpio_actual_io_mode_t actual_io_mode_write = -1;
+ H5D_mpio_actual_io_mode_t actual_io_mode_read = -1;
+ H5D_mpio_actual_io_mode_t actual_io_mode_expected = -1;
+ const char * filename;
+ const char * test_name;
+ hbool_t direct_multi_chunk_io;
+ hbool_t multi_chunk_io;
+ hbool_t is_chunked;
+ hbool_t is_collective;
+ int mpi_size = -1;
+ int mpi_rank = -1;
+ int length;
+ int * buffer;
+ int i;
+ MPI_Comm mpi_comm = MPI_COMM_NULL;
+ MPI_Info mpi_info = MPI_INFO_NULL;
+ hid_t fid = -1;
+ hid_t sid = -1;
+ hid_t dataset = -1;
+ hid_t data_type = H5T_NATIVE_INT;
+ hid_t fapl = -1;
+ hid_t mem_space = -1;
+ hid_t file_space = -1;
+ hid_t dcpl = -1;
+ hid_t dxpl_write = -1;
+ hid_t dxpl_read = -1;
+ hsize_t dims[RANK];
+ hsize_t chunk_dims[RANK];
+ hsize_t start[RANK];
+ hsize_t stride[RANK];
+ hsize_t count[RANK];
+ hsize_t block[RANK];
+ char message[256];
+ herr_t ret;
+
/* Set up some flags to make some future if statements slightly more readable */
- direct_multi_chunk_io = (
- selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND ||
- selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL );
-
+ direct_multi_chunk_io = (selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND ||
+ selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL);
+
/* Note: RESET performs the same tests as MULTI_CHUNK_MIX_DISAGREE and then
* tests independent I/O
*/
- multi_chunk_io = (
- selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_IND ||
- selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_COL ||
- selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX ||
- selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE ||
- selection_mode == TEST_ACTUAL_IO_RESET );
-
- is_chunked = (
- selection_mode != TEST_ACTUAL_IO_CONTIGUOUS &&
- selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE);
-
+ multi_chunk_io =
+ (selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_IND ||
+ selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_COL ||
+ selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX ||
+ selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE || selection_mode == TEST_ACTUAL_IO_RESET);
+
+ is_chunked =
+ (selection_mode != TEST_ACTUAL_IO_CONTIGUOUS && selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE);
+
is_collective = selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE;
/* Set up MPI parameters */
@@ -2997,7 +2954,7 @@ test_actual_io_mode(int selection_mode) {
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Barrier(MPI_COMM_WORLD);
-
+
HDassert(mpi_size >= 1);
mpi_comm = MPI_COMM_WORLD;
@@ -3014,10 +2971,10 @@ test_actual_io_mode(int selection_mode) {
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
VRFY((fid >= 0), "H5Fcreate succeeded");
- /* Create the basic Space */
+ /* Create the basic Space */
dims[0] = dim0;
dims[1] = dim1;
- sid = H5Screate_simple (RANK, dims, NULL);
+ sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded");
/* Create the dataset creation plist */
@@ -3025,27 +2982,26 @@ test_actual_io_mode(int selection_mode) {
VRFY((dcpl >= 0), "dataset creation plist created successfully");
/* If we are not testing contiguous datasets */
- if(is_chunked) {
+ if (is_chunked) {
/* Set up chunk information. */
- chunk_dims[0] = dims[0]/mpi_size;
+ chunk_dims[0] = dims[0] / mpi_size;
chunk_dims[1] = dims[1];
- ret = H5Pset_chunk(dcpl, 2, chunk_dims);
- VRFY((ret >= 0),"chunk creation property list succeeded");
+ ret = H5Pset_chunk(dcpl, 2, chunk_dims);
+ VRFY((ret >= 0), "chunk creation property list succeeded");
}
/* Create the dataset */
- dataset = H5Dcreate2(fid, "actual_io", data_type, sid, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid, "actual_io", data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded");
/* Create the file dataspace */
file_space = H5Dget_space(dataset);
VRFY((file_space >= 0), "H5Dget_space succeeded");
- /* Choose a selection method based on the type of I/O we want to occur,
+ /* Choose a selection method based on the type of I/O we want to occur,
* and also set up some selection-dependeent test info. */
- switch(selection_mode) {
-
+ switch (selection_mode) {
+
/* Independent I/O with optimization */
case TEST_ACTUAL_IO_MULTI_CHUNK_IND:
case TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND:
@@ -3054,10 +3010,10 @@ test_actual_io_mode(int selection_mode) {
* independent.
*/
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
-
- test_name = "Multi Chunk - Independent";
+
+ test_name = "Multi Chunk - Independent";
actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK;
- actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT;
+ actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT;
break;
/* Collective I/O with optimization */
@@ -3068,15 +3024,15 @@ test_actual_io_mode(int selection_mode) {
* selections to each chunk, the operation is purely collective.
*/
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
-
- test_name = "Multi Chunk - Collective";
+
+ test_name = "Multi Chunk - Collective";
actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK;
- if(mpi_size > 1)
+ if (mpi_size > 1)
actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE;
else
actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT;
break;
-
+
/* Mixed I/O with optimization */
case TEST_ACTUAL_IO_MULTI_CHUNK_MIX:
/* A chunk will be assigned collective I/O only if it is selected by each
@@ -3087,32 +3043,33 @@ test_actual_io_mode(int selection_mode) {
* assigned independent I/O. Each process will access one chunk collectively
* and at least one chunk independently, reporting mixed I/O.
*/
-
- if(mpi_rank == 0) {
- /* Select the first column */
- slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
- } else {
+
+ if (mpi_rank == 0) {
+ /* Select the first column */
+ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
+ }
+ else {
/* Select the first and the nth chunk in the nth column */
- block[0] = dim0 / mpi_size;
- block[1] = dim1 / mpi_size;
- count[0] = 2;
- count[1] = 1;
+ block[0] = dim0 / mpi_size;
+ block[1] = dim1 / mpi_size;
+ count[0] = 2;
+ count[1] = 1;
stride[0] = mpi_rank * block[0];
stride[1] = 1;
- start[0] = 0;
- start[1] = mpi_rank*block[1];
+ start[0] = 0;
+ start[1] = mpi_rank * block[1];
}
-
- test_name = "Multi Chunk - Mixed";
+
+ test_name = "Multi Chunk - Mixed";
actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK;
- actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED;
+ actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED;
break;
/* RESET tests that the properties are properly reset to defaults each time I/O is
* performed. To acheive this, we have RESET perform collective I/O (which would change
* the values from the defaults) followed by independent I/O (which should report the
* default values). RESET doesn't need to have a unique selection, so we reuse
- * MULTI_CHUMK_MIX_DISAGREE, which was chosen because it is a complex case that works
+ * MULTI_CHUMK_MIX_DISAGREE, which was chosen because it is a complex case that works
* on all builds. The independent section of RESET can be found at the end of this function.
*/
case TEST_ACTUAL_IO_RESET:
@@ -3121,55 +3078,56 @@ test_actual_io_mode(int selection_mode) {
case TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE:
/* A chunk will be assigned collective I/O only if it is selected by each
* process. To get mixed I/O with disagreement, assign process n to the
- * first chunk and the nth chunk. The first chunk, selected by all, is
+ * first chunk and the nth chunk. The first chunk, selected by all, is
* assgigned collective I/O, while each other process gets independent I/O.
* Since the root process with only access the first chunk, it will report
* collective I/O. The subsequent processes will access the first chunk
* collectively, and their other chunk indpendently, reporting mixed I/O.
*/
- if(mpi_rank == 0) {
- /* Select the first chunk in the first column */
- slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
- block[0] = block[0] / mpi_size;
- } else {
+ if (mpi_rank == 0) {
+ /* Select the first chunk in the first column */
+ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
+ block[0] = block[0] / mpi_size;
+ }
+ else {
/* Select the first and the nth chunk in the nth column */
- block[0] = dim0 / mpi_size;
- block[1] = dim1 / mpi_size;
- count[0] = 2;
- count[1] = 1;
+ block[0] = dim0 / mpi_size;
+ block[1] = dim1 / mpi_size;
+ count[0] = 2;
+ count[1] = 1;
stride[0] = mpi_rank * block[0];
stride[1] = 1;
- start[0] = 0;
- start[1] = mpi_rank*block[1];
+ start[0] = 0;
+ start[1] = mpi_rank * block[1];
}
-
+
/* If the testname was not already set by the RESET case */
if (selection_mode == TEST_ACTUAL_IO_RESET)
test_name = "RESET";
else
test_name = "Multi Chunk - Mixed (Disagreement)";
-
+
actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK;
- if(mpi_size > 1) {
- if(mpi_rank == 0)
+ if (mpi_size > 1) {
+ if (mpi_rank == 0)
actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE;
else
actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED;
}
else
actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT;
-
- break;
+
+ break;
/* Linked Chunk I/O */
- case TEST_ACTUAL_IO_LINK_CHUNK:
+ case TEST_ACTUAL_IO_LINK_CHUNK:
/* Nothing special; link chunk I/O is forced in the dxpl settings. */
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
-
- test_name = "Link Chunk";
+
+ test_name = "Link Chunk";
actual_chunk_opt_mode_expected = H5D_MPIO_LINK_CHUNK;
- actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE;
+ actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE;
break;
/* Contiguous Dataset */
@@ -3177,36 +3135,36 @@ test_actual_io_mode(int selection_mode) {
/* A non overlapping, regular selection in a contiguous dataset leads to
* collective I/O */
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
-
- test_name = "Contiguous";
+
+ test_name = "Contiguous";
actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION;
- actual_io_mode_expected = H5D_MPIO_CONTIGUOUS_COLLECTIVE;
+ actual_io_mode_expected = H5D_MPIO_CONTIGUOUS_COLLECTIVE;
break;
case TEST_ACTUAL_IO_NO_COLLECTIVE:
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
-
- test_name = "Independent";
+
+ test_name = "Independent";
actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION;
- actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE;
+ actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE;
break;
default:
- test_name = "Undefined Selection Mode";
+ test_name = "Undefined Selection Mode";
actual_chunk_opt_mode_expected = -1;
- actual_io_mode_expected = -1;
+ actual_io_mode_expected = -1;
break;
}
ret = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
-
+
/* Create a memory dataspace mirroring the dataset and select the same hyperslab
- * as in the file space.
+ * as in the file space.
*/
- mem_space = H5Screate_simple (RANK, dims, NULL);
+ mem_space = H5Screate_simple(RANK, dims, NULL);
VRFY((mem_space >= 0), "mem_space created");
-
+
ret = H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
@@ -3215,38 +3173,38 @@ test_actual_io_mode(int selection_mode) {
/* Allocate and initialize the buffer */
buffer = (int *)HDmalloc(sizeof(int) * length);
- VRFY((buffer != NULL), "HDmalloc of buffer succeeded");
- for(i = 0; i < length; i++)
+ VRFY((buffer != NULL), "HDmalloc of buffer succeeded");
+ for (i = 0; i < length; i++)
buffer[i] = i;
/* Set up the dxpl for the write */
dxpl_write = H5Pcreate(H5P_DATASET_XFER);
VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded");
-
+
/* Set collective I/O properties in the dxpl. */
- if(is_collective) {
+ if (is_collective) {
/* Request collective I/O */
ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
-
- /* Set the threshold number of processes per chunk to twice mpi_size.
- * This will prevent the threshold from ever being met, thus forcing
+
+ /* Set the threshold number of processes per chunk to twice mpi_size.
+ * This will prevent the threshold from ever being met, thus forcing
* multi chunk io instead of link chunk io.
* This is via deault.
*/
- if(multi_chunk_io) {
+ if (multi_chunk_io) {
/* force multi-chunk-io by threshold */
- ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl_write, (unsigned) mpi_size*2);
+ ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl_write, (unsigned)mpi_size * 2);
VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_num succeeded");
/* set this to manipulate testing senario about allocating processes
* to chunks */
- ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl_write, (unsigned) 99);
+ ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl_write, (unsigned)99);
VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_ratio succeeded");
}
/* Set directly go to multi-chunk-io without threshold calc. */
- if(direct_multi_chunk_io) {
+ if (direct_multi_chunk_io) {
/* set for multi chunk io by property*/
ret = H5Pset_dxpl_mpio_chunk_opt(dxpl_write, H5FD_MPIO_CHUNK_MULTI_IO);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
@@ -3259,43 +3217,46 @@ test_actual_io_mode(int selection_mode) {
/* Write */
ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl_write, buffer);
- if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout);
+ if (ret < 0)
+ H5Eprint2(H5E_DEFAULT, stdout);
VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded");
/* Retreive Actual io valuess */
ret = H5Pget_mpio_actual_io_mode(dxpl_write, &actual_io_mode_write);
- VRFY((ret >= 0), "retriving actual io mode suceeded" );
+ VRFY((ret >= 0), "retriving actual io mode suceeded");
ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_write, &actual_chunk_opt_mode_write);
- VRFY((ret >= 0), "retriving actual chunk opt mode succeeded" );
-
+ VRFY((ret >= 0), "retriving actual chunk opt mode succeeded");
+
/* Read */
ret = H5Dread(dataset, data_type, mem_space, file_space, dxpl_read, buffer);
- if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout);
+ if (ret < 0)
+ H5Eprint2(H5E_DEFAULT, stdout);
VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded");
-
+
/* Retreive Actual io values */
ret = H5Pget_mpio_actual_io_mode(dxpl_read, &actual_io_mode_read);
- VRFY((ret >= 0), "retriving actual io mode succeeded" );
+ VRFY((ret >= 0), "retriving actual io mode succeeded");
ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_read, &actual_chunk_opt_mode_read);
- VRFY((ret >= 0), "retriving actual chunk opt mode succeeded" );
+ VRFY((ret >= 0), "retriving actual chunk opt mode succeeded");
/* Check write vs read */
VRFY((actual_io_mode_read == actual_io_mode_write),
- "reading and writing are the same for actual_io_mode");
+ "reading and writing are the same for actual_io_mode");
VRFY((actual_chunk_opt_mode_read == actual_chunk_opt_mode_write),
- "reading and writing are the same for actual_chunk_opt_mode");
+ "reading and writing are the same for actual_chunk_opt_mode");
/* Test values */
- if(actual_chunk_opt_mode_expected != (unsigned) -1 && actual_io_mode_expected != (unsigned) -1) {
- sprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n",test_name);
+ if (actual_chunk_opt_mode_expected != (unsigned)-1 && actual_io_mode_expected != (unsigned)-1) {
+ HDsprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n", test_name);
VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message);
- sprintf(message, "Actual IO Mode has the correct value for %s.\n",test_name);
+ HDsprintf(message, "Actual IO Mode has the correct value for %s.\n", test_name);
VRFY((actual_io_mode_write == actual_io_mode_expected), message);
- } else {
- HDfprintf(stderr, "%s %d -> (%d,%d)\n", test_name, mpi_rank,
- actual_chunk_opt_mode_write, actual_io_mode_write);
+ }
+ else {
+ HDfprintf(stderr, "%s %d -> (%d,%d)\n", test_name, mpi_rank, actual_chunk_opt_mode_write,
+ actual_io_mode_write);
}
/* To test that the property is succesfully reset to the default, we perform some
@@ -3315,30 +3276,30 @@ test_actual_io_mode(int selection_mode) {
/* Check Properties */
ret = H5Pget_mpio_actual_io_mode(dxpl_write, &actual_io_mode_write);
- VRFY( (ret >= 0), "retriving actual io mode succeeded" );
+ VRFY((ret >= 0), "retriving actual io mode succeeded");
ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_write, &actual_chunk_opt_mode_write);
- VRFY( (ret >= 0), "retriving actual chunk opt mode succeeded" );
+ VRFY((ret >= 0), "retriving actual chunk opt mode succeeded");
VRFY(actual_chunk_opt_mode_write == H5D_MPIO_NO_CHUNK_OPTIMIZATION,
- "actual_chunk_opt_mode has correct value for reset write (independent)");
+ "actual_chunk_opt_mode has correct value for reset write (independent)");
VRFY(actual_io_mode_write == H5D_MPIO_NO_COLLECTIVE,
- "actual_io_mode has correct value for reset write (independent)");
-
+ "actual_io_mode has correct value for reset write (independent)");
+
/* Read */
ret = H5Dread(dataset, data_type, H5S_ALL, H5S_ALL, dxpl_read, buffer);
VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded");
/* Check Properties */
ret = H5Pget_mpio_actual_io_mode(dxpl_read, &actual_io_mode_read);
- VRFY( (ret >= 0), "retriving actual io mode succeeded" );
+ VRFY((ret >= 0), "retriving actual io mode succeeded");
ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_read, &actual_chunk_opt_mode_read);
- VRFY( (ret >= 0), "retriving actual chunk opt mode succeeded" );
-
+ VRFY((ret >= 0), "retriving actual chunk opt mode succeeded");
+
VRFY(actual_chunk_opt_mode_read == H5D_MPIO_NO_CHUNK_OPTIMIZATION,
- "actual_chunk_opt_mode has correct value for reset read (independent)");
+ "actual_chunk_opt_mode has correct value for reset read (independent)");
VRFY(actual_io_mode_read == H5D_MPIO_NO_COLLECTIVE,
- "actual_io_mode has correct value for reset read (independent)");
- }
+ "actual_io_mode has correct value for reset read (independent)");
+ }
}
/* Release some resources */
@@ -3355,24 +3316,24 @@ test_actual_io_mode(int selection_mode) {
return;
}
-
/* Function: actual_io_mode_tests
*
- * Purpose: Tests all possible cases of the actual_io_mode property.
+ * Purpose: Tests all possible cases of the actual_io_mode property.
*
* Programmer: Jacob Gruber
* Date: 2011-04-06
*/
void
-actual_io_mode_tests(void) {
+actual_io_mode_tests(void)
+{
int mpi_size = -1;
int mpi_rank = -1;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_rank);
-
+
test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE);
-
- /*
+
+ /*
* Test multi-chunk-io via proc_num threshold
*/
test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND);
@@ -3383,10 +3344,10 @@ actual_io_mode_tests(void) {
test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX);
else
HDfprintf(stdout, "Multi Chunk Mixed test requires 3 proceses minimum\n");
-
+
test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE);
- /*
+ /*
* Test multi-chunk-io via setting direct property
*/
test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND);
@@ -3394,31 +3355,31 @@ actual_io_mode_tests(void) {
test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK);
test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS);
-
+
test_actual_io_mode(TEST_ACTUAL_IO_RESET);
return;
}
-/*
+/*
* Function: test_no_collective_cause_mode
*
- * Purpose:
- * tests cases for broken collective I/O and checks that the
+ * Purpose:
+ * tests cases for broken collective I/O and checks that the
* H5Pget_mpio_no_collective_cause properties in the DXPL have the correct values.
*
- * Input:
+ * Input:
* selection_mode: various mode to cause broken collective I/O
* Note: Originally, each TEST case is supposed to be used alone.
* After some discussion, this is updated to take multiple TEST cases
- * with '|'. However there is no error check for any of combined
+ * with '|'. However there is no error check for any of combined
* test cases, so a tester is responsible to understand and feed
* proper combination of TESTs if needed.
*
- *
+ *
* TEST_COLLECTIVE:
* Test for regular collective I/O without cause of breaking.
* Just to test normal behavior.
- *
+ *
* TEST_SET_INDEPENDENT:
* Test for Independent I/O as the cause of breaking collective I/O.
*
@@ -3430,7 +3391,7 @@ actual_io_mode_tests(void) {
*
* TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES:
* Test for NULL dataspace as the cause of breaking collective I/O.
- *
+ *
* TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT:
* Test for Compact layout as the cause of breaking collective I/O.
*
@@ -3439,47 +3400,48 @@ actual_io_mode_tests(void) {
*
* TEST_FILTERS:
* Test for using filter (checksum) as the cause of breaking collective I/O.
- * Note: TEST_FILTERS mode will not work until H5Dcreate and H5write is supported for mpio and filter feature. Use test_no_collective_cause_mode_filter() function instead.
+ * Note: TEST_FILTERS mode will not work until H5Dcreate and H5write is supported for mpio and filter
+ * feature. Use test_no_collective_cause_mode_filter() function instead.
+ *
*
- *
* Programmer: Jonathan Kim
* Date: Aug, 2012
*/
#define DSET_NOCOLCAUSE "nocolcause"
-#define NELM 2
-#define FILE_EXTERNAL "nocolcause_extern.data"
-static void
-test_no_collective_cause_mode(int selection_mode)
+#define NELM 2
+#define FILE_EXTERNAL "nocolcause_extern.data"
+static void
+test_no_collective_cause_mode(int selection_mode)
{
- uint32_t no_collective_cause_local_write = 0;
- uint32_t no_collective_cause_local_read = 0;
- uint32_t no_collective_cause_local_expected = 0;
- uint32_t no_collective_cause_global_write = 0;
- uint32_t no_collective_cause_global_read = 0;
+ uint32_t no_collective_cause_local_write = 0;
+ uint32_t no_collective_cause_local_read = 0;
+ uint32_t no_collective_cause_local_expected = 0;
+ uint32_t no_collective_cause_global_write = 0;
+ uint32_t no_collective_cause_global_read = 0;
uint32_t no_collective_cause_global_expected = 0;
- hsize_t coord[NELM][RANK];
-
- const char * filename;
- const char * test_name;
- hbool_t is_chunked=1;
- hbool_t is_independent=0;
- int mpi_size = -1;
- int mpi_rank = -1;
+ hsize_t coord[NELM][RANK];
+
+ const char *filename;
+ const char *test_name;
+ hbool_t is_chunked = 1;
+ hbool_t is_independent = 0;
+ int mpi_size = -1;
+ int mpi_rank = -1;
int length;
- int * buffer;
+ int * buffer;
int i;
MPI_Comm mpi_comm;
MPI_Info mpi_info;
- hid_t fid = -1;
- hid_t sid = -1;
- hid_t dataset = -1;
- hid_t data_type = H5T_NATIVE_INT;
- hid_t fapl = -1;
- hid_t dcpl = -1;
+ hid_t fid = -1;
+ hid_t sid = -1;
+ hid_t dataset = -1;
+ hid_t data_type = H5T_NATIVE_INT;
+ hid_t fapl = -1;
+ hid_t dcpl = -1;
hid_t dxpl_write = -1;
- hid_t dxpl_read = -1;
+ hid_t dxpl_read = -1;
hsize_t dims[RANK];
- hid_t mem_space = -1;
+ hid_t mem_space = -1;
hid_t file_space = -1;
hsize_t chunk_dims[RANK];
herr_t ret;
@@ -3487,7 +3449,7 @@ test_no_collective_cause_mode(int selection_mode)
H5Z_filter_t filter_info;
#endif /* LATER */
/* set to global value as default */
- int l_facc_type = facc_type;
+ int l_facc_type = facc_type;
char message[256];
/* Set up MPI parameters */
@@ -3506,27 +3468,29 @@ test_no_collective_cause_mode(int selection_mode)
VRFY((dcpl >= 0), "dataset creation plist created successfully");
if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT) {
- ret = H5Pset_layout (dcpl, H5D_COMPACT);
- VRFY((ret >= 0),"set COMPACT layout succeeded");
+ ret = H5Pset_layout(dcpl, H5D_COMPACT);
+ VRFY((ret >= 0), "set COMPACT layout succeeded");
is_chunked = 0;
}
if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) {
- ret = H5Pset_external (dcpl, FILE_EXTERNAL, (off_t) 0, H5F_UNLIMITED);
- VRFY((ret >= 0),"set EXTERNAL file layout succeeded");
+ ret = H5Pset_external(dcpl, FILE_EXTERNAL, (off_t)0, H5F_UNLIMITED);
+ VRFY((ret >= 0), "set EXTERNAL file layout succeeded");
is_chunked = 0;
}
#ifdef LATER /* fletcher32 */
if (selection_mode & TEST_FILTERS) {
ret = H5Zfilter_avail(H5Z_FILTER_FLETCHER32);
- VRFY ((ret >=0 ), "Fletcher32 filter is available.\n");
+ VRFY((ret >= 0), "Fletcher32 filter is available.\n");
- ret = H5Zget_filter_info (H5Z_FILTER_FLETCHER32, &filter_info);
- VRFY ( ( (filter_info & H5Z_FILTER_CONFIG_ENCODE_ENABLED) || (filter_info & H5Z_FILTER_CONFIG_DECODE_ENABLED) ) , "Fletcher32 filter encoding and decoding available.\n");
+ ret = H5Zget_filter_info(H5Z_FILTER_FLETCHER32, &filter_info);
+ VRFY(((filter_info & H5Z_FILTER_CONFIG_ENCODE_ENABLED) ||
+ (filter_info & H5Z_FILTER_CONFIG_DECODE_ENABLED)),
+ "Fletcher32 filter encoding and decoding available.\n");
ret = H5Pset_fletcher32(dcpl);
- VRFY((ret >= 0),"set filter (flecher32) succeeded");
+ VRFY((ret >= 0), "set filter (flecher32) succeeded");
}
#endif /* LATER */
@@ -3546,10 +3510,9 @@ test_no_collective_cause_mode(int selection_mode)
dims[0] = dim0;
dims[1] = dim1;
}
- sid = H5Screate_simple (RANK, dims, NULL);
+ sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded");
}
-
filename = (const char *)GetTestParameters();
HDassert(filename != NULL);
@@ -3564,30 +3527,27 @@ test_no_collective_cause_mode(int selection_mode)
VRFY((fid >= 0), "H5Fcreate succeeded");
/* If we are not testing contiguous datasets */
- if(is_chunked) {
+ if (is_chunked) {
/* Set up chunk information. */
- chunk_dims[0] = dims[0]/mpi_size;
+ chunk_dims[0] = dims[0] / mpi_size;
chunk_dims[1] = dims[1];
- ret = H5Pset_chunk(dcpl, 2, chunk_dims);
- VRFY((ret >= 0),"chunk creation property list succeeded");
+ ret = H5Pset_chunk(dcpl, 2, chunk_dims);
+ VRFY((ret >= 0), "chunk creation property list succeeded");
}
-
/* Create the dataset */
- dataset = H5Dcreate2(fid, "nocolcause", data_type, sid, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid, "nocolcause", data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded");
-
- /*
- * Set expected causes and some tweaks based on the type of test
+ /*
+ * Set expected causes and some tweaks based on the type of test
*/
if (selection_mode & TEST_DATATYPE_CONVERSION) {
test_name = "Broken Collective I/O - Datatype Conversion";
no_collective_cause_local_expected |= H5D_MPIO_DATATYPE_CONVERSION;
no_collective_cause_global_expected |= H5D_MPIO_DATATYPE_CONVERSION;
/* set different sign to trigger type conversion */
- data_type = H5T_NATIVE_UINT;
+ data_type = H5T_NATIVE_UINT;
}
if (selection_mode & TEST_DATA_TRANSFORMS) {
@@ -3618,14 +3578,14 @@ test_no_collective_cause_mode(int selection_mode)
#endif /* LATER */
if (selection_mode & TEST_COLLECTIVE) {
- test_name = "Broken Collective I/O - Not Broken";
- no_collective_cause_local_expected = H5D_MPIO_COLLECTIVE;
+ test_name = "Broken Collective I/O - Not Broken";
+ no_collective_cause_local_expected = H5D_MPIO_COLLECTIVE;
no_collective_cause_global_expected = H5D_MPIO_COLLECTIVE;
}
if (selection_mode & TEST_SET_INDEPENDENT) {
- test_name = "Broken Collective I/O - Independent";
- no_collective_cause_local_expected = H5D_MPIO_SET_INDEPENDENT;
+ test_name = "Broken Collective I/O - Independent";
+ no_collective_cause_local_expected = H5D_MPIO_SET_INDEPENDENT;
no_collective_cause_global_expected = H5D_MPIO_SET_INDEPENDENT;
/* switch to independent io */
is_independent = 1;
@@ -3635,7 +3595,7 @@ test_no_collective_cause_mode(int selection_mode)
if (selection_mode & TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES ||
selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) {
file_space = H5S_ALL;
- mem_space = H5S_ALL;
+ mem_space = H5S_ALL;
}
else {
/* Get the file dataspace */
@@ -3643,7 +3603,7 @@ test_no_collective_cause_mode(int selection_mode)
VRFY((file_space >= 0), "H5Dget_space succeeded");
/* Create the memory dataspace */
- mem_space = H5Screate_simple (RANK, dims, NULL);
+ mem_space = H5Screate_simple(RANK, dims, NULL);
VRFY((mem_space >= 0), "mem_space created");
}
@@ -3652,15 +3612,15 @@ test_no_collective_cause_mode(int selection_mode)
/* Allocate and initialize the buffer */
buffer = (int *)HDmalloc(sizeof(int) * length);
- VRFY((buffer != NULL), "HDmalloc of buffer succeeded");
- for(i = 0; i < length; i++)
+ VRFY((buffer != NULL), "HDmalloc of buffer succeeded");
+ for (i = 0; i < length; i++)
buffer[i] = i;
/* Set up the dxpl for the write */
dxpl_write = H5Pcreate(H5P_DATASET_XFER);
VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded");
-
- if(is_independent) {
+
+ if (is_independent) {
/* Set Independent I/O */
ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_INDEPENDENT);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
@@ -3669,32 +3629,31 @@ test_no_collective_cause_mode(int selection_mode)
/* Set Collective I/O */
ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
-
}
if (selection_mode & TEST_DATA_TRANSFORMS) {
- ret = H5Pset_data_transform (dxpl_write, "x+1");
+ ret = H5Pset_data_transform(dxpl_write, "x+1");
VRFY((ret >= 0), "H5Pset_data_transform succeeded");
}
/*---------------------
* Test Write access
- *---------------------*/
+ *---------------------*/
/* Write */
ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl_write, buffer);
- if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout);
+ if (ret < 0)
+ H5Eprint2(H5E_DEFAULT, stdout);
VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded");
-
/* Get the cause of broken collective I/O */
- ret = H5Pget_mpio_no_collective_cause (dxpl_write, &no_collective_cause_local_write, &no_collective_cause_global_write);
- VRFY((ret >= 0), "retriving no collective cause succeeded" );
-
+ ret = H5Pget_mpio_no_collective_cause(dxpl_write, &no_collective_cause_local_write,
+ &no_collective_cause_global_write);
+ VRFY((ret >= 0), "retriving no collective cause succeeded");
/*---------------------
* Test Read access
- *---------------------*/
+ *---------------------*/
/* Make a copy of the dxpl to test the read operation */
dxpl_read = H5Pcopy(dxpl_write);
@@ -3703,25 +3662,27 @@ test_no_collective_cause_mode(int selection_mode)
/* Read */
ret = H5Dread(dataset, data_type, mem_space, file_space, dxpl_read, buffer);
- if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout);
+ if (ret < 0)
+ H5Eprint2(H5E_DEFAULT, stdout);
VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded");
-
+
/* Get the cause of broken collective I/O */
- ret = H5Pget_mpio_no_collective_cause (dxpl_read, &no_collective_cause_local_read, &no_collective_cause_global_read);
- VRFY((ret >= 0), "retriving no collective cause succeeded" );
+ ret = H5Pget_mpio_no_collective_cause(dxpl_read, &no_collective_cause_local_read,
+ &no_collective_cause_global_read);
+ VRFY((ret >= 0), "retriving no collective cause succeeded");
/* Check write vs read */
VRFY((no_collective_cause_local_read == no_collective_cause_local_write),
- "reading and writing are the same for local cause of Broken Collective I/O");
+ "reading and writing are the same for local cause of Broken Collective I/O");
VRFY((no_collective_cause_global_read == no_collective_cause_global_write),
- "reading and writing are the same for global cause of Broken Collective I/O");
-
+ "reading and writing are the same for global cause of Broken Collective I/O");
+
/* Test values */
- memset (message, 0, sizeof (message));
- sprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name);
+ HDmemset(message, 0, sizeof(message));
+ HDsprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n", test_name);
VRFY((no_collective_cause_local_write == no_collective_cause_local_expected), message);
- memset (message, 0, sizeof (message));
- sprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name);
+ HDmemset(message, 0, sizeof(message));
+ HDsprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name);
VRFY((no_collective_cause_global_write == no_collective_cause_global_expected), message);
/* Release some resources */
@@ -3752,55 +3713,54 @@ test_no_collective_cause_mode(int selection_mode)
return;
}
-
-/*
+/*
* Function: test_no_collective_cause_mode_filter
*
- * Purpose:
- * Test specific for using filter as a caus of broken collective I/O and
+ * Purpose:
+ * Test specific for using filter as a caus of broken collective I/O and
* checks that the H5Pget_mpio_no_collective_cause properties in the DXPL
* have the correct values.
*
- * NOTE:
- * This is a temporary function.
+ * NOTE:
+ * This is a temporary function.
* test_no_collective_cause_mode(TEST_FILTERS) will replace this when
* H5Dcreate and H5write support for mpio and filter feature.
*
- * Input:
+ * Input:
* TEST_FILTERS_READ:
* Test for using filter (checksum) as the cause of breaking collective I/O.
- *
+ *
* Programmer: Jonathan Kim
* Date: Aug, 2012
*/
-static void
-test_no_collective_cause_mode_filter(int selection_mode)
+static void
+test_no_collective_cause_mode_filter(int selection_mode)
{
- uint32_t no_collective_cause_local_read = 0;
- uint32_t no_collective_cause_local_expected = 0;
- uint32_t no_collective_cause_global_read = 0;
+ uint32_t no_collective_cause_local_read = 0;
+ uint32_t no_collective_cause_local_expected = 0;
+ uint32_t no_collective_cause_global_read = 0;
uint32_t no_collective_cause_global_expected = 0;
- const char * filename;
- const char * test_name;
- hbool_t is_chunked=1;
- int mpi_size = -1;
- int mpi_rank = -1;
+ const char *filename;
+ const char *test_name = "I/O";
+ hbool_t is_chunked = 1;
+ int mpi_size = -1;
+ int mpi_rank = -1;
int length;
- int * buffer;
+ int * buffer;
int i;
- MPI_Comm mpi_comm = MPI_COMM_NULL;
- MPI_Info mpi_info = MPI_INFO_NULL;
- hid_t fid = -1;
- hid_t sid = -1;
- hid_t dataset = -1;
- hid_t data_type = H5T_NATIVE_INT;
+ MPI_Comm mpi_comm = MPI_COMM_NULL;
+ MPI_Info mpi_info = MPI_INFO_NULL;
+ hid_t fid = -1;
+ hid_t sid = -1;
+ hid_t dataset = -1;
+ hid_t data_type = H5T_NATIVE_INT;
hid_t fapl_write = -1;
- hid_t fapl_read = -1;
- hid_t dcpl = -1;
- hid_t dxpl = -1;
+ hid_t fapl_read = -1;
+ hid_t dcpl = -1;
+ hid_t dxpl = -1;
hsize_t dims[RANK];
- hid_t mem_space = -1;
+ hid_t mem_space = -1;
hid_t file_space = -1;
hsize_t chunk_dims[RANK];
herr_t ret;
@@ -3814,7 +3774,7 @@ test_no_collective_cause_mode_filter(int selection_mode)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Barrier(MPI_COMM_WORLD);
-
+
HDassert(mpi_size >= 1);
mpi_comm = MPI_COMM_WORLD;
@@ -3824,28 +3784,29 @@ test_no_collective_cause_mode_filter(int selection_mode)
dcpl = H5Pcreate(H5P_DATASET_CREATE);
VRFY((dcpl >= 0), "dataset creation plist created successfully");
- if (selection_mode == TEST_FILTERS_READ ) {
+ if (selection_mode == TEST_FILTERS_READ) {
#ifdef LATER /* fletcher32 */
- ret = H5Zfilter_avail(H5Z_FILTER_FLETCHER32);
- VRFY ((ret >=0 ), "Fletcher32 filter is available.\n");
+ ret = H5Zfilter_avail(H5Z_FILTER_FLETCHER32);
+ VRFY((ret >= 0), "Fletcher32 filter is available.\n");
- ret = H5Zget_filter_info (H5Z_FILTER_FLETCHER32, (unsigned int *) &filter_info);
- VRFY ( ( (filter_info & H5Z_FILTER_CONFIG_ENCODE_ENABLED) || (filter_info & H5Z_FILTER_CONFIG_DECODE_ENABLED) ) , "Fletcher32 filter encoding and decoding available.\n");
+ ret = H5Zget_filter_info(H5Z_FILTER_FLETCHER32, (unsigned int *)&filter_info);
+ VRFY(((filter_info & H5Z_FILTER_CONFIG_ENCODE_ENABLED) ||
+ (filter_info & H5Z_FILTER_CONFIG_DECODE_ENABLED)),
+ "Fletcher32 filter encoding and decoding available.\n");
- ret = H5Pset_fletcher32(dcpl);
- VRFY((ret >= 0),"set filter (flecher32) succeeded");
+ ret = H5Pset_fletcher32(dcpl);
+ VRFY((ret >= 0), "set filter (flecher32) succeeded");
#endif /* LATER */
}
- else {
+ else {
VRFY(0, "Unexpected mode, only test for TEST_FILTERS_READ.");
}
- /* Create the basic Space */
+ /* Create the basic Space */
dims[0] = dim0;
dims[1] = dim1;
- sid = H5Screate_simple (RANK, dims, NULL);
+ sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded");
-
filename = (const char *)GetTestParameters();
HDassert(filename != NULL);
@@ -3858,24 +3819,22 @@ test_no_collective_cause_mode_filter(int selection_mode)
VRFY((fid >= 0), "H5Fcreate succeeded");
/* If we are not testing contiguous datasets */
- if(is_chunked) {
+ if (is_chunked) {
/* Set up chunk information. */
- chunk_dims[0] = dims[0]/mpi_size;
+ chunk_dims[0] = dims[0] / mpi_size;
chunk_dims[1] = dims[1];
- ret = H5Pset_chunk(dcpl, 2, chunk_dims);
- VRFY((ret >= 0),"chunk creation property list succeeded");
+ ret = H5Pset_chunk(dcpl, 2, chunk_dims);
+ VRFY((ret >= 0), "chunk creation property list succeeded");
}
-
/* Create the dataset */
- dataset = H5Dcreate2(fid, DSET_NOCOLCAUSE, data_type, sid, H5P_DEFAULT,
- dcpl, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid, DSET_NOCOLCAUSE, data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded");
#ifdef LATER /* fletcher32 */
/* Set expected cause */
- test_name = "Broken Collective I/O - Filter is required";
- no_collective_cause_local_expected = H5D_MPIO_FILTERS;
+ test_name = "Broken Collective I/O - Filter is required";
+ no_collective_cause_local_expected = H5D_MPIO_FILTERS;
no_collective_cause_global_expected = H5D_MPIO_FILTERS;
#endif /* LATER */
@@ -3884,7 +3843,7 @@ test_no_collective_cause_mode_filter(int selection_mode)
VRFY((file_space >= 0), "H5Dget_space succeeded");
/* Create the memory dataspace */
- mem_space = H5Screate_simple (RANK, dims, NULL);
+ mem_space = H5Screate_simple(RANK, dims, NULL);
VRFY((mem_space >= 0), "mem_space created");
/* Get the number of elements in the selection */
@@ -3892,34 +3851,33 @@ test_no_collective_cause_mode_filter(int selection_mode)
/* Allocate and initialize the buffer */
buffer = (int *)HDmalloc(sizeof(int) * length);
- VRFY((buffer != NULL), "HDmalloc of buffer succeeded");
- for(i = 0; i < length; i++)
+ VRFY((buffer != NULL), "HDmalloc of buffer succeeded");
+ for (i = 0; i < length; i++)
buffer[i] = i;
/* Set up the dxpl for the write */
dxpl = H5Pcreate(H5P_DATASET_XFER);
VRFY((dxpl >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded");
-
- if (selection_mode == TEST_FILTERS_READ) {
- /* To test read in collective I/O mode , write in independent mode
+
+ if (selection_mode == TEST_FILTERS_READ) {
+ /* To test read in collective I/O mode , write in independent mode
* because write fails with mpio + filter */
ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_INDEPENDENT);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
}
- else {
+ else {
/* To test write in collective I/O mode. */
ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
}
-
/* Write */
ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl, buffer);
- if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout);
+ if (ret < 0)
+ H5Eprint2(H5E_DEFAULT, stdout);
VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded");
-
/* Make a copy of the dxpl to test the read operation */
dxpl = H5Pcopy(dxpl);
VRFY((dxpl >= 0), "H5Pcopy succeeded");
@@ -3931,7 +3889,6 @@ test_no_collective_cause_mode_filter(int selection_mode)
if (fid)
H5Fclose(fid);
-
/*---------------------
* Test Read access
*---------------------*/
@@ -3940,8 +3897,8 @@ test_no_collective_cause_mode_filter(int selection_mode)
fapl_read = create_faccess_plist(mpi_comm, mpi_info, facc_type);
VRFY((fapl_read >= 0), "create_faccess_plist() succeeded");
- fid = H5Fopen (filename, H5F_ACC_RDONLY, fapl_read);
- dataset = H5Dopen2 (fid, DSET_NOCOLCAUSE, H5P_DEFAULT);
+ fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl_read);
+ dataset = H5Dopen2(fid, DSET_NOCOLCAUSE, H5P_DEFAULT);
/* Set collective I/O properties in the dxpl. */
ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
@@ -3950,19 +3907,21 @@ test_no_collective_cause_mode_filter(int selection_mode)
/* Read */
ret = H5Dread(dataset, data_type, mem_space, file_space, dxpl, buffer);
- if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout);
+ if (ret < 0)
+ H5Eprint2(H5E_DEFAULT, stdout);
VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded");
-
+
/* Get the cause of broken collective I/O */
- ret = H5Pget_mpio_no_collective_cause (dxpl, &no_collective_cause_local_read, &no_collective_cause_global_read);
- VRFY((ret >= 0), "retriving no collective cause succeeded" );
+ ret = H5Pget_mpio_no_collective_cause(dxpl, &no_collective_cause_local_read,
+ &no_collective_cause_global_read);
+ VRFY((ret >= 0), "retriving no collective cause succeeded");
/* Test values */
- memset (message, 0, sizeof (message));
- sprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name);
+ HDmemset(message, 0, sizeof(message));
+ HDsprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n", test_name);
VRFY((no_collective_cause_local_read == (uint32_t)no_collective_cause_local_expected), message);
- memset (message, 0, sizeof (message));
- sprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name);
+ HDmemset(message, 0, sizeof(message));
+ HDsprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name);
VRFY((no_collective_cause_global_read == (uint32_t)no_collective_cause_global_expected), message);
/* Release some resources */
@@ -3988,38 +3947,39 @@ test_no_collective_cause_mode_filter(int selection_mode)
/* Function: no_collective_cause_tests
*
- * Purpose: Tests cases for broken collective IO.
+ * Purpose: Tests cases for broken collective IO.
*
* Programmer: Jonathan Kim
* Date: Aug, 2012
*/
-void
-no_collective_cause_tests(void)
+void
+no_collective_cause_tests(void)
{
- /*
- * Test individual cause
+ /*
+ * Test individual cause
*/
- test_no_collective_cause_mode (TEST_COLLECTIVE);
- test_no_collective_cause_mode (TEST_SET_INDEPENDENT);
- test_no_collective_cause_mode (TEST_DATATYPE_CONVERSION);
- test_no_collective_cause_mode (TEST_DATA_TRANSFORMS);
- test_no_collective_cause_mode (TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES);
- test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT);
- test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL);
+ test_no_collective_cause_mode(TEST_COLLECTIVE);
+ test_no_collective_cause_mode(TEST_SET_INDEPENDENT);
+ test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION);
+ test_no_collective_cause_mode(TEST_DATA_TRANSFORMS);
+ test_no_collective_cause_mode(TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES);
+ test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT);
+ test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL);
#ifdef LATER /* fletcher32 */
- /* TODO: use this instead of below TEST_FILTERS_READ when H5Dcreate and
- * H5Dwrite is ready for mpio + filter feature.
- */
+ /* TODO: use this instead of below TEST_FILTERS_READ when H5Dcreate and
+ * H5Dwrite is ready for mpio + filter feature.
+ */
/* test_no_collective_cause_mode (TEST_FILTERS); */
- test_no_collective_cause_mode_filter (TEST_FILTERS_READ);
-#endif /* LATER */
+ test_no_collective_cause_mode_filter(TEST_FILTERS_READ);
+#endif /* LATER */
- /*
- * Test combined causes
+ /*
+ * Test combined causes
*/
- test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION);
- test_no_collective_cause_mode (TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS);
- test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS);
+ test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION);
+ test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS);
+ test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION |
+ TEST_DATA_TRANSFORMS);
return;
}
@@ -4038,41 +3998,42 @@ no_collective_cause_tests(void)
void
dataset_atomicity(void)
{
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t sid; /* Dataspace ID */
- hid_t dataset1; /* Dataset IDs */
- hsize_t dims[RANK]; /* dataset dim sizes */
- int *write_buf = NULL; /* data buffer */
- int *read_buf = NULL; /* data buffer */
- int buf_size;
- hid_t dataset2;
- hid_t file_dataspace; /* File dataspace ID */
- hid_t mem_dataspace; /* Memory dataspace ID */
- hsize_t start[RANK];
- hsize_t stride[RANK];
- hsize_t count[RANK];
- hsize_t block[RANK];
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t sid; /* Dataspace ID */
+ hid_t dataset1; /* Dataset IDs */
+ hsize_t dims[RANK]; /* dataset dim sizes */
+ int * write_buf = NULL; /* data buffer */
+ int * read_buf = NULL; /* data buffer */
+ int buf_size;
+ hid_t dataset2;
+ hid_t file_dataspace; /* File dataspace ID */
+ hid_t mem_dataspace; /* Memory dataspace ID */
+ hsize_t start[RANK];
+ hsize_t stride[RANK];
+ hsize_t count[RANK];
+ hsize_t block[RANK];
const char *filename;
- herr_t ret; /* Generic return value */
- int mpi_size, mpi_rank;
- int i, j, k;
- hbool_t atomicity = FALSE;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
-
- dim0 = 64; dim1 = 32;
+ herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank;
+ int i, j, k;
+ hbool_t atomicity = FALSE;
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
+
+ dim0 = 64;
+ dim1 = 32;
filename = GetTestParameters();
if (facc_type != FACC_MPIO) {
- printf("Atomicity tests will not work without the MPIO VFD\n");
+ HDprintf("Atomicity tests will not work without the MPIO VFD\n");
return;
}
- if(VERBOSE_MED)
- printf("atomic writes to file %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("atomic writes to file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
buf_size = dim0 * dim1;
/* allocate memory for data buffer */
@@ -4097,29 +4058,25 @@ dataset_atomicity(void)
/* setup dimensionality object */
dims[0] = dim0;
dims[1] = dim1;
- sid = H5Screate_simple (RANK, dims, NULL);
+ sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded");
/* create datasets */
- dataset1 = H5Dcreate2(fid, DATASETNAME5, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset1 = H5Dcreate2(fid, DATASETNAME5, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dataset1 >= 0), "H5Dcreate2 succeeded");
- dataset2 = H5Dcreate2(fid, DATASETNAME6, H5T_NATIVE_INT, sid,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset2 = H5Dcreate2(fid, DATASETNAME6, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dataset2 >= 0), "H5Dcreate2 succeeded");
/* initialize datasets to 0s */
if (0 == mpi_rank) {
- ret = H5Dwrite(dataset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, write_buf);
+ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf);
VRFY((ret >= 0), "H5Dwrite dataset1 succeeded");
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, write_buf);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, write_buf);
VRFY((ret >= 0), "H5Dwrite dataset2 succeeded");
}
-
+
ret = H5Dclose(dataset1);
VRFY((ret >= 0), "H5Dclose succeeded");
ret = H5Dclose(dataset2);
@@ -4129,35 +4086,39 @@ dataset_atomicity(void)
ret = H5Fclose(fid);
VRFY((ret >= 0), "H5Fclose succeeded");
- MPI_Barrier (comm);
+ MPI_Barrier(comm);
/* make sure setting atomicity fails on a serial file ID */
- /* open the file collectively */
- fid=H5Fopen(filename,H5F_ACC_RDWR,H5P_DEFAULT);
- VRFY((fid >= 0), "H5Fopen succeeed");
+ /* file locking allows only one file open (serial) for writing */
+ if (MAINPROCESS) {
+ fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
+ VRFY((fid >= 0), "H5Fopen succeeed");
+ }
/* should fail */
- ret = H5Fset_mpi_atomicity (fid , TRUE);
+ ret = H5Fset_mpi_atomicity(fid, TRUE);
VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed");
- ret = H5Fclose(fid);
- VRFY((ret >= 0), "H5Fclose succeeded");
+ if (MAINPROCESS) {
+ ret = H5Fclose(fid);
+ VRFY((ret >= 0), "H5Fclose succeeded");
+ }
- MPI_Barrier (comm);
+ MPI_Barrier(comm);
/* setup file access template */
acc_tpl = create_faccess_plist(comm, info, facc_type);
VRFY((acc_tpl >= 0), "");
/* open the file collectively */
- fid=H5Fopen(filename,H5F_ACC_RDWR,acc_tpl);
+ fid = H5Fopen(filename, H5F_ACC_RDWR, acc_tpl);
VRFY((fid >= 0), "H5Fopen succeeded");
/* Release file-access template */
ret = H5Pclose(acc_tpl);
VRFY((ret >= 0), "H5Pclose succeeded");
- ret = H5Fset_mpi_atomicity (fid , TRUE);
+ ret = H5Fset_mpi_atomicity(fid, TRUE);
VRFY((ret >= 0), "H5Fset_mpi_atomicity succeeded");
/* open dataset1 (contiguous case) */
@@ -4165,22 +4126,22 @@ dataset_atomicity(void)
VRFY((dataset1 >= 0), "H5Dopen2 succeeded");
if (0 == mpi_rank) {
- for (i=0 ; i<buf_size ; i++) {
+ for (i = 0; i < buf_size; i++) {
write_buf[i] = 5;
}
}
else {
- for (i=0 ; i<buf_size ; i++) {
+ for (i = 0; i < buf_size; i++) {
read_buf[i] = 8;
}
}
/* check that the atomicity flag is set */
- ret = H5Fget_mpi_atomicity (fid , &atomicity);
+ ret = H5Fget_mpi_atomicity(fid, &atomicity);
VRFY((ret >= 0), "atomcity get failed");
VRFY((atomicity == TRUE), "atomcity set failed");
- MPI_Barrier (comm);
+ MPI_Barrier(comm);
/* Process 0 writes contiguously to the entire dataset */
if (0 == mpi_rank) {
@@ -4193,27 +4154,30 @@ dataset_atomicity(void)
VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded");
}
- if(VERBOSE_MED) {
- i=0;j=0;k=0;
- for (i=0 ; i<dim0 ; i++) {
- printf ("\n");
- for (j=0 ; j<dim1 ; j++)
- printf ("%d ", read_buf[k++]);
+ if (VERBOSE_MED) {
+ i = 0;
+ j = 0;
+ k = 0;
+ for (i = 0; i < dim0; i++) {
+ HDprintf("\n");
+ for (j = 0; j < dim1; j++)
+ HDprintf("%d ", read_buf[k++]);
}
}
/* The processes that read the dataset must either read all values
as 0 (read happened before process 0 wrote to dataset 1), or 5
(read happened after process 0 wrote to dataset 1) */
- if (0 != mpi_rank) {
+ if (0 != mpi_rank) {
int compare = read_buf[0];
- VRFY((compare == 0 || compare == 5),
+ VRFY((compare == 0 || compare == 5),
"Atomicity Test Failed Process %d: Value read should be 0 or 5\n");
- for (i=1; i<buf_size; i++) {
+ for (i = 1; i < buf_size; i++) {
if (read_buf[i] != compare) {
- printf("Atomicity Test Failed Process %d: read_buf[%d] is %d, should be %d\n", mpi_rank, i, read_buf[i], compare);
- nerrors ++;
+ HDprintf("Atomicity Test Failed Process %d: read_buf[%d] is %d, should be %d\n", mpi_rank, i,
+ read_buf[i], compare);
+ nerrors++;
}
}
}
@@ -4222,8 +4186,10 @@ dataset_atomicity(void)
VRFY((ret >= 0), "H5D close succeeded");
/* release data buffers */
- if(write_buf) HDfree(write_buf);
- if(read_buf) HDfree(read_buf);
+ if (write_buf)
+ HDfree(write_buf);
+ if (read_buf)
+ HDfree(read_buf);
/* open dataset2 (non-contiguous case) */
dataset2 = H5Dopen2(fid, DATASETNAME6, H5P_DEFAULT);
@@ -4236,102 +4202,104 @@ dataset_atomicity(void)
read_buf = (int *)HDcalloc(buf_size, sizeof(int));
VRFY((read_buf != NULL), "read_buf HDcalloc succeeded");
- for (i=0 ; i<buf_size ; i++) {
+ for (i = 0; i < buf_size; i++) {
write_buf[i] = 5;
}
- for (i=0 ; i<buf_size ; i++) {
+ for (i = 0; i < buf_size; i++) {
read_buf[i] = 8;
}
atomicity = FALSE;
/* check that the atomicity flag is set */
- ret = H5Fget_mpi_atomicity (fid , &atomicity);
+ ret = H5Fget_mpi_atomicity(fid, &atomicity);
VRFY((ret >= 0), "atomcity get failed");
VRFY((atomicity == TRUE), "atomcity set failed");
-
- block[0] = dim0/mpi_size - 1;
- block[1] = dim1/mpi_size - 1;
+ block[0] = dim0 / mpi_size - 1;
+ block[1] = dim1 / mpi_size - 1;
stride[0] = block[0] + 1;
stride[1] = block[1] + 1;
- count[0] = mpi_size;
- count[1] = mpi_size;
- start[0] = 0;
- start[1] = 0;
+ count[0] = mpi_size;
+ count[1] = mpi_size;
+ start[0] = 0;
+ start[1] = 0;
/* create a file dataspace */
- file_dataspace = H5Dget_space (dataset2);
+ file_dataspace = H5Dget_space(dataset2);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace */
- mem_dataspace = H5Screate_simple (RANK, dims, NULL);
+ mem_dataspace = H5Screate_simple(RANK, dims, NULL);
VRFY((mem_dataspace >= 0), "");
ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
- MPI_Barrier (comm);
+ MPI_Barrier(comm);
/* Process 0 writes to the dataset */
if (0 == mpi_rank) {
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, write_buf);
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, write_buf);
VRFY((ret >= 0), "H5Dwrite dataset2 succeeded");
}
/* All processes wait for the write to finish. This works because
atomicity is set to true */
- MPI_Barrier (comm);
+ MPI_Barrier(comm);
/* The other processes read the entire dataset */
if (0 != mpi_rank) {
- ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
- H5P_DEFAULT, read_buf);
+ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, read_buf);
VRFY((ret >= 0), "H5Dread dataset2 succeeded");
}
- if(VERBOSE_MED) {
+ if (VERBOSE_MED) {
if (mpi_rank == 1) {
- i=0;j=0;k=0;
- for (i=0 ; i<dim0 ; i++) {
- printf ("\n");
- for (j=0 ; j<dim1 ; j++)
- printf ("%d ", read_buf[k++]);
+ i = 0;
+ j = 0;
+ k = 0;
+ for (i = 0; i < dim0; i++) {
+ HDprintf("\n");
+ for (j = 0; j < dim1; j++)
+ HDprintf("%d ", read_buf[k++]);
}
- printf ("\n");
+ HDprintf("\n");
}
}
/* The processes that read the dataset must either read all values
as 5 (read happened after process 0 wrote to dataset 1) */
- if (0 != mpi_rank) {
+ if (0 != mpi_rank) {
int compare;
- i=0;j=0;k=0;
+ i = 0;
+ j = 0;
+ k = 0;
compare = 5;
- for (i=0 ; i<dim0 ; i++) {
- if (i >= mpi_rank*(block[0]+1)) {
+ for (i = 0; i < dim0; i++) {
+ if (i >= mpi_rank * (block[0] + 1)) {
break;
}
- if ((i+1)%(block[0]+1)==0) {
+ if ((i + 1) % (block[0] + 1) == 0) {
k += dim1;
continue;
}
- for (j=0 ; j<dim1 ; j++) {
- if (j >= mpi_rank*(block[1]+1)) {
- k += dim1 - mpi_rank*(block[1]+1);
+ for (j = 0; j < dim1; j++) {
+ if (j >= mpi_rank * (block[1] + 1)) {
+ k += dim1 - mpi_rank * (block[1] + 1);
break;
}
- if ((j+1)%(block[1]+1)==0) {
+ if ((j + 1) % (block[1] + 1) == 0) {
k++;
continue;
}
else if (compare != read_buf[k]) {
- printf("Atomicity Test Failed Process %d: read_buf[%d] is %d, should be %d\n", mpi_rank, k, read_buf[k], compare);
+ HDprintf("Atomicity Test Failed Process %d: read_buf[%d] is %d, should be %d\n", mpi_rank,
+ k, read_buf[k], compare);
nerrors++;
}
- k ++;
+ k++;
}
}
}
@@ -4344,12 +4312,13 @@ dataset_atomicity(void)
VRFY((ret >= 0), "H5Sclose succeeded");
/* release data buffers */
- if(write_buf) HDfree(write_buf);
- if(read_buf) HDfree(read_buf);
+ if (write_buf)
+ HDfree(write_buf);
+ if (read_buf)
+ HDfree(read_buf);
ret = H5Fclose(fid);
VRFY((ret >= 0), "H5Fclose succeeded");
-
}
/* Function: dense_attr_test
@@ -4359,24 +4328,24 @@ dataset_atomicity(void)
* Programmer: Quincey Koziol
* Date: April, 2013
*/
-void
-test_dense_attr(void)
+void
+test_dense_attr(void)
{
- int mpi_size, mpi_rank;
- hid_t fpid, fid;
- hid_t gid, gpid;
- hid_t atFileSpace, atid;
- hsize_t atDims[1] = {10000};
- herr_t status;
+ int mpi_size, mpi_rank;
+ hid_t fpid, fid;
+ hid_t gid, gpid;
+ hid_t atFileSpace, atid;
+ hsize_t atDims[1] = {10000};
+ herr_t status;
const char *filename;
/* get filename */
filename = (const char *)GetTestParameters();
- HDassert( filename != NULL );
+ HDassert(filename != NULL);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
fpid = H5Pcreate(H5P_FILE_ACCESS);
VRFY((fpid > 0), "H5Pcreate succeeded");
@@ -4398,7 +4367,7 @@ test_dense_attr(void)
status = H5Pclose(gpid);
VRFY((status >= 0), "H5Pclose succeeded");
- atFileSpace = H5Screate_simple(1, atDims, NULL);
+ atFileSpace = H5Screate_simple(1, atDims, NULL);
VRFY((atFileSpace > 0), "H5Screate_simple succeeded");
atid = H5Acreate2(gid, "bar", H5T_STD_U64LE, atFileSpace, H5P_DEFAULT, H5P_DEFAULT);
VRFY((atid > 0), "H5Acreate succeeded");
@@ -4415,4 +4384,3 @@ test_dense_attr(void)
return;
}
-
diff --git a/testpar/t_file.c b/testpar/t_file.c
index 2d42e10..98a2856 100644
--- a/testpar/t_file.c
+++ b/testpar/t_file.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -31,65 +31,63 @@
void
test_split_comm_access(void)
{
- int mpi_size, mpi_rank;
- MPI_Comm comm;
- MPI_Info info = MPI_INFO_NULL;
- int is_old, mrc;
- int newrank, newprocs;
- hid_t fid; /* file IDs */
- hid_t acc_tpl; /* File access properties */
- herr_t ret; /* generic return value */
+ int mpi_size, mpi_rank;
+ MPI_Comm comm;
+ MPI_Info info = MPI_INFO_NULL;
+ int is_old, mrc;
+ int newrank, newprocs;
+ hid_t fid; /* file IDs */
+ hid_t acc_tpl; /* File access properties */
+ herr_t ret; /* generic return value */
const char *filename;
filename = (const char *)GetTestParameters();
if (VERBOSE_MED)
- printf("Split Communicator access test on file %s\n",
- filename);
+ HDprintf("Split Communicator access test on file %s\n", filename);
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
- is_old = mpi_rank%2;
- mrc = MPI_Comm_split(MPI_COMM_WORLD, is_old, mpi_rank, &comm);
- VRFY((mrc==MPI_SUCCESS), "");
- MPI_Comm_size(comm,&newprocs);
- MPI_Comm_rank(comm,&newrank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ is_old = mpi_rank % 2;
+ mrc = MPI_Comm_split(MPI_COMM_WORLD, is_old, mpi_rank, &comm);
+ VRFY((mrc == MPI_SUCCESS), "");
+ MPI_Comm_size(comm, &newprocs);
+ MPI_Comm_rank(comm, &newrank);
- if (is_old){
- /* odd-rank processes */
- mrc = MPI_Barrier(comm);
- VRFY((mrc==MPI_SUCCESS), "");
- }else{
- /* even-rank processes */
- int sub_mpi_rank; /* rank in the sub-comm */
- MPI_Comm_rank(comm,&sub_mpi_rank);
+ if (is_old) {
+ /* odd-rank processes */
+ mrc = MPI_Barrier(comm);
+ VRFY((mrc == MPI_SUCCESS), "");
+ }
+ else {
+ /* even-rank processes */
+ int sub_mpi_rank; /* rank in the sub-comm */
+ MPI_Comm_rank(comm, &sub_mpi_rank);
- /* setup file access template */
- acc_tpl = create_faccess_plist(comm, info, facc_type);
- VRFY((acc_tpl >= 0), "");
+ /* setup file access template */
+ acc_tpl = create_faccess_plist(comm, info, facc_type);
+ VRFY((acc_tpl >= 0), "");
- /* create the file collectively */
- fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl);
- VRFY((fid >= 0), "H5Fcreate succeeded");
+ /* create the file collectively */
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
+ VRFY((fid >= 0), "H5Fcreate succeeded");
- /* Release file-access template */
- ret=H5Pclose(acc_tpl);
- VRFY((ret >= 0), "");
+ /* Release file-access template */
+ ret = H5Pclose(acc_tpl);
+ VRFY((ret >= 0), "");
- /* close the file */
- ret=H5Fclose(fid);
- VRFY((ret >= 0), "");
+ /* close the file */
+ ret = H5Fclose(fid);
+ VRFY((ret >= 0), "");
- /* delete the test file */
- if (sub_mpi_rank == 0){
- mrc = MPI_File_delete((char *)filename, info);
- /*VRFY((mrc==MPI_SUCCESS), ""); */
- }
+ /* delete the test file */
+ if (sub_mpi_rank == 0) {
+ mrc = MPI_File_delete((char *)filename, info);
+ /*VRFY((mrc==MPI_SUCCESS), ""); */
+ }
}
mrc = MPI_Comm_free(&comm);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free succeeded");
+ VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free succeeded");
mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "final MPI_Barrier succeeded");
+ VRFY((mrc == MPI_SUCCESS), "final MPI_Barrier succeeded");
}
-
-
diff --git a/testpar/t_file_image.c b/testpar/t_file_image.c
index 62db11a..a8251de 100644
--- a/testpar/t_file_image.c
+++ b/testpar/t_file_image.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,11 +21,11 @@
*
* Process zero:
*
- * 1) Creates a core file with an integer vector data set of
- * length n (= mpi_size),
+ * 1) Creates a core file with an integer vector data set of
+ * length n (= mpi_size),
*
- * 2) Initializes the vector to zero in * location 0, and to -1
- * everywhere else.
+ * 2) Initializes the vector to zero in * location 0, and to -1
+ * everywhere else.
*
* 3) Flushes the core file, and gets an image of it. Closes
* the core file.
@@ -35,7 +35,7 @@
* 5) Awaits receipt on a file image from process n-1.
*
* 6) opens the image received from process n-1, verifies that
- * it contains a vector of length equal to mpi_size, and
+ * it contains a vector of length equal to mpi_size, and
* that the vector contains (0, 1, 2, ... n-1)
*
* 7) closes the core file and exits.
@@ -45,7 +45,7 @@
* 1) Await receipt of file image from process (i - 1).
*
* 2) Open the image with the core file driver, verify that i
- * contains a vector v of length, and that v[j] = j for
+ * contains a vector v of length, and that v[j] = j for
* 0 <= j < i, and that v[j] == -1 for i <= j < n
*
* 3) Set v[i] = i in the core file.
@@ -61,81 +61,75 @@
void
file_image_daisy_chain_test(void)
{
- char file_name[1024] = "\0";
- int mpi_size, mpi_rank;
- int mpi_result;
- int i;
- int space_ndims;
+ char file_name[1024] = "\0";
+ int mpi_size, mpi_rank;
+ int mpi_result;
+ int i;
+ int space_ndims;
MPI_Status rcvstat;
- int * vector_ptr = NULL;
- hid_t fapl_id = -1;
- hid_t file_id; /* file IDs */
- hid_t dset_id = -1;
- hid_t dset_type_id = -1;
- hid_t space_id = -1;
- herr_t err;
- hsize_t dims[1];
- void * image_ptr = NULL;
- ssize_t bytes_read;
- ssize_t image_len;
- hbool_t vector_ok = TRUE;
- htri_t tri_result;
-
+ int * vector_ptr = NULL;
+ hid_t fapl_id = -1;
+ hid_t file_id; /* file IDs */
+ hid_t dset_id = -1;
+ hid_t dset_type_id = -1;
+ hid_t space_id = -1;
+ herr_t err;
+ hsize_t dims[1];
+ void * image_ptr = NULL;
+ ssize_t bytes_read;
+ ssize_t image_len;
+ hbool_t vector_ok = TRUE;
+ htri_t tri_result;
/* set up MPI parameters */
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* setup file name */
- HDsnprintf(file_name, 1024, "file_image_daisy_chain_test_%05d.h5",
- (int)mpi_rank);
+ HDsnprintf(file_name, 1024, "file_image_daisy_chain_test_%05d.h5", (int)mpi_rank);
+
+ if (mpi_rank == 0) {
- if(mpi_rank == 0) {
-
- /* 1) Creates a core file with an integer vector data set
- * of length mpi_size,
+ /* 1) Creates a core file with an integer vector data set
+ * of length mpi_size,
*/
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((fapl_id >= 0), "creating fapl");
- err = H5Pset_fapl_core(fapl_id, (size_t)(64 *1024), FALSE);
+ err = H5Pset_fapl_core(fapl_id, (size_t)(64 * 1024), FALSE);
VRFY((err >= 0), "setting core file driver in fapl.");
file_id = H5Fcreate(file_name, 0, H5P_DEFAULT, fapl_id);
VRFY((file_id >= 0), "created core file");
- dims[0] = (hsize_t)mpi_size;
- space_id = H5Screate_simple(1, dims, dims);
+ dims[0] = (hsize_t)mpi_size;
+ space_id = H5Screate_simple(1, dims, dims);
VRFY((space_id >= 0), "created data space");
- dset_id = H5Dcreate2(file_id, "v", H5T_NATIVE_INT, space_id,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, "v", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dset_id >= 0), "created data set");
-
- /* 2) Initialize the vector to zero in location 0, and
- * to -1 everywhere else.
+ /* 2) Initialize the vector to zero in location 0, and
+ * to -1 everywhere else.
*/
- vector_ptr = (int *)HDmalloc((size_t)(mpi_size) * sizeof(int));
+ vector_ptr = (int *)HDmalloc((size_t)(mpi_size) * sizeof(int));
VRFY((vector_ptr != NULL), "allocated in memory representation of vector");
vector_ptr[0] = 0;
- for(i = 1; i < mpi_size; i++)
+ for (i = 1; i < mpi_size; i++)
vector_ptr[i] = -1;
- err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, (void *)vector_ptr);
+ err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)vector_ptr);
VRFY((err >= 0), "wrote initial data to vector.");
HDfree(vector_ptr);
vector_ptr = NULL;
-
/* 3) Flush the core file, and get an image of it. Close
* the core file.
*/
- err = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
+ err = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
VRFY((err >= 0), "flushed core file.");
image_len = H5Fget_file_image(file_id, NULL, (size_t)0);
@@ -148,206 +142,192 @@ file_image_daisy_chain_test(void)
VRFY(bytes_read == image_len, "wrote file into image buffer");
err = H5Sclose(space_id);
- VRFY((err >= 0), "closed data space.");
+ VRFY((err >= 0), "closed data space.");
- err = H5Dclose(dset_id);
- VRFY((err >= 0), "closed data set.");
+ err = H5Dclose(dset_id);
+ VRFY((err >= 0), "closed data set.");
- err = H5Fclose(file_id);
- VRFY((err >= 0), "closed core file(1).");
+ err = H5Fclose(file_id);
+ VRFY((err >= 0), "closed core file(1).");
- err = H5Pclose(fapl_id);
- VRFY((err >= 0), "closed fapl(1).");
+ err = H5Pclose(fapl_id);
+ VRFY((err >= 0), "closed fapl(1).");
-
/* 4) Send the image to process 1. */
- mpi_result = MPI_Ssend((void *)(&image_len), (int)sizeof(ssize_t),
- MPI_BYTE, 1, 0, MPI_COMM_WORLD);
- VRFY((mpi_result == MPI_SUCCESS), "sent image size to process 1");
+ mpi_result = MPI_Ssend((void *)(&image_len), (int)sizeof(ssize_t), MPI_BYTE, 1, 0, MPI_COMM_WORLD);
+ VRFY((mpi_result == MPI_SUCCESS), "sent image size to process 1");
- mpi_result = MPI_Ssend((void *)image_ptr, (int)image_len,
- MPI_BYTE, 1, 0, MPI_COMM_WORLD);
- VRFY((mpi_result == MPI_SUCCESS), "sent image to process 1");
+ mpi_result = MPI_Ssend((void *)image_ptr, (int)image_len, MPI_BYTE, 1, 0, MPI_COMM_WORLD);
+ VRFY((mpi_result == MPI_SUCCESS), "sent image to process 1");
HDfree(image_ptr);
image_ptr = NULL;
image_len = 0;
+ /* 5) Await receipt on a file image from process n-1. */
- /* 5) Await receipt on a file image from process n-1. */
-
- mpi_result = MPI_Recv((void *)(&image_len), (int)sizeof(ssize_t),
- MPI_BYTE, mpi_size - 1, 0, MPI_COMM_WORLD,
- &rcvstat);
- VRFY((mpi_result == MPI_SUCCESS), "received image len from process n-1");
+ mpi_result = MPI_Recv((void *)(&image_len), (int)sizeof(ssize_t), MPI_BYTE, mpi_size - 1, 0,
+ MPI_COMM_WORLD, &rcvstat);
+ VRFY((mpi_result == MPI_SUCCESS), "received image len from process n-1");
image_ptr = (void *)HDmalloc((size_t)image_len);
VRFY(image_ptr != NULL, "allocated file image receive buffer.");
- mpi_result = MPI_Recv((void *)image_ptr, (int)image_len,
- MPI_BYTE, mpi_size - 1, 0, MPI_COMM_WORLD,
- &rcvstat);
- VRFY((mpi_result == MPI_SUCCESS), \
- "received file image from process n-1");
-
- /* 6) open the image received from process n-1, verify that
- * it contains a vector of length equal to mpi_size, and
- * that the vector contains (0, 1, 2, ... n-1).
+ mpi_result =
+ MPI_Recv((void *)image_ptr, (int)image_len, MPI_BYTE, mpi_size - 1, 0, MPI_COMM_WORLD, &rcvstat);
+ VRFY((mpi_result == MPI_SUCCESS), "received file image from process n-1");
+
+ /* 6) open the image received from process n-1, verify that
+ * it contains a vector of length equal to mpi_size, and
+ * that the vector contains (0, 1, 2, ... n-1).
*/
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((fapl_id >= 0), "creating fapl");
- err = H5Pset_fapl_core(fapl_id, (size_t)(64 *1024), FALSE);
+ err = H5Pset_fapl_core(fapl_id, (size_t)(64 * 1024), FALSE);
VRFY((err >= 0), "setting core file driver in fapl.");
- err = H5Pset_file_image(fapl_id, image_ptr, (size_t)image_len);
+ err = H5Pset_file_image(fapl_id, image_ptr, (size_t)image_len);
VRFY((err >= 0), "set file image in fapl.");
file_id = H5Fopen(file_name, H5F_ACC_RDWR, fapl_id);
VRFY((file_id >= 0), "opened received file image file");
- dset_id = H5Dopen2(file_id, "v", H5P_DEFAULT);
+ dset_id = H5Dopen2(file_id, "v", H5P_DEFAULT);
VRFY((dset_id >= 0), "opened data set");
- dset_type_id = H5Dget_type(dset_id);
+ dset_type_id = H5Dget_type(dset_id);
VRFY((dset_type_id >= 0), "obtained data set type");
- tri_result = H5Tequal(dset_type_id, H5T_NATIVE_INT);
+ tri_result = H5Tequal(dset_type_id, H5T_NATIVE_INT);
VRFY((tri_result == TRUE), "verified data set type");
- space_id = H5Dget_space(dset_id);
+ space_id = H5Dget_space(dset_id);
VRFY((space_id >= 0), "opened data space");
- space_ndims = H5Sget_simple_extent_ndims(space_id);
- VRFY((space_ndims == 1), "verified data space num dims(1)");
+ space_ndims = H5Sget_simple_extent_ndims(space_id);
+ VRFY((space_ndims == 1), "verified data space num dims(1)");
- space_ndims = H5Sget_simple_extent_dims(space_id, dims, NULL);
- VRFY((space_ndims == 1), "verified data space num dims(2)");
- VRFY((dims[0] == (hsize_t)mpi_size), "verified data space dims");
+ space_ndims = H5Sget_simple_extent_dims(space_id, dims, NULL);
+ VRFY((space_ndims == 1), "verified data space num dims(2)");
+ VRFY((dims[0] == (hsize_t)mpi_size), "verified data space dims");
- vector_ptr = (int *)HDmalloc((size_t)(mpi_size) * sizeof(int));
+ vector_ptr = (int *)HDmalloc((size_t)(mpi_size) * sizeof(int));
VRFY((vector_ptr != NULL), "allocated in memory rep of vector");
- err = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, (void *)vector_ptr);
+ err = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)vector_ptr);
VRFY((err >= 0), "read received vector.");
- vector_ok = TRUE;
- for(i = 0; i < mpi_size; i++)
- if(vector_ptr[i] != i)
+ vector_ok = TRUE;
+ for (i = 0; i < mpi_size; i++)
+ if (vector_ptr[i] != i)
vector_ok = FALSE;
VRFY((vector_ok), "verified received vector.");
-
+
HDfree(vector_ptr);
vector_ptr = NULL;
- /* 7) closes the core file and exit. */
+ /* 7) closes the core file and exit. */
err = H5Sclose(space_id);
- VRFY((err >= 0), "closed data space.");
+ VRFY((err >= 0), "closed data space.");
- err = H5Dclose(dset_id);
- VRFY((err >= 0), "closed data set.");
+ err = H5Dclose(dset_id);
+ VRFY((err >= 0), "closed data set.");
- err = H5Fclose(file_id);
- VRFY((err >= 0), "closed core file(1).");
+ err = H5Fclose(file_id);
+ VRFY((err >= 0), "closed core file(1).");
- err = H5Pclose(fapl_id);
- VRFY((err >= 0), "closed fapl(1).");
+ err = H5Pclose(fapl_id);
+ VRFY((err >= 0), "closed fapl(1).");
HDfree(image_ptr);
image_ptr = NULL;
image_len = 0;
- } else {
+ }
+ else {
/* 1) Await receipt of file image from process (i - 1). */
- mpi_result = MPI_Recv((void *)(&image_len), (int)sizeof(ssize_t),
- MPI_BYTE, mpi_rank - 1, 0, MPI_COMM_WORLD,
- &rcvstat);
- VRFY((mpi_result == MPI_SUCCESS), \
- "received image size from process mpi_rank-1");
+ mpi_result = MPI_Recv((void *)(&image_len), (int)sizeof(ssize_t), MPI_BYTE, mpi_rank - 1, 0,
+ MPI_COMM_WORLD, &rcvstat);
+ VRFY((mpi_result == MPI_SUCCESS), "received image size from process mpi_rank-1");
image_ptr = (void *)HDmalloc((size_t)image_len);
VRFY(image_ptr != NULL, "allocated file image receive buffer.");
- mpi_result = MPI_Recv((void *)image_ptr, (int)image_len,
- MPI_BYTE, mpi_rank - 1, 0, MPI_COMM_WORLD,
- &rcvstat);
- VRFY((mpi_result == MPI_SUCCESS), \
- "received file image from process mpi_rank-1");
-
- /* 2) Open the image with the core file driver, verify that it
- * contains a vector v of length, and that v[j] = j for
- * 0 <= j < i, and that v[j] == -1 for i <= j < n
- */
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ mpi_result =
+ MPI_Recv((void *)image_ptr, (int)image_len, MPI_BYTE, mpi_rank - 1, 0, MPI_COMM_WORLD, &rcvstat);
+ VRFY((mpi_result == MPI_SUCCESS), "received file image from process mpi_rank-1");
+
+ /* 2) Open the image with the core file driver, verify that it
+ * contains a vector v of length, and that v[j] = j for
+ * 0 <= j < i, and that v[j] == -1 for i <= j < n
+ */
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((fapl_id >= 0), "creating fapl");
- err = H5Pset_fapl_core(fapl_id, (size_t)(64 * 1024), FALSE);
+ err = H5Pset_fapl_core(fapl_id, (size_t)(64 * 1024), FALSE);
VRFY((err >= 0), "setting core file driver in fapl.");
- err = H5Pset_file_image(fapl_id, image_ptr, (size_t)image_len);
+ err = H5Pset_file_image(fapl_id, image_ptr, (size_t)image_len);
VRFY((err >= 0), "set file image in fapl.");
file_id = H5Fopen(file_name, H5F_ACC_RDWR, fapl_id);
- H5Eprint2(H5P_DEFAULT, stderr);
+ H5Eprint2(H5P_DEFAULT, stderr);
VRFY((file_id >= 0), "opened received file image file");
- dset_id = H5Dopen2(file_id, "v", H5P_DEFAULT);
+ dset_id = H5Dopen2(file_id, "v", H5P_DEFAULT);
VRFY((dset_id >= 0), "opened data set");
- dset_type_id = H5Dget_type(dset_id);
+ dset_type_id = H5Dget_type(dset_id);
VRFY((dset_type_id >= 0), "obtained data set type");
- tri_result = H5Tequal(dset_type_id, H5T_NATIVE_INT);
+ tri_result = H5Tequal(dset_type_id, H5T_NATIVE_INT);
VRFY((tri_result == TRUE), "verified data set type");
- space_id = H5Dget_space(dset_id);
+ space_id = H5Dget_space(dset_id);
VRFY((space_id >= 0), "opened data space");
- space_ndims = H5Sget_simple_extent_ndims(space_id);
- VRFY((space_ndims == 1), "verified data space num dims(1)");
+ space_ndims = H5Sget_simple_extent_ndims(space_id);
+ VRFY((space_ndims == 1), "verified data space num dims(1)");
- space_ndims = H5Sget_simple_extent_dims(space_id, dims, NULL);
- VRFY((space_ndims == 1), "verified data space num dims(2)");
- VRFY((dims[0] == (hsize_t)mpi_size), "verified data space dims");
+ space_ndims = H5Sget_simple_extent_dims(space_id, dims, NULL);
+ VRFY((space_ndims == 1), "verified data space num dims(2)");
+ VRFY((dims[0] == (hsize_t)mpi_size), "verified data space dims");
- vector_ptr = (int *)HDmalloc((size_t)(mpi_size) * sizeof(int));
+ vector_ptr = (int *)HDmalloc((size_t)(mpi_size) * sizeof(int));
VRFY((vector_ptr != NULL), "allocated in memory rep of vector");
- err = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, (void *)vector_ptr);
+ err = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)vector_ptr);
VRFY((err >= 0), "read received vector.");
- vector_ok = TRUE;
- for(i = 0; i < mpi_size; i++){
- if(i < mpi_rank) {
- if(vector_ptr[i] != i)
+ vector_ok = TRUE;
+ for (i = 0; i < mpi_size; i++) {
+ if (i < mpi_rank) {
+ if (vector_ptr[i] != i)
vector_ok = FALSE;
- } else {
- if(vector_ptr[i] != -1)
+ }
+ else {
+ if (vector_ptr[i] != -1)
vector_ok = FALSE;
- }
+ }
}
VRFY((vector_ok), "verified received vector.");
-
- /* 3) Set v[i] = i in the core file. */
+ /* 3) Set v[i] = i in the core file. */
- vector_ptr[mpi_rank] = mpi_rank;
+ vector_ptr[mpi_rank] = mpi_rank;
- err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, (void *)vector_ptr);
+ err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)vector_ptr);
VRFY((err >= 0), "wrote modified data to vector.");
HDfree(vector_ptr);
vector_ptr = NULL;
-
- /* 4) Flush the core file and send it to process (mpi_rank + 1) % n. */
+ /* 4) Flush the core file and send it to process (mpi_rank + 1) % n. */
- err = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
+ err = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
VRFY((err >= 0), "flushed core file.");
image_len = H5Fget_file_image(file_id, NULL, (size_t)0);
@@ -359,38 +339,33 @@ file_image_daisy_chain_test(void)
bytes_read = H5Fget_file_image(file_id, image_ptr, (size_t)image_len);
VRFY(bytes_read == image_len, "wrote file into image buffer");
- mpi_result = MPI_Ssend((void *)(&image_len), (int)sizeof(ssize_t),
- MPI_BYTE, (mpi_rank + 1) % mpi_size, 0,
- MPI_COMM_WORLD);
- VRFY((mpi_result == MPI_SUCCESS), \
- "sent image size to process (mpi_rank + 1) % mpi_size");
+ mpi_result = MPI_Ssend((void *)(&image_len), (int)sizeof(ssize_t), MPI_BYTE,
+ (mpi_rank + 1) % mpi_size, 0, MPI_COMM_WORLD);
+ VRFY((mpi_result == MPI_SUCCESS), "sent image size to process (mpi_rank + 1) % mpi_size");
- mpi_result = MPI_Ssend((void *)image_ptr, (int)image_len,
- MPI_BYTE, (mpi_rank + 1) % mpi_size, 0,
+ mpi_result = MPI_Ssend((void *)image_ptr, (int)image_len, MPI_BYTE, (mpi_rank + 1) % mpi_size, 0,
MPI_COMM_WORLD);
- VRFY((mpi_result == MPI_SUCCESS), \
- "sent image to process (mpi_rank + 1) % mpi_size");
+ VRFY((mpi_result == MPI_SUCCESS), "sent image to process (mpi_rank + 1) % mpi_size");
HDfree(image_ptr);
image_ptr = NULL;
image_len = 0;
-
- /* 5) close the core file and exit. */
+
+ /* 5) close the core file and exit. */
err = H5Sclose(space_id);
- VRFY((err >= 0), "closed data space.");
+ VRFY((err >= 0), "closed data space.");
- err = H5Dclose(dset_id);
- VRFY((err >= 0), "closed data set.");
+ err = H5Dclose(dset_id);
+ VRFY((err >= 0), "closed data set.");
- err = H5Fclose(file_id);
- VRFY((err >= 0), "closed core file(1).");
+ err = H5Fclose(file_id);
+ VRFY((err >= 0), "closed core file(1).");
- err = H5Pclose(fapl_id);
- VRFY((err >= 0), "closed fapl(1).");
+ err = H5Pclose(fapl_id);
+ VRFY((err >= 0), "closed fapl(1).");
}
return;
} /* file_image_daisy_chain_test() */
-
diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c
index 1fa952d..ad25f1b 100644
--- a/testpar/t_filter_read.c
+++ b/testpar/t_filter_read.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -19,27 +19,25 @@
* Date: 2007/05/15
*/
-
#include "testphdf5.h"
#ifdef H5_HAVE_SZLIB_H
-# include "szlib.h"
+#include "szlib.h"
#endif
static int mpi_size, mpi_rank;
/* Chunk sizes */
-#define CHUNK_DIM1 7
-#define CHUNK_DIM2 27
+#define CHUNK_DIM1 7
+#define CHUNK_DIM2 27
/* Sizes of the vertical hyperslabs. Total dataset size is
{HS_DIM1, HS_DIM2 * mpi_size } */
-#define HS_DIM1 200
-#define HS_DIM2 100
+#define HS_DIM1 200
+#define HS_DIM2 100
-
/*-------------------------------------------------------------------------
- * Function: filter_read_internal
+ * Function: filter_read_internal
*
* Purpose: Tests parallel reading of a 2D dataset written serially using
* filters. During the parallel reading phase, the dataset is
@@ -51,28 +49,27 @@ static int mpi_size, mpi_rank;
*-------------------------------------------------------------------------
*/
static void
-filter_read_internal(const char *filename, hid_t dcpl,
- hsize_t *dset_size)
+filter_read_internal(const char *filename, hid_t dcpl, hsize_t *dset_size)
{
- hid_t file, dataset; /* HDF5 IDs */
- hid_t access_plist; /* Access property list ID */
- hid_t sid, memspace; /* Dataspace IDs */
- hsize_t size[2]; /* Dataspace dimensions */
- hsize_t hs_offset[2]; /* Hyperslab offset */
- hsize_t hs_size[2]; /* Hyperslab size */
- size_t i, j; /* Local index variables */
- char name[32] = "dataset";
- herr_t hrc; /* Error status */
- int *points = NULL; /* Writing buffer for entire dataset */
- int *check = NULL; /* Reading buffer for selected hyperslab */
+ hid_t file, dataset; /* HDF5 IDs */
+ hid_t access_plist; /* Access property list ID */
+ hid_t sid, memspace; /* Dataspace IDs */
+ hsize_t size[2]; /* Dataspace dimensions */
+ hsize_t hs_offset[2]; /* Hyperslab offset */
+ hsize_t hs_size[2]; /* Hyperslab size */
+ size_t i, j; /* Local index variables */
+ char name[32] = "dataset";
+ herr_t hrc; /* Error status */
+ int * points = NULL; /* Writing buffer for entire dataset */
+ int * check = NULL; /* Reading buffer for selected hyperslab */
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* set sizes for dataset and hyperslabs */
hs_size[0] = size[0] = HS_DIM1;
- hs_size[1] = HS_DIM2;
+ hs_size[1] = HS_DIM2;
size[1] = hs_size[1] * mpi_size;
@@ -81,50 +78,50 @@ filter_read_internal(const char *filename, hid_t dcpl,
/* Create the data space */
sid = H5Screate_simple(2, size, NULL);
- VRFY(sid>=0, "H5Screate_simple");
+ VRFY(sid >= 0, "H5Screate_simple");
/* Create buffers */
points = (int *)HDmalloc(size[0] * size[1] * sizeof(int));
- VRFY(points!=NULL, "HDmalloc");
+ VRFY(points != NULL, "HDmalloc");
check = (int *)HDmalloc(hs_size[0] * hs_size[1] * sizeof(int));
- VRFY(check!=NULL, "HDmalloc");
+ VRFY(check != NULL, "HDmalloc");
/* Initialize writing buffer with random data */
- for(i = 0; i < size[0]; i++)
- for(j = 0; j < size[1]; j++)
- points[i * size[1]+j] = (int)(i+j+7);
+ for (i = 0; i < size[0]; i++)
+ for (j = 0; j < size[1]; j++)
+ points[i * size[1] + j] = (int)(i + j + 7);
VRFY(H5Pall_filters_avail(dcpl), "Incorrect filter availability");
/* Serial write phase */
- if(MAINPROCESS) {
+ if (MAINPROCESS) {
file = H5Fcreate(h5_rmprefix(filename), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- VRFY(file>=0, "H5Fcreate");
+ VRFY(file >= 0, "H5Fcreate");
/* Create the dataset */
dataset = H5Dcreate2(file, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- VRFY(dataset>=0, "H5Dcreate2");
+ VRFY(dataset >= 0, "H5Dcreate2");
hrc = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points);
- VRFY(hrc>=0, "H5Dwrite");
+ VRFY(hrc >= 0, "H5Dwrite");
*dset_size = H5Dget_storage_size(dataset);
- VRFY(*dset_size>0, "H5Dget_storage_size");
+ VRFY(*dset_size > 0, "H5Dget_storage_size");
- hrc = H5Dclose (dataset);
- VRFY(hrc>=0, "H5Dclose");
+ hrc = H5Dclose(dataset);
+ VRFY(hrc >= 0, "H5Dclose");
- hrc = H5Fclose (file);
- VRFY(hrc>=0, "H5Fclose");
+ hrc = H5Fclose(file);
+ VRFY(hrc >= 0, "H5Fclose");
}
MPI_Barrier(MPI_COMM_WORLD);
/* Parallel read phase */
/* Set up MPIO file access property lists */
- access_plist = H5Pcreate(H5P_FILE_ACCESS);
+ access_plist = H5Pcreate(H5P_FILE_ACCESS);
VRFY((access_plist >= 0), "H5Pcreate");
hrc = H5Pset_fapl_mpio(access_plist, MPI_COMM_WORLD, MPI_INFO_NULL);
@@ -138,51 +135,48 @@ filter_read_internal(const char *filename, hid_t dcpl,
VRFY((dataset >= 0), "H5Dopen2");
hrc = H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL);
- VRFY(hrc>=0, "H5Sselect_hyperslab");
+ VRFY(hrc >= 0, "H5Sselect_hyperslab");
memspace = H5Screate_simple(2, hs_size, NULL);
- VRFY(memspace>=0, "H5Screate_simple");
+ VRFY(memspace >= 0, "H5Screate_simple");
- hrc = H5Dread (dataset, H5T_NATIVE_INT, memspace, sid, H5P_DEFAULT, check);
- VRFY(hrc>=0, "H5Dread");
+ hrc = H5Dread(dataset, H5T_NATIVE_INT, memspace, sid, H5P_DEFAULT, check);
+ VRFY(hrc >= 0, "H5Dread");
/* Check that the values read are the same as the values written */
- for (i=0; i<hs_size[0]; i++) {
- for (j=0; j<hs_size[1]; j++) {
- if(points[i*size[1]+(size_t)hs_offset[1]+j] !=
- check[i*hs_size[1]+j]) {
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n",
- (unsigned long)(i),
- (unsigned long)(hs_offset[1]+j));
- fprintf(stderr," At original: %d\n",
- (int)points[i*size[1]+(size_t)hs_offset[1]+j]);
- fprintf(stderr," At returned: %d\n",
- (int)check[i*hs_size[1]+j]);
- VRFY(FALSE, "");
- }
- }
+ for (i = 0; i < hs_size[0]; i++) {
+ for (j = 0; j < hs_size[1]; j++) {
+ if (points[i * size[1] + (size_t)hs_offset[1] + j] != check[i * hs_size[1] + j]) {
+ HDfprintf(stderr, " Read different values than written.\n");
+ HDfprintf(stderr, " At index %lu,%lu\n", (unsigned long)(i),
+ (unsigned long)(hs_offset[1] + j));
+ HDfprintf(stderr, " At original: %d\n",
+ (int)points[i * size[1] + (size_t)hs_offset[1] + j]);
+ HDfprintf(stderr, " At returned: %d\n", (int)check[i * hs_size[1] + j]);
+ VRFY(FALSE, "");
+ }
+ }
}
/* Get the storage size of the dataset */
- *dset_size=H5Dget_storage_size(dataset);
- VRFY(*dset_size!=0, "H5Dget_storage_size");
+ *dset_size = H5Dget_storage_size(dataset);
+ VRFY(*dset_size != 0, "H5Dget_storage_size");
/* Clean up objects used for this test */
- hrc = H5Dclose (dataset);
- VRFY(hrc>=0, "H5Dclose");
+ hrc = H5Dclose(dataset);
+ VRFY(hrc >= 0, "H5Dclose");
- hrc = H5Sclose (sid);
- VRFY(hrc>=0, "H5Sclose");
+ hrc = H5Sclose(sid);
+ VRFY(hrc >= 0, "H5Sclose");
- hrc = H5Sclose (memspace);
- VRFY(hrc>=0, "H5Sclose");
+ hrc = H5Sclose(memspace);
+ VRFY(hrc >= 0, "H5Sclose");
- hrc = H5Pclose (access_plist);
- VRFY(hrc>=0, "H5Pclose");
+ hrc = H5Pclose(access_plist);
+ VRFY(hrc >= 0, "H5Pclose");
- hrc = H5Fclose (file);
- VRFY(hrc>=0, "H5Fclose");
+ hrc = H5Fclose(file);
+ VRFY(hrc >= 0, "H5Fclose");
HDfree(points);
HDfree(check);
@@ -190,14 +184,13 @@ filter_read_internal(const char *filename, hid_t dcpl,
MPI_Barrier(MPI_COMM_WORLD);
}
-
/*-------------------------------------------------------------------------
* Function: test_filter_read
*
- * Purpose: Tests parallel reading of datasets written serially using
+ * Purpose: Tests parallel reading of datasets written serially using
* several (combinations of) filters.
*
- * Programmer: Christian Chilan
+ * Programmer: Christian Chilan
* Tuesday, May 15, 2007
*
* Modifications:
@@ -208,49 +201,49 @@ filter_read_internal(const char *filename, hid_t dcpl,
void
test_filter_read(void)
{
- hid_t dc; /* HDF5 IDs */
- const hsize_t chunk_size[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */
- hsize_t null_size; /* Size of dataset without filters */
- herr_t hrc;
- const char *filename;
- hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */
+ hid_t dc; /* HDF5 IDs */
+ const hsize_t chunk_size[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */
+ hsize_t null_size; /* Size of dataset without filters */
+ herr_t hrc;
+ const char * filename;
+ hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */
#ifdef H5_HAVE_FILTER_DEFLATE
- hsize_t deflate_size; /* Size of dataset with deflate filter */
-#endif /* H5_HAVE_FILTER_DEFLATE */
+ hsize_t deflate_size; /* Size of dataset with deflate filter */
+#endif /* H5_HAVE_FILTER_DEFLATE */
#ifdef H5_HAVE_FILTER_SZIP
- hsize_t szip_size; /* Size of dataset with szip filter */
- unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=4;
+ hsize_t szip_size; /* Size of dataset with szip filter */
+ unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 4;
#endif /* H5_HAVE_FILTER_SZIP */
- hsize_t shuffle_size; /* Size of dataset with shuffle filter */
+ hsize_t shuffle_size; /* Size of dataset with shuffle filter */
-#if(defined H5_HAVE_FILTER_DEFLATE || defined H5_HAVE_FILTER_SZIP)
- hsize_t combo_size; /* Size of dataset with multiple filters */
-#endif /* H5_HAVE_FILTER_DEFLATE || H5_HAVE_FILTER_SZIP */
+#if (defined H5_HAVE_FILTER_DEFLATE || defined H5_HAVE_FILTER_SZIP)
+ hsize_t combo_size; /* Size of dataset with multiple filters */
+#endif /* H5_HAVE_FILTER_DEFLATE || H5_HAVE_FILTER_SZIP */
filename = GetTestParameters();
- if(VERBOSE_MED)
- printf("Parallel reading of dataset written with filters %s\n", filename);
+ if (VERBOSE_MED)
+ HDprintf("Parallel reading of dataset written with filters %s\n", filename);
/*----------------------------------------------------------
* STEP 0: Test without filters.
*----------------------------------------------------------
*/
dc = H5Pcreate(H5P_DATASET_CREATE);
- VRFY(dc>=0,"H5Pcreate");
+ VRFY(dc >= 0, "H5Pcreate");
- hrc = H5Pset_chunk (dc, 2, chunk_size);
- VRFY(hrc>=0,"H5Pset_chunk");
+ hrc = H5Pset_chunk(dc, 2, chunk_size);
+ VRFY(hrc >= 0, "H5Pset_chunk");
- filter_read_internal(filename,dc,&null_size);
+ filter_read_internal(filename, dc, &null_size);
/* Clean up objects used for this test */
- hrc = H5Pclose (dc);
- VRFY(hrc>=0,"H5Pclose");
+ hrc = H5Pclose(dc);
+ VRFY(hrc >= 0, "H5Pclose");
/*----------------------------------------------------------
* STEP 1: Test Fletcher32 Checksum by itself.
@@ -258,21 +251,20 @@ test_filter_read(void)
*/
dc = H5Pcreate(H5P_DATASET_CREATE);
- VRFY(dc>=0,"H5Pset_filter");
+ VRFY(dc >= 0, "H5Pset_filter");
- hrc = H5Pset_chunk (dc, 2, chunk_size);
- VRFY(hrc>=0,"H5Pset_filter");
+ hrc = H5Pset_chunk(dc, 2, chunk_size);
+ VRFY(hrc >= 0, "H5Pset_filter");
- hrc = H5Pset_filter (dc,H5Z_FILTER_FLETCHER32,0,0,NULL);
- VRFY(hrc>=0,"H5Pset_filter");
+ hrc = H5Pset_filter(dc, H5Z_FILTER_FLETCHER32, 0, 0, NULL);
+ VRFY(hrc >= 0, "H5Pset_filter");
- filter_read_internal(filename,dc,&fletcher32_size);
- VRFY(fletcher32_size > null_size,"Size after checksumming is incorrect.");
+ filter_read_internal(filename, dc, &fletcher32_size);
+ VRFY(fletcher32_size > null_size, "Size after checksumming is incorrect.");
/* Clean up objects used for this test */
- hrc = H5Pclose (dc);
- VRFY(hrc>=0, "H5Pclose");
-
+ hrc = H5Pclose(dc);
+ VRFY(hrc >= 0, "H5Pclose");
/*----------------------------------------------------------
* STEP 2: Test deflation by itself.
@@ -281,68 +273,65 @@ test_filter_read(void)
#ifdef H5_HAVE_FILTER_DEFLATE
dc = H5Pcreate(H5P_DATASET_CREATE);
- VRFY(dc>=0, "H5Pcreate");
+ VRFY(dc >= 0, "H5Pcreate");
- hrc = H5Pset_chunk (dc, 2, chunk_size);
- VRFY(hrc>=0, "H5Pset_chunk");
+ hrc = H5Pset_chunk(dc, 2, chunk_size);
+ VRFY(hrc >= 0, "H5Pset_chunk");
- hrc = H5Pset_deflate (dc, 6);
- VRFY(hrc>=0, "H5Pset_deflate");
+ hrc = H5Pset_deflate(dc, 6);
+ VRFY(hrc >= 0, "H5Pset_deflate");
- filter_read_internal(filename,dc,&deflate_size);
+ filter_read_internal(filename, dc, &deflate_size);
/* Clean up objects used for this test */
- hrc = H5Pclose (dc);
- VRFY(hrc>=0, "H5Pclose");
+ hrc = H5Pclose(dc);
+ VRFY(hrc >= 0, "H5Pclose");
#endif /* H5_HAVE_FILTER_DEFLATE */
-
/*----------------------------------------------------------
* STEP 3: Test szip compression by itself.
*----------------------------------------------------------
*/
#ifdef H5_HAVE_FILTER_SZIP
- if(h5_szip_can_encode() == 1) {
+ if (h5_szip_can_encode() == 1) {
dc = H5Pcreate(H5P_DATASET_CREATE);
- VRFY(dc>=0, "H5Pcreate");
+ VRFY(dc >= 0, "H5Pcreate");
- hrc = H5Pset_chunk (dc, 2, chunk_size);
- VRFY(hrc>=0, "H5Pset_chunk");
+ hrc = H5Pset_chunk(dc, 2, chunk_size);
+ VRFY(hrc >= 0, "H5Pset_chunk");
- hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block);
- VRFY(hrc>=0, "H5Pset_szip");
+ hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block);
+ VRFY(hrc >= 0, "H5Pset_szip");
- filter_read_internal(filename,dc,&szip_size);
+ filter_read_internal(filename, dc, &szip_size);
/* Clean up objects used for this test */
- hrc = H5Pclose (dc);
- VRFY(hrc>=0, "H5Pclose");
+ hrc = H5Pclose(dc);
+ VRFY(hrc >= 0, "H5Pclose");
}
#endif /* H5_HAVE_FILTER_SZIP */
-
/*----------------------------------------------------------
* STEP 4: Test shuffling by itself.
*----------------------------------------------------------
*/
dc = H5Pcreate(H5P_DATASET_CREATE);
- VRFY(dc>=0, "H5Pcreate");
+ VRFY(dc >= 0, "H5Pcreate");
- hrc = H5Pset_chunk (dc, 2, chunk_size);
- VRFY(hrc>=0, "H5Pset_chunk");
+ hrc = H5Pset_chunk(dc, 2, chunk_size);
+ VRFY(hrc >= 0, "H5Pset_chunk");
- hrc = H5Pset_shuffle (dc);
- VRFY(hrc>=0, "H5Pset_shuffle");
+ hrc = H5Pset_shuffle(dc);
+ VRFY(hrc >= 0, "H5Pset_shuffle");
- filter_read_internal(filename,dc,&shuffle_size);
- VRFY(shuffle_size==null_size,"Shuffled size not the same as uncompressed size.");
+ filter_read_internal(filename, dc, &shuffle_size);
+ VRFY(shuffle_size == null_size, "Shuffled size not the same as uncompressed size.");
/* Clean up objects used for this test */
- hrc = H5Pclose (dc);
- VRFY(hrc>=0, "H5Pclose");
-
+ hrc = H5Pclose(dc);
+ VRFY(hrc >= 0, "H5Pclose");
/*----------------------------------------------------------
* STEP 5: Test shuffle + deflate + checksum in any order.
@@ -351,47 +340,47 @@ test_filter_read(void)
#ifdef H5_HAVE_FILTER_DEFLATE
/* Testing shuffle+deflate+checksum filters (checksum first) */
dc = H5Pcreate(H5P_DATASET_CREATE);
- VRFY(dc>=0, "H5Pcreate");
+ VRFY(dc >= 0, "H5Pcreate");
- hrc = H5Pset_chunk (dc, 2, chunk_size);
- VRFY(hrc>=0, "H5Pset_chunk");
+ hrc = H5Pset_chunk(dc, 2, chunk_size);
+ VRFY(hrc >= 0, "H5Pset_chunk");
- hrc = H5Pset_fletcher32 (dc);
- VRFY(hrc>=0, "H5Pset_fletcher32");
+ hrc = H5Pset_fletcher32(dc);
+ VRFY(hrc >= 0, "H5Pset_fletcher32");
- hrc = H5Pset_shuffle (dc);
- VRFY(hrc>=0, "H5Pset_shuffle");
+ hrc = H5Pset_shuffle(dc);
+ VRFY(hrc >= 0, "H5Pset_shuffle");
- hrc = H5Pset_deflate (dc, 6);
- VRFY(hrc>=0, "H5Pset_deflate");
+ hrc = H5Pset_deflate(dc, 6);
+ VRFY(hrc >= 0, "H5Pset_deflate");
- filter_read_internal(filename,dc,&combo_size);
+ filter_read_internal(filename, dc, &combo_size);
/* Clean up objects used for this test */
- hrc = H5Pclose (dc);
- VRFY(hrc>=0, "H5Pclose");
+ hrc = H5Pclose(dc);
+ VRFY(hrc >= 0, "H5Pclose");
/* Testing shuffle+deflate+checksum filters (checksum last) */
dc = H5Pcreate(H5P_DATASET_CREATE);
- VRFY(dc>=0, "H5Pcreate");
+ VRFY(dc >= 0, "H5Pcreate");
- hrc = H5Pset_chunk (dc, 2, chunk_size);
- VRFY(hrc>=0, "H5Pset_chunk");
+ hrc = H5Pset_chunk(dc, 2, chunk_size);
+ VRFY(hrc >= 0, "H5Pset_chunk");
- hrc = H5Pset_shuffle (dc);
- VRFY(hrc>=0, "H5Pset_shuffle");
+ hrc = H5Pset_shuffle(dc);
+ VRFY(hrc >= 0, "H5Pset_shuffle");
- hrc = H5Pset_deflate (dc, 6);
- VRFY(hrc>=0, "H5Pset_deflate");
+ hrc = H5Pset_deflate(dc, 6);
+ VRFY(hrc >= 0, "H5Pset_deflate");
- hrc = H5Pset_fletcher32 (dc);
- VRFY(hrc>=0, "H5Pset_fletcher32");
+ hrc = H5Pset_fletcher32(dc);
+ VRFY(hrc >= 0, "H5Pset_fletcher32");
- filter_read_internal(filename,dc,&combo_size);
+ filter_read_internal(filename, dc, &combo_size);
/* Clean up objects used for this test */
- hrc = H5Pclose (dc);
- VRFY(hrc>=0, "H5Pclose");
+ hrc = H5Pclose(dc);
+ VRFY(hrc >= 0, "H5Pclose");
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -403,54 +392,53 @@ test_filter_read(void)
/* Testing shuffle+szip(with encoder)+checksum filters(checksum first) */
dc = H5Pcreate(H5P_DATASET_CREATE);
- VRFY(dc>=0, "H5Pcreate");
+ VRFY(dc >= 0, "H5Pcreate");
- hrc = H5Pset_chunk (dc, 2, chunk_size);
- VRFY(hrc>=0, "H5Pset_chunk");
+ hrc = H5Pset_chunk(dc, 2, chunk_size);
+ VRFY(hrc >= 0, "H5Pset_chunk");
- hrc = H5Pset_fletcher32 (dc);
- VRFY(hrc>=0, "H5Pset_fletcher32");
+ hrc = H5Pset_fletcher32(dc);
+ VRFY(hrc >= 0, "H5Pset_fletcher32");
- hrc = H5Pset_shuffle (dc);
- VRFY(hrc>=0, "H5Pset_shuffle");
+ hrc = H5Pset_shuffle(dc);
+ VRFY(hrc >= 0, "H5Pset_shuffle");
/* Make sure encoding is enabled */
- if(h5_szip_can_encode() == 1) {
- hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block);
- VRFY(hrc>=0, "H5Pset_szip");
+ if (h5_szip_can_encode() == 1) {
+ hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block);
+ VRFY(hrc >= 0, "H5Pset_szip");
- filter_read_internal(filename,dc,&combo_size);
+ filter_read_internal(filename, dc, &combo_size);
}
/* Clean up objects used for this test */
- hrc = H5Pclose (dc);
- VRFY(hrc>=0, "H5Pclose");
+ hrc = H5Pclose(dc);
+ VRFY(hrc >= 0, "H5Pclose");
/* Testing shuffle+szip(with encoder)+checksum filters(checksum last) */
/* Make sure encoding is enabled */
- if(h5_szip_can_encode() == 1) {
- dc = H5Pcreate(H5P_DATASET_CREATE);
- VRFY(dc>=0, "H5Pcreate");
+ if (h5_szip_can_encode() == 1) {
+ dc = H5Pcreate(H5P_DATASET_CREATE);
+ VRFY(dc >= 0, "H5Pcreate");
- hrc = H5Pset_chunk (dc, 2, chunk_size);
- VRFY(hrc>=0, "H5Pset_chunk");
+ hrc = H5Pset_chunk(dc, 2, chunk_size);
+ VRFY(hrc >= 0, "H5Pset_chunk");
- hrc = H5Pset_shuffle (dc);
- VRFY(hrc>=0, "H5Pset_shuffle");
+ hrc = H5Pset_shuffle(dc);
+ VRFY(hrc >= 0, "H5Pset_shuffle");
- hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block);
- VRFY(hrc>=0, "H5Pset_szip");
+ hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block);
+ VRFY(hrc >= 0, "H5Pset_szip");
- hrc = H5Pset_fletcher32 (dc);
- VRFY(hrc>=0, "H5Pset_fletcher32");
+ hrc = H5Pset_fletcher32(dc);
+ VRFY(hrc >= 0, "H5Pset_fletcher32");
- filter_read_internal(filename,dc,&combo_size);
+ filter_read_internal(filename, dc, &combo_size);
- /* Clean up objects used for this test */
- hrc = H5Pclose (dc);
- VRFY(hrc>=0, "H5Pclose");
+ /* Clean up objects used for this test */
+ hrc = H5Pclose(dc);
+ VRFY(hrc >= 0, "H5Pclose");
}
#endif /* H5_HAVE_FILTER_SZIP */
}
-
diff --git a/testpar/t_init_term.c b/testpar/t_init_term.c
index 933fbd2..5fc3074 100644
--- a/testpar/t_init_term.c
+++ b/testpar/t_init_term.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,26 +21,23 @@
#include "testphdf5.h"
-int nerrors = 0; /* errors count */
+int nerrors = 0; /* errors count */
-const char *FILENAME[] = {
- "after_mpi_fin",
- NULL
-};
+const char *FILENAME[] = {"after_mpi_fin", NULL};
int
-main (int argc, char **argv)
+main(int argc, char **argv)
{
- int mpi_size, mpi_rank;
- MPI_Comm comm = MPI_COMM_WORLD;
+ int mpi_size, mpi_rank;
+ MPI_Comm comm = MPI_COMM_WORLD;
/* Initialize and finalize MPI */
MPI_Init(&argc, &argv);
MPI_Comm_size(comm, &mpi_size);
- MPI_Comm_rank(comm, &mpi_rank);
+ MPI_Comm_rank(comm, &mpi_rank);
- if(MAINPROCESS)
- TESTING("Usage of Serial HDF5 after MPI_Finalize() is called");
+ if (MAINPROCESS)
+ TESTING("Usage of Serial HDF5 after MPI_Finalize() is called");
MPI_Finalize();
@@ -50,9 +47,9 @@ main (int argc, char **argv)
and create a file serially */
H5open();
- if(mpi_rank == 0) {
- char filename[1024];
- hid_t file_id;
+ if (mpi_rank == 0) {
+ char filename[1024];
+ hid_t file_id;
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -63,12 +60,12 @@ main (int argc, char **argv)
H5close();
- if(MAINPROCESS) {
- if(0 == nerrors)
+ if (MAINPROCESS) {
+ if (0 == nerrors)
PASSED()
else
- H5_FAILED()
+ H5_FAILED()
}
- return (nerrors!=0);
+ return (nerrors != 0);
}
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index 81461f3..6e0e64e 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -6,21 +6,21 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "testphdf5.h"
+#include "H5Dprivate.h"
-#define DIM 2
-#define SIZE 32
-#define NDATASET 4
+#define DIM 2
+#define SIZE 32
+#define NDATASET 4
#define GROUP_DEPTH 128
enum obj_type { is_group, is_dset };
-
-static int get_size(void);
+static int get_size(void);
static void write_dataset(hid_t, hid_t, hid_t);
static int read_dataset(hid_t, hid_t, hid_t);
static void create_group_recursive(hid_t, hid_t, hid_t, int);
@@ -31,7 +31,6 @@ static int read_attribute(hid_t, int, int);
static int check_value(DATATYPE *, DATATYPE *, int);
static void get_slab(hsize_t[], hsize_t[], hsize_t[], hsize_t[], int);
-
/*
* The size value computed by this function is used extensively in
* configuring tests for the current number of processes.
@@ -52,14 +51,11 @@ get_size(void)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); /* needed for VRFY */
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
- if(mpi_size > size ) {
-
- if((mpi_size % 2) == 0 ) {
-
+ if (mpi_size > size) {
+ if ((mpi_size % 2) == 0) {
size = mpi_size;
-
- } else {
-
+ }
+ else {
size = mpi_size + 1;
}
}
@@ -67,7 +63,7 @@ get_size(void)
VRFY((mpi_size <= size), "mpi_size <= size");
VRFY(((size % 2) == 0), "size isn't even");
- return(size);
+ return (size);
} /* get_size() */
@@ -75,14 +71,15 @@ get_size(void)
* Example of using PHDF5 to create a zero sized dataset.
*
*/
-void zero_dim_dset(void)
+void
+zero_dim_dset(void)
{
- int mpi_size, mpi_rank;
- const char *filename;
- hid_t fid, plist, dcpl, dsid, sid;
- hsize_t dim, chunk_dim;
- herr_t ret;
- int data[1];
+ int mpi_size, mpi_rank;
+ const char *filename;
+ hid_t fid, plist, dcpl, dsid, sid;
+ hsize_t dim, chunk_dim;
+ herr_t ret;
+ int data[1];
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
@@ -90,37 +87,37 @@ void zero_dim_dset(void)
filename = GetTestParameters();
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- VRFY((plist>=0), "create_faccess_plist succeeded");
+ VRFY((plist >= 0), "create_faccess_plist succeeded");
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
- VRFY((fid>=0), "H5Fcreate succeeded");
+ VRFY((fid >= 0), "H5Fcreate succeeded");
ret = H5Pclose(plist);
- VRFY((ret>=0), "H5Pclose succeeded");
+ VRFY((ret >= 0), "H5Pclose succeeded");
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- VRFY((dcpl>=0), "failed H5Pcreate");
+ VRFY((dcpl >= 0), "failed H5Pcreate");
/* Set 1 chunk size */
chunk_dim = 1;
- ret = H5Pset_chunk(dcpl, 1, &chunk_dim);
- VRFY((ret>=0), "failed H5Pset_chunk");
+ ret = H5Pset_chunk(dcpl, 1, &chunk_dim);
+ VRFY((ret >= 0), "failed H5Pset_chunk");
/* Create 1D dataspace with 0 dim size */
dim = 0;
sid = H5Screate_simple(1, &dim, NULL);
- VRFY((sid>=0), "failed H5Screate_simple");
+ VRFY((sid >= 0), "failed H5Screate_simple");
/* Create chunked dataset */
dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- VRFY((dsid>=0), "failed H5Dcreate2");
+ VRFY((dsid >= 0), "failed H5Dcreate2");
/* write 0 elements from dataset */
ret = H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data);
- VRFY((ret>=0), "failed H5Dwrite");
+ VRFY((ret >= 0), "failed H5Dwrite");
/* Read 0 elements from dataset */
ret = H5Dread(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data);
- VRFY((ret>=0), "failed H5Dread");
+ VRFY((ret >= 0), "failed H5Dread");
H5Pclose(dcpl);
H5Dclose(dsid);
@@ -132,30 +129,31 @@ void zero_dim_dset(void)
* Example of using PHDF5 to create ndatasets datasets. Each process write
* a slab of array to the file.
*
- * Changes: Updated function to use a dynamically calculated size,
- * instead of the old SIZE #define. This should allow it
- * to function with an arbitrary number of processors.
+ * Changes: Updated function to use a dynamically calculated size,
+ * instead of the old SIZE #define. This should allow it
+ * to function with an arbitrary number of processors.
*
- * JRM - 8/11/04
+ * JRM - 8/11/04
*/
-void multiple_dset_write(void)
+void
+multiple_dset_write(void)
{
- int i, j, n, mpi_size, mpi_rank, size;
- hid_t iof, plist, dataset, memspace, filespace;
- hid_t dcpl; /* Dataset creation property list */
- hsize_t chunk_origin [DIM];
- hsize_t chunk_dims [DIM], file_dims [DIM];
- hsize_t count[DIM]={1,1};
- double * outme = NULL;
- double fill=1.0; /* Fill value */
- char dname [100];
- herr_t ret;
+ int i, j, n, mpi_size, mpi_rank, size;
+ hid_t iof, plist, dataset, memspace, filespace;
+ hid_t dcpl; /* Dataset creation property list */
+ hsize_t chunk_origin[DIM];
+ hsize_t chunk_dims[DIM], file_dims[DIM];
+ hsize_t count[DIM] = {1, 1};
+ double * outme = NULL;
+ double fill = 1.0; /* Fill value */
+ char dname[100];
+ herr_t ret;
const H5Ptest_param_t *pt;
- char *filename;
- int ndatasets;
+ char * filename;
+ int ndatasets;
- pt = GetTestParameters();
- filename = pt->name;
+ pt = GetTestParameters();
+ filename = pt->name;
ndatasets = pt->count;
size = get_size();
@@ -167,45 +165,45 @@ void multiple_dset_write(void)
VRFY((outme != NULL), "HDmalloc succeeded for outme");
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- VRFY((plist>=0), "create_faccess_plist succeeded");
+ VRFY((plist >= 0), "create_faccess_plist succeeded");
iof = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
- VRFY((iof>=0), "H5Fcreate succeeded");
+ VRFY((iof >= 0), "H5Fcreate succeeded");
ret = H5Pclose(plist);
- VRFY((ret>=0), "H5Pclose succeeded");
+ VRFY((ret >= 0), "H5Pclose succeeded");
/* decide the hyperslab according to process number. */
get_slab(chunk_origin, chunk_dims, count, file_dims, size);
- memspace = H5Screate_simple(DIM, chunk_dims, NULL);
+ memspace = H5Screate_simple(DIM, chunk_dims, NULL);
filespace = H5Screate_simple(DIM, file_dims, NULL);
- ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
- VRFY((ret>=0), "mdata hyperslab selection");
+ ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
+ VRFY((ret >= 0), "mdata hyperslab selection");
/* Create a dataset creation property list */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- VRFY((dcpl>=0), "dataset creation property list succeeded");
+ VRFY((dcpl >= 0), "dataset creation property list succeeded");
ret = H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill);
- VRFY((ret>=0), "set fill-value succeeded");
+ VRFY((ret >= 0), "set fill-value succeeded");
- for(n = 0; n < ndatasets; n++) {
- sprintf(dname, "dataset %d", n);
- dataset = H5Dcreate2(iof, dname, H5T_NATIVE_DOUBLE, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
- VRFY((dataset > 0), dname);
+ for (n = 0; n < ndatasets; n++) {
+ HDsprintf(dname, "dataset %d", n);
+ dataset = H5Dcreate2(iof, dname, H5T_NATIVE_DOUBLE, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ VRFY((dataset > 0), dname);
- /* calculate data to write */
- for(i = 0; i < size; i++)
- for(j = 0; j < size; j++)
- outme [(i * size) + j] = n*1000 + mpi_rank;
+ /* calculate data to write */
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++)
+ outme[(i * size) + j] = n * 1000 + mpi_rank;
- H5Dwrite(dataset, H5T_NATIVE_DOUBLE, memspace, filespace, H5P_DEFAULT, outme);
+ H5Dwrite(dataset, H5T_NATIVE_DOUBLE, memspace, filespace, H5P_DEFAULT, outme);
- H5Dclose(dataset);
+ H5Dclose(dataset);
#ifdef BARRIER_CHECKS
- if(!((n+1) % 10)) {
- printf("created %d datasets\n", n+1);
- MPI_Barrier(MPI_COMM_WORLD);
- }
+ if (!((n + 1) % 10)) {
+ HDprintf("created %d datasets\n", n + 1);
+ MPI_Barrier(MPI_COMM_WORLD);
+ }
#endif /* BARRIER_CHECKS */
}
@@ -217,29 +215,29 @@ void multiple_dset_write(void)
HDfree(outme);
}
-
/* Example of using PHDF5 to create, write, and read compact dataset.
*
- * Changes: Updated function to use a dynamically calculated size,
- * instead of the old SIZE #define. This should allow it
- * to function with an arbitrary number of processors.
+ * Changes: Updated function to use a dynamically calculated size,
+ * instead of the old SIZE #define. This should allow it
+ * to function with an arbitrary number of processors.
*
- * JRM - 8/11/04
+ * JRM - 8/11/04
*/
-void compact_dataset(void)
+void
+compact_dataset(void)
{
- int i, j, mpi_size, mpi_rank, size, err_num=0;
- hid_t iof, plist, dcpl, dxpl, dataset, filespace;
- hsize_t file_dims [DIM];
- double * outme;
- double * inme;
- char dname[]="dataset";
- herr_t ret;
+ int i, j, mpi_size, mpi_rank, size, err_num = 0;
+ hid_t iof, plist, dcpl, dxpl, dataset, filespace;
+ hsize_t file_dims[DIM];
+ double * outme;
+ double * inme;
+ char dname[] = "dataset";
+ herr_t ret;
const char *filename;
size = get_size();
- for(i = 0; i < DIM; i++ )
+ for (i = 0; i < DIM; i++)
file_dims[i] = size;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -255,14 +253,14 @@ void compact_dataset(void)
VRFY((mpi_size <= size), "mpi_size <= size");
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- iof = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
+ iof = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
/* Define data space */
filespace = H5Screate_simple(DIM, file_dims, NULL);
/* Create a compact dataset */
dcpl = H5Pcreate(H5P_DATASET_CREATE);
- VRFY((dcpl>=0), "dataset creation property list succeeded");
+ VRFY((dcpl >= 0), "dataset creation property list succeeded");
ret = H5Pset_layout(dcpl, H5D_COMPACT);
VRFY((dcpl >= 0), "set property list for compact dataset");
ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
@@ -276,16 +274,15 @@ void compact_dataset(void)
VRFY((dxpl >= 0), "");
ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* Recalculate data to write. Each process writes the same data. */
- for(i = 0; i < size; i++)
- for(j = 0; j < size; j++)
- outme[(i * size) + j] =(i + j) * 1000;
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++)
+ outme[(i * size) + j] = (i + j) * 1000;
ret = H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, dxpl, outme);
VRFY((ret >= 0), "H5Dwrite succeeded");
@@ -298,7 +295,7 @@ void compact_dataset(void)
/* Open the file and dataset, read and compare the data. */
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- iof = H5Fopen(filename, H5F_ACC_RDONLY, plist);
+ iof = H5Fopen(filename, H5F_ACC_RDONLY, plist);
VRFY((iof >= 0), "H5Fopen succeeded");
/* set up the collective transfer properties list */
@@ -306,12 +303,11 @@ void compact_dataset(void)
VRFY((dxpl >= 0), "");
ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(dxpl,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
dataset = H5Dopen2(iof, dname, H5P_DEFAULT);
VRFY((dataset >= 0), "H5Dopen2 succeeded");
@@ -319,11 +315,12 @@ void compact_dataset(void)
VRFY((ret >= 0), "H5Dread succeeded");
/* Verify data value */
- for(i = 0; i < size; i++)
- for(j = 0; j < size; j++)
- if(inme[(i * size) + j] != outme[(i * size) + j])
- if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
- printf("Dataset Verify failed at [%d][%d]: expect %f, got %f\n", i, j, outme[(i * size) + j], inme[(i * size) + j]);
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++)
+ if (inme[(i * size) + j] != outme[(i * size) + j])
+ if (err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
+ HDprintf("Dataset Verify failed at [%d][%d]: expect %f, got %f\n", i, j,
+ outme[(i * size) + j], inme[(i * size) + j]);
H5Pclose(plist);
H5Pclose(dxpl);
@@ -337,24 +334,25 @@ void compact_dataset(void)
* Example of using PHDF5 to create, write, and read dataset and attribute
* of Null dataspace.
*
- * Changes: Removed the assert that mpi_size <= the SIZE #define.
- * As best I can tell, this assert isn't needed here,
- * and in any case, the SIZE #define is being removed
- * in an update of the functions in this file to run
- * with an arbitrary number of processes.
+ * Changes: Removed the assert that mpi_size <= the SIZE #define.
+ * As best I can tell, this assert isn't needed here,
+ * and in any case, the SIZE #define is being removed
+ * in an update of the functions in this file to run
+ * with an arbitrary number of processes.
*
* JRM - 8/24/04
*/
-void null_dataset(void)
+void
+null_dataset(void)
{
- int mpi_size, mpi_rank;
- hid_t iof, plist, dxpl, dataset, attr, sid;
- unsigned uval=2; /* Buffer for writing to dataset */
- int val=1; /* Buffer for writing to attribute */
- int nelem;
- char dname[]="dataset";
- char attr_name[]="attribute";
- herr_t ret;
+ int mpi_size, mpi_rank;
+ hid_t iof, plist, dxpl, dataset, attr, sid;
+ unsigned uval = 2; /* Buffer for writing to dataset */
+ int val = 1; /* Buffer for writing to attribute */
+ int nelem;
+ char dname[] = "dataset";
+ char attr_name[] = "attribute";
+ herr_t ret;
const char *filename;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -363,7 +361,7 @@ void null_dataset(void)
filename = GetTestParameters();
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- iof = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
+ iof = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
/* Define data space */
sid = H5Screate(H5S_NULL);
@@ -381,12 +379,11 @@ void null_dataset(void)
VRFY((dxpl >= 0), "");
ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* Write "nothing" to the dataset(with type conversion) */
ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, &uval);
VRFY((ret >= 0), "H5Dwrite succeeded");
@@ -407,7 +404,7 @@ void null_dataset(void)
/* Open the file and dataset, read and compare the data. */
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- iof = H5Fopen(filename, H5F_ACC_RDONLY, plist);
+ iof = H5Fopen(filename, H5F_ACC_RDONLY, plist);
VRFY((iof >= 0), "H5Fopen succeeded");
/* set up the collective transfer properties list */
@@ -415,27 +412,27 @@ void null_dataset(void)
VRFY((dxpl >= 0), "");
ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pcreate xfer succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(dxpl,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
dataset = H5Dopen2(iof, dname, H5P_DEFAULT);
VRFY((dataset >= 0), "H5Dopen2 succeeded");
/* Try reading from the dataset(make certain our buffer is unmodified) */
ret = H5Dread(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, dxpl, &uval);
- VRFY((ret>=0), "H5Dread");
- VRFY((uval==2), "H5Dread");
+ VRFY((ret >= 0), "H5Dread");
+ VRFY((uval == 2), "H5Dread");
/* Open the attribute for the dataset */
attr = H5Aopen(dataset, attr_name, H5P_DEFAULT);
VRFY((attr >= 0), "H5Aopen");
- /* Try reading from the attribute(make certain our buffer is unmodified) */ ret = H5Aread(attr, H5T_NATIVE_INT, &val);
- VRFY((ret>=0), "H5Aread");
- VRFY((val==1), "H5Aread");
+ /* Try reading from the attribute(make certain our buffer is unmodified) */ ret =
+ H5Aread(attr, H5T_NATIVE_INT, &val);
+ VRFY((ret >= 0), "H5Aread");
+ VRFY((val == 1), "H5Aread");
H5Pclose(plist);
H5Pclose(dxpl);
@@ -449,25 +446,26 @@ void null_dataset(void)
* sizes(2GB, 4GB, etc.), but the metadata for the file pushes the file over
* the boundary of interest.
*
- * Changes: Removed the assert that mpi_size <= the SIZE #define.
- * As best I can tell, this assert isn't needed here,
- * and in any case, the SIZE #define is being removed
- * in an update of the functions in this file to run
- * with an arbitrary number of processes.
+ * Changes: Removed the assert that mpi_size <= the SIZE #define.
+ * As best I can tell, this assert isn't needed here,
+ * and in any case, the SIZE #define is being removed
+ * in an update of the functions in this file to run
+ * with an arbitrary number of processes.
*
* JRM - 8/11/04
*/
-void big_dataset(void)
+void
+big_dataset(void)
{
- int mpi_size, mpi_rank; /* MPI info */
- hid_t iof, /* File ID */
- fapl, /* File access property list ID */
- dataset, /* Dataset ID */
- filespace; /* Dataset's dataspace ID */
- hsize_t file_dims [4]; /* Dimensions of dataspace */
- char dname[]="dataset"; /* Name of dataset */
- MPI_Offset file_size; /* Size of file on disk */
- herr_t ret; /* Generic return value */
+ int mpi_size, mpi_rank; /* MPI info */
+ hid_t iof, /* File ID */
+ fapl, /* File access property list ID */
+ dataset, /* Dataset ID */
+ filespace; /* Dataset's dataspace ID */
+ hsize_t file_dims[4]; /* Dimensions of dataspace */
+ char dname[] = "dataset"; /* Name of dataset */
+ MPI_Offset file_size; /* Size of file on disk */
+ herr_t ret; /* Generic return value */
const char *filename;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -488,11 +486,11 @@ void big_dataset(void)
VRFY((iof >= 0), "H5Fcreate succeeded");
/* Define dataspace for 2GB dataspace */
- file_dims[0]= 2;
- file_dims[1]= 1024;
- file_dims[2]= 1024;
- file_dims[3]= 1024;
- filespace = H5Screate_simple(4, file_dims, NULL);
+ file_dims[0] = 2;
+ file_dims[1] = 1024;
+ file_dims[2] = 1024;
+ file_dims[3] = 1024;
+ filespace = H5Screate_simple(4, file_dims, NULL);
VRFY((filespace >= 0), "H5Screate_simple succeeded");
dataset = H5Dcreate2(iof, dname, H5T_NATIVE_UCHAR, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -517,11 +515,11 @@ void big_dataset(void)
VRFY((iof >= 0), "H5Fcreate succeeded");
/* Define dataspace for 4GB dataspace */
- file_dims[0]= 4;
- file_dims[1]= 1024;
- file_dims[2]= 1024;
- file_dims[3]= 1024;
- filespace = H5Screate_simple(4, file_dims, NULL);
+ file_dims[0] = 4;
+ file_dims[1] = 1024;
+ file_dims[2] = 1024;
+ file_dims[3] = 1024;
+ filespace = H5Screate_simple(4, file_dims, NULL);
VRFY((filespace >= 0), "H5Screate_simple succeeded");
dataset = H5Dcreate2(iof, dname, H5T_NATIVE_UCHAR, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -546,11 +544,11 @@ void big_dataset(void)
VRFY((iof >= 0), "H5Fcreate succeeded");
/* Define dataspace for 8GB dataspace */
- file_dims[0]= 8;
- file_dims[1]= 1024;
- file_dims[2]= 1024;
- file_dims[3]= 1024;
- filespace = H5Screate_simple(4, file_dims, NULL);
+ file_dims[0] = 8;
+ file_dims[1] = 1024;
+ file_dims[2] = 1024;
+ file_dims[3] = 1024;
+ filespace = H5Screate_simple(4, file_dims, NULL);
VRFY((filespace >= 0), "H5Screate_simple succeeded");
dataset = H5Dcreate2(iof, dname, H5T_NATIVE_UCHAR, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -577,35 +575,36 @@ void big_dataset(void)
* not have actual data written to the entire raw data area and relies on the
* default fill value of zeros to work correctly.
*
- * Changes: Removed the assert that mpi_size <= the SIZE #define.
- * As best I can tell, this assert isn't needed here,
- * and in any case, the SIZE #define is being removed
- * in an update of the functions in this file to run
- * with an arbitrary number of processes.
+ * Changes: Removed the assert that mpi_size <= the SIZE #define.
+ * As best I can tell, this assert isn't needed here,
+ * and in any case, the SIZE #define is being removed
+ * in an update of the functions in this file to run
+ * with an arbitrary number of processes.
*
- * Also added code to free dynamically allocated buffers.
+ * Also added code to free dynamically allocated buffers.
*
* JRM - 8/11/04
*/
-void dataset_fillvalue(void)
+void
+dataset_fillvalue(void)
{
- int mpi_size, mpi_rank; /* MPI info */
- int err_num; /* Number of errors */
- hid_t iof, /* File ID */
- fapl, /* File access property list ID */
- dxpl, /* Data transfer property list ID */
- dataset, /* Dataset ID */
- memspace, /* Memory dataspace ID */
- filespace; /* Dataset's dataspace ID */
- char dname[]="dataset"; /* Name of dataset */
+ int mpi_size, mpi_rank; /* MPI info */
+ int err_num; /* Number of errors */
+ hid_t iof, /* File ID */
+ fapl, /* File access property list ID */
+ dxpl, /* Data transfer property list ID */
+ dataset, /* Dataset ID */
+ memspace, /* Memory dataspace ID */
+ filespace; /* Dataset's dataspace ID */
+ char dname[] = "dataset"; /* Name of dataset */
hsize_t dset_dims[4] = {0, 6, 7, 8};
hsize_t req_start[4] = {0, 0, 0, 0};
hsize_t req_count[4] = {1, 6, 7, 8};
- hsize_t dset_size; /* Dataset size */
- int *rdata, *wdata; /* Buffers for data to read and write */
- int *twdata, *trdata; /* Temporary pointer into buffer */
- int acc, i, j, k, l; /* Local index variables */
- herr_t ret; /* Generic return value */
+ hsize_t dset_size; /* Dataset size */
+ int * rdata, *wdata; /* Buffers for data to read and write */
+ int * twdata, *trdata; /* Temporary pointer into buffer */
+ int acc, i, j, k, l; /* Local index variables */
+ herr_t ret; /* Generic return value */
const char *filename;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -615,13 +614,13 @@ void dataset_fillvalue(void)
/* Set the dataset dimension to be one row more than number of processes */
/* and calculate the actual dataset size. */
- dset_dims[0]=mpi_size+1;
- dset_size=dset_dims[0]*dset_dims[1]*dset_dims[2]*dset_dims[3];
+ dset_dims[0] = mpi_size + 1;
+ dset_size = dset_dims[0] * dset_dims[1] * dset_dims[2] * dset_dims[3];
/* Allocate space for the buffers */
- rdata=HDmalloc((size_t)(dset_size*sizeof(int)));
+ rdata = HDmalloc((size_t)(dset_size * sizeof(int)));
VRFY((rdata != NULL), "HDcalloc succeeded for read buffer");
- wdata=HDmalloc((size_t)(dset_size*sizeof(int)));
+ wdata = HDmalloc((size_t)(dset_size * sizeof(int)));
VRFY((wdata != NULL), "HDmalloc succeeded for write buffer");
fapl = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
@@ -646,26 +645,28 @@ void dataset_fillvalue(void)
* Read dataset before any data is written.
*/
/* set entire read buffer with the constant 2 */
- HDmemset(rdata,2,(size_t)(dset_size*sizeof(int)));
+ HDmemset(rdata, 2, (size_t)(dset_size * sizeof(int)));
+
/* Independently read the entire dataset back */
ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
VRFY((ret >= 0), "H5Dread succeeded");
/* Verify all data read are the fill value 0 */
- trdata = rdata;
+ trdata = rdata;
err_num = 0;
- for(i = 0; i < (int)dset_dims[0]; i++)
- for(j = 0; j < (int)dset_dims[1]; j++)
- for(k = 0; k < (int)dset_dims[2]; k++)
- for(l = 0; l < (int)dset_dims[3]; l++, twdata++, trdata++)
- if(*trdata != 0)
- if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
- printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i, j, k, l, *trdata);
- if(err_num > MAX_ERR_REPORT && !VERBOSE_MED)
- printf("[more errors ...]\n");
- if(err_num){
- printf("%d errors found in check_value\n", err_num);
- nerrors++;
+ for (i = 0; i < (int)dset_dims[0]; i++)
+ for (j = 0; j < (int)dset_dims[1]; j++)
+ for (k = 0; k < (int)dset_dims[2]; k++)
+ for (l = 0; l < (int)dset_dims[3]; l++, twdata++, trdata++)
+ if (*trdata != 0)
+ if (err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
+ HDprintf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i, j, k,
+ l, *trdata);
+ if (err_num > MAX_ERR_REPORT && !VERBOSE_MED)
+ HDprintf("[more errors ...]\n");
+ if (err_num) {
+ HDprintf("%d errors found in check_value\n", err_num);
+ nerrors++;
}
/* Barrier to ensure all processes have completed the above test. */
@@ -675,8 +676,8 @@ void dataset_fillvalue(void)
* Each process writes 1 row of data. Thus last row is not written.
*/
/* Create hyperslabs in memory and file dataspaces */
- req_start[0]=mpi_rank;
- ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, req_start, NULL, req_count, NULL);
+ req_start[0] = mpi_rank;
+ ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, req_start, NULL, req_count, NULL);
VRFY((ret >= 0), "H5Sselect_hyperslab succeeded on memory dataspace");
ret = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, req_start, NULL, req_count, NULL);
VRFY((ret >= 0), "H5Sselect_hyperslab succeeded on memory dataspace");
@@ -687,18 +688,17 @@ void dataset_fillvalue(void)
ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(dxpl,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
}
-
/* Fill write buffer with some values */
- twdata=wdata;
- for(i=0, acc=0; i<(int)dset_dims[0]; i++)
- for(j=0; j<(int)dset_dims[1]; j++)
- for(k=0; k<(int)dset_dims[2]; k++)
- for(l=0; l<(int)dset_dims[3]; l++)
+ twdata = wdata;
+ for (i = 0, acc = 0; i < (int)dset_dims[0]; i++)
+ for (j = 0; j < (int)dset_dims[1]; j++)
+ for (k = 0; k < (int)dset_dims[2]; k++)
+ for (l = 0; l < (int)dset_dims[3]; l++)
*twdata++ = acc++;
/* Collectively write a hyperslab of data to the dataset */
@@ -711,35 +711,39 @@ void dataset_fillvalue(void)
/*
* Read dataset after partial write.
*/
+
/* set entire read buffer with the constant 2 */
- HDmemset(rdata,2,(size_t)(dset_size*sizeof(int)));
+ HDmemset(rdata, 2, (size_t)(dset_size * sizeof(int)));
+
/* Independently read the entire dataset back */
ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
VRFY((ret >= 0), "H5Dread succeeded");
/* Verify correct data read */
- twdata=wdata;
- trdata=rdata;
- err_num=0;
- for(i=0; i<(int)dset_dims[0]; i++)
- for(j=0; j<(int)dset_dims[1]; j++)
- for(k=0; k<(int)dset_dims[2]; k++)
- for(l=0; l<(int)dset_dims[3]; l++, twdata++, trdata++)
- if(i<mpi_size) {
- if(*twdata != *trdata )
- if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
- printf("Dataset Verify failed at [%d][%d][%d][%d]: expect %d, got %d\n", i,j,k,l, *twdata, *trdata);
+ twdata = wdata;
+ trdata = rdata;
+ err_num = 0;
+ for (i = 0; i < (int)dset_dims[0]; i++)
+ for (j = 0; j < (int)dset_dims[1]; j++)
+ for (k = 0; k < (int)dset_dims[2]; k++)
+ for (l = 0; l < (int)dset_dims[3]; l++, twdata++, trdata++)
+ if (i < mpi_size) {
+ if (*twdata != *trdata)
+ if (err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
+ HDprintf("Dataset Verify failed at [%d][%d][%d][%d]: expect %d, got %d\n", i,
+ j, k, l, *twdata, *trdata);
} /* end if */
else {
- if(*trdata != 0)
- if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
- printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i,j,k,l, *trdata);
+ if (*trdata != 0)
+ if (err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
+ HDprintf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i,
+ j, k, l, *trdata);
} /* end else */
- if(err_num > MAX_ERR_REPORT && !VERBOSE_MED)
- printf("[more errors ...]\n");
- if(err_num){
- printf("%d errors found in check_value\n", err_num);
- nerrors++;
+ if (err_num > MAX_ERR_REPORT && !VERBOSE_MED)
+ HDprintf("[more errors ...]\n");
+ if (err_num) {
+ HDprintf("%d errors found in check_value\n", err_num);
+ nerrors++;
}
/* Close all file objects */
@@ -767,6 +771,14 @@ void dataset_fillvalue(void)
HDfree(wdata);
}
+/* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */
+void
+collective_group_write_independent_group_read(void)
+{
+ collective_group_write();
+ independent_group_read();
+}
+
/* Write multiple groups with a chunked dataset in each group collectively.
* These groups and datasets are for testing independent read later.
*
@@ -776,38 +788,39 @@ void dataset_fillvalue(void)
*
* JRM - 8/16/04
*/
-void collective_group_write(void)
+void
+collective_group_write(void)
{
- int mpi_rank, mpi_size, size;
- int i, j, m;
- char gname[64], dname[32];
- hid_t fid, gid, did, plist, dcpl, memspace, filespace;
- DATATYPE * outme = NULL;
- hsize_t chunk_origin[DIM];
- hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM];
- hsize_t chunk_size[2]; /* Chunk dimensions - computed shortly */
- herr_t ret1, ret2;
+ int mpi_rank, mpi_size, size;
+ int i, j, m;
+ char gname[64], dname[32];
+ hid_t fid, gid, did, plist, dcpl, memspace, filespace;
+ DATATYPE * outme = NULL;
+ hsize_t chunk_origin[DIM];
+ hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM];
+ hsize_t chunk_size[2]; /* Chunk dimensions - computed shortly */
+ herr_t ret1, ret2;
const H5Ptest_param_t *pt;
- char *filename;
- int ngroups;
+ char * filename;
+ int ngroups;
- pt = GetTestParameters();
+ pt = GetTestParameters();
filename = pt->name;
- ngroups = pt->count;
+ ngroups = pt->count;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
size = get_size();
- chunk_size[0] =(hsize_t)(size / 2);
- chunk_size[1] =(hsize_t)(size / 2);
+ chunk_size[0] = (hsize_t)(size / 2);
+ chunk_size[1] = (hsize_t)(size / 2);
outme = HDmalloc((size_t)(size * size * sizeof(DATATYPE)));
VRFY((outme != NULL), "HDmalloc succeeded for outme");
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
H5Pclose(plist);
/* decide the hyperslab according to process number. */
@@ -816,47 +829,44 @@ void collective_group_write(void)
/* select hyperslab in memory and file spaces. These two operations are
* identical since the datasets are the same. */
memspace = H5Screate_simple(DIM, file_dims, NULL);
- ret1 = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, chunk_origin,
- chunk_dims, count, chunk_dims);
- filespace = H5Screate_simple(DIM, file_dims, NULL);
- ret2 = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, chunk_origin,
- chunk_dims, count, chunk_dims);
- VRFY((memspace>=0), "memspace");
- VRFY((filespace>=0), "filespace");
- VRFY((ret1>=0), "mgroup memspace selection");
- VRFY((ret2>=0), "mgroup filespace selection");
+ ret1 = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
+ filespace = H5Screate_simple(DIM, file_dims, NULL);
+ ret2 = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
+ VRFY((memspace >= 0), "memspace");
+ VRFY((filespace >= 0), "filespace");
+ VRFY((ret1 >= 0), "mgroup memspace selection");
+ VRFY((ret2 >= 0), "mgroup filespace selection");
dcpl = H5Pcreate(H5P_DATASET_CREATE);
ret1 = H5Pset_chunk(dcpl, 2, chunk_size);
- VRFY((dcpl>=0), "dataset creation property");
- VRFY((ret1>=0), "set chunk for dataset creation property");
+ VRFY((dcpl >= 0), "dataset creation property");
+ VRFY((ret1 >= 0), "set chunk for dataset creation property");
/* creates ngroups groups under the root group, writes chunked
* datasets in parallel. */
- for(m = 0; m < ngroups; m++) {
- sprintf(gname, "group%d", m);
+ for (m = 0; m < ngroups; m++) {
+ HDsprintf(gname, "group%d", m);
gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((gid > 0), gname);
- sprintf(dname, "dataset%d", m);
+ HDsprintf(dname, "dataset%d", m);
did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
VRFY((did > 0), dname);
- for(i = 0; i < size; i++)
- for(j = 0; j < size; j++)
- outme[(i * size) + j] =(i + j) * 1000 + mpi_rank;
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++)
+ outme[(i * size) + j] = (i + j) * 1000 + mpi_rank;
- H5Dwrite(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT,
- outme);
+ H5Dwrite(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, outme);
H5Dclose(did);
H5Gclose(gid);
#ifdef BARRIER_CHECKS
- if(!((m+1) % 10)) {
- printf("created %d groups\n", m+1);
+ if (!((m + 1) % 10)) {
+ HDprintf("created %d groups\n", m + 1);
MPI_Barrier(MPI_COMM_WORLD);
- }
+ }
#endif /* BARRIER_CHECKS */
}
@@ -871,32 +881,34 @@ void collective_group_write(void)
/* Let two sets of processes open and read different groups and chunked
* datasets independently.
*/
-void independent_group_read(void)
+void
+independent_group_read(void)
{
- int mpi_rank, m;
- hid_t plist, fid;
+ int mpi_rank, m;
+ hid_t plist, fid;
const H5Ptest_param_t *pt;
- char *filename;
- int ngroups;
+ char * filename;
+ int ngroups;
- pt = GetTestParameters();
+ pt = GetTestParameters();
filename = pt->name;
- ngroups = pt->count;
+ ngroups = pt->count;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- fid = H5Fopen(filename, H5F_ACC_RDONLY, plist);
+ fid = H5Fopen(filename, H5F_ACC_RDONLY, plist);
H5Pclose(plist);
/* open groups and read datasets. Odd number processes read even number
* groups from the end; even number processes read odd number groups
* from the beginning. */
- if(mpi_rank%2==0) {
- for(m=ngroups-1; m==0; m-=2)
+ if (mpi_rank % 2 == 0) {
+ for (m = ngroups - 1; m == 0; m -= 2)
group_dataset_read(fid, mpi_rank, m);
- } else {
- for(m=0; m<ngroups; m+=2)
+ }
+ else {
+ for (m = 0; m < ngroups; m += 2)
group_dataset_read(fid, mpi_rank, m);
}
@@ -909,50 +921,50 @@ void independent_group_read(void)
* instead of the old SIZE #define. This should allow it
* to function with an arbitrary number of processors.
*
- * Also added code to verify the results of dynamic memory
- * allocations, and to free dynamically allocated memeory
- * when we are done with it.
+ * Also added code to verify the results of dynamic memory
+ * allocations, and to free dynamically allocated memeory
+ * when we are done with it.
*
* JRM - 8/16/04
*/
static void
group_dataset_read(hid_t fid, int mpi_rank, int m)
{
- int ret, i, j, size;
- char gname[64], dname[32];
- hid_t gid, did;
+ int ret, i, j, size;
+ char gname[64], dname[32];
+ hid_t gid, did;
DATATYPE *outdata = NULL;
- DATATYPE *indata = NULL;
+ DATATYPE *indata = NULL;
size = get_size();
- indata =(DATATYPE*)HDmalloc((size_t)(size * size * sizeof(DATATYPE)));
+ indata = (DATATYPE *)HDmalloc((size_t)(size * size * sizeof(DATATYPE)));
VRFY((indata != NULL), "HDmalloc succeeded for indata");
- outdata =(DATATYPE*)HDmalloc((size_t)(size * size * sizeof(DATATYPE)));
+ outdata = (DATATYPE *)HDmalloc((size_t)(size * size * sizeof(DATATYPE)));
VRFY((outdata != NULL), "HDmalloc succeeded for outdata");
/* open every group under root group. */
- sprintf(gname, "group%d", m);
+ HDsprintf(gname, "group%d", m);
gid = H5Gopen2(fid, gname, H5P_DEFAULT);
VRFY((gid > 0), gname);
/* check the data. */
- sprintf(dname, "dataset%d", m);
+ HDsprintf(dname, "dataset%d", m);
did = H5Dopen2(gid, dname, H5P_DEFAULT);
- VRFY((did>0), dname);
+ VRFY((did > 0), dname);
H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, indata);
/* this is the original value */
- for(i=0; i<size; i++)
- for(j=0; j<size; j++) {
- outdata[(i * size) + j] =(i+j)*1000 + mpi_rank;
- }
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++) {
+ outdata[(i * size) + j] = (i + j) * 1000 + mpi_rank;
+ }
/* compare the original value(outdata) to the value in file(indata).*/
ret = check_value(indata, outdata, size);
- VRFY((ret==0), "check the data");
+ VRFY((ret == 0), "check the data");
H5Dclose(did);
H5Gclose(gid);
@@ -993,22 +1005,23 @@ group_dataset_read(hid_t fid, int mpi_rank, int m)
*
* JRM - 8/16/04
*/
-void multiple_group_write(void)
+void
+multiple_group_write(void)
{
- int mpi_rank, mpi_size, size;
- int m;
- char gname[64];
- hid_t fid, gid, plist, memspace, filespace;
- hsize_t chunk_origin[DIM];
- hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM];
- herr_t ret;
+ int mpi_rank, mpi_size, size;
+ int m;
+ char gname[64];
+ hid_t fid, gid, plist, memspace, filespace;
+ hsize_t chunk_origin[DIM];
+ hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM];
+ herr_t ret;
const H5Ptest_param_t *pt;
- char *filename;
- int ngroups;
+ char * filename;
+ int ngroups;
- pt = GetTestParameters();
+ pt = GetTestParameters();
filename = pt->name;
- ngroups = pt->count;
+ ngroups = pt->count;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
@@ -1016,7 +1029,7 @@ void multiple_group_write(void)
size = get_size();
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
H5Pclose(plist);
/* decide the hyperslab according to process number. */
@@ -1024,38 +1037,36 @@ void multiple_group_write(void)
/* select hyperslab in memory and file spaces. These two operations are
* identical since the datasets are the same. */
- memspace = H5Screate_simple(DIM, file_dims, NULL);
- VRFY((memspace>=0), "memspace");
- ret = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, chunk_origin,
- chunk_dims, count, chunk_dims);
- VRFY((ret>=0), "mgroup memspace selection");
+ memspace = H5Screate_simple(DIM, file_dims, NULL);
+ VRFY((memspace >= 0), "memspace");
+ ret = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
+ VRFY((ret >= 0), "mgroup memspace selection");
- filespace = H5Screate_simple(DIM, file_dims, NULL);
- VRFY((filespace>=0), "filespace");
- ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, chunk_origin,
- chunk_dims, count, chunk_dims);
- VRFY((ret>=0), "mgroup filespace selection");
+ filespace = H5Screate_simple(DIM, file_dims, NULL);
+ VRFY((filespace >= 0), "filespace");
+ ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
+ VRFY((ret >= 0), "mgroup filespace selection");
/* creates ngroups groups under the root group, writes datasets in
* parallel. */
- for(m = 0; m < ngroups; m++) {
- sprintf(gname, "group%d", m);
+ for (m = 0; m < ngroups; m++) {
+ HDsprintf(gname, "group%d", m);
gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((gid > 0), gname);
/* create attribute for these groups. */
- write_attribute(gid, is_group, m);
+ write_attribute(gid, is_group, m);
- if(m != 0)
- write_dataset(memspace, filespace, gid);
+ if (m != 0)
+ write_dataset(memspace, filespace, gid);
H5Gclose(gid);
#ifdef BARRIER_CHECKS
- if(!((m+1) % 10)) {
- printf("created %d groups\n", m+1);
+ if (!((m + 1) % 10)) {
+ HDprintf("created %d groups\n", m + 1);
MPI_Barrier(MPI_COMM_WORLD);
- }
+ }
#endif /* BARRIER_CHECKS */
}
@@ -1063,14 +1074,14 @@ void multiple_group_write(void)
gid = H5Gopen2(fid, "group0", H5P_DEFAULT);
create_group_recursive(memspace, filespace, gid, 0);
ret = H5Gclose(gid);
- VRFY((ret>=0), "H5Gclose");
+ VRFY((ret >= 0), "H5Gclose");
ret = H5Sclose(filespace);
- VRFY((ret>=0), "H5Sclose");
+ VRFY((ret >= 0), "H5Sclose");
ret = H5Sclose(memspace);
- VRFY((ret>=0), "H5Sclose");
+ VRFY((ret >= 0), "H5Sclose");
ret = H5Fclose(fid);
- VRFY((ret>=0), "H5Fclose");
+ VRFY((ret >= 0), "H5Fclose");
}
/*
@@ -1086,11 +1097,11 @@ void multiple_group_write(void)
static void
write_dataset(hid_t memspace, hid_t filespace, hid_t gid)
{
- int i, j, n, size;
- int mpi_rank, mpi_size;
- char dname[32];
- DATATYPE * outme = NULL;
- hid_t did;
+ int i, j, n, size;
+ int mpi_rank, mpi_size;
+ char dname[32];
+ DATATYPE *outme = NULL;
+ hid_t did;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
@@ -1100,21 +1111,21 @@ write_dataset(hid_t memspace, hid_t filespace, hid_t gid)
outme = HDmalloc((size_t)(size * size * sizeof(double)));
VRFY((outme != NULL), "HDmalloc succeeded for outme");
- for(n = 0; n < NDATASET; n++) {
- sprintf(dname, "dataset%d", n);
- did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VRFY((did > 0), dname);
+ for (n = 0; n < NDATASET; n++) {
+ HDsprintf(dname, "dataset%d", n);
+ did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((did > 0), dname);
- for(i = 0; i < size; i++)
- for(j = 0; j < size; j++)
- outme[(i * size) + j] = n * 1000 + mpi_rank;
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++)
+ outme[(i * size) + j] = n * 1000 + mpi_rank;
- H5Dwrite(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, outme);
+ H5Dwrite(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, outme);
- /* create attribute for these datasets.*/
- write_attribute(did, is_dset, n);
+ /* create attribute for these datasets.*/
+ write_attribute(did, is_dset, n);
- H5Dclose(did);
+ H5Dclose(did);
}
HDfree(outme);
}
@@ -1126,30 +1137,30 @@ write_dataset(hid_t memspace, hid_t filespace, hid_t gid)
static void
create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, int counter)
{
- hid_t child_gid;
- int mpi_rank;
- char gname[64];
+ hid_t child_gid;
+ int mpi_rank;
+ char gname[64];
- MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
#ifdef BARRIER_CHECKS
- if(!((counter+1) % 10)) {
- printf("created %dth child groups\n", counter+1);
+ if (!((counter + 1) % 10)) {
+ HDprintf("created %dth child groups\n", counter + 1);
MPI_Barrier(MPI_COMM_WORLD);
- }
+ }
#endif /* BARRIER_CHECKS */
- sprintf(gname, "%dth_child_group", counter+1);
- child_gid = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VRFY((child_gid > 0), gname);
+ HDsprintf(gname, "%dth_child_group", counter + 1);
+ child_gid = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((child_gid > 0), gname);
- /* write datasets in parallel. */
- write_dataset(memspace, filespace, gid);
+ /* write datasets in parallel. */
+ write_dataset(memspace, filespace, gid);
- if(counter < GROUP_DEPTH )
- create_group_recursive(memspace, filespace, child_gid, counter+1);
+ if (counter < GROUP_DEPTH)
+ create_group_recursive(memspace, filespace, child_gid, counter + 1);
- H5Gclose(child_gid);
+ H5Gclose(child_gid);
}
/*
@@ -1162,21 +1173,22 @@ create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, int counter)
*
* JRM - 8/11/04
*/
-void multiple_group_read(void)
+void
+multiple_group_read(void)
{
- int mpi_rank, mpi_size, error_num, size;
- int m;
- char gname[64];
- hid_t plist, fid, gid, memspace, filespace;
- hsize_t chunk_origin[DIM];
- hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM];
+ int mpi_rank, mpi_size, error_num, size;
+ int m;
+ char gname[64];
+ hid_t plist, fid, gid, memspace, filespace;
+ hsize_t chunk_origin[DIM];
+ hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM];
const H5Ptest_param_t *pt;
- char *filename;
- int ngroups;
+ char * filename;
+ int ngroups;
- pt = GetTestParameters();
+ pt = GetTestParameters();
filename = pt->name;
- ngroups = pt->count;
+ ngroups = pt->count;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
@@ -1184,54 +1196,51 @@ void multiple_group_read(void)
size = get_size();
plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
- fid = H5Fopen(filename, H5F_ACC_RDONLY, plist);
+ fid = H5Fopen(filename, H5F_ACC_RDONLY, plist);
H5Pclose(plist);
/* decide hyperslab for each process */
get_slab(chunk_origin, chunk_dims, count, file_dims, size);
/* select hyperslab for memory and file space */
- memspace = H5Screate_simple(DIM, file_dims, NULL);
- H5Sselect_hyperslab(memspace, H5S_SELECT_SET, chunk_origin, chunk_dims,
- count, chunk_dims);
+ memspace = H5Screate_simple(DIM, file_dims, NULL);
+ H5Sselect_hyperslab(memspace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
filespace = H5Screate_simple(DIM, file_dims, NULL);
- H5Sselect_hyperslab(filespace, H5S_SELECT_SET, chunk_origin, chunk_dims,
- count, chunk_dims);
+ H5Sselect_hyperslab(filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
/* open every group under root group. */
- for(m=0; m<ngroups; m++) {
- sprintf(gname, "group%d", m);
+ for (m = 0; m < ngroups; m++) {
+ HDsprintf(gname, "group%d", m);
gid = H5Gopen2(fid, gname, H5P_DEFAULT);
VRFY((gid > 0), gname);
/* check the data. */
- if(m != 0)
- if((error_num = read_dataset(memspace, filespace, gid))>0)
- nerrors += error_num;
+ if (m != 0)
+ if ((error_num = read_dataset(memspace, filespace, gid)) > 0)
+ nerrors += error_num;
/* check attribute.*/
error_num = 0;
- if((error_num = read_attribute(gid, is_group, m))>0 )
- nerrors += error_num;
+ if ((error_num = read_attribute(gid, is_group, m)) > 0)
+ nerrors += error_num;
H5Gclose(gid);
#ifdef BARRIER_CHECKS
- if(!((m+1)%10))
+ if (!((m + 1) % 10))
MPI_Barrier(MPI_COMM_WORLD);
#endif /* BARRIER_CHECKS */
}
/* open all the groups in vertical direction. */
gid = H5Gopen2(fid, "group0", H5P_DEFAULT);
- VRFY((gid>0), "group0");
+ VRFY((gid > 0), "group0");
recursive_read_group(memspace, filespace, gid, 0);
H5Gclose(gid);
H5Sclose(filespace);
H5Sclose(memspace);
H5Fclose(fid);
-
}
/*
@@ -1247,43 +1256,42 @@ void multiple_group_read(void)
static int
read_dataset(hid_t memspace, hid_t filespace, hid_t gid)
{
- int i, j, n, mpi_rank, mpi_size, size, attr_errors=0, vrfy_errors=0;
- char dname[32];
+ int i, j, n, mpi_rank, mpi_size, size, attr_errors = 0, vrfy_errors = 0;
+ char dname[32];
DATATYPE *outdata = NULL, *indata = NULL;
- hid_t did;
+ hid_t did;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
size = get_size();
- indata =(DATATYPE*)HDmalloc((size_t)(size * size * sizeof(DATATYPE)));
+ indata = (DATATYPE *)HDmalloc((size_t)(size * size * sizeof(DATATYPE)));
VRFY((indata != NULL), "HDmalloc succeeded for indata");
- outdata =(DATATYPE*)HDmalloc((size_t)(size * size * sizeof(DATATYPE)));
+ outdata = (DATATYPE *)HDmalloc((size_t)(size * size * sizeof(DATATYPE)));
VRFY((outdata != NULL), "HDmalloc succeeded for outdata");
- for(n=0; n<NDATASET; n++) {
- sprintf(dname, "dataset%d", n);
+ for (n = 0; n < NDATASET; n++) {
+ HDsprintf(dname, "dataset%d", n);
did = H5Dopen2(gid, dname, H5P_DEFAULT);
- VRFY((did>0), dname);
+ VRFY((did > 0), dname);
- H5Dread(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT,
- indata);
+ H5Dread(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, indata);
/* this is the original value */
- for(i=0; i<size; i++)
- for(j=0; j<size; j++) {
- *outdata = n*1000 + mpi_rank;
- outdata++;
- }
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++) {
+ *outdata = n * 1000 + mpi_rank;
+ outdata++;
+ }
outdata -= size * size;
/* compare the original value(outdata) to the value in file(indata).*/
vrfy_errors = check_value(indata, outdata, size);
/* check attribute.*/
- if((attr_errors = read_attribute(did, is_dset, n))>0 )
+ if ((attr_errors = read_attribute(did, is_dset, n)) > 0)
vrfy_errors += attr_errors;
H5Dclose(did);
@@ -1303,23 +1311,23 @@ static void
recursive_read_group(hid_t memspace, hid_t filespace, hid_t gid, int counter)
{
hid_t child_gid;
- int mpi_rank, err_num=0;
+ int mpi_rank, err_num = 0;
char gname[64];
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
#ifdef BARRIER_CHECKS
- if((counter+1) % 10)
+ if ((counter + 1) % 10)
MPI_Barrier(MPI_COMM_WORLD);
#endif /* BARRIER_CHECKS */
- if((err_num = read_dataset(memspace, filespace, gid)) )
+ if ((err_num = read_dataset(memspace, filespace, gid)))
nerrors += err_num;
- if(counter < GROUP_DEPTH ) {
- sprintf(gname, "%dth_child_group", counter+1);
+ if (counter < GROUP_DEPTH) {
+ HDsprintf(gname, "%dth_child_group", counter + 1);
child_gid = H5Gopen2(gid, gname, H5P_DEFAULT);
- VRFY((child_gid>0), gname);
- recursive_read_group(memspace, filespace, child_gid, counter+1);
+ VRFY((child_gid > 0), gname);
+ recursive_read_group(memspace, filespace, child_gid, counter + 1);
H5Gclose(child_gid);
}
}
@@ -1331,23 +1339,23 @@ static void
write_attribute(hid_t obj_id, int this_type, int num)
{
hid_t sid, aid;
- hsize_t dspace_dims[1]={8};
- int i, mpi_rank, attr_data[8], dspace_rank=1;
+ hsize_t dspace_dims[1] = {8};
+ int i, mpi_rank, attr_data[8], dspace_rank = 1;
char attr_name[32];
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- if(this_type == is_group) {
- sprintf(attr_name, "Group Attribute %d", num);
+ if (this_type == is_group) {
+ HDsprintf(attr_name, "Group Attribute %d", num);
sid = H5Screate(H5S_SCALAR);
aid = H5Acreate2(obj_id, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT);
- H5Awrite(aid, H5T_NATIVE_INT, &num);
+ H5Awrite(aid, H5T_NATIVE_INT, &num);
H5Aclose(aid);
H5Sclose(sid);
} /* end if */
- else if(this_type == is_dset) {
- sprintf(attr_name, "Dataset Attribute %d", num);
- for(i=0; i<8; i++)
+ else if (this_type == is_dset) {
+ HDsprintf(attr_name, "Dataset Attribute %d", num);
+ for (i = 0; i < 8; i++)
attr_data[i] = i;
sid = H5Screate_simple(dspace_rank, dspace_dims, NULL);
aid = H5Acreate2(obj_id, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -1355,38 +1363,37 @@ write_attribute(hid_t obj_id, int this_type, int num)
H5Aclose(aid);
H5Sclose(sid);
} /* end else-if */
-
}
/* Read and verify attribute for group or dataset. */
static int
read_attribute(hid_t obj_id, int this_type, int num)
{
- hid_t aid;
- hsize_t group_block[2]={1,1}, dset_block[2]={1, 8};
- int i, mpi_rank, in_num, in_data[8], out_data[8], vrfy_errors = 0;
- char attr_name[32];
+ hid_t aid;
+ hsize_t group_block[2] = {1, 1}, dset_block[2] = {1, 8};
+ int i, mpi_rank, in_num, in_data[8], out_data[8], vrfy_errors = 0;
+ char attr_name[32];
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- if(this_type == is_group) {
- sprintf(attr_name, "Group Attribute %d", num);
+ if (this_type == is_group) {
+ HDsprintf(attr_name, "Group Attribute %d", num);
aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT);
- if(MAINPROCESS) {
+ if (MAINPROCESS) {
H5Aread(aid, H5T_NATIVE_INT, &in_num);
- vrfy_errors = dataset_vrfy(NULL, NULL, NULL, group_block, &in_num, &num);
- }
+ vrfy_errors = dataset_vrfy(NULL, NULL, NULL, group_block, &in_num, &num);
+ }
H5Aclose(aid);
}
- else if(this_type == is_dset) {
- sprintf(attr_name, "Dataset Attribute %d", num);
- for(i=0; i<8; i++)
+ else if (this_type == is_dset) {
+ HDsprintf(attr_name, "Dataset Attribute %d", num);
+ for (i = 0; i < 8; i++)
out_data[i] = i;
aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT);
- if(MAINPROCESS) {
+ if (MAINPROCESS) {
H5Aread(aid, H5T_NATIVE_INT, in_data);
vrfy_errors = dataset_vrfy(NULL, NULL, NULL, dset_block, in_data, out_data);
- }
+ }
H5Aclose(aid);
}
@@ -1396,69 +1403,70 @@ read_attribute(hid_t obj_id, int this_type, int num)
/* This functions compares the original data with the read-in data for its
* hyperslab part only by process ID.
*
- * Changes: Modified function to use a passed in size parameter
- * instead of the old SIZE #define. This should let us
- * run with an arbitrary number of processes.
+ * Changes: Modified function to use a passed in size parameter
+ * instead of the old SIZE #define. This should let us
+ * run with an arbitrary number of processes.
*
- * JRM - 8/16/04
+ * JRM - 8/16/04
*/
static int
check_value(DATATYPE *indata, DATATYPE *outdata, int size)
{
- int mpi_rank, mpi_size, err_num=0;
+ int mpi_rank, mpi_size, err_num = 0;
hsize_t i, j;
hsize_t chunk_origin[DIM];
- hsize_t chunk_dims[DIM], count[DIM];
+ hsize_t chunk_dims[DIM], count[DIM];
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
get_slab(chunk_origin, chunk_dims, count, NULL, size);
- indata += chunk_origin[0]*size;
- outdata += chunk_origin[0]*size;
- for(i=chunk_origin[0]; i<(chunk_origin[0]+chunk_dims[0]); i++)
- for(j=chunk_origin[1]; j<(chunk_origin[1]+chunk_dims[1]); j++) {
- if(*indata != *outdata )
- if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
- printf("Dataset Verify failed at [%lu][%lu](row %lu, col%lu): expect %d, got %d\n",(unsigned long)i,(unsigned long)j,(unsigned long)i,(unsigned long)j, *outdata, *indata);
- }
- if(err_num > MAX_ERR_REPORT && !VERBOSE_MED)
- printf("[more errors ...]\n");
- if(err_num)
- printf("%d errors found in check_value\n", err_num);
+ indata += chunk_origin[0] * size;
+ outdata += chunk_origin[0] * size;
+ for (i = chunk_origin[0]; i < (chunk_origin[0] + chunk_dims[0]); i++)
+ for (j = chunk_origin[1]; j < (chunk_origin[1] + chunk_dims[1]); j++) {
+ if (*indata != *outdata)
+ if (err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
+ HDprintf("Dataset Verify failed at [%lu][%lu](row %lu, col%lu): expect %d, got %d\n",
+ (unsigned long)i, (unsigned long)j, (unsigned long)i, (unsigned long)j, *outdata,
+ *indata);
+ }
+ if (err_num > MAX_ERR_REPORT && !VERBOSE_MED)
+ HDprintf("[more errors ...]\n");
+ if (err_num)
+ HDprintf("%d errors found in check_value\n", err_num);
return err_num;
}
/* Decide the portion of data chunk in dataset by process ID.
*
- * Changes: Modified function to use a passed in size parameter
- * instead of the old SIZE #define. This should let us
- * run with an arbitrary number of processes.
+ * Changes: Modified function to use a passed in size parameter
+ * instead of the old SIZE #define. This should let us
+ * run with an arbitrary number of processes.
*
- * JRM - 8/11/04
+ * JRM - 8/11/04
*/
static void
-get_slab(hsize_t chunk_origin[], hsize_t chunk_dims[], hsize_t count[],
- hsize_t file_dims[], int size)
+get_slab(hsize_t chunk_origin[], hsize_t chunk_dims[], hsize_t count[], hsize_t file_dims[], int size)
{
int mpi_rank, mpi_size;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
- if(chunk_origin != NULL) {
- chunk_origin[0] = mpi_rank *(size/mpi_size);
+ if (chunk_origin != NULL) {
+ chunk_origin[0] = mpi_rank * (size / mpi_size);
chunk_origin[1] = 0;
}
- if(chunk_dims != NULL) {
- chunk_dims[0] = size/mpi_size;
- chunk_dims[1] = size;
+ if (chunk_dims != NULL) {
+ chunk_dims[0] = size / mpi_size;
+ chunk_dims[1] = size;
}
- if(file_dims != NULL)
+ if (file_dims != NULL)
file_dims[0] = file_dims[1] = size;
- if(count != NULL)
+ if (count != NULL)
count[0] = count[1] = 1;
}
@@ -1480,29 +1488,29 @@ get_slab(hsize_t chunk_origin[], hsize_t chunk_dims[], hsize_t count[],
* on failure.
* JRM - 9/13/04
*
- * Changes: None.
+ * Changes: None.
*/
#define N 4
-void io_mode_confusion(void)
+void
+io_mode_confusion(void)
{
/*
* HDF5 APIs definitions
*/
- const int rank = 1;
+ const int rank = 1;
const char *dataset_name = "IntArray";
- hid_t file_id, dset_id; /* file and dataset identifiers */
- hid_t filespace, memspace; /* file and memory dataspace */
- /* identifiers */
- hsize_t dimsf[1]; /* dataset dimensions */
- int data[N] = {1}; /* pointer to data buffer to write */
- hsize_t coord[N] = {0L,1L,2L,3L};
- hid_t plist_id; /* property list identifier */
- herr_t status;
-
+ hid_t file_id, dset_id; /* file and dataset identifiers */
+ hid_t filespace, memspace; /* file and memory dataspace */
+ /* identifiers */
+ hsize_t dimsf[1]; /* dataset dimensions */
+ int data[N] = {1}; /* pointer to data buffer to write */
+ hsize_t coord[N] = {0L, 1L, 2L, 3L};
+ hid_t plist_id; /* property list identifier */
+ herr_t status;
/*
* MPI variables
@@ -1510,18 +1518,16 @@ void io_mode_confusion(void)
int mpi_size, mpi_rank;
-
/*
* test bed related variables
*/
- const char * fcn_name = "io_mode_confusion";
- const hbool_t verbose = FALSE;
- const H5Ptest_param_t * pt;
- char * filename;
-
+ const char * fcn_name = "io_mode_confusion";
+ const hbool_t verbose = FALSE;
+ const H5Ptest_param_t *pt;
+ char * filename;
- pt = GetTestParameters();
+ pt = GetTestParameters();
filename = pt->name;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -1531,183 +1537,154 @@ void io_mode_confusion(void)
* Set up file access property list with parallel I/O access
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Setting up property list.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Setting up property list.\n", mpi_rank, fcn_name);
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id != -1), "H5Pcreate() failed");
status = H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPI_INFO_NULL);
- VRFY((status >= 0 ), "H5Pset_fapl_mpio() failed");
-
+ VRFY((status >= 0), "H5Pset_fapl_mpio() failed");
/*
* Create a new file collectively and release property list identifier.
*/
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: Creating new file.\n", mpi_rank, fcn_name);
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id);
- VRFY((file_id >= 0 ), "H5Fcreate() failed");
+ VRFY((file_id >= 0), "H5Fcreate() failed");
status = H5Pclose(plist_id);
- VRFY((status >= 0 ), "H5Pclose() failed");
-
+ VRFY((status >= 0), "H5Pclose() failed");
/*
* Create the dataspace for the dataset.
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Creating the dataspace for the dataset.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Creating the dataspace for the dataset.\n", mpi_rank, fcn_name);
- dimsf[0] = N;
+ dimsf[0] = N;
filespace = H5Screate_simple(rank, dimsf, NULL);
- VRFY((filespace >= 0 ), "H5Screate_simple() failed.");
-
+ VRFY((filespace >= 0), "H5Screate_simple() failed.");
/*
* Create the dataset with default properties and close filespace.
*/
- if(verbose )
- HDfprintf(stdout,
- "%0d:%s: Creating the dataset, and closing filespace.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Creating the dataset, and closing filespace.\n", mpi_rank, fcn_name);
- dset_id = H5Dcreate2(file_id, dataset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- VRFY((dset_id >= 0 ), "H5Dcreate2() failed");
+ dset_id =
+ H5Dcreate2(file_id, dataset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "H5Dcreate2() failed");
status = H5Sclose(filespace);
- VRFY((status >= 0 ), "H5Sclose() failed");
-
+ VRFY((status >= 0), "H5Sclose() failed");
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Calling H5Screate_simple().\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling H5Screate_simple().\n", mpi_rank, fcn_name);
memspace = H5Screate_simple(rank, dimsf, NULL);
- VRFY((memspace >= 0 ), "H5Screate_simple() failed.");
+ VRFY((memspace >= 0), "H5Screate_simple() failed.");
-
- if(mpi_rank == 0 ) {
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Calling H5Sselect_all(memspace).\n",
- mpi_rank, fcn_name);
+ if (mpi_rank == 0) {
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling H5Sselect_all(memspace).\n", mpi_rank, fcn_name);
status = H5Sselect_all(memspace);
- VRFY((status >= 0 ), "H5Sselect_all() failed");
- } else {
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Calling H5Sselect_none(memspace).\n",
- mpi_rank, fcn_name);
+ VRFY((status >= 0), "H5Sselect_all() failed");
+ }
+ else {
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling H5Sselect_none(memspace).\n", mpi_rank, fcn_name);
status = H5Sselect_none(memspace);
- VRFY((status >= 0 ), "H5Sselect_none() failed");
+ VRFY((status >= 0), "H5Sselect_none() failed");
}
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Calling MPI_Barrier().\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling MPI_Barrier().\n", mpi_rank, fcn_name);
MPI_Barrier(MPI_COMM_WORLD);
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Calling H5Dget_space().\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling H5Dget_space().\n", mpi_rank, fcn_name);
filespace = H5Dget_space(dset_id);
- VRFY((filespace >= 0 ), "H5Dget_space() failed");
-
+ VRFY((filespace >= 0), "H5Dget_space() failed");
/* select all */
- if(mpi_rank == 0 ) {
- if(verbose )
- HDfprintf(stdout,
- "%0d:%s: Calling H5Sselect_elements() -- set up hang?\n",
- mpi_rank, fcn_name);
+ if (mpi_rank == 0) {
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling H5Sselect_elements() -- set up hang?\n", mpi_rank, fcn_name);
status = H5Sselect_elements(filespace, H5S_SELECT_SET, N, (const hsize_t *)&coord);
- VRFY((status >= 0 ), "H5Sselect_elements() failed");
- } else { /* select nothing */
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Calling H5Sselect_none().\n",
- mpi_rank, fcn_name);
+ VRFY((status >= 0), "H5Sselect_elements() failed");
+ }
+ else { /* select nothing */
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling H5Sselect_none().\n", mpi_rank, fcn_name);
status = H5Sselect_none(filespace);
- VRFY((status >= 0 ), "H5Sselect_none() failed");
+ VRFY((status >= 0), "H5Sselect_none() failed");
}
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Calling MPI_Barrier().\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling MPI_Barrier().\n", mpi_rank, fcn_name);
MPI_Barrier(MPI_COMM_WORLD);
-
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: Calling H5Pcreate().\n", mpi_rank, fcn_name);
plist_id = H5Pcreate(H5P_DATASET_XFER);
- VRFY((plist_id != -1 ), "H5Pcreate() failed");
-
+ VRFY((plist_id != -1), "H5Pcreate() failed");
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Calling H5Pset_dxpl_mpio().\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling H5Pset_dxpl_mpio().\n", mpi_rank, fcn_name);
status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
- VRFY((status >= 0 ), "H5Pset_dxpl_mpio() failed");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- status = H5Pset_dxpl_mpio_collective_opt(plist_id, H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((status>= 0),"set independent IO collectively succeeded");
+ VRFY((status >= 0), "H5Pset_dxpl_mpio() failed");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ status = H5Pset_dxpl_mpio_collective_opt(plist_id, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((status >= 0), "set independent IO collectively succeeded");
}
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Calling H5Dwrite() -- hang here?.\n", mpi_rank, fcn_name);
+ status = H5Dwrite(dset_id, H5T_NATIVE_INT, memspace, filespace, plist_id, data);
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Calling H5Dwrite() -- hang here?.\n",
- mpi_rank, fcn_name);
-
- status = H5Dwrite(dset_id, H5T_NATIVE_INT, memspace, filespace,
- plist_id, data);
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Returned from H5Dwrite(), status=%d.\n",
- mpi_rank, fcn_name, status);
- VRFY((status >= 0 ), "H5Dwrite() failed");
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Returned from H5Dwrite(), status=%d.\n", mpi_rank, fcn_name, status);
+ VRFY((status >= 0), "H5Dwrite() failed");
/*
* Close/release resources.
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Cleaning up from test.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Cleaning up from test.\n", mpi_rank, fcn_name);
status = H5Dclose(dset_id);
- VRFY((status >= 0 ), "H5Dclose() failed");
+ VRFY((status >= 0), "H5Dclose() failed");
status = H5Sclose(filespace);
- VRFY((status >= 0 ), "H5Dclose() failed");
+ VRFY((status >= 0), "H5Dclose() failed");
status = H5Sclose(memspace);
- VRFY((status >= 0 ), "H5Sclose() failed");
+ VRFY((status >= 0), "H5Sclose() failed");
status = H5Pclose(plist_id);
- VRFY((status >= 0 ), "H5Pclose() failed");
+ VRFY((status >= 0), "H5Pclose() failed");
status = H5Fclose(file_id);
- VRFY((status >= 0 ), "H5Fclose() failed");
-
+ VRFY((status >= 0), "H5Fclose() failed");
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: Done.\n", mpi_rank, fcn_name);
return;
@@ -1719,13 +1696,13 @@ void io_mode_confusion(void)
/*
* At present, the object header code maintains an image of its on disk
* representation, which is updates as necessary instead of generating on
- * request.
+ * request.
*
* Prior to the fix that this test in designed to verify, the image of the
* on disk representation was only updated on flush -- not when the object
* header was marked clean.
*
- * This worked perfectly well as long as all writes of a given object
+ * This worked perfectly well as long as all writes of a given object
* header were written from a single process. However, with the implementation
* of round robin metadata data writes in parallel HDF5, this is no longer
* the case -- it is possible for a given object header to be flushed from
@@ -1733,14 +1710,14 @@ void io_mode_confusion(void)
* clean in all other processes on each flush. This resulted in NULL or
* out of data object header information being written to disk.
*
- * To repair this, I modified the object header code to update its
- * on disk image both on flush on when marked clean.
+ * To repair this, I modified the object header code to update its
+ * on disk image both on flush on when marked clean.
*
* This test is directed at verifying that the fix performs as expected.
*
* The test functions by creating a HDF5 file with several small datasets,
- * and then flushing the file. This should result of at least one of
- * the associated object headers being flushed by a process other than
+ * and then flushing the file. This should result of at least one of
+ * the associated object headers being flushed by a process other than
* process 0.
*
* Then for each data set, add an attribute and flush the file again.
@@ -1750,73 +1727,57 @@ void io_mode_confusion(void)
* Open the each of the data sets in turn. If all opens are successful,
* the test passes. Otherwise the test fails.
*
- * Note that this test will probably become irrelevent shortly, when we
+ * Note that this test will probably become irrelevent shortly, when we
* land the journaling modifications on the trunk -- at which point all
* cache clients will have to construct on disk images on demand.
*
- * JRM -- 10/13/10
+ * JRM -- 10/13/10
*
* Changes:
- * Break it into two parts, a writer to write the file and a reader
- * the correctness of the writer. AKC -- 2010/10/27
+ * Break it into two parts, a writer to write the file and a reader
+ * the correctness of the writer. AKC -- 2010/10/27
*/
-#define NUM_DATA_SETS 4
-#define LOCAL_DATA_SIZE 4
-#define LARGE_ATTR_SIZE 256
+#define NUM_DATA_SETS 4
+#define LOCAL_DATA_SIZE 4
+#define LARGE_ATTR_SIZE 256
/* Since all even and odd processes are split into writer and reader comm
* respectively, process 0 and 1 in COMM_WORLD become the root process of
* the writer and reader comm respectively.
*/
-#define Writer_Root 0
-#define Reader_Root 1
-#define Reader_wait(mpi_err, xsteps) \
- mpi_err = MPI_Bcast(&xsteps, 1, MPI_INT, Writer_Root, MPI_COMM_WORLD)
-#define Reader_result(mpi_err, xsteps_done) \
+#define Writer_Root 0
+#define Reader_Root 1
+#define Reader_wait(mpi_err, xsteps) mpi_err = MPI_Bcast(&xsteps, 1, MPI_INT, Writer_Root, MPI_COMM_WORLD)
+#define Reader_result(mpi_err, xsteps_done) \
mpi_err = MPI_Bcast(&xsteps_done, 1, MPI_INT, Reader_Root, MPI_COMM_WORLD)
-#define Reader_check(mpi_err, xsteps, xsteps_done) \
- { Reader_wait(mpi_err, xsteps); \
- Reader_result(mpi_err, xsteps_done);}
+#define Reader_check(mpi_err, xsteps, xsteps_done) \
+ { \
+ Reader_wait(mpi_err, xsteps); \
+ Reader_result(mpi_err, xsteps_done); \
+ }
/* object names used by both rr_obj_hdr_flush_confusion and
* rr_obj_hdr_flush_confusion_reader.
*/
-const char * dataset_name[NUM_DATA_SETS] =
- {
- "dataset_0",
- "dataset_1",
- "dataset_2",
- "dataset_3"
- };
-const char * att_name[NUM_DATA_SETS] =
- {
- "attribute_0",
- "attribute_1",
- "attribute_2",
- "attribute_3"
- };
-const char * lg_att_name[NUM_DATA_SETS] =
- {
- "large_attribute_0",
- "large_attribute_1",
- "large_attribute_2",
- "large_attribute_3"
- };
-
-void rr_obj_hdr_flush_confusion(void)
+const char *dataset_name[NUM_DATA_SETS] = {"dataset_0", "dataset_1", "dataset_2", "dataset_3"};
+const char *att_name[NUM_DATA_SETS] = {"attribute_0", "attribute_1", "attribute_2", "attribute_3"};
+const char *lg_att_name[NUM_DATA_SETS] = {"large_attribute_0", "large_attribute_1", "large_attribute_2",
+ "large_attribute_3"};
+
+void
+rr_obj_hdr_flush_confusion(void)
{
/* MPI variables */
/* private communicator size and rank */
- int mpi_size;
- int mpi_rank;
- int mrc; /* mpi error code */
- int is_reader; /* 1 for reader process; 0 for writer process. */
+ int mpi_size;
+ int mpi_rank;
+ int mrc; /* mpi error code */
+ int is_reader; /* 1 for reader process; 0 for writer process. */
MPI_Comm comm;
-
/* test bed related variables */
- const char * fcn_name = "rr_obj_hdr_flush_confusion";
- const hbool_t verbose = FALSE;
+ const char * fcn_name = "rr_obj_hdr_flush_confusion";
+ const hbool_t verbose = FALSE;
/* Create two new private communicators from MPI_COMM_WORLD.
* Even and odd ranked processes go to comm_writers and comm_readers
@@ -1828,8 +1789,8 @@ void rr_obj_hdr_flush_confusion(void)
HDassert(mpi_size > 2);
is_reader = mpi_rank % 2;
- mrc = MPI_Comm_split(MPI_COMM_WORLD, is_reader, mpi_rank, &comm);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_split");
+ mrc = MPI_Comm_split(MPI_COMM_WORLD, is_reader, mpi_rank, &comm);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Comm_split");
/* The reader proocesses branches off to do reading
* while the writer processes continues to do writing
@@ -1839,32 +1800,33 @@ void rr_obj_hdr_flush_confusion(void)
* step. When all steps are done, they inform readers to end.
*/
if (is_reader)
- rr_obj_hdr_flush_confusion_reader(comm);
+ rr_obj_hdr_flush_confusion_reader(comm);
else
- rr_obj_hdr_flush_confusion_writer(comm);
+ rr_obj_hdr_flush_confusion_writer(comm);
MPI_Comm_free(&comm);
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: Done.\n", mpi_rank, fcn_name);
return;
} /* rr_obj_hdr_flush_confusion() */
-void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
+void
+rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
{
- int i;
- int j;
- hid_t file_id = -1;
- hid_t fapl_id = -1;
- hid_t dxpl_id = -1;
- hid_t att_id[NUM_DATA_SETS];
- hid_t att_space[NUM_DATA_SETS];
- hid_t lg_att_id[NUM_DATA_SETS];
- hid_t lg_att_space[NUM_DATA_SETS];
- hid_t disk_space[NUM_DATA_SETS];
- hid_t mem_space[NUM_DATA_SETS];
- hid_t dataset[NUM_DATA_SETS];
+ int i;
+ int j;
+ hid_t file_id = -1;
+ hid_t fapl_id = -1;
+ hid_t dxpl_id = -1;
+ hid_t att_id[NUM_DATA_SETS];
+ hid_t att_space[NUM_DATA_SETS];
+ hid_t lg_att_id[NUM_DATA_SETS];
+ hid_t lg_att_space[NUM_DATA_SETS];
+ hid_t disk_space[NUM_DATA_SETS];
+ hid_t mem_space[NUM_DATA_SETS];
+ hid_t dataset[NUM_DATA_SETS];
hsize_t att_size[1];
hsize_t lg_att_size[1];
hsize_t disk_count[1];
@@ -1873,10 +1835,10 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
hsize_t mem_count[1];
hsize_t mem_size[1];
hsize_t mem_start[1];
- herr_t err;
- double data[LOCAL_DATA_SIZE];
- double att[LOCAL_DATA_SIZE];
- double lg_att[LARGE_ATTR_SIZE];
+ herr_t err;
+ double data[LOCAL_DATA_SIZE];
+ double att[LOCAL_DATA_SIZE];
+ double lg_att[LARGE_ATTR_SIZE];
/* MPI variables */
/* world communication size and rank */
@@ -1885,22 +1847,22 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
/* private communicator size and rank */
int mpi_size;
int mpi_rank;
- int mrc; /* mpi error code */
+ int mrc; /* mpi error code */
/* steps to verify and have been verified */
- int steps = 0;
+ int steps = 0;
int steps_done = 0;
/* test bed related variables */
- const char * fcn_name = "rr_obj_hdr_flush_confusion_writer";
- const hbool_t verbose = FALSE;
- const H5Ptest_param_t * pt;
- char * filename;
+ const char * fcn_name = "rr_obj_hdr_flush_confusion_writer";
+ const hbool_t verbose = FALSE;
+ const H5Ptest_param_t *pt;
+ char * filename;
/*
* setup test bed related variables:
*/
- pt = (const H5Ptest_param_t *)GetTestParameters();
+ pt = (const H5Ptest_param_t *)GetTestParameters();
filename = pt->name;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_world_rank);
@@ -1912,108 +1874,99 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
* Set up file access property list with parallel I/O access
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Setting up property list.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Setting up property list.\n", mpi_rank, fcn_name);
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((fapl_id != -1), "H5Pcreate(H5P_FILE_ACCESS) failed");
err = H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL);
- VRFY((err >= 0 ), "H5Pset_fapl_mpio() failed");
-
+ VRFY((err >= 0), "H5Pset_fapl_mpio() failed");
/*
* Create a new file collectively and release property list identifier.
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Creating new file \"%s\".\n",
- mpi_rank, fcn_name, filename);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Creating new file \"%s\".\n", mpi_rank, fcn_name, filename);
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- VRFY((file_id >= 0 ), "H5Fcreate() failed");
+ VRFY((file_id >= 0), "H5Fcreate() failed");
err = H5Pclose(fapl_id);
- VRFY((err >= 0 ), "H5Pclose(fapl_id) failed");
-
+ VRFY((err >= 0), "H5Pclose(fapl_id) failed");
/*
* Step 1: create the data sets and write data.
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Creating the datasets.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Creating the datasets.\n", mpi_rank, fcn_name);
disk_size[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_size);
- mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE);
+ mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE);
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
+ for (i = 0; i < NUM_DATA_SETS; i++) {
disk_space[i] = H5Screate_simple(1, disk_size, NULL);
- VRFY((disk_space[i] >= 0), "H5Screate_simple(1) failed.\n");
+ VRFY((disk_space[i] >= 0), "H5Screate_simple(1) failed.\n");
- dataset[i] = H5Dcreate2(file_id, dataset_name[i], H5T_NATIVE_DOUBLE,
- disk_space[i], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset[i] = H5Dcreate2(file_id, dataset_name[i], H5T_NATIVE_DOUBLE, disk_space[i], H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
VRFY((dataset[i] >= 0), "H5Dcreate(1) failed.\n");
}
- /*
+ /*
* setup data transfer property list
*/
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: Setting up dxpl.\n", mpi_rank, fcn_name);
dxpl_id = H5Pcreate(H5P_DATASET_XFER);
VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n");
err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE);
- VRFY((err >= 0),
- "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n");
+ VRFY((err >= 0), "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n");
- /*
- * write data to the data sets
+ /*
+ * write data to the data sets
*/
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: Writing datasets.\n", mpi_rank, fcn_name);
disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE);
disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank);
- mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE);
- mem_start[0] = (hsize_t)(0);
+ mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE);
+ mem_start[0] = (hsize_t)(0);
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) {
+ for (j = 0; j < LOCAL_DATA_SIZE; j++) {
data[j] = (double)(mpi_rank + 1);
}
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
- err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start,
- NULL, disk_count, NULL);
+ for (i = 0; i < NUM_DATA_SETS; i++) {
+ err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, NULL, disk_count, NULL);
VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n");
mem_space[i] = H5Screate_simple(1, mem_size, NULL);
- VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n");
- err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET,
- mem_start, NULL, mem_count, NULL);
+ VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n");
+ err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, mem_start, NULL, mem_count, NULL);
VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n");
- err = H5Dwrite(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i],
- disk_space[i], dxpl_id, data);
+ err = H5Dwrite(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], disk_space[i], dxpl_id, data);
VRFY((err >= 0), "H5Dwrite(1) failed.\n");
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ )
- data[j] *= 10.0;
+ for (j = 0; j < LOCAL_DATA_SIZE; j++)
+ data[j] *= 10.0;
}
- /*
+ /*
* close the data spaces
*/
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: closing dataspaces.\n", mpi_rank, fcn_name);
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
+ for (i = 0; i < NUM_DATA_SETS; i++) {
err = H5Sclose(disk_space[i]);
VRFY((err >= 0), "H5Sclose(disk_space[i]) failed.\n");
err = H5Sclose(mem_space[i]);
@@ -2022,13 +1975,12 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
/* End of Step 1: create the data sets and write data. */
- /*
+ /*
* flush the metadata cache
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", mpi_rank, fcn_name);
err = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
VRFY((err >= 0), "H5Fflush(1) failed.\n");
@@ -2040,37 +1992,35 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
* Step 2: write attributes to each dataset
*/
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: writing attributes.\n", mpi_rank, fcn_name);
att_size[0] = (hsize_t)(LOCAL_DATA_SIZE);
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) {
+ for (j = 0; j < LOCAL_DATA_SIZE; j++) {
att[j] = (double)(j + 1);
}
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
+ for (i = 0; i < NUM_DATA_SETS; i++) {
att_space[i] = H5Screate_simple(1, att_size, NULL);
VRFY((att_space[i] >= 0), "H5Screate_simple(3) failed.\n");
- att_id[i] = H5Acreate2(dataset[i], att_name[i], H5T_NATIVE_DOUBLE,
- att_space[i], H5P_DEFAULT, H5P_DEFAULT);
+ att_id[i] =
+ H5Acreate2(dataset[i], att_name[i], H5T_NATIVE_DOUBLE, att_space[i], H5P_DEFAULT, H5P_DEFAULT);
VRFY((att_id[i] >= 0), "H5Acreate(1) failed.\n");
err = H5Awrite(att_id[i], H5T_NATIVE_DOUBLE, att);
VRFY((err >= 0), "H5Awrite(1) failed.\n");
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) {
+ for (j = 0; j < LOCAL_DATA_SIZE; j++) {
att[j] /= 10.0;
}
}
/*
- * close attribute IDs and spaces
+ * close attribute IDs and spaces
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: closing attr ids and spaces .\n",
- mpi_rank, fcn_name);
-
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: closing attr ids and spaces .\n", mpi_rank, fcn_name);
+ for (i = 0; i < NUM_DATA_SETS; i++) {
err = H5Sclose(att_space[i]);
VRFY((err >= 0), "H5Sclose(att_space[i]) failed.\n");
err = H5Aclose(att_id[i]);
@@ -2079,13 +2029,12 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
/* End of Step 2: write attributes to each dataset */
- /*
+ /*
* flush the metadata cache again
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", mpi_rank, fcn_name);
err = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
VRFY((err >= 0), "H5Fflush(2) failed.\n");
@@ -2097,44 +2046,42 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
* Step 3: write large attributes to each dataset
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: writing large attributes.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: writing large attributes.\n", mpi_rank, fcn_name);
lg_att_size[0] = (hsize_t)(LARGE_ATTR_SIZE);
- for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) {
+ for (j = 0; j < LARGE_ATTR_SIZE; j++) {
lg_att[j] = (double)(j + 1);
}
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
+ for (i = 0; i < NUM_DATA_SETS; i++) {
lg_att_space[i] = H5Screate_simple(1, lg_att_size, NULL);
VRFY((lg_att_space[i] >= 0), "H5Screate_simple(4) failed.\n");
- lg_att_id[i] = H5Acreate2(dataset[i], lg_att_name[i], H5T_NATIVE_DOUBLE,
- lg_att_space[i], H5P_DEFAULT, H5P_DEFAULT);
+ lg_att_id[i] = H5Acreate2(dataset[i], lg_att_name[i], H5T_NATIVE_DOUBLE, lg_att_space[i], H5P_DEFAULT,
+ H5P_DEFAULT);
VRFY((lg_att_id[i] >= 0), "H5Acreate(2) failed.\n");
err = H5Awrite(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att);
VRFY((err >= 0), "H5Awrite(2) failed.\n");
- for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) {
+ for (j = 0; j < LARGE_ATTR_SIZE; j++) {
lg_att[j] /= 10.0;
}
}
-
+
/* Step 3: write large attributes to each dataset */
- /*
+ /*
* flush the metadata cache yet again to clean the object headers.
*
* This is an attempt to crate a situation where we have dirty
* object header continuation chunks, but clean opject headers
* to verify a speculative bug fix -- it doesn't seem to work,
- * but I will leave the code in anyway, as the object header
+ * but I will leave the code in anyway, as the object header
* code is going to change a lot in the near future.
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", mpi_rank, fcn_name);
err = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
VRFY((err >= 0), "H5Fflush(3) failed.\n");
@@ -2146,30 +2093,28 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
* Step 4: write different large attributes to each dataset
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: writing different large attributes.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: writing different large attributes.\n", mpi_rank, fcn_name);
- for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) {
+ for (j = 0; j < LARGE_ATTR_SIZE; j++) {
lg_att[j] = (double)(j + 2);
}
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
+ for (i = 0; i < NUM_DATA_SETS; i++) {
err = H5Awrite(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att);
VRFY((err >= 0), "H5Awrite(2) failed.\n");
- for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) {
+ for (j = 0; j < LARGE_ATTR_SIZE; j++) {
lg_att[j] /= 10.0;
}
}
/* End of Step 4: write different large attributes to each dataset */
- /*
+ /*
* flush the metadata cache again
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", mpi_rank, fcn_name);
err = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
VRFY((err >= 0), "H5Fflush(3) failed.\n");
@@ -2180,14 +2125,13 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
/* Step 5: Close all objects and the file */
/*
- * close large attribute IDs and spaces
+ * close large attribute IDs and spaces
*/
- if(verbose )
- HDfprintf(stdout, "%0d:%s: closing large attr ids and spaces .\n",
- mpi_rank, fcn_name);
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: closing large attr ids and spaces .\n", mpi_rank, fcn_name);
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
+ for (i = 0; i < NUM_DATA_SETS; i++) {
err = H5Sclose(lg_att_space[i]);
VRFY((err >= 0), "H5Sclose(lg_att_space[i]) failed.\n");
@@ -2195,15 +2139,14 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
VRFY((err >= 0), "H5Aclose(lg_att_id[i]) failed.\n");
}
-
- /*
+ /*
* close the data sets
*/
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: closing datasets .\n", mpi_rank, fcn_name);
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
+ for (i = 0; i < NUM_DATA_SETS; i++) {
err = H5Dclose(dataset[i]);
VRFY((err >= 0), "H5Dclose(dataset[i])1 failed.\n");
}
@@ -2212,65 +2155,64 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
* close the data transfer property list.
*/
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: closing dxpl .\n", mpi_rank, fcn_name);
err = H5Pclose(dxpl_id);
VRFY((err >= 0), "H5Pclose(dxpl_id) failed.\n");
-
/*
* Close file.
*/
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: closing file.\n", mpi_rank, fcn_name);
err = H5Fclose(file_id);
- VRFY((err >= 0 ), "H5Fclose(1) failed");
-
+ VRFY((err >= 0), "H5Fclose(1) failed");
+
/* End of Step 5: Close all objects and the file */
/* Tell the reader to check the file up to steps. */
steps++;
Reader_check(mrc, steps, steps_done);
-
/* All done. Inform reader to end. */
- steps=0;
+ steps = 0;
Reader_check(mrc, steps, steps_done);
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: Done.\n", mpi_rank, fcn_name);
return;
} /* rr_obj_hdr_flush_confusion_writer() */
-void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm)
+void
+rr_obj_hdr_flush_confusion_reader(MPI_Comm comm)
{
- int i;
- int j;
- hid_t file_id = -1;
- hid_t fapl_id = -1;
- hid_t dxpl_id = -1;
- hid_t lg_att_id[NUM_DATA_SETS];
- hid_t lg_att_type[NUM_DATA_SETS];
- hid_t disk_space[NUM_DATA_SETS];
- hid_t mem_space[NUM_DATA_SETS];
- hid_t dataset[NUM_DATA_SETS];
+ int i;
+ int j;
+ hid_t file_id = -1;
+ hid_t fapl_id = -1;
+ hid_t dxpl_id = -1;
+ hid_t lg_att_id[NUM_DATA_SETS];
+ hid_t lg_att_type[NUM_DATA_SETS];
+ hid_t disk_space[NUM_DATA_SETS];
+ hid_t mem_space[NUM_DATA_SETS];
+ hid_t dataset[NUM_DATA_SETS];
hsize_t disk_count[1];
hsize_t disk_start[1];
hsize_t mem_count[1];
hsize_t mem_size[1];
hsize_t mem_start[1];
- herr_t err;
- htri_t tri_err;
- double data[LOCAL_DATA_SIZE];
- double data_read[LOCAL_DATA_SIZE];
- double att[LOCAL_DATA_SIZE];
- double att_read[LOCAL_DATA_SIZE];
- double lg_att[LARGE_ATTR_SIZE];
- double lg_att_read[LARGE_ATTR_SIZE];
+ herr_t err;
+ htri_t tri_err;
+ double data[LOCAL_DATA_SIZE];
+ double data_read[LOCAL_DATA_SIZE];
+ double att[LOCAL_DATA_SIZE];
+ double att_read[LOCAL_DATA_SIZE];
+ double lg_att[LARGE_ATTR_SIZE];
+ double lg_att_read[LARGE_ATTR_SIZE];
/* MPI variables */
/* world communication size and rank */
@@ -2279,21 +2221,21 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm)
/* private communicator size and rank */
int mpi_size;
int mpi_rank;
- int mrc; /* mpi error code */
- int steps = -1; /* How far (steps) to verify the file */
- int steps_done = -1; /* How far (steps) have been verified */
+ int mrc; /* mpi error code */
+ int steps = -1; /* How far (steps) to verify the file */
+ int steps_done = -1; /* How far (steps) have been verified */
/* test bed related variables */
- const char * fcn_name = "rr_obj_hdr_flush_confusion_reader";
- const hbool_t verbose = FALSE;
- const H5Ptest_param_t * pt;
- char * filename;
+ const char * fcn_name = "rr_obj_hdr_flush_confusion_reader";
+ const hbool_t verbose = FALSE;
+ const H5Ptest_param_t *pt;
+ char * filename;
/*
* setup test bed related variables:
*/
- pt = (const H5Ptest_param_t *)GetTestParameters();
+ pt = (const H5Ptest_param_t *)GetTestParameters();
filename = pt->name;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_world_rank);
@@ -2303,295 +2245,285 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm)
/* Repeatedly re-open the file and verify its contents until it is */
/* told to end (when steps=0). */
- while (steps_done != 0){
- Reader_wait(mrc, steps);
- VRFY((mrc >= 0), "Reader_wait failed");
- steps_done = 0;
-
- if (steps > 0 ){
- /*
- * Set up file access property list with parallel I/O access
- */
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Setting up property list.\n",
- mpi_rank, fcn_name);
-
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- VRFY((fapl_id != -1), "H5Pcreate(H5P_FILE_ACCESS) failed");
- err = H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL);
- VRFY((err >= 0 ), "H5Pset_fapl_mpio() failed");
-
- /*
- * Create a new file collectively and release property list identifier.
- */
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Re-open file \"%s\".\n",
- mpi_rank, fcn_name, filename);
-
- file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id);
- VRFY((file_id >= 0 ), "H5Fopen() failed");
- err = H5Pclose(fapl_id);
- VRFY((err >= 0 ), "H5Pclose(fapl_id) failed");
+ while (steps_done != 0) {
+ Reader_wait(mrc, steps);
+ VRFY((mrc >= 0), "Reader_wait failed");
+ steps_done = 0;
+
+ if (steps > 0) {
+ /*
+ * Set up file access property list with parallel I/O access
+ */
+
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Setting up property list.\n", mpi_rank, fcn_name);
+
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ VRFY((fapl_id != -1), "H5Pcreate(H5P_FILE_ACCESS) failed");
+ err = H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL);
+ VRFY((err >= 0), "H5Pset_fapl_mpio() failed");
+
+ /*
+ * Create a new file collectively and release property list identifier.
+ */
+
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Re-open file \"%s\".\n", mpi_rank, fcn_name, filename);
+
+ file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id);
+ VRFY((file_id >= 0), "H5Fopen() failed");
+ err = H5Pclose(fapl_id);
+ VRFY((err >= 0), "H5Pclose(fapl_id) failed");
#if 1
- if (steps >= 1){
- /*=====================================================*
- * Step 1: open the data sets and read data.
- *=====================================================*/
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: opening the datasets.\n",
- mpi_rank, fcn_name);
-
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
- dataset[i] = -1;
- }
-
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
- dataset[i] = H5Dopen2(file_id, dataset_name[i], H5P_DEFAULT);
- VRFY((dataset[i] >= 0), "H5Dopen(1) failed.\n");
- disk_space[i] = H5Dget_space(dataset[i]);
- VRFY((disk_space[i] >= 0), "H5Dget_space failed.\n");
- }
-
- /*
- * setup data transfer property list
- */
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Setting up dxpl.\n", mpi_rank, fcn_name);
-
- dxpl_id = H5Pcreate(H5P_DATASET_XFER);
- VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n");
- err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE);
- VRFY((err >= 0),
- "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n");
-
- /*
- * read data from the data sets
- */
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: Reading datasets.\n", mpi_rank, fcn_name);
-
- disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE);
- disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank);
-
- mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE);
-
- mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE);
- mem_start[0] = (hsize_t)(0);
-
- /* set up expected data for verification */
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) {
- data[j] = (double)(mpi_rank + 1);
- }
-
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
- err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start,
- NULL, disk_count, NULL);
- VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n");
- mem_space[i] = H5Screate_simple(1, mem_size, NULL);
- VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n");
- err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET,
- mem_start, NULL, mem_count, NULL);
- VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n");
- err = H5Dread(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i],
- disk_space[i], dxpl_id, data_read);
- VRFY((err >= 0), "H5Dread(1) failed.\n");
-
- /* compare read data with expected data */
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ )
- if (data_read[j] != data[j]){
- HDfprintf(stdout,
- "%0d:%s: Reading datasets value failed in "
- "Dataset %d, at position %d: expect %f, got %f.\n",
- mpi_rank, fcn_name, i, j, data[j], data_read[j]);
- nerrors++;
- }
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ )
- data[j] *= 10.0;
- }
-
- /*
- * close the data spaces
- */
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: closing dataspaces.\n", mpi_rank, fcn_name);
-
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
- err = H5Sclose(disk_space[i]);
- VRFY((err >= 0), "H5Sclose(disk_space[i]) failed.\n");
- err = H5Sclose(mem_space[i]);
- VRFY((err >= 0), "H5Sclose(mem_space[i]) failed.\n");
- }
- steps_done++;
- }
- /* End of Step 1: open the data sets and read data. */
+ if (steps >= 1) {
+ /*=====================================================*
+ * Step 1: open the data sets and read data.
+ *=====================================================*/
+
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: opening the datasets.\n", mpi_rank, fcn_name);
+
+ for (i = 0; i < NUM_DATA_SETS; i++) {
+ dataset[i] = -1;
+ }
+
+ for (i = 0; i < NUM_DATA_SETS; i++) {
+ dataset[i] = H5Dopen2(file_id, dataset_name[i], H5P_DEFAULT);
+ VRFY((dataset[i] >= 0), "H5Dopen(1) failed.\n");
+ disk_space[i] = H5Dget_space(dataset[i]);
+ VRFY((disk_space[i] >= 0), "H5Dget_space failed.\n");
+ }
+
+ /*
+ * setup data transfer property list
+ */
+
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Setting up dxpl.\n", mpi_rank, fcn_name);
+
+ dxpl_id = H5Pcreate(H5P_DATASET_XFER);
+ VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n");
+ err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE);
+ VRFY((err >= 0), "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n");
+
+ /*
+ * read data from the data sets
+ */
+
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: Reading datasets.\n", mpi_rank, fcn_name);
+
+ disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE);
+ disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank);
+
+ mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE);
+
+ mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE);
+ mem_start[0] = (hsize_t)(0);
+
+ /* set up expected data for verification */
+ for (j = 0; j < LOCAL_DATA_SIZE; j++) {
+ data[j] = (double)(mpi_rank + 1);
+ }
+
+ for (i = 0; i < NUM_DATA_SETS; i++) {
+ err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, NULL, disk_count,
+ NULL);
+ VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n");
+ mem_space[i] = H5Screate_simple(1, mem_size, NULL);
+ VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n");
+ err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, mem_start, NULL, mem_count, NULL);
+ VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n");
+ err = H5Dread(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], disk_space[i], dxpl_id,
+ data_read);
+ VRFY((err >= 0), "H5Dread(1) failed.\n");
+
+ /* compare read data with expected data */
+ for (j = 0; j < LOCAL_DATA_SIZE; j++)
+ if (data_read[j] != data[j]) {
+ HDfprintf(stdout,
+ "%0d:%s: Reading datasets value failed in "
+ "Dataset %d, at position %d: expect %f, got %f.\n",
+ mpi_rank, fcn_name, i, j, data[j], data_read[j]);
+ nerrors++;
+ }
+ for (j = 0; j < LOCAL_DATA_SIZE; j++)
+ data[j] *= 10.0;
+ }
+
+ /*
+ * close the data spaces
+ */
+
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: closing dataspaces.\n", mpi_rank, fcn_name);
+
+ for (i = 0; i < NUM_DATA_SETS; i++) {
+ err = H5Sclose(disk_space[i]);
+ VRFY((err >= 0), "H5Sclose(disk_space[i]) failed.\n");
+ err = H5Sclose(mem_space[i]);
+ VRFY((err >= 0), "H5Sclose(mem_space[i]) failed.\n");
+ }
+ steps_done++;
+ }
+ /* End of Step 1: open the data sets and read data. */
#endif
#if 1
- /*=====================================================*
- * Step 2: reading attributes from each dataset
- *=====================================================*/
-
- if (steps >= 2){
- if(verbose )
- HDfprintf(stdout, "%0d:%s: reading attributes.\n", mpi_rank, fcn_name);
-
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) {
-
- att[j] = (double)(j + 1);
- }
-
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
- hid_t att_id, att_type;
-
- att_id = H5Aopen(dataset[i], att_name[i], H5P_DEFAULT);
- VRFY((att_id >= 0), "H5Aopen failed.\n");
- att_type = H5Aget_type(att_id);
- VRFY((att_type >= 0), "H5Aget_type failed.\n");
- tri_err = H5Tequal(att_type, H5T_NATIVE_DOUBLE);
- VRFY((tri_err >= 0), "H5Tequal failed.\n");
- if (tri_err==0){
- HDfprintf(stdout,
- "%0d:%s: Mismatched Attribute type of Dataset %d.\n",
- mpi_rank, fcn_name, i);
- nerrors++;
- }else{
- /* should verify attribute size before H5Aread */
- err = H5Aread(att_id, H5T_NATIVE_DOUBLE, att_read);
- VRFY((err >= 0), "H5Aread failed.\n");
- /* compare read attribute data with expected data */
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ )
- if (att_read[j] != att[j]){
- HDfprintf(stdout,
- "%0d:%s: Mismatched attribute data read in Dataset %d, at position %d: expect %f, got %f.\n",
- mpi_rank, fcn_name, i, j, att[j], att_read[j]);
- nerrors++;
- }
- for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) {
-
- att[j] /= 10.0;
- }
- }
- err = H5Aclose(att_id);
- VRFY((err >= 0), "H5Aclose failed.\n");
- }
- steps_done++;
- }
- /* End of Step 2: reading attributes from each dataset */
+ /*=====================================================*
+ * Step 2: reading attributes from each dataset
+ *=====================================================*/
+
+ if (steps >= 2) {
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: reading attributes.\n", mpi_rank, fcn_name);
+
+ for (j = 0; j < LOCAL_DATA_SIZE; j++) {
+ att[j] = (double)(j + 1);
+ }
+
+ for (i = 0; i < NUM_DATA_SETS; i++) {
+ hid_t att_id, att_type;
+
+ att_id = H5Aopen(dataset[i], att_name[i], H5P_DEFAULT);
+ VRFY((att_id >= 0), "H5Aopen failed.\n");
+ att_type = H5Aget_type(att_id);
+ VRFY((att_type >= 0), "H5Aget_type failed.\n");
+ tri_err = H5Tequal(att_type, H5T_NATIVE_DOUBLE);
+ VRFY((tri_err >= 0), "H5Tequal failed.\n");
+ if (tri_err == 0) {
+ HDfprintf(stdout, "%0d:%s: Mismatched Attribute type of Dataset %d.\n", mpi_rank,
+ fcn_name, i);
+ nerrors++;
+ }
+ else {
+ /* should verify attribute size before H5Aread */
+ err = H5Aread(att_id, H5T_NATIVE_DOUBLE, att_read);
+ VRFY((err >= 0), "H5Aread failed.\n");
+ /* compare read attribute data with expected data */
+ for (j = 0; j < LOCAL_DATA_SIZE; j++)
+ if (att_read[j] != att[j]) {
+ HDfprintf(stdout,
+ "%0d:%s: Mismatched attribute data read in Dataset %d, at position "
+ "%d: expect %f, got %f.\n",
+ mpi_rank, fcn_name, i, j, att[j], att_read[j]);
+ nerrors++;
+ }
+ for (j = 0; j < LOCAL_DATA_SIZE; j++) {
+ att[j] /= 10.0;
+ }
+ }
+ err = H5Aclose(att_id);
+ VRFY((err >= 0), "H5Aclose failed.\n");
+ }
+ steps_done++;
+ }
+ /* End of Step 2: reading attributes from each dataset */
#endif
-
#if 1
- /*=====================================================*
- * Step 3 or 4: read large attributes from each dataset.
- * Step 4 has different attribute value from step 3.
- *=====================================================*/
-
- if (steps >= 3){
- if(verbose )
- HDfprintf(stdout, "%0d:%s: reading large attributes.\n", mpi_rank, fcn_name);
-
- for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) {
-
- lg_att[j] = (steps==3) ? (double)(j + 1) : (double)(j+2);
- }
-
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
- lg_att_id[i] = H5Aopen(dataset[i], lg_att_name[i], H5P_DEFAULT);
- VRFY((lg_att_id[i] >= 0), "H5Aopen(2) failed.\n");
- lg_att_type[i] = H5Aget_type(lg_att_id[i]);
- VRFY((err >= 0), "H5Aget_type failed.\n");
- tri_err = H5Tequal(lg_att_type[i], H5T_NATIVE_DOUBLE);
- VRFY((tri_err >= 0), "H5Tequal failed.\n");
- if (tri_err==0){
- HDfprintf(stdout,
- "%0d:%s: Mismatched Large attribute type of Dataset %d.\n",
- mpi_rank, fcn_name, i);
- nerrors++;
- }else{
- /* should verify large attribute size before H5Aread */
- err = H5Aread(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att_read);
- VRFY((err >= 0), "H5Aread failed.\n");
- /* compare read attribute data with expected data */
- for ( j = 0; j < LARGE_ATTR_SIZE; j++ )
- if (lg_att_read[j] != lg_att[j]){
- HDfprintf(stdout,
- "%0d:%s: Mismatched large attribute data read in Dataset %d, at position %d: expect %f, got %f.\n",
- mpi_rank, fcn_name, i, j, lg_att[j], lg_att_read[j]);
- nerrors++;
- }
- for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) {
-
- lg_att[j] /= 10.0;
- }
- }
- err = H5Tclose(lg_att_type[i]);
- VRFY((err >= 0), "H5Tclose failed.\n");
- err = H5Aclose(lg_att_id[i]);
- VRFY((err >= 0), "H5Aclose failed.\n");
- }
- /* Both step 3 and 4 use this same read checking code. */
- steps_done = (steps==3) ? 3 : 4;
- }
-
- /* End of Step 3 or 4: read large attributes from each dataset */
+ /*=====================================================*
+ * Step 3 or 4: read large attributes from each dataset.
+ * Step 4 has different attribute value from step 3.
+ *=====================================================*/
+
+ if (steps >= 3) {
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: reading large attributes.\n", mpi_rank, fcn_name);
+
+ for (j = 0; j < LARGE_ATTR_SIZE; j++) {
+ lg_att[j] = (steps == 3) ? (double)(j + 1) : (double)(j + 2);
+ }
+
+ for (i = 0; i < NUM_DATA_SETS; i++) {
+ lg_att_id[i] = H5Aopen(dataset[i], lg_att_name[i], H5P_DEFAULT);
+ VRFY((lg_att_id[i] >= 0), "H5Aopen(2) failed.\n");
+ lg_att_type[i] = H5Aget_type(lg_att_id[i]);
+ VRFY((err >= 0), "H5Aget_type failed.\n");
+ tri_err = H5Tequal(lg_att_type[i], H5T_NATIVE_DOUBLE);
+ VRFY((tri_err >= 0), "H5Tequal failed.\n");
+ if (tri_err == 0) {
+ HDfprintf(stdout, "%0d:%s: Mismatched Large attribute type of Dataset %d.\n",
+ mpi_rank, fcn_name, i);
+ nerrors++;
+ }
+ else {
+ /* should verify large attribute size before H5Aread */
+ err = H5Aread(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att_read);
+ VRFY((err >= 0), "H5Aread failed.\n");
+ /* compare read attribute data with expected data */
+ for (j = 0; j < LARGE_ATTR_SIZE; j++)
+ if (lg_att_read[j] != lg_att[j]) {
+ HDfprintf(stdout,
+ "%0d:%s: Mismatched large attribute data read in Dataset %d, at "
+ "position %d: expect %f, got %f.\n",
+ mpi_rank, fcn_name, i, j, lg_att[j], lg_att_read[j]);
+ nerrors++;
+ }
+ for (j = 0; j < LARGE_ATTR_SIZE; j++) {
+
+ lg_att[j] /= 10.0;
+ }
+ }
+ err = H5Tclose(lg_att_type[i]);
+ VRFY((err >= 0), "H5Tclose failed.\n");
+ err = H5Aclose(lg_att_id[i]);
+ VRFY((err >= 0), "H5Aclose failed.\n");
+ }
+ /* Both step 3 and 4 use this same read checking code. */
+ steps_done = (steps == 3) ? 3 : 4;
+ }
+
+ /* End of Step 3 or 4: read large attributes from each dataset */
#endif
-
- /*=====================================================*
- * Step 5: read all objects from the file
- *=====================================================*/
- if (steps>=5){
- /* nothing extra to verify. The file is closed normally. */
- /* Just increment steps_done */
- steps_done++;
- }
-
- /*
- * Close the data sets
- */
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: closing datasets again.\n",
- mpi_rank, fcn_name);
-
- for ( i = 0; i < NUM_DATA_SETS; i++ ) {
- if ( dataset[i] >= 0 ) {
- err = H5Dclose(dataset[i]);
- VRFY((err >= 0), "H5Dclose(dataset[i])1 failed.\n");
- }
- }
-
- /*
- * close the data transfer property list.
- */
-
- if(verbose )
- HDfprintf(stdout, "%0d:%s: closing dxpl .\n", mpi_rank, fcn_name);
-
- err = H5Pclose(dxpl_id);
- VRFY((err >= 0), "H5Pclose(dxpl_id) failed.\n");
-
- /*
- * Close the file
- */
- if(verbose)
- HDfprintf(stdout, "%0d:%s: closing file again.\n",
- mpi_rank, fcn_name);
- err = H5Fclose(file_id);
- VRFY((err >= 0 ), "H5Fclose(1) failed");
-
- } /* else if (steps_done==0) */
- Reader_result(mrc, steps_done);
+ /*=====================================================*
+ * Step 5: read all objects from the file
+ *=====================================================*/
+ if (steps >= 5) {
+ /* nothing extra to verify. The file is closed normally. */
+ /* Just increment steps_done */
+ steps_done++;
+ }
+
+ /*
+ * Close the data sets
+ */
+
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: closing datasets again.\n", mpi_rank, fcn_name);
+
+ for (i = 0; i < NUM_DATA_SETS; i++) {
+ if (dataset[i] >= 0) {
+ err = H5Dclose(dataset[i]);
+ VRFY((err >= 0), "H5Dclose(dataset[i])1 failed.\n");
+ }
+ }
+
+ /*
+ * close the data transfer property list.
+ */
+
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: closing dxpl .\n", mpi_rank, fcn_name);
+
+ err = H5Pclose(dxpl_id);
+ VRFY((err >= 0), "H5Pclose(dxpl_id) failed.\n");
+
+ /*
+ * Close the file
+ */
+ if (verbose)
+ HDfprintf(stdout, "%0d:%s: closing file again.\n", mpi_rank, fcn_name);
+ err = H5Fclose(file_id);
+ VRFY((err >= 0), "H5Fclose(1) failed");
+
+ } /* else if (steps_done==0) */
+ Reader_result(mrc, steps_done);
} /* end while(1) */
- if(verbose )
+ if (verbose)
HDfprintf(stdout, "%0d:%s: Done.\n", mpi_rank, fcn_name);
return;
@@ -2606,27 +2538,27 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm)
#undef Writer_Root
#undef Reader_Root
-
/*
* Test creating a chunked dataset in parallel in a file with an alignment set
* and an alignment threshold large enough to avoid aligning the chunks but
* small enough that the raw data aggregator will be aligned if it is treated as
* an object that must be aligned by the library
*/
-#define CHUNK_SIZE 72
-#define NCHUNKS 32
-#define AGGR_SIZE 2048
+#define CHUNK_SIZE 72
+#define NCHUNKS 32
+#define AGGR_SIZE 2048
#define EXTRA_ALIGN 100
- void chunk_align_bug_1(void)
- {
- int mpi_rank;
- hid_t file_id, dset_id, fapl_id, dcpl_id, space_id;
- hsize_t dims = CHUNK_SIZE * NCHUNKS, cdims = CHUNK_SIZE;
- h5_stat_size_t file_size;
- hsize_t align;
- herr_t ret;
- const char *filename;
+void
+chunk_align_bug_1(void)
+{
+ int mpi_rank;
+ hid_t file_id, dset_id, fapl_id, dcpl_id, space_id;
+ hsize_t dims = CHUNK_SIZE * NCHUNKS, cdims = CHUNK_SIZE;
+ h5_stat_size_t file_size;
+ hsize_t align;
+ herr_t ret;
+ const char * filename;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -2691,8 +2623,6 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm)
return;
} /* end chunk_align_bug_1() */
-
/*=============================================================================
* End of t_mdset.c
*===========================================================================*/
-
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index de255cd..a883f55 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -28,137 +28,129 @@
#include "testpar.h"
/* FILENAME and filenames must have the same number of names */
-const char *FILENAME[2]={
- "MPItest",
- NULL};
-char filenames[2][200];
-int nerrors = 0;
-hid_t fapl; /* file access property list */
+const char *FILENAME[2] = {"MPItest", NULL};
+char filenames[2][200];
+int nerrors = 0;
+hid_t fapl; /* file access property list */
/* protocols */
static int errors_sum(int nerrs);
-#define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */
+#define MPIO_TEST_WRITE_SIZE 1024 * 1024 /* 1 MB */
static int
test_mpio_overlap_writes(char *filename)
{
- int mpi_size, mpi_rank;
- MPI_Comm comm;
- MPI_Info info = MPI_INFO_NULL;
- int color, mrc;
- MPI_File fh;
- int i;
- int vrfyerrs, nerrs;
- unsigned char buf[4093]; /* use some prime number for size */
- int bufsize = sizeof(buf);
- MPI_Offset stride;
- MPI_Offset mpi_off;
- MPI_Status mpi_stat;
-
+ int mpi_size, mpi_rank;
+ MPI_Comm comm;
+ MPI_Info info = MPI_INFO_NULL;
+ int color, mrc;
+ MPI_File fh;
+ int i;
+ int vrfyerrs, nerrs;
+ unsigned char buf[4093]; /* use some prime number for size */
+ int bufsize = sizeof(buf);
+ MPI_Offset stride;
+ MPI_Offset mpi_off;
+ MPI_Status mpi_stat;
if (VERBOSE_MED)
- printf("MPIO independent overlapping writes test on file %s\n",
- filename);
+ HDprintf("MPIO independent overlapping writes test on file %s\n", filename);
nerrs = 0;
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* Need at least 2 processes */
if (mpi_size < 2) {
- if (MAINPROCESS)
- printf("Need at least 2 processes to run MPIO test.\n");
- printf(" -SKIP- \n");
- return 0;
+ if (MAINPROCESS)
+ HDprintf("Need at least 2 processes to run MPIO test.\n");
+ HDprintf(" -SKIP- \n");
+ return 0;
}
/* splits processes 0 to n-2 into one comm. and the last one into another */
color = ((mpi_rank < (mpi_size - 1)) ? 0 : 1);
- mrc = MPI_Comm_split (MPI_COMM_WORLD, color, mpi_rank, &comm);
- VRFY((mrc==MPI_SUCCESS), "Comm_split succeeded");
-
- if (color==0){
- /* First n-1 processes (color==0) open a file and write it */
- mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE|MPI_MODE_RDWR,
- info, &fh);
- VRFY((mrc==MPI_SUCCESS), "");
-
- stride = 1;
- mpi_off = mpi_rank*stride;
- while (mpi_off < MPIO_TEST_WRITE_SIZE){
- /* make sure the write does not exceed the TEST_WRITE_SIZE */
- if (mpi_off+stride > MPIO_TEST_WRITE_SIZE)
- stride = MPIO_TEST_WRITE_SIZE - mpi_off;
-
- /* set data to some trivial pattern for easy verification */
- for (i=0; i<stride; i++)
- buf[i] = (unsigned char)(mpi_off+i);
- mrc = MPI_File_write_at(fh, mpi_off, buf, (int)stride, MPI_BYTE,
- &mpi_stat);
- VRFY((mrc==MPI_SUCCESS), "");
-
- /* move the offset pointer to last byte written by all processes */
- mpi_off += (mpi_size - 1 - mpi_rank) * stride;
-
- /* Increase chunk size without exceeding buffer size. */
- /* Then move the starting offset for next write. */
- stride *= 2;
- if (stride > bufsize)
- stride = bufsize;
- mpi_off += mpi_rank*stride;
- }
-
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
- mrc = MPI_Comm_free(&comm);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
-
- /* sync with the other waiting processes */
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after writes");
- }else{
- /* last process waits till writes are done,
- * then opens file to verify data.
- */
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after writes");
-
- mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY,
- info, &fh);
- VRFY((mrc==MPI_SUCCESS), "");
-
- stride = bufsize;
- for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){
- /* make sure it does not read beyond end of data */
- if (mpi_off+stride > MPIO_TEST_WRITE_SIZE)
- stride = MPIO_TEST_WRITE_SIZE - mpi_off;
- mrc = MPI_File_read_at(fh, mpi_off, buf, (int)stride, MPI_BYTE,
- &mpi_stat);
- VRFY((mrc==MPI_SUCCESS), "");
- vrfyerrs=0;
- for (i=0; i<stride; i++){
- unsigned char expected;
- expected = (unsigned char)(mpi_off+i);
- if ((expected != buf[i]) &&
- (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) {
- printf("proc %d: found data error at [%ld], expect %u, got %u\n",
- mpi_rank, (long)(mpi_off+i), expected, buf[i]);
- }
- }
- if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
- printf("proc %d: [more errors ...]\n", mpi_rank);
-
- nerrs += vrfyerrs;
- }
-
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
- mrc = MPI_Comm_free(&comm);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
+ mrc = MPI_Comm_split(MPI_COMM_WORLD, color, mpi_rank, &comm);
+ VRFY((mrc == MPI_SUCCESS), "Comm_split succeeded");
+
+ if (color == 0) {
+ /* First n-1 processes (color==0) open a file and write it */
+ mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh);
+ VRFY((mrc == MPI_SUCCESS), "");
+
+ stride = 1;
+ mpi_off = mpi_rank * stride;
+ while (mpi_off < MPIO_TEST_WRITE_SIZE) {
+ /* make sure the write does not exceed the TEST_WRITE_SIZE */
+ if (mpi_off + stride > MPIO_TEST_WRITE_SIZE)
+ stride = MPIO_TEST_WRITE_SIZE - mpi_off;
+
+ /* set data to some trivial pattern for easy verification */
+ for (i = 0; i < stride; i++)
+ buf[i] = (unsigned char)(mpi_off + i);
+ mrc = MPI_File_write_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, &mpi_stat);
+ VRFY((mrc == MPI_SUCCESS), "");
+
+ /* move the offset pointer to last byte written by all processes */
+ mpi_off += (mpi_size - 1 - mpi_rank) * stride;
+
+ /* Increase chunk size without exceeding buffer size. */
+ /* Then move the starting offset for next write. */
+ stride *= 2;
+ if (stride > bufsize)
+ stride = bufsize;
+ mpi_off += mpi_rank * stride;
+ }
+
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE");
+ mrc = MPI_Comm_free(&comm);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free");
+
+ /* sync with the other waiting processes */
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync after writes");
+ }
+ else {
+ /* last process waits till writes are done,
+ * then opens file to verify data.
+ */
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync after writes");
+
+ mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, info, &fh);
+ VRFY((mrc == MPI_SUCCESS), "");
+
+ stride = bufsize;
+ for (mpi_off = 0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize) {
+ /* make sure it does not read beyond end of data */
+ if (mpi_off + stride > MPIO_TEST_WRITE_SIZE)
+ stride = MPIO_TEST_WRITE_SIZE - mpi_off;
+ mrc = MPI_File_read_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, &mpi_stat);
+ VRFY((mrc == MPI_SUCCESS), "");
+ vrfyerrs = 0;
+ for (i = 0; i < stride; i++) {
+ unsigned char expected;
+ expected = (unsigned char)(mpi_off + i);
+ if ((expected != buf[i]) && (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) {
+ HDprintf("proc %d: found data error at [%ld], expect %u, got %u\n", mpi_rank,
+ (long)(mpi_off + i), expected, buf[i]);
+ }
+ }
+ if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
+ HDprintf("proc %d: [more errors ...]\n", mpi_rank);
+
+ nerrs += vrfyerrs;
+ }
+
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE");
+ mrc = MPI_Comm_free(&comm);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free");
}
/*
@@ -166,15 +158,14 @@ test_mpio_overlap_writes(char *filename)
* before ending this test.
*/
mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
+ VRFY((mrc == MPI_SUCCESS), "Sync before leaving test");
return (nerrs);
}
-
-#define MB 1048576 /* 1024*1024 == 2**20 */
-#define GB 1073741824 /* 1024**3 == 2**30 */
-#define TWO_GB_LESS1 2147483647 /* 2**31 - 1 */
-#define FOUR_GB_LESS1 4294967295L /* 2**32 - 1 */
+#define MB 1048576 /* 1024*1024 == 2**20 */
+#define GB 1073741824 /* 1024**3 == 2**30 */
+#define TWO_GB_LESS1 2147483647 /* 2**31 - 1 */
+#define FOUR_GB_LESS1 4294967295L /* 2**32 - 1 */
/*
* Verify that MPI_Offset exceeding 2**31 can be computed correctly.
* Print any failure as information only, not as an error so that this
@@ -189,224 +180,222 @@ test_mpio_overlap_writes(char *filename)
static int
test_mpio_gb_file(char *filename)
{
- int mpi_size, mpi_rank;
- MPI_Info info = MPI_INFO_NULL;
- int mrc;
- MPI_File fh;
- int i, j, n;
- int vrfyerrs;
- int writerrs; /* write errors */
- int nerrs;
- int ntimes; /* how many times */
- char *buf = NULL;
- char expected;
- MPI_Offset size;
- MPI_Offset mpi_off;
- MPI_Offset mpi_off_old;
- MPI_Status mpi_stat;
- int is_signed, sizeof_mpi_offset;
+ int mpi_size, mpi_rank;
+ MPI_Info info = MPI_INFO_NULL;
+ int mrc;
+ MPI_File fh;
+ int i, j, n;
+ int vrfyerrs;
+ int writerrs; /* write errors */
+ int nerrs;
+ int ntimes; /* how many times */
+ char * buf = NULL;
+ char expected;
+ MPI_Offset size;
+ MPI_Offset mpi_off;
+ MPI_Offset mpi_off_old;
+ MPI_Status mpi_stat;
+ int is_signed, sizeof_mpi_offset;
nerrs = 0;
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
if (VERBOSE_MED)
- printf("MPI_Offset range test\n");
+ HDprintf("MPI_Offset range test\n");
/* figure out the signness and sizeof MPI_Offset */
- mpi_off = 0;
- is_signed = ((MPI_Offset)(mpi_off - 1)) < 0;
+ mpi_off = 0;
+ is_signed = ((MPI_Offset)(mpi_off - 1)) < 0;
sizeof_mpi_offset = (int)(sizeof(MPI_Offset));
/*
* Verify the sizeof MPI_Offset and correctness of handling multiple GB
* sizes.
*/
- if (MAINPROCESS){ /* only process 0 needs to check it*/
- printf("MPI_Offset is %s %d bytes integeral type\n",
- is_signed ? "signed" : "unsigned", (int)sizeof(MPI_Offset));
- if (sizeof_mpi_offset <= 4 && is_signed){
- printf("Skipped 2GB range test "
- "because MPI_Offset cannot support it\n");
- }else {
- /* verify correctness of assigning 2GB sizes */
- mpi_off = 2 * 1024 * (MPI_Offset)MB;
- INFO((mpi_off>0), "2GB OFFSET assignment no overflow");
- INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed");
-
- /* verify correctness of increasing from below 2 GB to above 2GB */
- mpi_off = TWO_GB_LESS1;
- for (i=0; i < 3; i++){
- mpi_off_old = mpi_off;
- mpi_off = mpi_off + 1;
- /* no overflow */
- INFO((mpi_off>0), "2GB OFFSET increment no overflow");
- /* correct inc. */
- INFO((mpi_off-1)==mpi_off_old, "2GB OFFSET increment succeed");
- }
- }
-
- if (sizeof_mpi_offset <= 4){
- printf("Skipped 4GB range test "
- "because MPI_Offset cannot support it\n");
- }else {
- /* verify correctness of assigning 4GB sizes */
- mpi_off = 4 * 1024 * (MPI_Offset)MB;
- INFO((mpi_off>0), "4GB OFFSET assignment no overflow");
- INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed");
-
- /* verify correctness of increasing from below 4 GB to above 4 GB */
- mpi_off = FOUR_GB_LESS1;
- for (i=0; i < 3; i++){
- mpi_off_old = mpi_off;
- mpi_off = mpi_off + 1;
- /* no overflow */
- INFO((mpi_off>0), "4GB OFFSET increment no overflow");
- /* correct inc. */
- INFO((mpi_off-1)==mpi_off_old, "4GB OFFSET increment succeed");
- }
- }
+ if (MAINPROCESS) { /* only process 0 needs to check it*/
+ HDprintf("MPI_Offset is %s %d bytes integeral type\n", is_signed ? "signed" : "unsigned",
+ (int)sizeof(MPI_Offset));
+ if (sizeof_mpi_offset <= 4 && is_signed) {
+ HDprintf("Skipped 2GB range test "
+ "because MPI_Offset cannot support it\n");
+ }
+ else {
+ /* verify correctness of assigning 2GB sizes */
+ mpi_off = 2 * 1024 * (MPI_Offset)MB;
+ INFO((mpi_off > 0), "2GB OFFSET assignment no overflow");
+ INFO((mpi_off - 1) == TWO_GB_LESS1, "2GB OFFSET assignment succeed");
+
+ /* verify correctness of increasing from below 2 GB to above 2GB */
+ mpi_off = TWO_GB_LESS1;
+ for (i = 0; i < 3; i++) {
+ mpi_off_old = mpi_off;
+ mpi_off = mpi_off + 1;
+ /* no overflow */
+ INFO((mpi_off > 0), "2GB OFFSET increment no overflow");
+ /* correct inc. */
+ INFO((mpi_off - 1) == mpi_off_old, "2GB OFFSET increment succeed");
+ }
+ }
+
+ if (sizeof_mpi_offset <= 4) {
+ HDprintf("Skipped 4GB range test "
+ "because MPI_Offset cannot support it\n");
+ }
+ else {
+ /* verify correctness of assigning 4GB sizes */
+ mpi_off = 4 * 1024 * (MPI_Offset)MB;
+ INFO((mpi_off > 0), "4GB OFFSET assignment no overflow");
+ INFO((mpi_off - 1) == FOUR_GB_LESS1, "4GB OFFSET assignment succeed");
+
+ /* verify correctness of increasing from below 4 GB to above 4 GB */
+ mpi_off = FOUR_GB_LESS1;
+ for (i = 0; i < 3; i++) {
+ mpi_off_old = mpi_off;
+ mpi_off = mpi_off + 1;
+ /* no overflow */
+ INFO((mpi_off > 0), "4GB OFFSET increment no overflow");
+ /* correct inc. */
+ INFO((mpi_off - 1) == mpi_off_old, "4GB OFFSET increment succeed");
+ }
+ }
}
/*
* Verify if we can write to a file of multiple GB sizes.
*/
if (VERBOSE_MED)
- printf("MPIO GB file test %s\n", filename);
-
- if (sizeof_mpi_offset <= 4){
- printf("Skipped GB file range test "
- "because MPI_Offset cannot support it\n");
- }else{
- buf = HDmalloc(MB);
- VRFY((buf!=NULL), "malloc succeed");
-
- /* open a new file. Remove it first in case it exists. */
- /* Must delete because MPI_File_open does not have a Truncate mode. */
- /* Don't care if it has error. */
- MPI_File_delete(filename, MPI_INFO_NULL);
- MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */
-
- mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR,
- info, &fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN");
-
- printf("MPIO GB file write test %s\n", filename);
-
- /* instead of writing every bytes of the file, we will just write
- * some data around the 2 and 4 GB boundaries. That should cover
- * potential integer overflow and filesystem size limits.
- */
- writerrs = 0;
- for (n=2; n <= 4; n+=2){
- ntimes = GB/MB*n/mpi_size + 1;
- for (i=ntimes-2; i <= ntimes; i++){
- mpi_off = (i*mpi_size + mpi_rank)*(MPI_Offset)MB;
- if (VERBOSE_MED)
- HDfprintf(stdout,"proc %d: write to mpi_off=%016llx, %lld\n",
- mpi_rank, mpi_off, mpi_off);
- /* set data to some trivial pattern for easy verification */
- for (j=0; j<MB; j++)
- *(buf+j) = i*mpi_size + mpi_rank;
- if (VERBOSE_MED)
- HDfprintf(stdout,"proc %d: writing %d bytes at offset %lld\n",
- mpi_rank, MB, mpi_off);
- mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
- INFO((mrc==MPI_SUCCESS), "GB size file write");
- if (mrc!=MPI_SUCCESS)
- writerrs++;
- }
- }
-
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
-
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after writes");
-
- /*
- * Verify if we can read the multiple GB file just created.
- */
- /* open it again to verify the data written */
- /* but only if there was no write errors */
- printf("MPIO GB file read test %s\n", filename);
- if (errors_sum(writerrs)>0){
- printf("proc %d: Skip read test due to previous write errors\n",
- mpi_rank);
- goto finish;
- }
- mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh);
- VRFY((mrc==MPI_SUCCESS), "");
-
- /* Only read back parts of the file that have been written. */
- for (n=2; n <= 4; n+=2){
- ntimes = GB/MB*n/mpi_size + 1;
- for (i=ntimes-2; i <= ntimes; i++){
- mpi_off = (i*mpi_size + (mpi_size - mpi_rank - 1))*(MPI_Offset)MB;
- if (VERBOSE_MED)
- HDfprintf(stdout,"proc %d: read from mpi_off=%016llx, %lld\n",
- mpi_rank, mpi_off, mpi_off);
- mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
- INFO((mrc==MPI_SUCCESS), "GB size file read");
- expected = i*mpi_size + (mpi_size - mpi_rank - 1);
- vrfyerrs=0;
- for (j=0; j<MB; j++){
- if ((*(buf+j) != expected) &&
- (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)){
- printf("proc %d: found data error at [%ld+%d], expect %d, got %d\n",
- mpi_rank, (long)mpi_off, j, expected, *(buf+j));
- }
- }
- if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
- printf("proc %d: [more errors ...]\n", mpi_rank);
-
- nerrs += vrfyerrs;
- }
- }
-
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
-
- /*
- * one more sync to ensure all processes have done reading
- * before ending this test.
- */
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
-
- printf("Test if MPI_File_get_size works correctly with %s\n", filename);
-
- mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh);
- VRFY((mrc==MPI_SUCCESS), "");
-
- if (MAINPROCESS){ /* only process 0 needs to check it*/
+ HDprintf("MPIO GB file test %s\n", filename);
+
+ if (sizeof_mpi_offset <= 4) {
+ HDprintf("Skipped GB file range test "
+ "because MPI_Offset cannot support it\n");
+ }
+ else {
+ buf = (char *)HDmalloc(MB);
+ VRFY((buf != NULL), "malloc succeed");
+
+ /* open a new file. Remove it first in case it exists. */
+ /* Must delete because MPI_File_open does not have a Truncate mode. */
+ /* Don't care if it has error. */
+ MPI_File_delete(filename, MPI_INFO_NULL);
+ MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */
+
+ mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh);
+ VRFY((mrc == MPI_SUCCESS), "MPI_FILE_OPEN");
+
+ HDprintf("MPIO GB file write test %s\n", filename);
+
+ /* instead of writing every bytes of the file, we will just write
+ * some data around the 2 and 4 GB boundaries. That should cover
+ * potential integer overflow and filesystem size limits.
+ */
+ writerrs = 0;
+ for (n = 2; n <= 4; n += 2) {
+ ntimes = GB / MB * n / mpi_size + 1;
+ for (i = ntimes - 2; i <= ntimes; i++) {
+ mpi_off = (i * mpi_size + mpi_rank) * (MPI_Offset)MB;
+ if (VERBOSE_MED)
+ HDfprintf(stdout, "proc %d: write to mpi_off=%016llx, %lld\n", mpi_rank, mpi_off,
+ mpi_off);
+ /* set data to some trivial pattern for easy verification */
+ for (j = 0; j < MB; j++)
+ *(buf + j) = (int8_t)(i * mpi_size + mpi_rank);
+ if (VERBOSE_MED)
+ HDfprintf(stdout, "proc %d: writing %d bytes at offset %lld\n", mpi_rank, MB, mpi_off);
+ mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
+ INFO((mrc == MPI_SUCCESS), "GB size file write");
+ if (mrc != MPI_SUCCESS)
+ writerrs++;
+ }
+ }
+
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE");
+
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync after writes");
+
+ /*
+ * Verify if we can read the multiple GB file just created.
+ */
+ /* open it again to verify the data written */
+ /* but only if there was no write errors */
+ HDprintf("MPIO GB file read test %s\n", filename);
+ if (errors_sum(writerrs) > 0) {
+ HDprintf("proc %d: Skip read test due to previous write errors\n", mpi_rank);
+ goto finish;
+ }
+ mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh);
+ VRFY((mrc == MPI_SUCCESS), "");
+
+ /* Only read back parts of the file that have been written. */
+ for (n = 2; n <= 4; n += 2) {
+ ntimes = GB / MB * n / mpi_size + 1;
+ for (i = ntimes - 2; i <= ntimes; i++) {
+ mpi_off = (i * mpi_size + (mpi_size - mpi_rank - 1)) * (MPI_Offset)MB;
+ if (VERBOSE_MED)
+ HDfprintf(stdout, "proc %d: read from mpi_off=%016llx, %lld\n", mpi_rank, mpi_off,
+ mpi_off);
+ mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
+ INFO((mrc == MPI_SUCCESS), "GB size file read");
+ expected = (int8_t)(i * mpi_size + (mpi_size - mpi_rank - 1));
+ vrfyerrs = 0;
+ for (j = 0; j < MB; j++) {
+ if ((*(buf + j) != expected) && (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) {
+ HDprintf("proc %d: found data error at [%ld+%d], expect %d, got %d\n", mpi_rank,
+ (long)mpi_off, j, expected, *(buf + j));
+ }
+ }
+ if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
+ HDprintf("proc %d: [more errors ...]\n", mpi_rank);
+
+ nerrs += vrfyerrs;
+ }
+ }
+
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE");
+
+ /*
+ * one more sync to ensure all processes have done reading
+ * before ending this test.
+ */
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync before leaving test");
+
+ HDprintf("Test if MPI_File_get_size works correctly with %s\n", filename);
+
+ mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh);
+ VRFY((mrc == MPI_SUCCESS), "");
+
+ if (MAINPROCESS) { /* only process 0 needs to check it*/
mrc = MPI_File_get_size(fh, &size);
- VRFY((mrc==MPI_SUCCESS), "");
- VRFY((size == mpi_off+MB), "MPI_File_get_size doesn't return correct file size.");
+ VRFY((mrc == MPI_SUCCESS), "");
+ VRFY((size == mpi_off + MB), "MPI_File_get_size doesn't return correct file size.");
}
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE");
- /*
- * one more sync to ensure all processes have done reading
- * before ending this test.
- */
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
+ /*
+ * one more sync to ensure all processes have done reading
+ * before ending this test.
+ */
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync before leaving test");
}
finish:
if (buf)
- HDfree(buf);
+ HDfree(buf);
return (nerrs);
}
-
/*
* MPI-IO Test: One writes, Many reads.
* Verify if only one process writes some data and then all other
@@ -424,191 +413,189 @@ finish:
* Each process writes something, then reads all data back.
*/
-#define DIMSIZE 32 /* Dimension size. */
-#define PRINTID printf("Proc %d: ", mpi_rank)
-#define USENONE 0
-#define USEATOM 1 /* request atomic I/O */
-#define USEFSYNC 2 /* request file_sync */
-
+#define DIMSIZE 32 /* Dimension size. */
+#define PRINTID HDprintf("Proc %d: ", mpi_rank)
+#define USENONE 0
+#define USEATOM 1 /* request atomic I/O */
+#define USEFSYNC 2 /* request file_sync */
static int
test_mpio_1wMr(char *filename, int special_request)
{
- char hostname[128];
- int mpi_size, mpi_rank;
- MPI_File fh;
- char mpi_err_str[MPI_MAX_ERROR_STRING];
- int mpi_err_strlen;
- int mpi_err;
+ char hostname[128];
+ int mpi_size, mpi_rank;
+ MPI_File fh;
+ char mpi_err_str[MPI_MAX_ERROR_STRING];
+ int mpi_err_strlen;
+ int mpi_err;
unsigned char writedata[DIMSIZE], readdata[DIMSIZE];
unsigned char expect_val;
- int i, irank;
- int nerrs = 0; /* number of errors */
- int atomicity;
- MPI_Offset mpi_off;
- MPI_Status mpi_stat;
+ int i, irank;
+ int nerrs = 0; /* number of errors */
+ int atomicity;
+ MPI_Offset mpi_off;
+ MPI_Status mpi_stat;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- if (MAINPROCESS && VERBOSE_MED){
- printf("Testing one process writes, all processes read.\n");
- printf("Using %d processes accessing file %s\n", mpi_size, filename);
- printf(" (Filename can be specified via program argument)\n");
+ if (MAINPROCESS && VERBOSE_MED) {
+ HDprintf("Testing one process writes, all processes read.\n");
+ HDprintf("Using %d processes accessing file %s\n", mpi_size, filename);
+ HDprintf(" (Filename can be specified via program argument)\n");
}
/* show the hostname so that we can tell where the processes are running */
- if (VERBOSE_DEF){
- if (gethostname(hostname, 128) < 0){
- PRINTID;
- printf("gethostname failed\n");
- return 1;
- }
- PRINTID;
- printf("hostname=%s\n", hostname);
+ if (VERBOSE_DEF) {
+#ifdef H5_HAVE_GETHOSTNAME
+ if (HDgethostname(hostname, sizeof(hostname)) < 0) {
+ HDprintf("gethostname failed\n");
+ hostname[0] = '\0';
+ }
+#else
+ HDprintf("gethostname unavailable\n");
+ hostname[0] = '\0';
+#endif
+ PRINTID;
+ HDprintf("hostname=%s\n", hostname);
}
/* Delete any old file in order to start anew. */
/* Must delete because MPI_File_open does not have a Truncate mode. */
/* Don't care if it has error. */
MPI_File_delete(filename, MPI_INFO_NULL);
- MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */
-
- if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename,
- MPI_MODE_RDWR | MPI_MODE_CREATE ,
- MPI_INFO_NULL, &fh))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- PRINTID;
- printf("MPI_File_open failed (%s)\n", mpi_err_str);
- return 1;
- }
+ MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */
-if (special_request & USEATOM){
- /* ==================================================
- * Set atomcity to true (1). A POSIX compliant filesystem
- * should not need this.
- * ==================================================*/
- if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- PRINTID;
- printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str);
- }
- if (VERBOSE_HI)
- printf("Initial atomicity = %d\n", atomicity);
- if ((mpi_err = MPI_File_set_atomicity(fh, 1)) != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- PRINTID;
- printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str);
+ if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL,
+ &fh)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ PRINTID;
+ HDprintf("MPI_File_open failed (%s)\n", mpi_err_str);
+ return 1;
}
- if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- PRINTID;
- printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str);
+
+ if (special_request & USEATOM) {
+ /* ==================================================
+ * Set atomcity to true (1). A POSIX compliant filesystem
+ * should not need this.
+ * ==================================================*/
+ if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ PRINTID;
+ HDprintf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str);
+ }
+ if (VERBOSE_HI)
+ HDprintf("Initial atomicity = %d\n", atomicity);
+ if ((mpi_err = MPI_File_set_atomicity(fh, 1)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ PRINTID;
+ HDprintf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str);
+ }
+ if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ PRINTID;
+ HDprintf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str);
+ }
+ if (VERBOSE_HI)
+ HDprintf("After set_atomicity atomicity = %d\n", atomicity);
}
- if (VERBOSE_HI)
- printf("After set_atomicity atomicity = %d\n", atomicity);
-}
/* This barrier is not necessary but do it anyway. */
MPI_Barrier(MPI_COMM_WORLD);
- if (VERBOSE_HI){
- PRINTID;
- printf("between MPI_Barrier and MPI_File_write_at\n");
+ if (VERBOSE_HI) {
+ PRINTID;
+ HDprintf("between MPI_Barrier and MPI_File_write_at\n");
}
/* ==================================================
* Each process calculates what to write but
* only process irank(0) writes.
* ==================================================*/
- irank=0;
- for (i=0; i < DIMSIZE; i++)
- writedata[i] = irank*DIMSIZE + i;
- mpi_off = irank*DIMSIZE;
+ irank = 0;
+ for (i = 0; i < DIMSIZE; i++)
+ writedata[i] = (uint8_t)(irank * DIMSIZE + i);
+ mpi_off = irank * DIMSIZE;
/* Only one process writes */
- if (mpi_rank==irank){
- if (VERBOSE_HI){
- PRINTID; printf("wrote %d bytes at %ld\n", DIMSIZE, (long)mpi_off);
- }
- if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE,
- MPI_BYTE, &mpi_stat))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- PRINTID;
- printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n",
- (long) mpi_off, DIMSIZE, mpi_err_str);
- return 1;
- };
+ if (mpi_rank == irank) {
+ if (VERBOSE_HI) {
+ PRINTID;
+ HDprintf("wrote %d bytes at %ld\n", DIMSIZE, (long)mpi_off);
+ }
+ if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, MPI_BYTE, &mpi_stat)) !=
+ MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ PRINTID;
+ HDprintf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", (long)mpi_off, DIMSIZE,
+ mpi_err_str);
+ return 1;
+ };
};
/* Bcast the return code and */
/* make sure all writing are done before reading. */
MPI_Bcast(&mpi_err, 1, MPI_INT, irank, MPI_COMM_WORLD);
- if (VERBOSE_HI){
- PRINTID;
- printf("MPI_Bcast: mpi_err = %d\n", mpi_err);
+ if (VERBOSE_HI) {
+ PRINTID;
+ HDprintf("MPI_Bcast: mpi_err = %d\n", mpi_err);
}
-if (special_request & USEFSYNC){
- /* ==================================================
- * Do a file sync. A POSIX compliant filesystem
- * should not need this.
- * ==================================================*/
- if (VERBOSE_HI)
- printf("Apply MPI_File_sync\n");
- /* call file_sync to force the write out */
- if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- PRINTID;
- printf("MPI_File_sync failed (%s)\n", mpi_err_str);
- }
- MPI_Barrier(MPI_COMM_WORLD);
- /* call file_sync to force the write out */
- if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- PRINTID;
- printf("MPI_File_sync failed (%s)\n", mpi_err_str);
+ if (special_request & USEFSYNC) {
+ /* ==================================================
+ * Do a file sync. A POSIX compliant filesystem
+ * should not need this.
+ * ==================================================*/
+ if (VERBOSE_HI)
+ HDprintf("Apply MPI_File_sync\n");
+ /* call file_sync to force the write out */
+ if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ PRINTID;
+ HDprintf("MPI_File_sync failed (%s)\n", mpi_err_str);
+ }
+ MPI_Barrier(MPI_COMM_WORLD);
+ /* call file_sync to force the write out */
+ if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ PRINTID;
+ HDprintf("MPI_File_sync failed (%s)\n", mpi_err_str);
+ }
}
-}
/* This barrier is not necessary because the Bcase or File_sync above */
/* should take care of it. Do it anyway. */
MPI_Barrier(MPI_COMM_WORLD);
- if (VERBOSE_HI){
- PRINTID;
- printf("after MPI_Barrier\n");
+ if (VERBOSE_HI) {
+ PRINTID;
+ HDprintf("after MPI_Barrier\n");
}
/* ==================================================
* Each process reads what process 0 wrote and verify.
* ==================================================*/
- irank=0;
- mpi_off = irank*DIMSIZE;
- if ((mpi_err = MPI_File_read_at(fh, mpi_off, readdata, DIMSIZE, MPI_BYTE,
- &mpi_stat))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- PRINTID;
- printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n",
- (long) mpi_off, DIMSIZE, mpi_err_str);
- return 1;
+ irank = 0;
+ mpi_off = irank * DIMSIZE;
+ if ((mpi_err = MPI_File_read_at(fh, mpi_off, readdata, DIMSIZE, MPI_BYTE, &mpi_stat)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ PRINTID;
+ HDprintf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", (long)mpi_off, DIMSIZE,
+ mpi_err_str);
+ return 1;
};
- for (i=0; i < DIMSIZE; i++){
- expect_val = irank*DIMSIZE + i;
- if (readdata[i] != expect_val){
- PRINTID;
- printf("read data[%d:%d] got %02x, expect %02x\n", irank, i,
- readdata[i], expect_val);
- nerrs++;
- }
+ for (i = 0; i < DIMSIZE; i++) {
+ expect_val = (uint8_t)(irank * DIMSIZE + i);
+ if (readdata[i] != expect_val) {
+ PRINTID;
+ HDprintf("read data[%d:%d] got %02x, expect %02x\n", irank, i, readdata[i], expect_val);
+ nerrs++;
+ }
}
MPI_File_close(&fh);
- if (VERBOSE_HI){
- PRINTID;
- printf("%d data errors detected\n", nerrs);
+ if (VERBOSE_HI) {
+ PRINTID;
+ HDprintf("%d data errors detected\n", nerrs);
}
mpi_err = MPI_Barrier(MPI_COMM_WORLD);
@@ -617,131 +604,129 @@ if (special_request & USEFSYNC){
/*
-Function: test_mpio_derived_dtype
-
-Test Whether the Displacement of MPI derived datatype
-(+ File_set_view + MPI_write)works or not on this MPI-IO package
-and this platform.
-
-1. Details for the test:
-1) Create two derived datatypes with MPI_Type_hindexed:
- datatype1:
- count = 1, blocklens = 1, offsets = 0,
- base type = MPI_BYTE(essentially a char)
- datatype2:
- count = 1, blocklens = 1, offsets = 1(byte),
- base type = MPI_BYTE
-
-2) Using these two derived datatypes,
- Build another derived datatype with MPI_Type_struct:
- advtype: derived from datatype1 and datatype2
- advtype:
- count = 2, blocklens[0] = 1, blocklens[1]=1,
- offsets[0] = 0, offsets[1] = 1(byte),
- bas_type[0]=datatype1,
- bas_type[1] = datatype2;
-
-3) Setting MPI file view with advtype
-4) Writing 2 bytes 1 to 2 using MPI_File_write to a file
-5) File content:
-Suppose the fill value of the file is 0(most machines indeed do so)
-and Fill value is embraced with "() in the following output:
-Expected output should be:
-1,0,2
-
-
-
-However, at some platforms, for example, IBM AIX(at March 23rd, 2005):
-the following values were obtained:
-1,2,0
-
-The problem is that the displacement of the second derived datatype(datatype2) which formed the final derived datatype(advtype)
- has been put after the basic datatype(MPI_BYTE) of datatype2. This is a bug.
-
-
-2. This test will verify whether the complicated derived datatype is working on
-the current platform.
-
-If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change
-the configuration specific file of HDF5 so that we can change our configurationsetting to support collective IO for irregular selections.
-
-If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that
-we can turn off collective IO support for irregular selections.
-*/
-
-static int test_mpio_derived_dtype(char *filename) {
-
- MPI_File fh;
- char mpi_err_str[MPI_MAX_ERROR_STRING];
- int mpi_err_strlen;
- int mpi_err;
- int i;
- int nerrors = 0; /* number of errors */
- MPI_Datatype etype,filetype;
- MPI_Datatype adv_filetype,bas_filetype[2];
- MPI_Datatype etypenew, filetypenew;
- MPI_Offset disp;
- MPI_Status Status;
- MPI_Aint adv_disp[2];
- MPI_Aint offsets[1];
- int blocklens[1],adv_blocklens[2];
- int count,outcount;
- int retcode;
-
- int mpi_rank,mpi_size;
-
- char buf[3],outbuf[3] = {0};
+ Function: test_mpio_derived_dtype
+
+ Test Whether the Displacement of MPI derived datatype
+ (+ File_set_view + MPI_write)works or not on this MPI-IO package
+ and this platform.
+
+ 1. Details for the test:
+ 1) Create two derived datatypes with MPI_Type_create_hindexed:
+ datatype1:
+ count = 1, blocklens = 1, offsets = 0,
+ base type = MPI_BYTE(essentially a char)
+ datatype2:
+ count = 1, blocklens = 1, offsets = 1(byte),
+ base type = MPI_BYTE
+
+ 2) Using these two derived datatypes,
+ Build another derived datatype with MPI_Type_create_struct:
+ advtype: derived from datatype1 and datatype2
+ advtype:
+ count = 2, blocklens[0] = 1, blocklens[1]=1,
+ offsets[0] = 0, offsets[1] = 1(byte),
+ bas_type[0]=datatype1,
+ bas_type[1] = datatype2;
+
+ 3) Setting MPI file view with advtype
+ 4) Writing 2 bytes 1 to 2 using MPI_File_write to a file
+ 5) File content:
+ Suppose the fill value of the file is 0(most machines indeed do so)
+ and Fill value is embraced with "() in the following output:
+ Expected output should be:
+ 1,0,2
+
+
+
+ However, at some platforms, for example, IBM AIX(at March 23rd, 2005):
+ the following values were obtained:
+ 1,2,0
+
+ The problem is that the displacement of the second derived datatype(datatype2) which formed the final derived
+ datatype(advtype) has been put after the basic datatype(MPI_BYTE) of datatype2. This is a bug.
+
+
+ 2. This test will verify whether the complicated derived datatype is working on
+ the current platform.
+
+ If this bug has been fixed in the previous not-working package, this test will issue a HDprintf message to
+ tell the developer to change the configuration specific file of HDF5 so that we can change our
+ configurationsetting to support collective IO for irregular selections.
+
+ If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message
+ to inform the corresponding failure so that we can turn off collective IO support for irregular selections.
+ */
+
+static int
+test_mpio_derived_dtype(char *filename)
+{
+
+ MPI_File fh;
+ char mpi_err_str[MPI_MAX_ERROR_STRING];
+ int mpi_err_strlen;
+ int mpi_err;
+ int i;
+ MPI_Datatype etype, filetype;
+ MPI_Datatype adv_filetype, bas_filetype[2];
+ MPI_Datatype filetypenew;
+ MPI_Offset disp;
+ MPI_Status Status;
+ MPI_Aint adv_disp[2];
+ MPI_Aint offsets[1];
+ int blocklens[1], adv_blocklens[2];
+ int count, outcount;
+ int retcode;
+
+ int mpi_rank, mpi_size;
+
+ char buf[3], outbuf[3] = {0};
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
retcode = 0;
- for(i=0;i<3;i++)
- buf[i] = i+1;
+ for (i = 0; i < 3; i++)
+ buf[i] = (char)(i + 1);
-
- if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename,
- MPI_MODE_RDWR | MPI_MODE_CREATE,
- MPI_INFO_NULL, &fh))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_open failed (%s)\n", mpi_err_str);
- return 1;
+ if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL,
+ &fh)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ HDprintf("MPI_File_open failed (%s)\n", mpi_err_str);
+ return 1;
}
disp = 0;
etype = MPI_BYTE;
- count = 1;
+ count = 1;
blocklens[0] = 1;
offsets[0] = 0;
- if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&filetype))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
- return 1;
+ if ((mpi_err = MPI_Type_create_hindexed(count, blocklens, offsets, MPI_BYTE, &filetype)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ HDprintf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
+ return 1;
}
- if((mpi_err=MPI_Type_commit(&filetype))!=MPI_SUCCESS){
+ if ((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_commit failed (%s)\n", mpi_err_str);
- return 1;
+ HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str);
+ return 1;
}
- count = 1;
- blocklens[0]=1;
- offsets[0] = 1;
- if((mpi_err= MPI_Type_hindexed(count,blocklens,offsets,MPI_BYTE,&filetypenew))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
- return 1;
+ count = 1;
+ blocklens[0] = 1;
+ offsets[0] = 1;
+ if ((mpi_err = MPI_Type_create_hindexed(count, blocklens, offsets, MPI_BYTE, &filetypenew)) !=
+ MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ HDprintf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
+ return 1;
}
- if((mpi_err=MPI_Type_commit(&filetypenew))!=MPI_SUCCESS){
+ if ((mpi_err = MPI_Type_commit(&filetypenew)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_commit failed (%s)\n", mpi_err_str);
- return 1;
+ HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str);
+ return 1;
}
outcount = 2;
@@ -752,242 +737,222 @@ static int test_mpio_derived_dtype(char *filename) {
bas_filetype[0] = filetype;
bas_filetype[1] = filetypenew;
- if((mpi_err= MPI_Type_struct(outcount,adv_blocklens,adv_disp,bas_filetype,&adv_filetype))
- != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_struct failed (%s)\n", mpi_err_str);
- return 1;
+ if ((mpi_err = MPI_Type_create_struct(outcount, adv_blocklens, adv_disp, bas_filetype, &adv_filetype)) !=
+ MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ HDprintf("MPI_Type_create_struct failed (%s)\n", mpi_err_str);
+ return 1;
}
- if((mpi_err=MPI_Type_commit(&adv_filetype))!=MPI_SUCCESS){
+ if ((mpi_err = MPI_Type_commit(&adv_filetype)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_commit failed (%s)\n", mpi_err_str);
- return 1;
+ HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str);
+ return 1;
}
-
- if((mpi_err = MPI_File_set_view(fh,disp,etype,adv_filetype,"native",MPI_INFO_NULL))!= MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_set_view failed (%s)\n", mpi_err_str);
- return 1;
+ if ((mpi_err = MPI_File_set_view(fh, disp, etype, adv_filetype, "native", MPI_INFO_NULL)) !=
+ MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ HDprintf("MPI_File_set_view failed (%s)\n", mpi_err_str);
+ return 1;
}
- if((mpi_err = MPI_File_write(fh,buf,3,MPI_BYTE,&Status))!= MPI_SUCCESS){
+ if ((mpi_err = MPI_File_write(fh, buf, 3, MPI_BYTE, &Status)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_write failed (%s)\n", mpi_err_str);
- return 1;
- ;
+ HDprintf("MPI_File_write failed (%s)\n", mpi_err_str);
+ return 1;
}
-
- if((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_close failed (%s)\n", mpi_err_str);
- return 1;
+ if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ HDprintf("MPI_File_close failed (%s)\n", mpi_err_str);
+ return 1;
}
-
- if((mpi_err = MPI_File_open(MPI_COMM_WORLD,filename,MPI_MODE_RDONLY,MPI_INFO_NULL,&fh)) != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_open failed (%s)\n", mpi_err_str);
- return 1;
+ if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh)) !=
+ MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ HDprintf("MPI_File_open failed (%s)\n", mpi_err_str);
+ return 1;
}
- if((mpi_err = MPI_File_set_view(fh,0,MPI_BYTE,MPI_BYTE,"native",MPI_INFO_NULL))!= MPI_SUCCESS){
+ if ((mpi_err = MPI_File_set_view(fh, 0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_set_view failed (%s)\n", mpi_err_str);
- return 1;
+ HDprintf("MPI_File_set_view failed (%s)\n", mpi_err_str);
+ return 1;
}
- if((mpi_err = MPI_File_read(fh,outbuf,3,MPI_BYTE,&Status))!=MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_read failed (%s)\n", mpi_err_str);
- return 1;
+ if ((mpi_err = MPI_File_read(fh, outbuf, 3, MPI_BYTE, &Status)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ HDprintf("MPI_File_read failed (%s)\n", mpi_err_str);
+ return 1;
}
- if(outbuf[2]==2) {
- retcode = 0;
+ if (outbuf[2] == 2) {
+ retcode = 0;
}
else {
-/* if(mpi_rank == 0) {
- printf("complicated derived datatype is NOT working at this platform\n");
- printf("go back to hdf5/config and find the corresponding\n");
- printf("configure-specific file and change ?????\n");
- }
-*/
- retcode = -1;
- }
-
- if((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS){
- MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_close failed (%s)\n", mpi_err_str);
- return 1;
+ /* if(mpi_rank == 0) {
+ HDprintf("complicated derived datatype is NOT working at this platform\n");
+ HDprintf("go back to hdf5/config and find the corresponding\n");
+ HDprintf("configure-specific file and change ?????\n");
+ }
+ */
+ retcode = -1;
}
+ if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) {
+ MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
+ HDprintf("MPI_File_close failed (%s)\n", mpi_err_str);
+ return 1;
+ }
mpi_err = MPI_Barrier(MPI_COMM_WORLD);
- if(retcode == -1) {
- if(mpi_rank == 0) {
- printf("Complicated derived datatype is NOT working at this platform\n");
- printf(" Please report to help@hdfgroup.org about this problem.\n");
- }
- retcode = 1;
+ if (retcode == -1) {
+ if (mpi_rank == 0) {
+ HDprintf("Complicated derived datatype is NOT working at this platform\n");
+ HDprintf(" Please report to help@hdfgroup.org about this problem.\n");
+ }
+ retcode = 1;
}
return retcode;
}
/*
-Function: test_mpio_special_collective
+ Function: test_mpio_special_collective
-Test Whether collective IO is still working when more than one process
-has no contribution to IO. To properly test this case, at least FOUR
-processes are needed.
+ Test Whether collective IO is still working when more than one process
+ has no contribution to IO. To properly test this case, at least FOUR
+ processes are needed.
-1. Details for the test:
-1) Create one derived datatype with MPI_Type_hindexed:
+ 1. Details for the test:
+ 1) Create one derived datatype with MPI_Type_create_hindexed:
-2) Choosing at least two processes to contribute none for IO with
- the buf size inside MPI_Write_at_all to 0.
-3) Choosing at least two processes to have real contributions for IO.
-4) Do collective IO.
+ 2) Choosing at least two processes to contribute none for IO with
+ the buf size inside MPI_Write_at_all to 0.
+ 3) Choosing at least two processes to have real contributions for IO.
+ 4) Do collective IO.
-2. This test will fail with the MPI-IO package that doesn't support this. For example,
-mpich 1.2.6.
+ 2. This test will fail with the MPI-IO package that doesn't support this. For example,
+ mpich 1.2.6.
-If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change
-the configuration specific file of HDF5 so that we can change our configurationsetting to support special collective IO; currently only special collective IO.
+ If this bug has been fixed in the previous not-working package, this test will issue a HDprintf message to
+ tell the developer to change the configuration specific file of HDF5 so that we can change our
+ configurationsetting to support special collective IO; currently only special collective IO.
-If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that
-we can turn off the support for special collective IO; currently only special collective IO.
-*/
+ If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message
+ to inform the corresponding failure so that we can turn off the support for special collective IO; currently
+ only special collective IO.
+ */
static int
test_mpio_special_collective(char *filename)
{
- int mpi_size, mpi_rank;
- MPI_File fh;
- MPI_Datatype etype,buftype,filetype;
- char mpi_err_str[MPI_MAX_ERROR_STRING];
- int mpi_err_strlen;
- int mpi_err;
- char writedata[2*DIMSIZE];
- char filerep[7] = "native";
- int i;
- int count,bufcount;
- int blocklens[2];
- MPI_Aint offsets[2];
- MPI_Offset mpi_off = 0;
- MPI_Status mpi_stat;
- int retcode = 0;
+ int mpi_size, mpi_rank;
+ MPI_File fh;
+ MPI_Datatype etype, buftype, filetype;
+ char mpi_err_str[MPI_MAX_ERROR_STRING];
+ int mpi_err_strlen;
+ int mpi_err;
+ char writedata[2 * DIMSIZE];
+ char filerep[7] = "native";
+ int i;
+ int count, bufcount;
+ int blocklens[2];
+ MPI_Aint offsets[2];
+ MPI_Offset mpi_off = 0;
+ MPI_Status mpi_stat;
+ int retcode = 0;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* create MPI data type */
etype = MPI_BYTE;
- if(mpi_rank == 0 || mpi_rank == 1) {
- count = DIMSIZE;
+ if (mpi_rank == 0 || mpi_rank == 1) {
+ count = DIMSIZE;
bufcount = 1;
} /* end if */
else {
- count = 0;
+ count = 0;
bufcount = 0;
} /* end else */
blocklens[0] = count;
- offsets[0] = mpi_rank*count;
+ offsets[0] = mpi_rank * count;
blocklens[1] = count;
- offsets[1] = (mpi_size+mpi_rank)*count;
-
- if(count !=0) {
- if((mpi_err = MPI_Type_hindexed(2,
- blocklens,
- offsets,
- etype,
- &filetype)) != MPI_SUCCESS) {
+ offsets[1] = (mpi_size + mpi_rank) * count;
+
+ if (count != 0) {
+ if ((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, &filetype)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
+ HDprintf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
return 1;
} /* end if */
- if((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) {
+ if ((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_commit failed (%s)\n", mpi_err_str);
+ HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str);
return 1;
} /* end if */
- if((mpi_err = MPI_Type_hindexed(2,
- blocklens,
- offsets,
- etype,
- &buftype)) != MPI_SUCCESS) {
+ if ((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, &buftype)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
+ HDprintf("MPI_Type_contiguous failed (%s)\n", mpi_err_str);
return 1;
} /* end if */
- if((mpi_err = MPI_Type_commit(&buftype)) != MPI_SUCCESS) {
+ if ((mpi_err = MPI_Type_commit(&buftype)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_Type_commit failed (%s)\n", mpi_err_str);
+ HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str);
return 1;
} /* end if */
- } /* end if */
+ } /* end if */
else {
filetype = MPI_BYTE;
buftype = MPI_BYTE;
} /* end else */
/* Open a file */
- if ((mpi_err = MPI_File_open(MPI_COMM_WORLD,
- filename,
- MPI_MODE_RDWR | MPI_MODE_CREATE,
- MPI_INFO_NULL,
+ if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL,
&fh)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_open failed (%s)\n", mpi_err_str);
+ HDprintf("MPI_File_open failed (%s)\n", mpi_err_str);
return 1;
} /* end if */
/* each process writes some data */
- for (i=0; i < 2*DIMSIZE; i++)
- writedata[i] = (char)(mpi_rank*DIMSIZE + i);
+ for (i = 0; i < 2 * DIMSIZE; i++)
+ writedata[i] = (char)(mpi_rank * DIMSIZE + i);
/* Set the file view */
- if((mpi_err = MPI_File_set_view(fh,
- mpi_off,
- MPI_BYTE,
- filetype,
- filerep,
- MPI_INFO_NULL)) != MPI_SUCCESS) {
+ if ((mpi_err = MPI_File_set_view(fh, mpi_off, MPI_BYTE, filetype, filerep, MPI_INFO_NULL)) !=
+ MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_set_view failed (%s)\n", mpi_err_str);
+ HDprintf("MPI_File_set_view failed (%s)\n", mpi_err_str);
return 1;
} /* end if */
/* Collectively write into the file */
- if ((mpi_err = MPI_File_write_at_all(fh,
- mpi_off,
- writedata,
- bufcount,
- buftype,
- &mpi_stat)) != MPI_SUCCESS) {
+ if ((mpi_err = MPI_File_write_at_all(fh, mpi_off, writedata, bufcount, buftype, &mpi_stat)) !=
+ MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n",
- (long) mpi_off, bufcount, mpi_err_str);
+ HDprintf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", (long)mpi_off, bufcount,
+ mpi_err_str);
return 1;
} /* end if */
/* Close the file */
if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) {
MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen);
- printf("MPI_File_close failed. \n");
+ HDprintf("MPI_File_close failed. \n");
return 1;
} /* end if */
/* Perform a barrier */
mpi_err = MPI_Barrier(MPI_COMM_WORLD);
- if(retcode != 0) {
- if(mpi_rank == 0) {
- printf("special collective IO is NOT working at this platform\n");
- printf(" Please report to help@hdfgroup.org about this problem.\n");
+ if (retcode != 0) {
+ if (mpi_rank == 0) {
+ HDprintf("special collective IO is NOT working at this platform\n");
+ HDprintf(" Please report to help@hdfgroup.org about this problem.\n");
} /* end if */
retcode = 1;
} /* end if */
@@ -1002,72 +967,74 @@ test_mpio_special_collective(char *filename)
static int
parse_options(int argc, char **argv)
{
- while (--argc){
- if (**(++argv) != '-'){
- break;
- }else{
- switch(*(*argv+1)){
- case 'v': if (*((*argv+1)+1))
- ParseTestVerbosity((*argv+1)+1);
- else
- SetTestVerbosity(VERBO_MED);
- break;
- case 'f': if (--argc < 1) {
- nerrors++;
- return(1);
- }
- if (**(++argv) == '-') {
- nerrors++;
- return(1);
- }
- paraprefix = *argv;
- break;
- case 'h': /* print help message--return with nerrors set */
- return(1);
- default: nerrors++;
- return(1);
- }
- }
+ while (--argc) {
+ if (**(++argv) != '-') {
+ break;
+ }
+ else {
+ switch (*(*argv + 1)) {
+ case 'v':
+ if (*((*argv + 1) + 1))
+ ParseTestVerbosity((*argv + 1) + 1);
+ else
+ SetTestVerbosity(VERBO_MED);
+ break;
+ case 'f':
+ if (--argc < 1) {
+ nerrors++;
+ return (1);
+ }
+ if (**(++argv) == '-') {
+ nerrors++;
+ return (1);
+ }
+ paraprefix = *argv;
+ break;
+ case 'h': /* print help message--return with nerrors set */
+ return (1);
+ default:
+ nerrors++;
+ return (1);
+ }
+ }
} /*while*/
/* compose the test filenames */
{
- int i, n;
- hid_t plist;
-
- plist = H5Pcreate (H5P_FILE_ACCESS);
- H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL);
- n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
-
- for (i=0; i < n; i++)
- if (h5_fixname(FILENAME[i],plist,filenames[i],sizeof(filenames[i]))
- == NULL){
- printf("h5_fixname failed\n");
- nerrors++;
- return(1);
- }
- H5Pclose(plist);
- if (VERBOSE_MED){
- printf("Test filenames are:\n");
- for (i=0; i < n; i++)
- printf(" %s\n", filenames[i]);
- }
+ int i, n;
+ hid_t plist;
+
+ plist = H5Pcreate(H5P_FILE_ACCESS);
+ H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL);
+ n = sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; /* exclude the NULL */
+
+ for (i = 0; i < n; i++)
+ if (h5_fixname(FILENAME[i], plist, filenames[i], sizeof(filenames[i])) == NULL) {
+ HDprintf("h5_fixname failed\n");
+ nerrors++;
+ return (1);
+ }
+ H5Pclose(plist);
+ if (VERBOSE_MED) {
+ HDprintf("Test filenames are:\n");
+ for (i = 0; i < n; i++)
+ HDprintf(" %s\n", filenames[i]);
+ }
}
- return(0);
+ return (0);
}
-
/*
* Show command usage
*/
static void
usage(void)
{
- printf("Usage: t_mpi [-v<verbosity>] [-f <prefix>]\n");
- printf("\t-v<verbosity>\tset verbose level (0-9,l,m,h)\n");
- printf("\t-f <prefix>\tfilename prefix\n");
- printf("\n");
+ HDprintf("Usage: t_mpi [-v<verbosity>] [-f <prefix>]\n");
+ HDprintf("\t-v<verbosity>\tset verbose level (0-9,l,m,h)\n");
+ HDprintf("\t-f <prefix>\tfilename prefix\n");
+ HDprintf("\n");
}
/*
@@ -1078,14 +1045,13 @@ errors_sum(int nerrs)
{
int temp;
MPI_Allreduce(&nerrs, &temp, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
- return(temp);
+ return (temp);
}
-
int
main(int argc, char **argv)
{
- int mpi_size, mpi_rank; /* mpi variables */
+ int mpi_size, mpi_rank; /* mpi variables */
int ret_code;
MPI_Init(&argc, &argv);
@@ -1097,63 +1063,61 @@ main(int argc, char **argv)
* hang in the atexit post processing in which it may try to make MPI
* calls. By then, MPI calls may not work.
*/
- if (H5dont_atexit() < 0){
- printf("Failed to turn off atexit processing. Continue.\n", mpi_rank);
+ if (H5dont_atexit() < 0) {
+ HDprintf("Failed to turn off atexit processing. Continue.\n");
};
H5open();
- if (parse_options(argc, argv) != 0){
- if (MAINPROCESS)
- usage();
- goto finish;
+ if (parse_options(argc, argv) != 0) {
+ if (MAINPROCESS)
+ usage();
+ goto finish;
}
- if (MAINPROCESS){
- printf("===================================\n");
- printf("MPI functionality tests\n");
- printf("===================================\n");
+ if (MAINPROCESS) {
+ HDprintf("===================================\n");
+ HDprintf("MPI functionality tests\n");
+ HDprintf("===================================\n");
}
if (VERBOSE_MED)
- h5_show_hostname();
+ h5_show_hostname();
- fapl = H5Pcreate (H5P_FILE_ACCESS);
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
/* set alarm. */
ALARM_ON;
-
/*=======================================
* MPIO 1 write Many read test
*=======================================*/
MPI_BANNER("MPIO 1 write Many read test...");
ret_code = test_mpio_1wMr(filenames[0], USENONE);
ret_code = errors_sum(ret_code);
- if (mpi_rank==0 && ret_code > 0){
- printf("***FAILED with %d total errors\n", ret_code);
- nerrors += ret_code;
+ if (mpi_rank == 0 && ret_code > 0) {
+ HDprintf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
}
/* test atomicity and file sync in high verbose mode only */
/* since they often hang when broken and PHDF5 does not use them. */
- if (VERBOSE_HI){
- MPI_BANNER("MPIO 1 write Many read test with atomicity...");
- ret_code = test_mpio_1wMr(filenames[0], USEATOM);
- ret_code = errors_sum(ret_code);
- if (mpi_rank==0 && ret_code > 0){
- printf("***FAILED with %d total errors\n", ret_code);
- nerrors += ret_code;
- }
-
- MPI_BANNER("MPIO 1 write Many read test with file sync...");
- ret_code = test_mpio_1wMr(filenames[0], USEFSYNC);
- ret_code = errors_sum(ret_code);
- if (mpi_rank==0 && ret_code > 0){
- printf("***FAILED with %d total errors\n", ret_code);
- nerrors += ret_code;
- }
- }
+ if (VERBOSE_HI) {
+ MPI_BANNER("MPIO 1 write Many read test with atomicity...");
+ ret_code = test_mpio_1wMr(filenames[0], USEATOM);
+ ret_code = errors_sum(ret_code);
+ if (mpi_rank == 0 && ret_code > 0) {
+ HDprintf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
+ }
+ MPI_BANNER("MPIO 1 write Many read test with file sync...");
+ ret_code = test_mpio_1wMr(filenames[0], USEFSYNC);
+ ret_code = errors_sum(ret_code);
+ if (mpi_rank == 0 && ret_code > 0) {
+ HDprintf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
+ }
+ }
/*=======================================
* MPIO MPIO File size range test
@@ -1162,13 +1126,13 @@ main(int argc, char **argv)
#ifndef H5_HAVE_WIN32_API
ret_code = test_mpio_gb_file(filenames[0]);
ret_code = errors_sum(ret_code);
- if (mpi_rank==0 && ret_code > 0){
- printf("***FAILED with %d total errors\n", ret_code);
- nerrors += ret_code;
+ if (mpi_rank == 0 && ret_code > 0) {
+ HDprintf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
}
#else
- if (mpi_rank==0)
- printf(" will be skipped on Windows (JIRA HDDFV-8064)\n");
+ if (mpi_rank == 0)
+ HDprintf(" will be skipped on Windows (JIRA HDDFV-8064)\n");
#endif
/*=======================================
@@ -1177,9 +1141,9 @@ main(int argc, char **argv)
MPI_BANNER("MPIO independent overlapping writes...");
ret_code = test_mpio_overlap_writes(filenames[0]);
ret_code = errors_sum(ret_code);
- if (mpi_rank==0 && ret_code > 0){
- printf("***FAILED with %d total errors\n", ret_code);
- nerrors += ret_code;
+ if (mpi_rank == 0 && ret_code > 0) {
+ HDprintf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
}
/*=======================================
@@ -1188,9 +1152,9 @@ main(int argc, char **argv)
MPI_BANNER("MPIO complicated derived datatype test...");
ret_code = test_mpio_derived_dtype(filenames[0]);
ret_code = errors_sum(ret_code);
- if (mpi_rank==0 && ret_code > 0){
- printf("***FAILED with %d total errors\n", ret_code);
- nerrors += ret_code;
+ if (mpi_rank == 0 && ret_code > 0) {
+ HDprintf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
}
/*=======================================
@@ -1199,7 +1163,7 @@ main(int argc, char **argv)
if (mpi_size < 4) {
MPI_BANNER("MPIO special collective io test SKIPPED.");
if (mpi_rank == 0)
- printf("This test needs at least four processes to run.\n");
+ HDprintf("This test needs at least four processes to run.\n");
ret_code = 0;
goto sc_finish;
} /* end if */
@@ -1209,26 +1173,25 @@ main(int argc, char **argv)
sc_finish:
ret_code = errors_sum(ret_code);
- if (mpi_rank==0 && ret_code > 0){
- printf("***FAILED with %d total errors\n", ret_code);
- nerrors += ret_code;
+ if (mpi_rank == 0 && ret_code > 0) {
+ HDprintf("***FAILED with %d total errors\n", ret_code);
+ nerrors += ret_code;
}
-
finish:
/* make sure all processes are finished before final report, cleanup
* and exit.
*/
MPI_Barrier(MPI_COMM_WORLD);
- if (MAINPROCESS){ /* only process 0 reports */
- printf("===================================\n");
- if (nerrors){
- printf("***MPI tests detected %d errors***\n", nerrors);
- }
- else{
- printf("MPI tests finished with no errors\n");
- }
- printf("===================================\n");
+ if (MAINPROCESS) { /* only process 0 reports */
+ HDprintf("===================================\n");
+ if (nerrors) {
+ HDprintf("***MPI tests detected %d errors***\n", nerrors);
+ }
+ else {
+ HDprintf("MPI tests finished with no errors\n");
+ }
+ HDprintf("===================================\n");
}
/* turn off alarm */
@@ -1241,6 +1204,5 @@ finish:
MPI_Finalize();
/* cannot just return (nerrors) because exit code is limited to 1byte */
- return(nerrors!=0);
+ return (nerrors != 0);
}
-
diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c
index 0782f3d..2a80f4a 100644
--- a/testpar/t_pflush1.c
+++ b/testpar/t_pflush1.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -15,186 +15,197 @@
* Programmer: Leon Arber <larber@uiuc.edu>
* Sept. 28, 2006.
*
- * Purpose: This is the first half of a two-part test that makes sure
- * that a file can be read after a parallel application crashes as long
- * as the file was flushed first. We simulate a crash by
- * calling _exit(0) since this doesn't flush HDF5 caches but
- * still exits with success.
+ * Purpose: This is the first half of a two-part test that makes sure
+ * that a file can be read after a parallel application crashes
+ * as long as the file was flushed first. We simulate a crash by
+ * calling _exit() since this doesn't flush HDF5 caches but
+ * still exits with success.
*/
-#include <mpi.h>
#include "h5test.h"
-const char *FILENAME[] = {
- "flush",
- "noflush",
- NULL
-};
+const char *FILENAME[] = {"flush", "noflush", NULL};
-static double the_data[100][100];
+static int data_g[100][100];
+
+#define N_GROUPS 100
/*-------------------------------------------------------------------------
- * Function: create_file
- *
- * Purpose: Creates file used in part 1 of the test
+ * Function: create_test_file
*
- * Return: Success: 0
+ * Purpose: Creates the file used in part 1 of the test
*
- * Failure: 1
+ * Return: Success: A valid file ID
+ * Failure: H5I_INVALID_HID
*
- * Programmer: Leon Arber
+ * Programmer: Leon Arber
* Sept. 26, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
-create_file(char* name, hid_t fapl)
+create_test_file(char *name, hid_t fapl_id)
{
- hid_t file, dcpl, space, dset, groups, grp, plist;
- hsize_t ds_size[2] = {100, 100};
- hsize_t ch_size[2] = {5, 5};
- hsize_t i, j;
-
-
-
- if((file=H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t top_level_gid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t dxpl_id = H5I_INVALID_HID;
+ hsize_t dims[2] = {100, 100};
+ hsize_t chunk_dims[2] = {5, 5};
+ hsize_t i, j;
+
+ if ((fid = H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ goto error;
/* Create a chunked dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dcpl, 2, ch_size) < 0) goto error;
- if((space = H5Screate_simple(2, ds_size, NULL)) < 0) goto error;
- if((dset = H5Dcreate2(file, "dset", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
-
- plist = H5Pcreate(H5P_DATASET_XFER);
- H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
-
+ if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0)
+ goto error;
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
+ if ((did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
/* Write some data */
- for(i = 0; i < ds_size[0]; i++) {
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
- for(j = 0; j < ds_size[1]; j++)
- the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1);
- }
- if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, plist, the_data) < 0) goto error;
+ for (i = 0; i < dims[0]; i++)
+ for (j = 0; j < dims[1]; j++)
+ data_g[i][j] = (int)(i + (i * j) + j);
+
+ if (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, dxpl_id, data_g) < 0)
+ goto error;
/* Create some groups */
- if((groups = H5Gcreate2(file, "some_groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- for(i = 0; i < 100; i++) {
- sprintf(name, "grp%02u", (unsigned)i);
- if((grp = H5Gcreate2(groups, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Gclose(grp) < 0) goto error;
+ if ((top_level_gid = H5Gcreate2(fid, "some_groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < N_GROUPS; i++) {
+ HDsprintf(name, "grp%02u", (unsigned)i);
+ if ((gid = H5Gcreate2(top_level_gid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(gid) < 0)
+ goto error;
}
- return file;
+ return fid;
error:
- HD_exit(1);
-}
+ return H5I_INVALID_HID;
+} /* end create_test_file() */
/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Part 1 of a two-part H5Fflush() test.
+ * Function: main
*
- * Return: Success: 0
+ * Purpose: Part 1 of a two-part parallel H5Fflush() test.
*
- * Failure: 1
+ * Return: EXIT_FAILURE (always)
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, October 23, 1998
*
- * Modifications:
- * Leon Arber
- * Sept. 26, 2006, expand test to check for failure if H5Fflush is not called.
- *
- *
*-------------------------------------------------------------------------
*/
int
-main(int argc, char* argv[])
+main(int argc, char *argv[])
{
- hid_t file1, file2, fapl;
- MPI_File *mpifh_p = NULL;
- char name[1024];
- const char *envval = NULL;
- int mpi_size, mpi_rank;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ MPI_File * mpifh_p = NULL;
+ char name[1024];
+ const char *envval = NULL;
+ int mpi_size;
+ int mpi_rank;
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
MPI_Init(&argc, &argv);
MPI_Comm_size(comm, &mpi_size);
MPI_Comm_rank(comm, &mpi_rank);
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- H5Pset_fapl_mpio(fapl, comm, info);
+ if (mpi_rank == 0)
+ TESTING("H5Fflush (part1)");
- if(mpi_rank == 0)
- TESTING("H5Fflush (part1)");
+ /* Don't run using the split VFD */
envval = HDgetenv("HDF5_DRIVER");
- if(envval == NULL)
+ if (envval == NULL)
envval = "nomatch";
- if(HDstrcmp(envval, "split")) {
- /* Create the file */
- h5_fixname(FILENAME[0], fapl, name, sizeof name);
- file1 = create_file(name, fapl);
- /* Flush and exit without closing the library */
- if(H5Fflush(file1, H5F_SCOPE_GLOBAL) < 0) goto error;
-
- /* Create the other file which will not be flushed */
- h5_fixname(FILENAME[1], fapl, name, sizeof name);
- file2 = create_file(name, fapl);
-
-
- if(mpi_rank == 0)
- PASSED();
- fflush(stdout);
- fflush(stderr);
- } /* end if */
- else {
- SKIPPED();
- puts(" Test not compatible with current Virtual File Driver");
- } /* end else */
-
- /*
- * Some systems like AIX do not like files not closed when MPI_Finalize
+
+ if (!HDstrcmp(envval, "split")) {
+ if (mpi_rank == 0) {
+ SKIPPED();
+ HDputs(" Test not compatible with current Virtual File Driver");
+ }
+ MPI_Finalize();
+ HDexit(EXIT_FAILURE);
+ }
+
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if (H5Pset_fapl_mpio(fapl_id, comm, info) < 0)
+ goto error;
+
+ /* Create the file */
+ h5_fixname(FILENAME[0], fapl_id, name, sizeof(name));
+ if ((fid1 = create_test_file(name, fapl_id)) < 0)
+ goto error;
+ /* Flush and exit without closing the library */
+ if (H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0)
+ goto error;
+
+ /* Create the other file which will not be flushed */
+ h5_fixname(FILENAME[1], fapl_id, name, sizeof(name));
+ if ((fid2 = create_test_file(name, fapl_id)) < 0)
+ goto error;
+
+ if (mpi_rank == 0)
+ PASSED();
+
+ HDfflush(stdout);
+ HDfflush(stderr);
+
+ /* Some systems like AIX do not like files not being closed when MPI_Finalize
* is called. So, we need to get the MPI file handles, close them by hand.
* Then the _exit is still needed to stop at_exit from happening in some systems.
* Note that MPIO VFD returns the address of the file-handle in the VFD struct
* because MPI_File_close wants to modify the file-handle variable.
*/
- /* close file1 */
- if(H5Fget_vfd_handle(file1, fapl, (void **)&mpifh_p) < 0) {
- printf("H5Fget_vfd_handle for file1 failed\n");
- goto error;
- } /* end if */
- if(MPI_File_close(mpifh_p) != MPI_SUCCESS) {
- printf("MPI_File_close for file1 failed\n");
- goto error;
- } /* end if */
- /* close file2 */
- if(H5Fget_vfd_handle(file2, fapl, (void **)&mpifh_p) < 0) {
- printf("H5Fget_vfd_handle for file2 failed\n");
- goto error;
- } /* end if */
- if(MPI_File_close(mpifh_p) != MPI_SUCCESS) {
- printf("MPI_File_close for file2 failed\n");
- goto error;
- } /* end if */
-
- fflush(stdout);
- fflush(stderr);
- HD_exit(0);
+ /* Close file 1 */
+ if (H5Fget_vfd_handle(fid1, fapl_id, (void **)&mpifh_p) < 0)
+ goto error;
+ if (MPI_File_close(mpifh_p) != MPI_SUCCESS)
+ goto error;
+
+ /* Close file 2 */
+ if (H5Fget_vfd_handle(fid2, fapl_id, (void **)&mpifh_p) < 0)
+ goto error;
+ if (MPI_File_close(mpifh_p) != MPI_SUCCESS)
+ goto error;
+
+ HDfflush(stdout);
+ HDfflush(stderr);
+
+ /* Always exit with a failure code!
+ *
+ * In accordance with the standard, not having all processes
+ * call MPI_Finalize() can be considered an error, so mpiexec
+ * et al. may indicate failure on return. It's much easier to
+ * always ignore the failure condition than to handle some
+ * platforms returning success and others failure.
+ */
+ HD_exit(EXIT_FAILURE);
error:
- fflush(stdout);
- fflush(stderr);
- HD_exit(1);
-}
-
+ HDfflush(stdout);
+ HDfflush(stderr);
+ HDprintf("*** ERROR ***\n");
+ HDprintf("THERE WAS A REAL ERROR IN t_pflush1.\n");
+ HD_exit(EXIT_FAILURE);
+} /* end main() */
diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c
index bd8ce78..95f54a1 100644
--- a/testpar/t_pflush2.c
+++ b/testpar/t_pflush2.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -24,197 +24,199 @@
#include "h5test.h"
-const char *FILENAME[] = {
- "flush",
- "noflush",
- NULL
-};
+const char *FILENAME[] = {"flush", "noflush", NULL};
-static double the_data[100][100];
+static int data_g[100][100];
+#define N_GROUPS 100
/*-------------------------------------------------------------------------
- * Function: check_file
+ * Function: check_test_file
*
- * Purpose: Part 2 of a two-part H5Fflush() test.
+ * Purpose: Part 2 of a two-part H5Fflush() test.
*
- * Return: Success: 0
+ * Return: SUCCEED/FAIL
*
- * Failure: 1
- *
- * Programmer: Leon Arber
+ * Programmer: Leon Arber
* Sept. 26, 2006.
*
*-------------------------------------------------------------------------
*/
-static int
-check_file(char* name, hid_t fapl)
+static herr_t
+check_test_file(char *name, hid_t fapl_id)
{
- hid_t file, space, dset, groups, grp, plist;
- hsize_t ds_size[2];
- double error;
- hsize_t i, j;
-
- plist = H5Pcreate(H5P_DATASET_XFER);
- H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
- if((file = H5Fopen(name, H5F_ACC_RDONLY, fapl)) < 0) goto error;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t top_level_gid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t dxpl_id = H5I_INVALID_HID;
+ hsize_t dims[2];
+ int val;
+ hsize_t i, j;
+
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
+ if ((fid = H5Fopen(name, H5F_ACC_RDONLY, fapl_id)) < 0)
+ goto error;
/* Open the dataset */
- if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) goto error;
- if((space = H5Dget_space(dset)) < 0) goto error;
- if(H5Sget_simple_extent_dims(space, ds_size, NULL) < 0) goto error;
- assert(100==ds_size[0] && 100==ds_size[1]);
+ if ((did = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
+ goto error;
+ if ((sid = H5Dget_space(did)) < 0)
+ goto error;
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ goto error;
+ HDassert(100 == dims[0] && 100 == dims[1]);
/* Read some data */
- if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, plist,
- the_data) < 0) goto error;
- for (i=0; i<ds_size[0]; i++) {
- for (j=0; j<ds_size[1]; j++) {
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
- error = fabs(the_data[i][j]-(double)(hssize_t)i/((hssize_t)j+1));
- if (error>0.0001) {
- H5_FAILED();
- printf(" dset[%lu][%lu] = %g\n",
- (unsigned long)i, (unsigned long)j, the_data[i][j]);
- printf(" should be %g\n",
- (double)(hssize_t)i/(hssize_t)(j+1));
- goto error;
- }
- }
+ if (H5Dread(did, H5T_NATIVE_INT, sid, sid, dxpl_id, data_g) < 0)
+ goto error;
+ for (i = 0; i < dims[0]; i++) {
+ for (j = 0; j < dims[1]; j++) {
+ val = (int)(i + (i * j) + j);
+ if (data_g[i][j] != val) {
+ H5_FAILED();
+ HDprintf(" data_g[%lu][%lu] = %d\n", (unsigned long)i, (unsigned long)j, data_g[i][j]);
+ HDprintf(" should be %d\n", val);
+ }
+ }
}
/* Open some groups */
- if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error;
- for(i = 0; i < 100; i++) {
- sprintf(name, "grp%02u", (unsigned)i);
- if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error;
- if(H5Gclose(grp) < 0) goto error;
+ if ((top_level_gid = H5Gopen2(fid, "some_groups", H5P_DEFAULT)) < 0)
+ goto error;
+ for (i = 0; i < N_GROUPS; i++) {
+ HDsprintf(name, "grp%02u", (unsigned)i);
+ if ((gid = H5Gopen2(top_level_gid, name, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Gclose(gid) < 0)
+ goto error;
}
- if(H5Gclose(groups) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
- if(H5Pclose(plist) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
+ if (H5Gclose(top_level_gid) < 0)
+ goto error;
+ if (H5Dclose(did) < 0)
+ goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
+ if (H5Pclose(dxpl_id) < 0)
+ goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
- return 0;
+ return SUCCEED;
error:
- H5E_BEGIN_TRY {
- H5Pclose(plist);
- H5Gclose(groups);
- H5Dclose(dset);
- H5Fclose(file);
- H5Sclose(space);
- } H5E_END_TRY;
- return 1;
-}
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dxpl_id);
+ H5Gclose(top_level_gid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ H5Sclose(sid);
+ H5Gclose(gid);
+ }
+ H5E_END_TRY;
+ return FAIL;
+} /* end check_test_file() */
/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Part 2 of a two-part H5Fflush() test.
+ * Function: main
*
- * Return: Success: 0
+ * Purpose: Part 2 of a two-part H5Fflush() test.
*
- * Failure: 1
+ * Return: EXIT_SUCCESS/EXIT_FAIL
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, October 23, 1998
*
- * Modifications:
- * Leon Arber
- * Sept. 26, 2006, expand to check for case where the was file not flushed.
- *
*-------------------------------------------------------------------------
*/
int
-main(int argc, char* argv[])
+main(int argc, char *argv[])
{
- hid_t fapl1, fapl2;
+ hid_t fapl_id1 = H5I_INVALID_HID;
+ hid_t fapl_id2 = H5I_INVALID_HID;
H5E_auto2_t func;
-
- char name[1024];
+ char name[1024];
const char *envval = NULL;
- int mpi_size, mpi_rank;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
+ int mpi_size;
+ int mpi_rank;
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
MPI_Init(&argc, &argv);
MPI_Comm_size(comm, &mpi_size);
MPI_Comm_rank(comm, &mpi_rank);
- fapl1 = H5Pcreate(H5P_FILE_ACCESS);
- H5Pset_fapl_mpio(fapl1, comm, info);
-
- fapl2 = H5Pcreate(H5P_FILE_ACCESS);
- H5Pset_fapl_mpio(fapl2, comm, info);
-
-
- if(mpi_rank == 0)
- TESTING("H5Fflush (part2 with flush)");
+ if (mpi_rank == 0)
+ TESTING("H5Fflush (part2 with flush)");
- /* Don't run this test using the core or split file drivers */
+ /* Don't run using the split VFD */
envval = HDgetenv("HDF5_DRIVER");
if (envval == NULL)
envval = "nomatch";
- if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split")) {
- /* Check the case where the file was flushed */
- h5_fixname(FILENAME[0], fapl1, name, sizeof name);
- if(check_file(name, fapl1))
- {
- H5_FAILED()
- goto error;
- }
- else if(mpi_rank == 0)
- {
- PASSED()
- }
-
- /* Check the case where the file was not flushed. This should give an error
- * so we turn off the error stack temporarily */
- if(mpi_rank == 0)
- TESTING("H5Fflush (part2 without flush)");
- H5Eget_auto2(H5E_DEFAULT,&func,NULL);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
- h5_fixname(FILENAME[1], fapl2, name, sizeof name);
- if(check_file(name, fapl2))
- {
- if(mpi_rank == 0)
- {
- PASSED()
- }
- }
- else
- {
- H5_FAILED()
- goto error;
- }
- H5Eset_auto2(H5E_DEFAULT, func, NULL);
-
-
- h5_clean_files(&FILENAME[0], fapl1);
- h5_clean_files(&FILENAME[1], fapl2);
+
+ if (!HDstrcmp(envval, "split")) {
+ if (mpi_rank == 0) {
+ SKIPPED();
+ HDputs(" Test not compatible with current Virtual File Driver");
+ }
+ MPI_Finalize();
+ HDexit(EXIT_FAILURE);
}
- else
- {
- SKIPPED();
- puts(" Test not compatible with current Virtual File Driver");
+
+ if ((fapl_id1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if (H5Pset_fapl_mpio(fapl_id1, comm, info) < 0)
+ goto error;
+
+ if ((fapl_id2 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if (H5Pset_fapl_mpio(fapl_id2, comm, info) < 0)
+ goto error;
+
+ /* Check the case where the file was flushed */
+ h5_fixname(FILENAME[0], fapl_id1, name, sizeof(name));
+ if (check_test_file(name, fapl_id1)) {
+ H5_FAILED()
+ goto error;
+ }
+ else if (mpi_rank == 0) {
+ PASSED()
}
- MPI_Finalize();
- return 0;
+ /* Check the case where the file was not flushed. This should give an error
+ * so we turn off the error stack temporarily.
+ */
+ if (mpi_rank == 0)
+ TESTING("H5Fflush (part2 without flush)");
+ H5Eget_auto2(H5E_DEFAULT, &func, NULL);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ h5_fixname(FILENAME[1], fapl_id2, name, sizeof(name));
+ if (check_test_file(name, fapl_id2)) {
+ if (mpi_rank == 0)
+ PASSED()
+ }
+ else {
+ H5_FAILED()
+ goto error;
+ }
- error:
- return 1;
-}
+ H5Eset_auto2(H5E_DEFAULT, func, NULL);
+ h5_clean_files(&FILENAME[0], fapl_id1);
+ h5_clean_files(&FILENAME[1], fapl_id2);
+ MPI_Finalize();
+ HDexit(EXIT_SUCCESS);
+error:
+ HDexit(EXIT_FAILURE);
+} /* end main() */
diff --git a/testpar/t_ph5basic.c b/testpar/t_ph5basic.c
index 574591c..05f2c77 100644
--- a/testpar/t_ph5basic.c
+++ b/testpar/t_ph5basic.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,70 +17,67 @@
#include "testphdf5.h"
-
/*-------------------------------------------------------------------------
* Function: test_fapl_mpio_dup
*
* Purpose: Test if fapl_mpio property list keeps a duplicate of the
- * communicator and INFO objects given when set; and returns
- * duplicates of its components when H5Pget_fapl_mpio is called.
- *
- * Return: Success: None
+ * communicator and INFO objects given when set; and returns
+ * duplicates of its components when H5Pget_fapl_mpio is called.
*
- * Failure: Abort
+ * Return: Success: None
+ * Failure: Abort
*
* Programmer: Albert Cheng
* January 9, 2003
*
- * Modifications:
*-------------------------------------------------------------------------
*/
void
test_fapl_mpio_dup(void)
{
- int mpi_size, mpi_rank;
+ int mpi_size, mpi_rank;
MPI_Comm comm, comm_tmp;
- int mpi_size_old, mpi_rank_old;
- int mpi_size_tmp, mpi_rank_tmp;
- MPI_Info info = MPI_INFO_NULL;
+ int mpi_size_old, mpi_rank_old;
+ int mpi_size_tmp, mpi_rank_tmp;
+ MPI_Info info = MPI_INFO_NULL;
MPI_Info info_tmp = MPI_INFO_NULL;
- int mrc; /* MPI return value */
- hid_t acc_pl; /* File access properties */
- herr_t ret; /* hdf5 return value */
- int nkeys, nkeys_tmp;
+ int mrc; /* MPI return value */
+ hid_t acc_pl; /* File access properties */
+ herr_t ret; /* HDF5 return value */
+ int nkeys, nkeys_tmp;
if (VERBOSE_MED)
- printf("Verify fapl_mpio duplicates communicator and INFO objects\n");
+ HDprintf("Verify fapl_mpio duplicates communicator and INFO objects\n");
/* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
if (VERBOSE_MED)
- printf("rank/size of MPI_COMM_WORLD are %d/%d\n", mpi_rank, mpi_size);
+ HDprintf("rank/size of MPI_COMM_WORLD are %d/%d\n", mpi_rank, mpi_size);
/* Create a new communicator that has the same processes as MPI_COMM_WORLD.
* Use MPI_Comm_split because it is simplier than MPI_Comm_create
*/
mrc = MPI_Comm_split(MPI_COMM_WORLD, 0, 0, &comm);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_split");
- MPI_Comm_size(comm,&mpi_size_old);
- MPI_Comm_rank(comm,&mpi_rank_old);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Comm_split");
+ MPI_Comm_size(comm, &mpi_size_old);
+ MPI_Comm_rank(comm, &mpi_rank_old);
if (VERBOSE_MED)
- printf("rank/size of comm are %d/%d\n", mpi_rank_old, mpi_size_old);
+ HDprintf("rank/size of comm are %d/%d\n", mpi_rank_old, mpi_size_old);
/* create a new INFO object with some trivial information. */
mrc = MPI_Info_create(&info);
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_create");
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_create");
mrc = MPI_Info_set(info, "hdf_info_name", "XYZ");
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_set");
- if (MPI_INFO_NULL != info){
- mrc=MPI_Info_get_nkeys(info, &nkeys);
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys");
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_set");
+ if (MPI_INFO_NULL != info) {
+ mrc = MPI_Info_get_nkeys(info, &nkeys);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys");
}
if (VERBOSE_MED)
- h5_dump_info_object(info);
+ h5_dump_info_object(info);
- acc_pl = H5Pcreate (H5P_FILE_ACCESS);
+ acc_pl = H5Pcreate(H5P_FILE_ACCESS);
VRFY((acc_pl >= 0), "H5P_FILE_ACCESS");
ret = H5Pset_fapl_mpio(acc_pl, comm, info);
@@ -92,28 +89,27 @@ test_fapl_mpio_dup(void)
* valid communicator and INFO object.
*/
mrc = MPI_Comm_free(&comm);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
- if (MPI_INFO_NULL!=info){
- mrc = MPI_Info_free(&info);
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_free");
+ VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free");
+ if (MPI_INFO_NULL != info) {
+ mrc = MPI_Info_free(&info);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_free");
}
ret = H5Pget_fapl_mpio(acc_pl, &comm_tmp, &info_tmp);
VRFY((ret >= 0), "H5Pget_fapl_mpio");
- MPI_Comm_size(comm_tmp,&mpi_size_tmp);
- MPI_Comm_rank(comm_tmp,&mpi_rank_tmp);
+ MPI_Comm_size(comm_tmp, &mpi_size_tmp);
+ MPI_Comm_rank(comm_tmp, &mpi_rank_tmp);
if (VERBOSE_MED)
- printf("After H5Pget_fapl_mpio: rank/size of comm are %d/%d\n",
- mpi_rank_tmp, mpi_size_tmp);
- VRFY((mpi_size_tmp==mpi_size), "MPI_Comm_size");
- VRFY((mpi_rank_tmp==mpi_rank), "MPI_Comm_rank");
- if (MPI_INFO_NULL != info_tmp){
- mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp);
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys");
- VRFY((nkeys_tmp==nkeys), "new and old nkeys equal");
+ HDprintf("After H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", mpi_rank_tmp, mpi_size_tmp);
+ VRFY((mpi_size_tmp == mpi_size), "MPI_Comm_size");
+ VRFY((mpi_rank_tmp == mpi_rank), "MPI_Comm_rank");
+ if (MPI_INFO_NULL != info_tmp) {
+ mrc = MPI_Info_get_nkeys(info_tmp, &nkeys_tmp);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys");
+ VRFY((nkeys_tmp == nkeys), "new and old nkeys equal");
}
if (VERBOSE_MED)
- h5_dump_info_object(info_tmp);
+ h5_dump_info_object(info_tmp);
/* Case 2:
* Free the retrieved communicator and INFO object.
@@ -122,23 +118,23 @@ test_fapl_mpio_dup(void)
* Also verify the NULL argument option.
*/
mrc = MPI_Comm_free(&comm_tmp);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
- if (MPI_INFO_NULL!=info_tmp){
- mrc = MPI_Info_free(&info_tmp);
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_free");
+ VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free");
+ if (MPI_INFO_NULL != info_tmp) {
+ mrc = MPI_Info_free(&info_tmp);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_free");
}
/* check NULL argument options. */
ret = H5Pget_fapl_mpio(acc_pl, &comm_tmp, NULL);
VRFY((ret >= 0), "H5Pget_fapl_mpio Comm only");
mrc = MPI_Comm_free(&comm_tmp);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
+ VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free");
ret = H5Pget_fapl_mpio(acc_pl, NULL, &info_tmp);
VRFY((ret >= 0), "H5Pget_fapl_mpio Info only");
- if (MPI_INFO_NULL!=info_tmp){
- mrc = MPI_Info_free(&info_tmp);
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_free");
+ if (MPI_INFO_NULL != info_tmp) {
+ mrc = MPI_Info_free(&info_tmp);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_free");
}
ret = H5Pget_fapl_mpio(acc_pl, NULL, NULL);
@@ -148,44 +144,41 @@ test_fapl_mpio_dup(void)
/* Donot free the returned objects which are used in the next case. */
ret = H5Pget_fapl_mpio(acc_pl, &comm_tmp, &info_tmp);
VRFY((ret >= 0), "H5Pget_fapl_mpio");
- MPI_Comm_size(comm_tmp,&mpi_size_tmp);
- MPI_Comm_rank(comm_tmp,&mpi_rank_tmp);
+ MPI_Comm_size(comm_tmp, &mpi_size_tmp);
+ MPI_Comm_rank(comm_tmp, &mpi_rank_tmp);
if (VERBOSE_MED)
- printf("After second H5Pget_fapl_mpio: rank/size of comm are %d/%d\n",
- mpi_rank_tmp, mpi_size_tmp);
- VRFY((mpi_size_tmp==mpi_size), "MPI_Comm_size");
- VRFY((mpi_rank_tmp==mpi_rank), "MPI_Comm_rank");
- if (MPI_INFO_NULL != info_tmp){
- mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp);
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys");
- VRFY((nkeys_tmp==nkeys), "new and old nkeys equal");
+ HDprintf("After second H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", mpi_rank_tmp, mpi_size_tmp);
+ VRFY((mpi_size_tmp == mpi_size), "MPI_Comm_size");
+ VRFY((mpi_rank_tmp == mpi_rank), "MPI_Comm_rank");
+ if (MPI_INFO_NULL != info_tmp) {
+ mrc = MPI_Info_get_nkeys(info_tmp, &nkeys_tmp);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys");
+ VRFY((nkeys_tmp == nkeys), "new and old nkeys equal");
}
if (VERBOSE_MED)
- h5_dump_info_object(info_tmp);
+ h5_dump_info_object(info_tmp);
/* Case 3:
* Close the property list and verify the retrieved communicator and INFO
* object are still valid.
*/
H5Pclose(acc_pl);
- MPI_Comm_size(comm_tmp,&mpi_size_tmp);
- MPI_Comm_rank(comm_tmp,&mpi_rank_tmp);
+ MPI_Comm_size(comm_tmp, &mpi_size_tmp);
+ MPI_Comm_rank(comm_tmp, &mpi_rank_tmp);
if (VERBOSE_MED)
- printf("After Property list closed: rank/size of comm are %d/%d\n",
- mpi_rank_tmp, mpi_size_tmp);
- if (MPI_INFO_NULL != info_tmp){
- mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp);
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys");
+ HDprintf("After Property list closed: rank/size of comm are %d/%d\n", mpi_rank_tmp, mpi_size_tmp);
+ if (MPI_INFO_NULL != info_tmp) {
+ mrc = MPI_Info_get_nkeys(info_tmp, &nkeys_tmp);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys");
}
if (VERBOSE_MED)
- h5_dump_info_object(info_tmp);
+ h5_dump_info_object(info_tmp);
/* clean up */
mrc = MPI_Comm_free(&comm_tmp);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
- if (MPI_INFO_NULL!=info_tmp){
- mrc = MPI_Info_free(&info_tmp);
- VRFY((mrc==MPI_SUCCESS), "MPI_Info_free");
+ VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free");
+ if (MPI_INFO_NULL != info_tmp) {
+ mrc = MPI_Info_free(&info_tmp);
+ VRFY((mrc == MPI_SUCCESS), "MPI_Info_free");
}
-}
-
+} /* end test_fapl_mpio_dup() */
diff --git a/testpar/t_prestart.c b/testpar/t_prestart.c
index 719d150..38eed4a 100644
--- a/testpar/t_prestart.c
+++ b/testpar/t_prestart.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -21,37 +21,34 @@
#include "testphdf5.h"
-int nerrors = 0; /* errors count */
+int nerrors = 0; /* errors count */
-const char *FILENAME[] = {
- "shutdown",
- NULL
-};
+const char *FILENAME[] = {"shutdown", NULL};
int
-main (int argc, char **argv)
+main(int argc, char **argv)
{
- hid_t file_id, dset_id, grp_id;
- hid_t fapl, sid, mem_dataspace;
- herr_t ret;
- char filename[1024];
- int mpi_size, mpi_rank, ndims, i, j;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
- hsize_t dims[RANK];
- hsize_t start[RANK];
- hsize_t count[RANK];
- hsize_t stride[RANK];
- hsize_t block[RANK];
- DATATYPE *data_array = NULL, *dataptr; /* data buffer */
+ hid_t file_id, dset_id, grp_id;
+ hid_t fapl, sid, mem_dataspace;
+ herr_t ret;
+ char filename[1024];
+ int mpi_size, mpi_rank, ndims, i, j;
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
+ hsize_t dims[RANK];
+ hsize_t start[RANK];
+ hsize_t count[RANK];
+ hsize_t stride[RANK];
+ hsize_t block[RANK];
+ DATATYPE *data_array = NULL, *dataptr; /* data buffer */
MPI_Init(&argc, &argv);
MPI_Comm_size(comm, &mpi_size);
- MPI_Comm_rank(comm, &mpi_rank);
+ MPI_Comm_rank(comm, &mpi_rank);
+
+ if (MAINPROCESS)
+ TESTING("proper shutdown of HDF5 library");
- if(MAINPROCESS)
- TESTING("proper shutdown of HDF5 library");
-
/* Set up file access property list with parallel I/O access */
fapl = H5Pcreate(H5P_FILE_ACCESS);
VRFY((fapl >= 0), "H5Pcreate succeeded");
@@ -73,64 +70,62 @@ main (int argc, char **argv)
ndims = H5Sget_simple_extent_dims(sid, dims, NULL);
VRFY((ndims == 2), "H5Sget_simple_extent_dims succeeded");
- VRFY(dims[0] == ROW_FACTOR*mpi_size, "Wrong dataset dimensions");
- VRFY(dims[1] == COL_FACTOR*mpi_size, "Wrong dataset dimensions");
+ VRFY(dims[0] == ROW_FACTOR * mpi_size, "Wrong dataset dimensions");
+ VRFY(dims[1] == COL_FACTOR * mpi_size, "Wrong dataset dimensions");
/* allocate memory for data buffer */
- data_array = (DATATYPE *)HDmalloc(dims[0]*dims[1]*sizeof(DATATYPE));
+ data_array = (DATATYPE *)HDmalloc(dims[0] * dims[1] * sizeof(DATATYPE));
VRFY((data_array != NULL), "data_array HDmalloc succeeded");
/* Each process takes a slabs of rows. */
- block[0] = dims[0]/mpi_size;
- block[1] = dims[1];
+ block[0] = dims[0] / mpi_size;
+ block[1] = dims[1];
stride[0] = block[0];
stride[1] = block[1];
- count[0] = 1;
- count[1] = 1;
- start[0] = mpi_rank*block[0];
- start[1] = 0;
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = mpi_rank * block[0];
+ start[1] = 0;
ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* write data independently */
- ret = H5Dread(dset_id, H5T_NATIVE_INT, mem_dataspace, sid,
- H5P_DEFAULT, data_array);
+ ret = H5Dread(dset_id, H5T_NATIVE_INT, mem_dataspace, sid, H5P_DEFAULT, data_array);
VRFY((ret >= 0), "H5Dwrite succeeded");
dataptr = data_array;
- for (i=0; i < block[0]; i++){
- for (j=0; j < block[1]; j++){
- if(*dataptr != mpi_rank+1) {
- printf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n",
- (unsigned long)i, (unsigned long)j,
- (unsigned long)(i+start[0]), (unsigned long)(j+start[1]),
- mpi_rank+1, *(dataptr));
- nerrors ++;
+ for (i = 0; i < block[0]; i++) {
+ for (j = 0; j < block[1]; j++) {
+ if (*dataptr != mpi_rank + 1) {
+ HDprintf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n",
+ (unsigned long)i, (unsigned long)j, (unsigned long)(i + start[0]),
+ (unsigned long)(j + start[1]), mpi_rank + 1, *(dataptr));
+ nerrors++;
}
dataptr++;
- }
+ }
}
MPI_Finalize();
HDremove(filename);
/* release data buffers */
- if(data_array)
+ if (data_array)
HDfree(data_array);
nerrors += GetTestNumErrs();
- if(MAINPROCESS) {
- if(0 == nerrors)
+ if (MAINPROCESS) {
+ if (0 == nerrors)
PASSED()
else
- H5_FAILED()
+ H5_FAILED()
}
- return (nerrors!=0);
+ return (nerrors != 0);
}
diff --git a/testpar/t_pshutdown.c b/testpar/t_pshutdown.c
index def7071..698c01f 100644
--- a/testpar/t_pshutdown.c
+++ b/testpar/t_pshutdown.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -25,37 +25,34 @@
#include "testphdf5.h"
-int nerrors = 0; /* errors count */
+int nerrors = 0; /* errors count */
-const char *FILENAME[] = {
- "shutdown",
- NULL
-};
+const char *FILENAME[] = {"shutdown", NULL};
int
-main (int argc, char **argv)
+main(int argc, char **argv)
{
- hid_t file_id, dset_id, grp_id;
- hid_t fapl, sid, mem_dataspace;
- hsize_t dims[RANK], i;
- herr_t ret;
- char filename[1024];
- int mpi_size, mpi_rank;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
- hsize_t start[RANK];
- hsize_t count[RANK];
- hsize_t stride[RANK];
- hsize_t block[RANK];
- DATATYPE *data_array = NULL; /* data buffer */
+ hid_t file_id, dset_id, grp_id;
+ hid_t fapl, sid, mem_dataspace;
+ hsize_t dims[RANK], i;
+ herr_t ret;
+ char filename[1024];
+ int mpi_size, mpi_rank;
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
+ hsize_t start[RANK];
+ hsize_t count[RANK];
+ hsize_t stride[RANK];
+ hsize_t block[RANK];
+ DATATYPE *data_array = NULL; /* data buffer */
MPI_Init(&argc, &argv);
MPI_Comm_size(comm, &mpi_size);
- MPI_Comm_rank(comm, &mpi_rank);
+ MPI_Comm_rank(comm, &mpi_rank);
+
+ if (MAINPROCESS)
+ TESTING("proper shutdown of HDF5 library");
- if(MAINPROCESS)
- TESTING("proper shutdown of HDF5 library");
-
/* Set up file access property list with parallel I/O access */
fapl = H5Pcreate(H5P_FILE_ACCESS);
VRFY((fapl >= 0), "H5Pcreate succeeded");
@@ -68,58 +65,57 @@ main (int argc, char **argv)
grp_id = H5Gcreate2(file_id, "Group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((grp_id >= 0), "H5Gcreate succeeded");
- dims[0] = ROW_FACTOR*mpi_size;
- dims[1] = COL_FACTOR*mpi_size;
- sid = H5Screate_simple (RANK, dims, NULL);
+ dims[0] = ROW_FACTOR * mpi_size;
+ dims[1] = COL_FACTOR * mpi_size;
+ sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded");
dset_id = H5Dcreate2(grp_id, "Dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dset_id >= 0), "H5Dcreate succeeded");
/* allocate memory for data buffer */
- data_array = (DATATYPE *)HDmalloc(dims[0]*dims[1]*sizeof(DATATYPE));
+ data_array = (DATATYPE *)HDmalloc(dims[0] * dims[1] * sizeof(DATATYPE));
VRFY((data_array != NULL), "data_array HDmalloc succeeded");
/* Each process takes a slabs of rows. */
- block[0] = dims[0]/mpi_size;
- block[1] = dims[1];
+ block[0] = dims[0] / mpi_size;
+ block[1] = dims[1];
stride[0] = block[0];
stride[1] = block[1];
- count[0] = 1;
- count[1] = 1;
- start[0] = mpi_rank*block[0];
- start[1] = 0;
+ count[0] = 1;
+ count[1] = 1;
+ start[0] = mpi_rank * block[0];
+ start[1] = 0;
/* put some trivial data in the data_array */
- for(i=0 ; i<dims[0]*dims[1]; i++)
+ for (i = 0; i < dims[0] * dims[1]; i++)
data_array[i] = mpi_rank + 1;
ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
- mem_dataspace = H5Screate_simple (RANK, block, NULL);
+ mem_dataspace = H5Screate_simple(RANK, block, NULL);
VRFY((mem_dataspace >= 0), "");
/* write data independently */
- ret = H5Dwrite(dset_id, H5T_NATIVE_INT, mem_dataspace, sid,
- H5P_DEFAULT, data_array);
+ ret = H5Dwrite(dset_id, H5T_NATIVE_INT, mem_dataspace, sid, H5P_DEFAULT, data_array);
VRFY((ret >= 0), "H5Dwrite succeeded");
/* release data buffers */
- if(data_array)
+ if (data_array)
HDfree(data_array);
MPI_Finalize();
nerrors += GetTestNumErrs();
- if(MAINPROCESS) {
- if(0 == nerrors)
+ if (MAINPROCESS) {
+ if (0 == nerrors)
PASSED()
else
- H5_FAILED()
+ H5_FAILED()
}
- return (nerrors!=0);
+ return (nerrors != 0);
}
diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c
index 4c139b3..3bd5a15 100644
--- a/testpar/t_shapesame.c
+++ b/testpar/t_shapesame.c
@@ -5,116 +5,106 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
This program will test independant and collective reads and writes between
- selections of different rank that non-the-less are deemed as having the
+ selections of different rank that non-the-less are deemed as having the
same shape by H5Sselect_shape_same().
*/
-#define H5S_PACKAGE /*suppress error about including H5Spkg */
+#define H5S_PACKAGE /*suppress error about including H5Spkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5S_TESTING
-
-#include "hdf5.h"
-#include "H5private.h"
+#include "H5Spkg.h" /* Dataspaces */
#include "testphdf5.h"
-#include "H5Spkg.h" /* Dataspaces */
-
/* On Lustre (and perhaps other parallel file systems?), we have severe
* slow downs if two or more processes attempt to access the same file system
* block. To minimize this problem, we set alignment in the shape same tests
- * to the default Lustre block size -- which greatly reduces contention in
+ * to the default Lustre block size -- which greatly reduces contention in
* the chunked dataset case.
*/
-#define SHAPE_SAME_TEST_ALIGNMENT ((hsize_t)(4 * 1024 * 1024))
-
-
-#define PAR_SS_DR_MAX_RANK 5 /* must update code if this changes */
-
-struct hs_dr_pio_test_vars_t
-{
- int mpi_size;
- int mpi_rank;
- MPI_Comm mpi_comm;
- MPI_Info mpi_info;
- int test_num;
- int edge_size;
- int checker_edge_size;
- int chunk_edge_size;
- int small_rank;
- int large_rank;
- hid_t dset_type;
- uint32_t * small_ds_buf_0;
- uint32_t * small_ds_buf_1;
- uint32_t * small_ds_buf_2;
- uint32_t * small_ds_slice_buf;
- uint32_t * large_ds_buf_0;
- uint32_t * large_ds_buf_1;
- uint32_t * large_ds_buf_2;
- uint32_t * large_ds_slice_buf;
- int small_ds_offset;
- int large_ds_offset;
- hid_t fid; /* HDF5 file ID */
- hid_t xfer_plist;
- hid_t full_mem_small_ds_sid;
- hid_t full_file_small_ds_sid;
- hid_t mem_small_ds_sid;
- hid_t file_small_ds_sid_0;
- hid_t file_small_ds_sid_1;
- hid_t small_ds_slice_sid;
- hid_t full_mem_large_ds_sid;
- hid_t full_file_large_ds_sid;
- hid_t mem_large_ds_sid;
- hid_t file_large_ds_sid_0;
- hid_t file_large_ds_sid_1;
- hid_t file_large_ds_process_slice_sid;
- hid_t mem_large_ds_process_slice_sid;
- hid_t large_ds_slice_sid;
- hid_t small_dataset; /* Dataset ID */
- hid_t large_dataset; /* Dataset ID */
- size_t small_ds_size;
- size_t small_ds_slice_size;
- size_t large_ds_size;
- size_t large_ds_slice_size;
- hsize_t dims[PAR_SS_DR_MAX_RANK];
- hsize_t chunk_dims[PAR_SS_DR_MAX_RANK];
- hsize_t start[PAR_SS_DR_MAX_RANK];
- hsize_t stride[PAR_SS_DR_MAX_RANK];
- hsize_t count[PAR_SS_DR_MAX_RANK];
- hsize_t block[PAR_SS_DR_MAX_RANK];
- hsize_t * start_ptr;
- hsize_t * stride_ptr;
- hsize_t * count_ptr;
- hsize_t * block_ptr;
- int skips;
- int max_skips;
- int64_t total_tests;
- int64_t tests_run;
- int64_t tests_skipped;
+#define SHAPE_SAME_TEST_ALIGNMENT ((hsize_t)(4 * 1024 * 1024))
+
+#define PAR_SS_DR_MAX_RANK 5 /* must update code if this changes */
+
+struct hs_dr_pio_test_vars_t {
+ int mpi_size;
+ int mpi_rank;
+ MPI_Comm mpi_comm;
+ MPI_Info mpi_info;
+ int test_num;
+ int edge_size;
+ int checker_edge_size;
+ int chunk_edge_size;
+ int small_rank;
+ int large_rank;
+ hid_t dset_type;
+ uint32_t *small_ds_buf_0;
+ uint32_t *small_ds_buf_1;
+ uint32_t *small_ds_buf_2;
+ uint32_t *small_ds_slice_buf;
+ uint32_t *large_ds_buf_0;
+ uint32_t *large_ds_buf_1;
+ uint32_t *large_ds_buf_2;
+ uint32_t *large_ds_slice_buf;
+ int small_ds_offset;
+ int large_ds_offset;
+ hid_t fid; /* HDF5 file ID */
+ hid_t xfer_plist;
+ hid_t full_mem_small_ds_sid;
+ hid_t full_file_small_ds_sid;
+ hid_t mem_small_ds_sid;
+ hid_t file_small_ds_sid_0;
+ hid_t file_small_ds_sid_1;
+ hid_t small_ds_slice_sid;
+ hid_t full_mem_large_ds_sid;
+ hid_t full_file_large_ds_sid;
+ hid_t mem_large_ds_sid;
+ hid_t file_large_ds_sid_0;
+ hid_t file_large_ds_sid_1;
+ hid_t file_large_ds_process_slice_sid;
+ hid_t mem_large_ds_process_slice_sid;
+ hid_t large_ds_slice_sid;
+ hid_t small_dataset; /* Dataset ID */
+ hid_t large_dataset; /* Dataset ID */
+ size_t small_ds_size;
+ size_t small_ds_slice_size;
+ size_t large_ds_size;
+ size_t large_ds_slice_size;
+ hsize_t dims[PAR_SS_DR_MAX_RANK];
+ hsize_t chunk_dims[PAR_SS_DR_MAX_RANK];
+ hsize_t start[PAR_SS_DR_MAX_RANK];
+ hsize_t stride[PAR_SS_DR_MAX_RANK];
+ hsize_t count[PAR_SS_DR_MAX_RANK];
+ hsize_t block[PAR_SS_DR_MAX_RANK];
+ hsize_t * start_ptr;
+ hsize_t * stride_ptr;
+ hsize_t * count_ptr;
+ hsize_t * block_ptr;
+ int skips;
+ int max_skips;
+ int64_t total_tests;
+ int64_t tests_run;
+ int64_t tests_skipped;
};
/*-------------------------------------------------------------------------
- * Function: hs_dr_pio_test__setup()
- *
- * Purpose: Do setup for tests of I/O to/from hyperslab selections of
- * different rank in the parallel case.
+ * Function: hs_dr_pio_test__setup()
*
- * Return: void
+ * Purpose: Do setup for tests of I/O to/from hyperslab selections of
+ * different rank in the parallel case.
*
- * Programmer: JRM -- 8/9/11
+ * Return: void
*
- * Modifications:
- *
- * None.
+ * Programmer: JRM -- 8/9/11
*
*-------------------------------------------------------------------------
*/
@@ -122,60 +112,53 @@ struct hs_dr_pio_test_vars_t
#define CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG 0
static void
-hs_dr_pio_test__setup(const int test_num,
- const int edge_size,
- const int checker_edge_size,
- const int chunk_edge_size,
- const int small_rank,
- const int large_rank,
- const hbool_t use_collective_io,
- const hid_t dset_type,
- const int express_test,
- struct hs_dr_pio_test_vars_t * tv_ptr)
+hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker_edge_size,
+ const int chunk_edge_size, const int small_rank, const int large_rank,
+ const hbool_t use_collective_io, const hid_t dset_type, const int express_test,
+ struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG
+#if CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG
const char *fcnName = "hs_dr_pio_test__setup()";
#endif /* CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG */
const char *filename;
- hbool_t mis_match = FALSE;
- int i;
+ hbool_t mis_match = FALSE;
+ int i;
int mrc;
- int mpi_rank; /* needed by the VRFY macro */
- uint32_t expected_value;
- uint32_t * ptr_0;
- uint32_t * ptr_1;
- hid_t acc_tpl; /* File access templates */
+ int mpi_rank; /* needed by the VRFY macro */
+ uint32_t expected_value;
+ uint32_t * ptr_0;
+ uint32_t * ptr_1;
+ hid_t acc_tpl; /* File access templates */
hid_t small_ds_dcpl_id = H5P_DEFAULT;
hid_t large_ds_dcpl_id = H5P_DEFAULT;
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
- HDassert( edge_size >= 6 );
- HDassert( edge_size >= chunk_edge_size );
- HDassert( ( chunk_edge_size == 0 ) || ( chunk_edge_size >= 3 ) );
- HDassert( 1 < small_rank );
- HDassert( small_rank < large_rank );
- HDassert( large_rank <= PAR_SS_DR_MAX_RANK );
+ HDassert(edge_size >= 6);
+ HDassert(edge_size >= chunk_edge_size);
+ HDassert((chunk_edge_size == 0) || (chunk_edge_size >= 3));
+ HDassert(1 < small_rank);
+ HDassert(small_rank < large_rank);
+ HDassert(large_rank <= PAR_SS_DR_MAX_RANK);
- tv_ptr->test_num = test_num;
- tv_ptr->edge_size = edge_size;
+ tv_ptr->test_num = test_num;
+ tv_ptr->edge_size = edge_size;
tv_ptr->checker_edge_size = checker_edge_size;
- tv_ptr->chunk_edge_size = chunk_edge_size;
- tv_ptr->small_rank = small_rank;
- tv_ptr->large_rank = large_rank;
- tv_ptr->dset_type = dset_type;
+ tv_ptr->chunk_edge_size = chunk_edge_size;
+ tv_ptr->small_rank = small_rank;
+ tv_ptr->large_rank = large_rank;
+ tv_ptr->dset_type = dset_type;
MPI_Comm_size(MPI_COMM_WORLD, &(tv_ptr->mpi_size));
MPI_Comm_rank(MPI_COMM_WORLD, &(tv_ptr->mpi_rank));
/* the VRFY() macro needs the local variable mpi_rank -- set it up now */
mpi_rank = tv_ptr->mpi_rank;
- HDassert( tv_ptr->mpi_size >= 1 );
+ HDassert(tv_ptr->mpi_size >= 1);
tv_ptr->mpi_comm = MPI_COMM_WORLD;
tv_ptr->mpi_info = MPI_INFO_NULL;
- for ( i = 0; i < tv_ptr->small_rank - 1; i++ )
- {
+ for (i = 0; i < tv_ptr->small_rank - 1; i++) {
tv_ptr->small_ds_size *= (size_t)(tv_ptr->edge_size);
tv_ptr->small_ds_slice_size *= (size_t)(tv_ptr->edge_size);
}
@@ -184,10 +167,10 @@ hs_dr_pio_test__setup(const int test_num,
/* used by checker board tests only */
tv_ptr->small_ds_offset = PAR_SS_DR_MAX_RANK - tv_ptr->small_rank;
- HDassert( 0 < tv_ptr->small_ds_offset );
- HDassert( tv_ptr->small_ds_offset < PAR_SS_DR_MAX_RANK );
+ HDassert(0 < tv_ptr->small_ds_offset);
+ HDassert(tv_ptr->small_ds_offset < PAR_SS_DR_MAX_RANK);
- for ( i = 0; i < tv_ptr->large_rank - 1; i++ ) {
+ for (i = 0; i < tv_ptr->large_rank - 1; i++) {
tv_ptr->large_ds_size *= (size_t)(tv_ptr->edge_size);
tv_ptr->large_ds_slice_size *= (size_t)(tv_ptr->edge_size);
@@ -197,9 +180,8 @@ hs_dr_pio_test__setup(const int test_num,
/* used by checker board tests only */
tv_ptr->large_ds_offset = PAR_SS_DR_MAX_RANK - tv_ptr->large_rank;
- HDassert( 0 <= tv_ptr->large_ds_offset );
- HDassert( tv_ptr->large_ds_offset < PAR_SS_DR_MAX_RANK );
-
+ HDassert(0 <= tv_ptr->large_ds_offset);
+ HDassert(tv_ptr->large_ds_offset < PAR_SS_DR_MAX_RANK);
/* set up the start, stride, count, and block pointers */
/* used by contiguous tests only */
@@ -208,7 +190,6 @@ hs_dr_pio_test__setup(const int test_num,
tv_ptr->count_ptr = &(tv_ptr->count[PAR_SS_DR_MAX_RANK - tv_ptr->large_rank]);
tv_ptr->block_ptr = &(tv_ptr->block[PAR_SS_DR_MAX_RANK - tv_ptr->large_rank]);
-
/* Allocate buffers */
tv_ptr->small_ds_buf_0 = (uint32_t *)HDmalloc(sizeof(uint32_t) * tv_ptr->small_ds_size);
VRFY((tv_ptr->small_ds_buf_0 != NULL), "malloc of small_ds_buf_0 succeeded");
@@ -219,8 +200,7 @@ hs_dr_pio_test__setup(const int test_num,
tv_ptr->small_ds_buf_2 = (uint32_t *)HDmalloc(sizeof(uint32_t) * tv_ptr->small_ds_size);
VRFY((tv_ptr->small_ds_buf_2 != NULL), "malloc of small_ds_buf_2 succeeded");
- tv_ptr->small_ds_slice_buf =
- (uint32_t *)HDmalloc(sizeof(uint32_t) * tv_ptr->small_ds_slice_size);
+ tv_ptr->small_ds_slice_buf = (uint32_t *)HDmalloc(sizeof(uint32_t) * tv_ptr->small_ds_slice_size);
VRFY((tv_ptr->small_ds_slice_buf != NULL), "malloc of small_ds_slice_buf succeeded");
tv_ptr->large_ds_buf_0 = (uint32_t *)HDmalloc(sizeof(uint32_t) * tv_ptr->large_ds_size);
@@ -232,14 +212,13 @@ hs_dr_pio_test__setup(const int test_num,
tv_ptr->large_ds_buf_2 = (uint32_t *)HDmalloc(sizeof(uint32_t) * tv_ptr->large_ds_size);
VRFY((tv_ptr->large_ds_buf_2 != NULL), "malloc of large_ds_buf_2 succeeded");
- tv_ptr->large_ds_slice_buf =
- (uint32_t *)HDmalloc(sizeof(uint32_t) * tv_ptr->large_ds_slice_size);
+ tv_ptr->large_ds_slice_buf = (uint32_t *)HDmalloc(sizeof(uint32_t) * tv_ptr->large_ds_slice_size);
VRFY((tv_ptr->large_ds_slice_buf != NULL), "malloc of large_ds_slice_buf succeeded");
/* initialize the buffers */
ptr_0 = tv_ptr->small_ds_buf_0;
- for(i = 0; i < (int)(tv_ptr->small_ds_size); i++)
+ for (i = 0; i < (int)(tv_ptr->small_ds_size); i++)
*ptr_0++ = (uint32_t)i;
HDmemset(tv_ptr->small_ds_buf_1, 0, sizeof(uint32_t) * tv_ptr->small_ds_size);
HDmemset(tv_ptr->small_ds_buf_2, 0, sizeof(uint32_t) * tv_ptr->small_ds_size);
@@ -247,7 +226,7 @@ hs_dr_pio_test__setup(const int test_num,
HDmemset(tv_ptr->small_ds_slice_buf, 0, sizeof(uint32_t) * tv_ptr->small_ds_slice_size);
ptr_0 = tv_ptr->large_ds_buf_0;
- for(i = 0; i < (int)(tv_ptr->large_ds_size); i++)
+ for (i = 0; i < (int)(tv_ptr->large_ds_size); i++)
*ptr_0++ = (uint32_t)i;
HDmemset(tv_ptr->large_ds_buf_1, 0, sizeof(uint32_t) * tv_ptr->large_ds_size);
HDmemset(tv_ptr->large_ds_buf_2, 0, sizeof(uint32_t) * tv_ptr->large_ds_size);
@@ -255,23 +234,19 @@ hs_dr_pio_test__setup(const int test_num,
HDmemset(tv_ptr->large_ds_slice_buf, 0, sizeof(uint32_t) * tv_ptr->large_ds_slice_size);
filename = (const char *)GetTestParameters();
- HDassert( filename != NULL );
-#if CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG
- if ( MAINPROCESS ) {
+ HDassert(filename != NULL);
+#if CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG
+ if (MAINPROCESS) {
HDfprintf(stdout, "%d: test num = %d.\n", tv_ptr->mpi_rank, tv_ptr->test_num);
HDfprintf(stdout, "%d: mpi_size = %d.\n", tv_ptr->mpi_rank, tv_ptr->mpi_size);
- HDfprintf(stdout,
- "%d: small/large rank = %d/%d, use_collective_io = %d.\n",
- tv_ptr->mpi_rank, tv_ptr->small_rank, tv_ptr->large_rank,
- (int)use_collective_io);
- HDfprintf(stdout, "%d: edge_size = %d, chunk_edge_size = %d.\n",
- tv_ptr->mpi_rank, tv_ptr->edge_size, tv_ptr->chunk_edge_size);
- HDfprintf(stdout, "%d: checker_edge_size = %d.\n",
- tv_ptr->mpi_rank, tv_ptr->checker_edge_size);
- HDfprintf(stdout, "%d: small_ds_size = %d, large_ds_size = %d.\n",
- tv_ptr->mpi_rank, (int)(tv_ptr->small_ds_size),
- (int)(tv_ptr->large_ds_size));
+ HDfprintf(stdout, "%d: small/large rank = %d/%d, use_collective_io = %d.\n", tv_ptr->mpi_rank,
+ tv_ptr->small_rank, tv_ptr->large_rank, (int)use_collective_io);
+ HDfprintf(stdout, "%d: edge_size = %d, chunk_edge_size = %d.\n", tv_ptr->mpi_rank, tv_ptr->edge_size,
+ tv_ptr->chunk_edge_size);
+ HDfprintf(stdout, "%d: checker_edge_size = %d.\n", tv_ptr->mpi_rank, tv_ptr->checker_edge_size);
+ HDfprintf(stdout, "%d: small_ds_size = %d, large_ds_size = %d.\n", tv_ptr->mpi_rank,
+ (int)(tv_ptr->small_ds_size), (int)(tv_ptr->large_ds_size));
HDfprintf(stdout, "%d: filename = %s.\n", tv_ptr->mpi_rank, filename);
}
#endif /* CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG */
@@ -286,7 +261,7 @@ hs_dr_pio_test__setup(const int test_num,
* the same file system block. Do this only if express_test is greater
* than zero.
*/
- if ( express_test > 0 ) {
+ if (express_test > 0) {
ret = H5Pset_alignment(acc_tpl, (hsize_t)0, SHAPE_SAME_TEST_ALIGNMENT);
VRFY((ret != FAIL), "H5Pset_alignment() succeeded");
@@ -302,118 +277,91 @@ hs_dr_pio_test__setup(const int test_num,
ret = H5Pclose(acc_tpl);
VRFY((ret >= 0), "H5Pclose(acc_tpl) succeeded");
-
/* setup dims: */
tv_ptr->dims[0] = (hsize_t)(tv_ptr->mpi_size + 1);
- tv_ptr->dims[1] = tv_ptr->dims[2] =
- tv_ptr->dims[3] = tv_ptr->dims[4] = (hsize_t)(tv_ptr->edge_size);
-
+ tv_ptr->dims[1] = tv_ptr->dims[2] = tv_ptr->dims[3] = tv_ptr->dims[4] = (hsize_t)(tv_ptr->edge_size);
/* Create small ds dataspaces */
- tv_ptr->full_mem_small_ds_sid =
- H5Screate_simple(tv_ptr->small_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->full_mem_small_ds_sid != 0),
- "H5Screate_simple() full_mem_small_ds_sid succeeded");
+ tv_ptr->full_mem_small_ds_sid = H5Screate_simple(tv_ptr->small_rank, tv_ptr->dims, NULL);
+ VRFY((tv_ptr->full_mem_small_ds_sid != 0), "H5Screate_simple() full_mem_small_ds_sid succeeded");
- tv_ptr->full_file_small_ds_sid =
- H5Screate_simple(tv_ptr->small_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->full_file_small_ds_sid != 0),
- "H5Screate_simple() full_file_small_ds_sid succeeded");
+ tv_ptr->full_file_small_ds_sid = H5Screate_simple(tv_ptr->small_rank, tv_ptr->dims, NULL);
+ VRFY((tv_ptr->full_file_small_ds_sid != 0), "H5Screate_simple() full_file_small_ds_sid succeeded");
tv_ptr->mem_small_ds_sid = H5Screate_simple(tv_ptr->small_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->mem_small_ds_sid != 0),
- "H5Screate_simple() mem_small_ds_sid succeeded");
+ VRFY((tv_ptr->mem_small_ds_sid != 0), "H5Screate_simple() mem_small_ds_sid succeeded");
tv_ptr->file_small_ds_sid_0 = H5Screate_simple(tv_ptr->small_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->file_small_ds_sid_0 != 0),
- "H5Screate_simple() file_small_ds_sid_0 succeeded");
+ VRFY((tv_ptr->file_small_ds_sid_0 != 0), "H5Screate_simple() file_small_ds_sid_0 succeeded");
/* used by checker board tests only */
tv_ptr->file_small_ds_sid_1 = H5Screate_simple(tv_ptr->small_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->file_small_ds_sid_1 != 0),
- "H5Screate_simple() file_small_ds_sid_1 succeeded");
-
- tv_ptr->small_ds_slice_sid =
- H5Screate_simple(tv_ptr->small_rank - 1, &(tv_ptr->dims[1]), NULL);
- VRFY((tv_ptr->small_ds_slice_sid != 0),
- "H5Screate_simple() small_ds_slice_sid succeeded");
+ VRFY((tv_ptr->file_small_ds_sid_1 != 0), "H5Screate_simple() file_small_ds_sid_1 succeeded");
+ tv_ptr->small_ds_slice_sid = H5Screate_simple(tv_ptr->small_rank - 1, &(tv_ptr->dims[1]), NULL);
+ VRFY((tv_ptr->small_ds_slice_sid != 0), "H5Screate_simple() small_ds_slice_sid succeeded");
/* Create large ds dataspaces */
- tv_ptr->full_mem_large_ds_sid =
- H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->full_mem_large_ds_sid != 0),
- "H5Screate_simple() full_mem_large_ds_sid succeeded");
+ tv_ptr->full_mem_large_ds_sid = H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
+ VRFY((tv_ptr->full_mem_large_ds_sid != 0), "H5Screate_simple() full_mem_large_ds_sid succeeded");
- tv_ptr->full_file_large_ds_sid =
- H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->full_file_large_ds_sid != FAIL),
- "H5Screate_simple() full_file_large_ds_sid succeeded");
+ tv_ptr->full_file_large_ds_sid = H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
+ VRFY((tv_ptr->full_file_large_ds_sid != FAIL), "H5Screate_simple() full_file_large_ds_sid succeeded");
tv_ptr->mem_large_ds_sid = H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->mem_large_ds_sid != FAIL),
- "H5Screate_simple() mem_large_ds_sid succeeded");
+ VRFY((tv_ptr->mem_large_ds_sid != FAIL), "H5Screate_simple() mem_large_ds_sid succeeded");
tv_ptr->file_large_ds_sid_0 = H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->file_large_ds_sid_0 != FAIL),
- "H5Screate_simple() file_large_ds_sid_0 succeeded");
+ VRFY((tv_ptr->file_large_ds_sid_0 != FAIL), "H5Screate_simple() file_large_ds_sid_0 succeeded");
/* used by checker board tests only */
tv_ptr->file_large_ds_sid_1 = H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->file_large_ds_sid_1 != FAIL),
- "H5Screate_simple() file_large_ds_sid_1 succeeded");
+ VRFY((tv_ptr->file_large_ds_sid_1 != FAIL), "H5Screate_simple() file_large_ds_sid_1 succeeded");
- tv_ptr->mem_large_ds_process_slice_sid =
- H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->mem_large_ds_process_slice_sid != FAIL),
+ tv_ptr->mem_large_ds_process_slice_sid = H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
+ VRFY((tv_ptr->mem_large_ds_process_slice_sid != FAIL),
"H5Screate_simple() mem_large_ds_process_slice_sid succeeded");
- tv_ptr->file_large_ds_process_slice_sid =
- H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
- VRFY((tv_ptr->file_large_ds_process_slice_sid != FAIL),
+ tv_ptr->file_large_ds_process_slice_sid = H5Screate_simple(tv_ptr->large_rank, tv_ptr->dims, NULL);
+ VRFY((tv_ptr->file_large_ds_process_slice_sid != FAIL),
"H5Screate_simple() file_large_ds_process_slice_sid succeeded");
-
- tv_ptr->large_ds_slice_sid =
- H5Screate_simple(tv_ptr->large_rank - 1, &(tv_ptr->dims[1]), NULL);
- VRFY((tv_ptr->large_ds_slice_sid != 0),
- "H5Screate_simple() large_ds_slice_sid succeeded");
-
+ tv_ptr->large_ds_slice_sid = H5Screate_simple(tv_ptr->large_rank - 1, &(tv_ptr->dims[1]), NULL);
+ VRFY((tv_ptr->large_ds_slice_sid != 0), "H5Screate_simple() large_ds_slice_sid succeeded");
/* if chunk edge size is greater than zero, set up the small and
* large data set creation property lists to specify chunked
* datasets.
*/
- if ( tv_ptr->chunk_edge_size > 0 ) {
+ if (tv_ptr->chunk_edge_size > 0) {
- /* Under Lustre (and perhaps other parallel file systems?) we get
- * locking delays when two or more processes attempt to access the
+ /* Under Lustre (and perhaps other parallel file systems?) we get
+ * locking delays when two or more processes attempt to access the
* same file system block.
*
- * To minimize this problem, I have changed chunk_dims[0]
+ * To minimize this problem, I have changed chunk_dims[0]
* from (mpi_size + 1) to just when any sort of express test is
- * selected. Given the structure of the test, and assuming we
- * set the alignment large enough, this avoids the contention
- * issue by seeing to it that each chunk is only accessed by one
+ * selected. Given the structure of the test, and assuming we
+ * set the alignment large enough, this avoids the contention
+ * issue by seeing to it that each chunk is only accessed by one
* process.
*
- * One can argue as to whether this is a good thing to do in our
+ * One can argue as to whether this is a good thing to do in our
* tests, but for now it is necessary if we want the test to complete
* in a reasonable amount of time.
*
* JRM -- 9/16/10
*/
- if ( express_test == 0 ) {
+ if (express_test == 0) {
tv_ptr->chunk_dims[0] = 1;
-
- } else {
+ }
+ else {
tv_ptr->chunk_dims[0] = 1;
}
- tv_ptr->chunk_dims[1] = tv_ptr->chunk_dims[2] =
- tv_ptr->chunk_dims[3] =
- tv_ptr->chunk_dims[4] = (hsize_t)(tv_ptr->chunk_edge_size);
+ tv_ptr->chunk_dims[1] = tv_ptr->chunk_dims[2] = tv_ptr->chunk_dims[3] = tv_ptr->chunk_dims[4] =
+ (hsize_t)(tv_ptr->chunk_edge_size);
small_ds_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
VRFY((ret != FAIL), "H5Pcreate() small_ds_dcpl_id succeeded");
@@ -424,7 +372,6 @@ hs_dr_pio_test__setup(const int test_num,
ret = H5Pset_chunk(small_ds_dcpl_id, tv_ptr->small_rank, tv_ptr->chunk_dims);
VRFY((ret != FAIL), "H5Pset_chunk() small_ds_dcpl_id succeeded");
-
large_ds_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
VRFY((ret != FAIL), "H5Pcreate() large_ds_dcpl_id succeeded");
@@ -436,260 +383,195 @@ hs_dr_pio_test__setup(const int test_num,
}
/* create the small dataset */
- tv_ptr->small_dataset = H5Dcreate2(tv_ptr->fid, "small_dataset", tv_ptr->dset_type,
- tv_ptr->file_small_ds_sid_0, H5P_DEFAULT,
- small_ds_dcpl_id, H5P_DEFAULT);
+ tv_ptr->small_dataset =
+ H5Dcreate2(tv_ptr->fid, "small_dataset", tv_ptr->dset_type, tv_ptr->file_small_ds_sid_0, H5P_DEFAULT,
+ small_ds_dcpl_id, H5P_DEFAULT);
VRFY((ret != FAIL), "H5Dcreate2() small_dataset succeeded");
/* create the large dataset */
- tv_ptr->large_dataset = H5Dcreate2(tv_ptr->fid, "large_dataset", tv_ptr->dset_type,
- tv_ptr->file_large_ds_sid_0, H5P_DEFAULT,
- large_ds_dcpl_id, H5P_DEFAULT);
+ tv_ptr->large_dataset =
+ H5Dcreate2(tv_ptr->fid, "large_dataset", tv_ptr->dset_type, tv_ptr->file_large_ds_sid_0, H5P_DEFAULT,
+ large_ds_dcpl_id, H5P_DEFAULT);
VRFY((ret != FAIL), "H5Dcreate2() large_dataset succeeded");
-
/* setup xfer property list */
tv_ptr->xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((tv_ptr->xfer_plist >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded");
- if(use_collective_io) {
+ if (use_collective_io) {
ret = H5Pset_dxpl_mpio(tv_ptr->xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
}
/* setup selection to write initial data to the small and large data sets */
- tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
+ tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
tv_ptr->stride[0] = (hsize_t)(2 * (tv_ptr->mpi_size + 1));
- tv_ptr->count[0] = 1;
- tv_ptr->block[0] = 1;
+ tv_ptr->count[0] = 1;
+ tv_ptr->block[0] = 1;
- for ( i = 1; i < tv_ptr->large_rank; i++ ) {
+ for (i = 1; i < tv_ptr->large_rank; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
+ tv_ptr->count[i] = 1;
+ tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
/* setup selections for writing initial data to the small data set */
- ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(mem_small_ds_sid, set) suceeded");
- ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(file_small_ds_sid_0, set) suceeded");
- if ( MAINPROCESS ) { /* add an additional slice to the selections */
+ if (MAINPROCESS) { /* add an additional slice to the selections */
tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_size);
- ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid,
- H5S_SELECT_OR,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
- VRFY((ret>= 0), "H5Sselect_hyperslab(mem_small_ds_sid, or) suceeded");
-
- ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0,
- H5S_SELECT_OR,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
- VRFY((ret>= 0), "H5Sselect_hyperslab(file_small_ds_sid_0, or) suceeded");
- }
+ ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid, H5S_SELECT_OR, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(mem_small_ds_sid, or) suceeded");
+ ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0, H5S_SELECT_OR, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(file_small_ds_sid_0, or) suceeded");
+ }
/* write the initial value of the small data set to file */
- ret = H5Dwrite(tv_ptr->small_dataset, tv_ptr->dset_type, tv_ptr->mem_small_ds_sid,
+ ret = H5Dwrite(tv_ptr->small_dataset, tv_ptr->dset_type, tv_ptr->mem_small_ds_sid,
tv_ptr->file_small_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->small_ds_buf_0);
VRFY((ret >= 0), "H5Dwrite() small_dataset initial write succeeded");
-
/* sync with the other processes before checking data */
- if ( ! use_collective_io ) {
+ if (!use_collective_io) {
mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes");
+ VRFY((mrc == MPI_SUCCESS), "Sync after small dataset writes");
}
- /* read the small data set back to verify that it contains the
- * expected data. Note that each process reads in the entire
+ /* read the small data set back to verify that it contains the
+ * expected data. Note that each process reads in the entire
* data set and verifies it.
*/
- ret = H5Dread(tv_ptr->small_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->full_mem_small_ds_sid,
- tv_ptr->full_file_small_ds_sid,
- tv_ptr->xfer_plist,
- tv_ptr->small_ds_buf_1);
+ ret = H5Dread(tv_ptr->small_dataset, H5T_NATIVE_UINT32, tv_ptr->full_mem_small_ds_sid,
+ tv_ptr->full_file_small_ds_sid, tv_ptr->xfer_plist, tv_ptr->small_ds_buf_1);
VRFY((ret >= 0), "H5Dread() small_dataset initial read succeeded");
-
/* verify that the correct data was written to the small data set */
expected_value = 0;
- mis_match = FALSE;
- ptr_1 = tv_ptr->small_ds_buf_1;
+ mis_match = FALSE;
+ ptr_1 = tv_ptr->small_ds_buf_1;
i = 0;
- for ( i = 0; i < (int)(tv_ptr->small_ds_size); i++ ) {
+ for (i = 0; i < (int)(tv_ptr->small_ds_size); i++) {
- if ( *ptr_1 != expected_value ) {
+ if (*ptr_1 != expected_value) {
mis_match = TRUE;
}
ptr_1++;
expected_value++;
}
- VRFY( (mis_match == FALSE), "small ds init data good.");
-
+ VRFY((mis_match == FALSE), "small ds init data good.");
/* setup selections for writing initial data to the large data set */
tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
- ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(mem_large_ds_sid, set) suceeded");
- ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(file_large_ds_sid_0, set) suceeded");
-
- /* In passing, setup the process slice data spaces as well */
-
- ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_process_slice_sid,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
- VRFY((ret >= 0),
- "H5Sselect_hyperslab(mem_large_ds_process_slice_sid, set) suceeded");
-
- ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_process_slice_sid,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
- VRFY((ret >= 0),
- "H5Sselect_hyperslab(file_large_ds_process_slice_sid, set) suceeded");
-
- if ( MAINPROCESS ) { /* add an additional slice to the selections */
+
+ /* In passing, setup the process slice dataspaces as well */
+
+ ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_process_slice_sid, H5S_SELECT_SET, tv_ptr->start,
+ tv_ptr->stride, tv_ptr->count, tv_ptr->block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(mem_large_ds_process_slice_sid, set) suceeded");
+
+ ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_process_slice_sid, H5S_SELECT_SET, tv_ptr->start,
+ tv_ptr->stride, tv_ptr->count, tv_ptr->block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(file_large_ds_process_slice_sid, set) suceeded");
+
+ if (MAINPROCESS) { /* add an additional slice to the selections */
tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_size);
- ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid,
- H5S_SELECT_OR,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
- VRFY((ret>= 0), "H5Sselect_hyperslab(mem_large_ds_sid, or) suceeded");
-
- ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0,
- H5S_SELECT_OR,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
- VRFY((ret>= 0), "H5Sselect_hyperslab(file_large_ds_sid_0, or) suceeded");
- }
+ ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid, H5S_SELECT_OR, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(mem_large_ds_sid, or) suceeded");
+ ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0, H5S_SELECT_OR, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(file_large_ds_sid_0, or) suceeded");
+ }
/* write the initial value of the large data set to file */
- ret = H5Dwrite(tv_ptr->large_dataset, tv_ptr->dset_type,
- tv_ptr->mem_large_ds_sid, tv_ptr->file_large_ds_sid_0,
- tv_ptr->xfer_plist, tv_ptr->large_ds_buf_0);
- if ( ret < 0 ) H5Eprint2(H5E_DEFAULT, stderr);
+ ret = H5Dwrite(tv_ptr->large_dataset, tv_ptr->dset_type, tv_ptr->mem_large_ds_sid,
+ tv_ptr->file_large_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->large_ds_buf_0);
+ if (ret < 0)
+ H5Eprint2(H5E_DEFAULT, stderr);
VRFY((ret >= 0), "H5Dwrite() large_dataset initial write succeeded");
-
/* sync with the other processes before checking data */
- if ( ! use_collective_io ) {
+ if (!use_collective_io) {
mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes");
+ VRFY((mrc == MPI_SUCCESS), "Sync after large dataset writes");
}
-
- /* read the large data set back to verify that it contains the
- * expected data. Note that each process reads in the entire
+ /* read the large data set back to verify that it contains the
+ * expected data. Note that each process reads in the entire
* data set.
*/
- ret = H5Dread(tv_ptr->large_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->full_mem_large_ds_sid,
- tv_ptr->full_file_large_ds_sid,
- tv_ptr->xfer_plist,
- tv_ptr->large_ds_buf_1);
+ ret = H5Dread(tv_ptr->large_dataset, H5T_NATIVE_UINT32, tv_ptr->full_mem_large_ds_sid,
+ tv_ptr->full_file_large_ds_sid, tv_ptr->xfer_plist, tv_ptr->large_ds_buf_1);
VRFY((ret >= 0), "H5Dread() large_dataset initial read succeeded");
-
/* verify that the correct data was written to the large data set */
expected_value = 0;
- mis_match = FALSE;
- ptr_1 = tv_ptr->large_ds_buf_1;
+ mis_match = FALSE;
+ ptr_1 = tv_ptr->large_ds_buf_1;
i = 0;
- for ( i = 0; i < (int)(tv_ptr->large_ds_size); i++ ) {
+ for (i = 0; i < (int)(tv_ptr->large_ds_size); i++) {
- if ( *ptr_1 != expected_value ) {
+ if (*ptr_1 != expected_value) {
mis_match = TRUE;
}
ptr_1++;
expected_value++;
}
- VRFY( (mis_match == FALSE), "large ds init data good.");
-
+ VRFY((mis_match == FALSE), "large ds init data good.");
/* sync with the other processes before changing data */
- if ( ! use_collective_io ) {
+ if (!use_collective_io) {
mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync initial values check");
+ VRFY((mrc == MPI_SUCCESS), "Sync initial values check");
}
return;
} /* hs_dr_pio_test__setup() */
-
/*-------------------------------------------------------------------------
- * Function: hs_dr_pio_test__takedown()
- *
- * Purpose: Do takedown after tests of I/O to/from hyperslab selections
- * of different rank in the parallel case.
- *
- * Return: void
+ * Function: hs_dr_pio_test__takedown()
*
- * Programmer: JRM -- 9/18/09
+ * Purpose: Do takedown after tests of I/O to/from hyperslab selections
+ * of different rank in the parallel case.
*
- * Modifications:
+ * Return: void
*
- * None.
+ * Programmer: JRM -- 9/18/09
*
*-------------------------------------------------------------------------
*/
@@ -697,19 +579,19 @@ hs_dr_pio_test__setup(const int test_num,
#define HS_DR_PIO_TEST__TAKEDOWN__DEBUG 0
static void
-hs_dr_pio_test__takedown( struct hs_dr_pio_test_vars_t * tv_ptr)
+hs_dr_pio_test__takedown(struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if HS_DR_PIO_TEST__TAKEDOWN__DEBUG
+#if HS_DR_PIO_TEST__TAKEDOWN__DEBUG
const char *fcnName = "hs_dr_pio_test__takedown()";
-#endif /* HS_DR_PIO_TEST__TAKEDOWN__DEBUG */
- int mpi_rank; /* needed by the VRFY macro */
- herr_t ret; /* Generic return value */
+#endif /* HS_DR_PIO_TEST__TAKEDOWN__DEBUG */
+ int mpi_rank; /* needed by the VRFY macro */
+ herr_t ret; /* Generic return value */
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
/* Close property lists */
- if ( tv_ptr->xfer_plist != H5P_DEFAULT ) {
+ if (tv_ptr->xfer_plist != H5P_DEFAULT) {
ret = H5Pclose(tv_ptr->xfer_plist);
VRFY((ret != FAIL), "H5Pclose(xfer_plist) succeeded");
}
@@ -771,43 +653,46 @@ hs_dr_pio_test__takedown( struct hs_dr_pio_test_vars_t * tv_ptr)
/* Free memory buffers */
- if ( tv_ptr->small_ds_buf_0 != NULL ) HDfree(tv_ptr->small_ds_buf_0);
- if ( tv_ptr->small_ds_buf_1 != NULL ) HDfree(tv_ptr->small_ds_buf_1);
- if ( tv_ptr->small_ds_buf_2 != NULL ) HDfree(tv_ptr->small_ds_buf_2);
- if ( tv_ptr->small_ds_slice_buf != NULL ) HDfree(tv_ptr->small_ds_slice_buf);
-
- if ( tv_ptr->large_ds_buf_0 != NULL ) HDfree(tv_ptr->large_ds_buf_0);
- if ( tv_ptr->large_ds_buf_1 != NULL ) HDfree(tv_ptr->large_ds_buf_1);
- if ( tv_ptr->large_ds_buf_2 != NULL ) HDfree(tv_ptr->large_ds_buf_2);
- if ( tv_ptr->large_ds_slice_buf != NULL ) HDfree(tv_ptr->large_ds_slice_buf);
+ if (tv_ptr->small_ds_buf_0 != NULL)
+ HDfree(tv_ptr->small_ds_buf_0);
+ if (tv_ptr->small_ds_buf_1 != NULL)
+ HDfree(tv_ptr->small_ds_buf_1);
+ if (tv_ptr->small_ds_buf_2 != NULL)
+ HDfree(tv_ptr->small_ds_buf_2);
+ if (tv_ptr->small_ds_slice_buf != NULL)
+ HDfree(tv_ptr->small_ds_slice_buf);
+
+ if (tv_ptr->large_ds_buf_0 != NULL)
+ HDfree(tv_ptr->large_ds_buf_0);
+ if (tv_ptr->large_ds_buf_1 != NULL)
+ HDfree(tv_ptr->large_ds_buf_1);
+ if (tv_ptr->large_ds_buf_2 != NULL)
+ HDfree(tv_ptr->large_ds_buf_2);
+ if (tv_ptr->large_ds_slice_buf != NULL)
+ HDfree(tv_ptr->large_ds_slice_buf);
return;
} /* hs_dr_pio_test__takedown() */
-
/*-------------------------------------------------------------------------
- * Function: contig_hs_dr_pio_test__d2m_l2s()
- *
- * Purpose: Part one of a series of tests of I/O to/from hyperslab
- * selections of different rank in the parallel.
+ * Function: contig_hs_dr_pio_test__d2m_l2s()
*
- * Verify that we can read from disk correctly using
- * selections of different rank that H5S_select_shape_same()
- * views as being of the same shape.
+ * Purpose: Part one of a series of tests of I/O to/from hyperslab
+ * selections of different rank in the parallel.
*
- * In this function, we test this by reading small_rank - 1
- * slices from the on disk large cube, and verifying that the
- * data read is correct. Verify that H5S_select_shape_same()
- * returns true on the memory and file selections.
+ * Verify that we can read from disk correctly using
+ * selections of different rank that H5S_select_shape_same()
+ * views as being of the same shape.
*
- * Return: void
+ * In this function, we test this by reading small_rank - 1
+ * slices from the on disk large cube, and verifying that the
+ * data read is correct. Verify that H5S_select_shape_same()
+ * returns true on the memory and file selections.
*
- * Programmer: JRM -- 9/10/11
+ * Return: void
*
- * Modifications:
- *
- * None.
+ * Programmer: JRM -- 9/10/11
*
*-------------------------------------------------------------------------
*/
@@ -815,42 +700,41 @@ hs_dr_pio_test__takedown( struct hs_dr_pio_test_vars_t * tv_ptr)
#define CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG 0
static void
-contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
+contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG
+#if CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG
const char *fcnName = "contig_hs_dr_pio_test__run_test()";
#endif /* CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
- hbool_t mis_match = FALSE;
- int i, j, k, l;
- size_t n;
- int mpi_rank; /* needed by the VRFY macro */
- uint32_t expected_value;
- uint32_t * ptr_1;
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hbool_t mis_match = FALSE;
+ int i, j, k, l;
+ size_t n;
+ int mpi_rank; /* needed by the VRFY macro */
+ uint32_t expected_value;
+ uint32_t *ptr_1;
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
-
- /* We have already done a H5Sselect_all() on the data space
- * small_ds_slice_sid in the initialization phase, so no need to
+ /* We have already done a H5Sselect_all() on the dataspace
+ * small_ds_slice_sid in the initialization phase, so no need to
* call H5Sselect_all() again.
*/
/* set up start, stride, count, and block -- note that we will
* change start[] so as to read slices of the large cube.
*/
- for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) {
+ for (i = 0; i < PAR_SS_DR_MAX_RANK; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- if ( (PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1) ) {
+ tv_ptr->count[i] = 1;
+ if ((PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1)) {
tv_ptr->block[i] = 1;
-
- } else {
+ }
+ else {
tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
@@ -859,55 +743,53 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
/* zero out the buffer we will be reading into */
HDmemset(tv_ptr->small_ds_slice_buf, 0, sizeof(uint32_t) * tv_ptr->small_ds_slice_size);
-#if CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG
- HDfprintf(stdout,
- "%s reading slices from big cube on disk into small cube slice.\n",
- fcnName);
+#if CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG
+ HDfprintf(stdout, "%s reading slices from big cube on disk into small cube slice.\n", fcnName);
#endif /* CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
/* in serial versions of this test, we loop through all the dimensions
- * of the large data set. However, in the parallel version, each
+ * of the large data set. However, in the parallel version, each
* process only works with that slice of the large cube indicated
- * by its rank -- hence we set the most slowly changing index to
+ * by its rank -- hence we set the most slowly changing index to
* mpi_rank, and don't itterate over it.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0) {
i = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
i = 0;
}
- /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
+ /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
* loop over it -- either we are setting i to mpi_rank, or
- * we are setting it to zero. It will not change during the
+ * we are setting it to zero. It will not change during the
* test.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1) {
j = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
j = 0;
}
do {
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2) {
k = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
k = 0;
}
do {
- /* since small rank >= 2 and large_rank > small_rank, we
+ /* since small rank >= 2 and large_rank > small_rank, we
* have large_rank >= 3. Since PAR_SS_DR_MAX_RANK == 5
* (baring major re-orgaization), this gives us:
*
@@ -919,16 +801,16 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
l = 0;
do {
- if ( (tv_ptr->skips)++ < tv_ptr->max_skips ) { /* skip the test */
+ if ((tv_ptr->skips)++ < tv_ptr->max_skips) { /* skip the test */
- (tv_ptr->tests_skipped)++;
-
- } else { /* run the test */
+ (tv_ptr->tests_skipped)++;
+ }
+ else { /* run the test */
tv_ptr->skips = 0; /* reset the skips counter */
- /* we know that small_rank - 1 >= 1 and that
- * large_rank > small_rank by the assertions at the head
+ /* we know that small_rank - 1 >= 1 and that
+ * large_rank > small_rank by the assertions at the head
* of this function. Thus no need for another inner loop.
*/
tv_ptr->start[0] = (hsize_t)i;
@@ -937,59 +819,43 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
tv_ptr->start[3] = (hsize_t)l;
tv_ptr->start[4] = 0;
- ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0,
- H5S_SELECT_SET,
- tv_ptr->start_ptr,
- tv_ptr->stride_ptr,
- tv_ptr->count_ptr,
- tv_ptr->block_ptr);
- VRFY((ret != FAIL),
- "H5Sselect_hyperslab(file_large_cube_sid) succeeded");
-
+ ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0, H5S_SELECT_SET, tv_ptr->start_ptr,
+ tv_ptr->stride_ptr, tv_ptr->count_ptr, tv_ptr->block_ptr);
+ VRFY((ret != FAIL), "H5Sselect_hyperslab(file_large_cube_sid) succeeded");
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->small_ds_slice_sid,
- tv_ptr->file_large_ds_sid_0);
+ check =
+ H5S_select_shape_same_test(tv_ptr->small_ds_slice_sid, tv_ptr->file_large_ds_sid_0);
VRFY((check == TRUE), "H5S_select_shape_same_test passed");
-
/* Read selection from disk */
-#if CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG
- HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n",
- fcnName, (int)(tv_ptr->mpi_rank),
- (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]),
- (int)(tv_ptr->start[2]), (int)(tv_ptr->start[3]),
- (int)(tv_ptr->start[4]));
- HDfprintf(stdout, "%s slice/file extent dims = %d/%d.\n",
- fcnName,
+#if CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, (int)(tv_ptr->mpi_rank),
+ (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]), (int)(tv_ptr->start[2]),
+ (int)(tv_ptr->start[3]), (int)(tv_ptr->start[4]));
+ HDfprintf(stdout, "%s slice/file extent dims = %d/%d.\n", fcnName,
H5Sget_simple_extent_ndims(tv_ptr->small_ds_slice_sid),
H5Sget_simple_extent_ndims(tv_ptr->file_large_ds_sid_0));
#endif /* CONTIG_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
- ret = H5Dread(tv_ptr->large_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->small_ds_slice_sid,
- tv_ptr->file_large_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->small_ds_slice_buf);
+ ret =
+ H5Dread(tv_ptr->large_dataset, H5T_NATIVE_UINT32, tv_ptr->small_ds_slice_sid,
+ tv_ptr->file_large_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->small_ds_slice_buf);
VRFY((ret >= 0), "H5Dread() slice from large ds succeeded.");
-
/* verify that expected data is retrieved */
- mis_match = FALSE;
- ptr_1 = tv_ptr->small_ds_slice_buf;
+ mis_match = FALSE;
+ ptr_1 = tv_ptr->small_ds_slice_buf;
expected_value = (uint32_t)(
- (i * tv_ptr->edge_size * tv_ptr->edge_size *
- tv_ptr->edge_size * tv_ptr->edge_size) +
+ (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
(j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
- (k * tv_ptr->edge_size * tv_ptr->edge_size) +
- (l * tv_ptr->edge_size));
+ (k * tv_ptr->edge_size * tv_ptr->edge_size) + (l * tv_ptr->edge_size));
- for ( n = 0; n < tv_ptr->small_ds_slice_size; n++ ) {
+ for (n = 0; n < tv_ptr->small_ds_slice_size; n++) {
- if ( *ptr_1 != expected_value ) {
+ if (*ptr_1 != expected_value) {
mis_match = TRUE;
}
@@ -1000,55 +866,43 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
expected_value++;
}
- VRFY((mis_match == FALSE),
- "small slice read from large ds data good.");
+ VRFY((mis_match == FALSE), "small slice read from large ds data good.");
- (tv_ptr->tests_run)++;
+ (tv_ptr->tests_run)++;
}
l++;
(tv_ptr->total_tests)++;
- } while ( ( tv_ptr->large_rank > 2 ) &&
- ( (tv_ptr->small_rank - 1) <= 1 ) &&
- ( l < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 2) && ((tv_ptr->small_rank - 1) <= 1) && (l < tv_ptr->edge_size));
k++;
- } while ( ( tv_ptr->large_rank > 3 ) &&
- ( (tv_ptr->small_rank - 1) <= 2 ) &&
- ( k < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 3) && ((tv_ptr->small_rank - 1) <= 2) && (k < tv_ptr->edge_size));
j++;
- } while ( ( tv_ptr->large_rank > 4 ) &&
- ( (tv_ptr->small_rank - 1) <= 3 ) &&
- ( j < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 4) && ((tv_ptr->small_rank - 1) <= 3) && (j < tv_ptr->edge_size));
return;
} /* contig_hs_dr_pio_test__d2m_l2s() */
-
/*-------------------------------------------------------------------------
- * Function: contig_hs_dr_pio_test__d2m_s2l()
- *
- * Purpose: Part two of a series of tests of I/O to/from hyperslab
- * selections of different rank in the parallel.
- *
- * Verify that we can read from disk correctly using
- * selections of different rank that H5S_select_shape_same()
- * views as being of the same shape.
+ * Function: contig_hs_dr_pio_test__d2m_s2l()
*
- * In this function, we test this by reading slices of the
- * on disk small data set into slices through the in memory
- * large data set, and verify that the correct data (and
- * only the correct data) is read.
+ * Purpose: Part two of a series of tests of I/O to/from hyperslab
+ * selections of different rank in the parallel.
*
- * Return: void
+ * Verify that we can read from disk correctly using
+ * selections of different rank that H5S_select_shape_same()
+ * views as being of the same shape.
*
- * Programmer: JRM -- 8/10/11
+ * In this function, we test this by reading slices of the
+ * on disk small data set into slices through the in memory
+ * large data set, and verify that the correct data (and
+ * only the correct data) is read.
*
- * Modifications:
+ * Return: void
*
- * None.
+ * Programmer: JRM -- 8/10/11
*
*-------------------------------------------------------------------------
*/
@@ -1056,56 +910,49 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
#define CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG 0
static void
-contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
+contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG
+#if CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG
const char *fcnName = "contig_hs_dr_pio_test__d2m_s2l()";
#endif /* CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG */
- hbool_t mis_match = FALSE;
- int i, j, k, l;
- size_t n;
- int mpi_rank; /* needed by the VRFY macro */
- size_t start_index;
- size_t stop_index;
- uint32_t expected_value;
- uint32_t * ptr_1;
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hbool_t mis_match = FALSE;
+ int i, j, k, l;
+ size_t n;
+ int mpi_rank; /* needed by the VRFY macro */
+ size_t start_index;
+ size_t stop_index;
+ uint32_t expected_value;
+ uint32_t *ptr_1;
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
- /* Read slices of the on disk small data set into slices
- * through the in memory large data set, and verify that the correct
+ /* Read slices of the on disk small data set into slices
+ * through the in memory large data set, and verify that the correct
* data (and only the correct data) is read.
*/
- tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
+ tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
tv_ptr->stride[0] = (hsize_t)(2 * (tv_ptr->mpi_size + 1));
- tv_ptr->count[0] = 1;
- tv_ptr->block[0] = 1;
+ tv_ptr->count[0] = 1;
+ tv_ptr->block[0] = 1;
- for ( i = 1; i < tv_ptr->large_rank; i++ ) {
+ for (i = 1; i < tv_ptr->large_rank; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
+ tv_ptr->count[i] = 1;
+ tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
- ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(file_small_ds_sid_0, set) suceeded");
-
-#if CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG
- HDfprintf(stdout,
- "%s reading slices of on disk small data set into slices of big data set.\n",
- fcnName);
+#if CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG
+ HDfprintf(stdout, "%s reading slices of on disk small data set into slices of big data set.\n", fcnName);
#endif /* CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG */
/* zero out the in memory large ds */
@@ -1114,68 +961,66 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
/* set up start, stride, count, and block -- note that we will
* change start[] so as to read slices of the large cube.
*/
- for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) {
+ for (i = 0; i < PAR_SS_DR_MAX_RANK; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- if ( (PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1) ) {
+ tv_ptr->count[i] = 1;
+ if ((PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1)) {
tv_ptr->block[i] = 1;
-
- } else {
+ }
+ else {
tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
}
-
/* in serial versions of this test, we loop through all the dimensions
- * of the large data set that don't appear in the small data set.
+ * of the large data set that don't appear in the small data set.
*
- * However, in the parallel version, each process only works with that
- * slice of the large (and small) data set indicated by its rank -- hence
- * we set the most slowly changing index to mpi_rank, and don't itterate
+ * However, in the parallel version, each process only works with that
+ * slice of the large (and small) data set indicated by its rank -- hence
+ * we set the most slowly changing index to mpi_rank, and don't itterate
* over it.
*/
-
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0) {
i = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
i = 0;
}
- /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
+ /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
* loop over it -- either we are setting i to mpi_rank, or
- * we are setting it to zero. It will not change during the
+ * we are setting it to zero. It will not change during the
* test.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1) {
j = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
j = 0;
}
do {
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2) {
k = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
k = 0;
}
do {
- /* since small rank >= 2 and large_rank > small_rank, we
+ /* since small rank >= 2 and large_rank > small_rank, we
* have large_rank >= 3. Since PAR_SS_DR_MAX_RANK == 5
* (baring major re-orgaization), this gives us:
*
@@ -1187,11 +1032,11 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
l = 0;
do {
- if ( (tv_ptr->skips)++ < tv_ptr->max_skips ) { /* skip the test */
+ if ((tv_ptr->skips)++ < tv_ptr->max_skips) { /* skip the test */
(tv_ptr->tests_skipped)++;
-
- } else { /* run the test */
+ }
+ else { /* run the test */
tv_ptr->skips = 0; /* reset the skips counter */
@@ -1205,74 +1050,56 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
tv_ptr->start[3] = (hsize_t)l;
tv_ptr->start[4] = 0;
- ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid,
- H5S_SELECT_SET,
- tv_ptr->start_ptr,
- tv_ptr->stride_ptr,
- tv_ptr->count_ptr,
- tv_ptr->block_ptr);
- VRFY((ret != FAIL),
- "H5Sselect_hyperslab(mem_large_ds_sid) succeeded");
-
+ ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid, H5S_SELECT_SET, tv_ptr->start_ptr,
+ tv_ptr->stride_ptr, tv_ptr->count_ptr, tv_ptr->block_ptr);
+ VRFY((ret != FAIL), "H5Sselect_hyperslab(mem_large_ds_sid) succeeded");
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0,
- tv_ptr->mem_large_ds_sid);
+ check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0, tv_ptr->mem_large_ds_sid);
VRFY((check == TRUE), "H5S_select_shape_same_test passed");
-
/* Read selection from disk */
-#if CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG
- HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n",
- fcnName, (int)(tv_ptr->mpi_rank),
- (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]),
- (int)(tv_ptr->start[2]), (int)(tv_ptr->start[3]),
- (int)(tv_ptr->start[4]));
- HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n",
- fcnName, tv_ptr->mpi_rank,
+#if CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, (int)(tv_ptr->mpi_rank),
+ (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]), (int)(tv_ptr->start[2]),
+ (int)(tv_ptr->start[3]), (int)(tv_ptr->start[4]));
+ HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n", fcnName, tv_ptr->mpi_rank,
H5Sget_simple_extent_ndims(tv_ptr->mem_large_ds_sid),
H5Sget_simple_extent_ndims(tv_ptr->file_small_ds_sid_0));
#endif /* CONTIG_HS_DR_PIO_TEST__D2M_S2L__DEBUG */
- ret = H5Dread(tv_ptr->small_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_large_ds_sid,
- tv_ptr->file_small_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->large_ds_buf_1);
+ ret = H5Dread(tv_ptr->small_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_large_ds_sid,
+ tv_ptr->file_small_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->large_ds_buf_1);
VRFY((ret >= 0), "H5Dread() slice from small ds succeeded.");
/* verify that the expected data and only the
* expected data was read.
*/
- ptr_1 = tv_ptr->large_ds_buf_1;
- expected_value = (uint32_t)
- ((size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size);
- start_index = (size_t)(
- (i * tv_ptr->edge_size * tv_ptr->edge_size *
- tv_ptr->edge_size * tv_ptr->edge_size) +
+ ptr_1 = tv_ptr->large_ds_buf_1;
+ expected_value = (uint32_t)((size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size);
+ start_index = (size_t)(
+ (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
(j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
- (k * tv_ptr->edge_size * tv_ptr->edge_size) +
- (l * tv_ptr->edge_size));
+ (k * tv_ptr->edge_size * tv_ptr->edge_size) + (l * tv_ptr->edge_size));
stop_index = start_index + tv_ptr->small_ds_slice_size - 1;
- HDassert( start_index < stop_index );
- HDassert( stop_index <= tv_ptr->large_ds_size );
+ HDassert(start_index < stop_index);
+ HDassert(stop_index <= tv_ptr->large_ds_size);
- for ( n = 0; n < tv_ptr->large_ds_size; n++ ) {
+ for (n = 0; n < tv_ptr->large_ds_size; n++) {
- if ( ( n >= start_index ) && ( n <= stop_index ) ) {
+ if ((n >= start_index) && (n <= stop_index)) {
- if ( *ptr_1 != expected_value ) {
+ if (*ptr_1 != expected_value) {
mis_match = TRUE;
}
expected_value++;
+ }
+ else {
- } else {
-
- if ( *ptr_1 != 0 ) {
+ if (*ptr_1 != 0) {
mis_match = TRUE;
}
@@ -1283,8 +1110,7 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
ptr_1++;
}
- VRFY((mis_match == FALSE),
- "small slice read from large ds data good.");
+ VRFY((mis_match == FALSE), "small slice read from large ds data good.");
(tv_ptr->tests_run)++;
}
@@ -1293,47 +1119,36 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
(tv_ptr->total_tests)++;
- } while ( ( tv_ptr->large_rank > 2 ) &&
- ( (tv_ptr->small_rank - 1) <= 1 ) &&
- ( l < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 2) && ((tv_ptr->small_rank - 1) <= 1) && (l < tv_ptr->edge_size));
k++;
- } while ( ( tv_ptr->large_rank > 3 ) &&
- ( (tv_ptr->small_rank - 1) <= 2 ) &&
- ( k < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 3) && ((tv_ptr->small_rank - 1) <= 2) && (k < tv_ptr->edge_size));
j++;
- } while ( ( tv_ptr->large_rank > 4 ) &&
- ( (tv_ptr->small_rank - 1) <= 3 ) &&
- ( j < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 4) && ((tv_ptr->small_rank - 1) <= 3) && (j < tv_ptr->edge_size));
return;
} /* contig_hs_dr_pio_test__d2m_s2l() */
-
/*-------------------------------------------------------------------------
- * Function: contig_hs_dr_pio_test__m2d_l2s()
+ * Function: contig_hs_dr_pio_test__m2d_l2s()
*
- * Purpose: Part three of a series of tests of I/O to/from hyperslab
- * selections of different rank in the parallel.
+ * Purpose: Part three of a series of tests of I/O to/from hyperslab
+ * selections of different rank in the parallel.
*
- * Verify that we can write from memory to file using
- * selections of different rank that H5S_select_shape_same()
- * views as being of the same shape.
+ * Verify that we can write from memory to file using
+ * selections of different rank that H5S_select_shape_same()
+ * views as being of the same shape.
*
- * Do this by writing small_rank - 1 dimensional slices from
- * the in memory large data set to the on disk small cube
- * dataset. After each write, read the slice of the small
- * dataset back from disk, and verify that it contains
- * the expected data. Verify that H5S_select_shape_same()
- * returns true on the memory and file selections.
+ * Do this by writing small_rank - 1 dimensional slices from
+ * the in memory large data set to the on disk small cube
+ * dataset. After each write, read the slice of the small
+ * dataset back from disk, and verify that it contains
+ * the expected data. Verify that H5S_select_shape_same()
+ * returns true on the memory and file selections.
*
- * Return: void
+ * Return: void
*
- * Programmer: JRM -- 8/10/11
- *
- * Modifications:
- *
- * None.
+ * Programmer: JRM -- 8/10/11
*
*-------------------------------------------------------------------------
*/
@@ -1341,80 +1156,70 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
#define CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG 0
static void
-contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
+contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG
+#if CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG
const char *fcnName = "contig_hs_dr_pio_test__m2d_l2s()";
#endif /* CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG */
- hbool_t mis_match = FALSE;
- int i, j, k, l;
- size_t n;
- int mpi_rank; /* needed by the VRFY macro */
- size_t start_index;
- size_t stop_index;
- uint32_t expected_value;
- uint32_t * ptr_1;
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hbool_t mis_match = FALSE;
+ int i, j, k, l;
+ size_t n;
+ int mpi_rank; /* needed by the VRFY macro */
+ size_t start_index;
+ size_t stop_index;
+ uint32_t expected_value;
+ uint32_t *ptr_1;
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
-
/* now we go in the opposite direction, verifying that we can write
* from memory to file using selections of different rank that
* H5S_select_shape_same() views as being of the same shape.
*
- * Start by writing small_rank - 1 dimensional slices from the in memory large
- * data set to the on disk small cube dataset. After each write, read the
- * slice of the small dataset back from disk, and verify that it contains
- * the expected data. Verify that H5S_select_shape_same() returns true on
+ * Start by writing small_rank - 1 dimensional slices from the in memory large
+ * data set to the on disk small cube dataset. After each write, read the
+ * slice of the small dataset back from disk, and verify that it contains
+ * the expected data. Verify that H5S_select_shape_same() returns true on
* the memory and file selections.
*/
- tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
+ tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
tv_ptr->stride[0] = (hsize_t)(2 * (tv_ptr->mpi_size + 1));
- tv_ptr->count[0] = 1;
- tv_ptr->block[0] = 1;
+ tv_ptr->count[0] = 1;
+ tv_ptr->block[0] = 1;
- for ( i = 1; i < tv_ptr->large_rank; i++ ) {
+ for (i = 1; i < tv_ptr->large_rank; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
+ tv_ptr->count[i] = 1;
+ tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
- ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(file_small_ds_sid_0, set) suceeded");
- ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(mem_small_ds_sid, set) suceeded");
-
/* set up start, stride, count, and block -- note that we will
* change start[] so as to read slices of the large cube.
*/
- for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) {
+ for (i = 0; i < PAR_SS_DR_MAX_RANK; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- if ( (PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1) ) {
+ tv_ptr->count[i] = 1;
+ if ((PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1)) {
tv_ptr->block[i] = 1;
-
- } else {
+ }
+ else {
tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
@@ -1423,60 +1228,56 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
/* zero out the in memory small ds */
HDmemset(tv_ptr->small_ds_buf_1, 0, sizeof(uint32_t) * tv_ptr->small_ds_size);
-
-#if CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG
- HDfprintf(stdout,
- "%s writing slices from big ds to slices of small ds on disk.\n",
- fcnName);
+#if CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG
+ HDfprintf(stdout, "%s writing slices from big ds to slices of small ds on disk.\n", fcnName);
#endif /* CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG */
/* in serial versions of this test, we loop through all the dimensions
- * of the large data set that don't appear in the small data set.
+ * of the large data set that don't appear in the small data set.
*
- * However, in the parallel version, each process only works with that
- * slice of the large (and small) data set indicated by its rank -- hence
- * we set the most slowly changing index to mpi_rank, and don't itterate
+ * However, in the parallel version, each process only works with that
+ * slice of the large (and small) data set indicated by its rank -- hence
+ * we set the most slowly changing index to mpi_rank, and don't itterate
* over it.
*/
-
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0) {
i = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
i = 0;
}
- /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
+ /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
* loop over it -- either we are setting i to mpi_rank, or
- * we are setting it to zero. It will not change during the
+ * we are setting it to zero. It will not change during the
* test.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1) {
j = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
j = 0;
}
j = 0;
do {
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2) {
k = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
k = 0;
}
do {
- /* since small rank >= 2 and large_rank > small_rank, we
+ /* since small rank >= 2 and large_rank > small_rank, we
* have large_rank >= 3. Since PAR_SS_DR_MAX_RANK == 5
* (baring major re-orgaization), this gives us:
*
@@ -1488,11 +1289,11 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
l = 0;
do {
- if ( (tv_ptr->skips)++ < tv_ptr->max_skips ) { /* skip the test */
+ if ((tv_ptr->skips)++ < tv_ptr->max_skips) { /* skip the test */
(tv_ptr->tests_skipped)++;
-
- } else { /* run the test */
+ }
+ else { /* run the test */
tv_ptr->skips = 0; /* reset the skips counter */
@@ -1502,12 +1303,8 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
*/
/* zero out this rank's slice of the on disk small data set */
- ret = H5Dwrite(tv_ptr->small_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_small_ds_sid,
- tv_ptr->file_small_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->small_ds_buf_2);
+ ret = H5Dwrite(tv_ptr->small_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_small_ds_sid,
+ tv_ptr->file_small_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->small_ds_buf_2);
VRFY((ret >= 0), "H5Dwrite() zero slice to small ds succeeded.");
/* select the portion of the in memory large cube from which we
@@ -1519,88 +1316,65 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
tv_ptr->start[3] = (hsize_t)l;
tv_ptr->start[4] = 0;
- ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid,
- H5S_SELECT_SET,
- tv_ptr->start_ptr,
- tv_ptr->stride_ptr,
- tv_ptr->count_ptr,
- tv_ptr->block_ptr);
- VRFY((ret >= 0),
- "H5Sselect_hyperslab() mem_large_ds_sid succeeded.");
-
+ ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid, H5S_SELECT_SET, tv_ptr->start_ptr,
+ tv_ptr->stride_ptr, tv_ptr->count_ptr, tv_ptr->block_ptr);
+ VRFY((ret >= 0), "H5Sselect_hyperslab() mem_large_ds_sid succeeded.");
/* verify that H5S_select_shape_same() reports the in
* memory slice through the cube selection and the
* on disk full square selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0,
- tv_ptr->mem_large_ds_sid);
+ check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0, tv_ptr->mem_large_ds_sid);
VRFY((check == TRUE), "H5S_select_shape_same_test passed.");
-
- /* write the slice from the in memory large data set to the
+ /* write the slice from the in memory large data set to the
* slice of the on disk small dataset. */
-#if CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG
- HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n",
- fcnName, (int)(tv_ptr->mpi_rank),
- (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]),
- (int)(tv_ptr->start[2]), (int)(tv_ptr->start[3]),
- (int)(tv_ptr->start[4]));
- HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n",
- fcnName, tv_ptr->mpi_rank,
+#if CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, (int)(tv_ptr->mpi_rank),
+ (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]), (int)(tv_ptr->start[2]),
+ (int)(tv_ptr->start[3]), (int)(tv_ptr->start[4]));
+ HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n", fcnName, tv_ptr->mpi_rank,
H5Sget_simple_extent_ndims(tv_ptr->mem_large_ds_sid),
H5Sget_simple_extent_ndims(tv_ptr->file_small_ds_sid_0));
#endif /* CONTIG_HS_DR_PIO_TEST__M2D_L2S__DEBUG */
- ret = H5Dwrite(tv_ptr->small_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_large_ds_sid,
- tv_ptr->file_small_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->large_ds_buf_0);
+ ret = H5Dwrite(tv_ptr->small_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_large_ds_sid,
+ tv_ptr->file_small_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->large_ds_buf_0);
VRFY((ret >= 0), "H5Dwrite() slice to large ds succeeded.");
-
/* read the on disk square into memory */
- ret = H5Dread(tv_ptr->small_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_small_ds_sid,
- tv_ptr->file_small_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->small_ds_buf_1);
+ ret = H5Dread(tv_ptr->small_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_small_ds_sid,
+ tv_ptr->file_small_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->small_ds_buf_1);
VRFY((ret >= 0), "H5Dread() slice from small ds succeeded.");
-
/* verify that expected data is retrieved */
mis_match = FALSE;
- ptr_1 = tv_ptr->small_ds_buf_1;
+ ptr_1 = tv_ptr->small_ds_buf_1;
expected_value = (uint32_t)(
- (i * tv_ptr->edge_size * tv_ptr->edge_size *
- tv_ptr->edge_size * tv_ptr->edge_size) +
+ (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
(j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
- (k * tv_ptr->edge_size * tv_ptr->edge_size) +
- (l * tv_ptr->edge_size));
+ (k * tv_ptr->edge_size * tv_ptr->edge_size) + (l * tv_ptr->edge_size));
start_index = (size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size;
- stop_index = start_index + tv_ptr->small_ds_slice_size - 1;
+ stop_index = start_index + tv_ptr->small_ds_slice_size - 1;
- HDassert( start_index < stop_index );
- HDassert( stop_index <= tv_ptr->small_ds_size );
+ HDassert(start_index < stop_index);
+ HDassert(stop_index <= tv_ptr->small_ds_size);
- for ( n = 0; n < tv_ptr->small_ds_size; n++ ) {
+ for (n = 0; n < tv_ptr->small_ds_size; n++) {
- if ( ( n >= start_index ) && ( n <= stop_index ) ) {
+ if ((n >= start_index) && (n <= stop_index)) {
- if ( *ptr_1 != expected_value ) {
+ if (*ptr_1 != expected_value) {
mis_match = TRUE;
}
expected_value++;
+ }
+ else {
- } else {
-
- if ( *ptr_1 != 0 ) {
+ if (*ptr_1 != 0) {
mis_match = TRUE;
}
@@ -1611,59 +1385,47 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
ptr_1++;
}
- VRFY((mis_match == FALSE),
- "small slice write from large ds data good.");
+ VRFY((mis_match == FALSE), "small slice write from large ds data good.");
(tv_ptr->tests_run)++;
}
l++;
- (tv_ptr->total_tests)++;
+ (tv_ptr->total_tests)++;
- } while ( ( tv_ptr->large_rank > 2 ) &&
- ( (tv_ptr->small_rank - 1) <= 1 ) &&
- ( l < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 2) && ((tv_ptr->small_rank - 1) <= 1) && (l < tv_ptr->edge_size));
k++;
- } while ( ( tv_ptr->large_rank > 3 ) &&
- ( (tv_ptr->small_rank - 1) <= 2 ) &&
- ( k < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 3) && ((tv_ptr->small_rank - 1) <= 2) && (k < tv_ptr->edge_size));
j++;
- } while ( ( tv_ptr->large_rank > 4 ) &&
- ( (tv_ptr->small_rank - 1) <= 3 ) &&
- ( j < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 4) && ((tv_ptr->small_rank - 1) <= 3) && (j < tv_ptr->edge_size));
return;
} /* contig_hs_dr_pio_test__m2d_l2s() */
-
/*-------------------------------------------------------------------------
- * Function: contig_hs_dr_pio_test__m2d_s2l()
+ * Function: contig_hs_dr_pio_test__m2d_s2l()
*
- * Purpose: Part four of a series of tests of I/O to/from hyperslab
- * selections of different rank in the parallel.
+ * Purpose: Part four of a series of tests of I/O to/from hyperslab
+ * selections of different rank in the parallel.
*
- * Verify that we can write from memory to file using
- * selections of different rank that H5S_select_shape_same()
- * views as being of the same shape.
+ * Verify that we can write from memory to file using
+ * selections of different rank that H5S_select_shape_same()
+ * views as being of the same shape.
*
- * Do this by writing the contents of the process's slice of
- * the in memory small data set to slices of the on disk
- * large data set. After each write, read the process's
- * slice of the large data set back into memory, and verify
- * that it contains the expected data.
+ * Do this by writing the contents of the process's slice of
+ * the in memory small data set to slices of the on disk
+ * large data set. After each write, read the process's
+ * slice of the large data set back into memory, and verify
+ * that it contains the expected data.
*
- * Verify that H5S_select_shape_same() returns true on the
- * memory and file selections.
+ * Verify that H5S_select_shape_same() returns true on the
+ * memory and file selections.
*
- * Return: void
+ * Return: void
*
- * Programmer: JRM -- 8/10/11
- *
- * Modifications:
- *
- * None
+ * Programmer: JRM -- 8/10/11
*
*-------------------------------------------------------------------------
*/
@@ -1671,72 +1433,67 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
#define CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG 0
static void
-contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
+contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG
+#if CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG
const char *fcnName = "contig_hs_dr_pio_test__m2d_s2l()";
#endif /* CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG */
- hbool_t mis_match = FALSE;
- int i, j, k, l;
- size_t n;
- int mpi_rank; /* needed by the VRFY macro */
- size_t start_index;
- size_t stop_index;
- uint32_t expected_value;
- uint32_t * ptr_1;
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hbool_t mis_match = FALSE;
+ int i, j, k, l;
+ size_t n;
+ int mpi_rank; /* needed by the VRFY macro */
+ size_t start_index;
+ size_t stop_index;
+ uint32_t expected_value;
+ uint32_t *ptr_1;
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
- /* Now write the contents of the process's slice of the in memory
- * small data set to slices of the on disk large data set. After
+ /* Now write the contents of the process's slice of the in memory
+ * small data set to slices of the on disk large data set. After
* each write, read the process's slice of the large data set back
- * into memory, and verify that it contains the expected data.
- * Verify that H5S_select_shape_same() returns true on the memory
+ * into memory, and verify that it contains the expected data.
+ * Verify that H5S_select_shape_same() returns true on the memory
* and file selections.
*/
- /* select the slice of the in memory small data set associated with
+ /* select the slice of the in memory small data set associated with
* the process's mpi rank.
*/
- tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
+ tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
tv_ptr->stride[0] = (hsize_t)(2 * (tv_ptr->mpi_size + 1));
- tv_ptr->count[0] = 1;
- tv_ptr->block[0] = 1;
+ tv_ptr->count[0] = 1;
+ tv_ptr->block[0] = 1;
- for ( i = 1; i < tv_ptr->large_rank; i++ ) {
+ for (i = 1; i < tv_ptr->large_rank; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
+ tv_ptr->count[i] = 1;
+ tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
- ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(mem_small_ds_sid, set) suceeded");
-
/* set up start, stride, count, and block -- note that we will
* change start[] so as to write slices of the small data set to
* slices of the large data set.
*/
- for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) {
+ for (i = 0; i < PAR_SS_DR_MAX_RANK; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- if ( (PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1) ) {
+ tv_ptr->count[i] = 1;
+ if ((PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1)) {
tv_ptr->block[i] = 1;
-
- } else {
+ }
+ else {
tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
@@ -1745,48 +1502,46 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
/* zero out the in memory large ds */
HDmemset(tv_ptr->large_ds_buf_1, 0, sizeof(uint32_t) * tv_ptr->large_ds_size);
-#if CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG
- HDfprintf(stdout,
- "%s writing process slices of small ds to slices of large ds on disk.\n",
- fcnName);
+#if CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG
+ HDfprintf(stdout, "%s writing process slices of small ds to slices of large ds on disk.\n", fcnName);
#endif /* CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG */
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0) {
i = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
i = 0;
}
- /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
+ /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
* loop over it -- either we are setting i to mpi_rank, or
- * we are setting it to zero. It will not change during the
+ * we are setting it to zero. It will not change during the
* test.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1) {
j = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
j = 0;
}
do {
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2) {
k = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
k = 0;
}
do {
- /* since small rank >= 2 and large_rank > small_rank, we
+ /* since small rank >= 2 and large_rank > small_rank, we
* have large_rank >= 3. Since PAR_SS_DR_MAX_RANK == 5
* (baring major re-orgaization), this gives us:
*
@@ -1798,29 +1553,26 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
l = 0;
do {
- if ( (tv_ptr->skips)++ < tv_ptr->max_skips ) { /* skip the test */
+ if ((tv_ptr->skips)++ < tv_ptr->max_skips) { /* skip the test */
(tv_ptr->tests_skipped)++;
-#if CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG
+#if CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG
tv_ptr->start[0] = (hsize_t)i;
tv_ptr->start[1] = (hsize_t)j;
tv_ptr->start[2] = (hsize_t)k;
tv_ptr->start[3] = (hsize_t)l;
tv_ptr->start[4] = 0;
- HDfprintf(stdout,
- "%s:%d: skipping test with start = %d %d %d %d %d.\n",
- fcnName, (int)(tv_ptr->mpi_rank),
- (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]),
- (int)(tv_ptr->start[2]), (int)(tv_ptr->start[3]),
- (int)(tv_ptr->start[4]));
- HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n",
- fcnName, tv_ptr->mpi_rank,
+ HDfprintf(stdout, "%s:%d: skipping test with start = %d %d %d %d %d.\n", fcnName,
+ (int)(tv_ptr->mpi_rank), (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]),
+ (int)(tv_ptr->start[2]), (int)(tv_ptr->start[3]), (int)(tv_ptr->start[4]));
+ HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n", fcnName, tv_ptr->mpi_rank,
H5Sget_simple_extent_ndims(tv_ptr->mem_small_ds_sid),
H5Sget_simple_extent_ndims(tv_ptr->file_large_ds_sid_0));
#endif /* CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG */
- } else { /* run the test */
+ }
+ else { /* run the test */
tv_ptr->skips = 0; /* reset the skips counter */
@@ -1833,15 +1585,11 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
* Note that this will leave one slice with its original data
* as there is one more slice than processes.
*/
- ret = H5Dwrite(tv_ptr->large_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->large_ds_slice_sid,
- tv_ptr->file_large_ds_process_slice_sid,
- tv_ptr->xfer_plist,
+ ret = H5Dwrite(tv_ptr->large_dataset, H5T_NATIVE_UINT32, tv_ptr->large_ds_slice_sid,
+ tv_ptr->file_large_ds_process_slice_sid, tv_ptr->xfer_plist,
tv_ptr->large_ds_buf_2);
VRFY((ret != FAIL), "H5Dwrite() to zero large ds suceeded");
-
/* select the portion of the in memory large cube to which we
* are going to write data.
*/
@@ -1851,97 +1599,71 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
tv_ptr->start[3] = (hsize_t)l;
tv_ptr->start[4] = 0;
- ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0,
- H5S_SELECT_SET,
- tv_ptr->start_ptr,
- tv_ptr->stride_ptr,
- tv_ptr->count_ptr,
- tv_ptr->block_ptr);
- VRFY((ret != FAIL),
- "H5Sselect_hyperslab() target large ds slice succeeded");
-
+ ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0, H5S_SELECT_SET, tv_ptr->start_ptr,
+ tv_ptr->stride_ptr, tv_ptr->count_ptr, tv_ptr->block_ptr);
+ VRFY((ret != FAIL), "H5Sselect_hyperslab() target large ds slice succeeded");
/* verify that H5S_select_shape_same() reports the in
* memory small data set slice selection and the
* on disk slice through the large data set selection
* as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->mem_small_ds_sid,
- tv_ptr->file_large_ds_sid_0);
+ check = H5S_select_shape_same_test(tv_ptr->mem_small_ds_sid, tv_ptr->file_large_ds_sid_0);
VRFY((check == TRUE), "H5S_select_shape_same_test passed");
-
- /* write the small data set slice from memory to the
- * target slice of the disk data set
+ /* write the small data set slice from memory to the
+ * target slice of the disk data set
*/
-#if CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG
- HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n",
- fcnName, (int)(tv_ptr->mpi_rank),
- (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]),
- (int)(tv_ptr->start[2]), (int)(tv_ptr->start[3]),
- (int)(tv_ptr->start[4]));
- HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n",
- fcnName, tv_ptr->mpi_rank,
+#if CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, (int)(tv_ptr->mpi_rank),
+ (int)(tv_ptr->start[0]), (int)(tv_ptr->start[1]), (int)(tv_ptr->start[2]),
+ (int)(tv_ptr->start[3]), (int)(tv_ptr->start[4]));
+ HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n", fcnName, tv_ptr->mpi_rank,
H5Sget_simple_extent_ndims(tv_ptr->mem_small_ds_sid),
H5Sget_simple_extent_ndims(tv_ptr->file_large_ds_sid_0));
#endif /* CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG */
- ret = H5Dwrite(tv_ptr->large_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_small_ds_sid,
- tv_ptr->file_large_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->small_ds_buf_0);
- VRFY((ret != FAIL),
- "H5Dwrite of small ds slice to large ds succeeded");
-
+ ret = H5Dwrite(tv_ptr->large_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_small_ds_sid,
+ tv_ptr->file_large_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->small_ds_buf_0);
+ VRFY((ret != FAIL), "H5Dwrite of small ds slice to large ds succeeded");
- /* read this processes slice on the on disk large
+ /* read this processes slice on the on disk large
* data set into memory.
*/
- ret = H5Dread(tv_ptr->large_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_large_ds_process_slice_sid,
- tv_ptr->file_large_ds_process_slice_sid,
- tv_ptr->xfer_plist,
- tv_ptr->large_ds_buf_1);
- VRFY((ret != FAIL),
- "H5Dread() of process slice of large ds succeeded");
-
+ ret = H5Dread(
+ tv_ptr->large_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_large_ds_process_slice_sid,
+ tv_ptr->file_large_ds_process_slice_sid, tv_ptr->xfer_plist, tv_ptr->large_ds_buf_1);
+ VRFY((ret != FAIL), "H5Dread() of process slice of large ds succeeded");
/* verify that the expected data and only the
* expected data was read.
*/
- ptr_1 = tv_ptr->large_ds_buf_1;
- expected_value = (uint32_t)
- ((size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size);
-
- start_index = (size_t)
- ((i * tv_ptr->edge_size * tv_ptr->edge_size *
- tv_ptr->edge_size * tv_ptr->edge_size) +
- (j * tv_ptr->edge_size * tv_ptr->edge_size *
- tv_ptr->edge_size) +
- (k * tv_ptr->edge_size * tv_ptr->edge_size) +
- (l * tv_ptr->edge_size));
+ ptr_1 = tv_ptr->large_ds_buf_1;
+ expected_value = (uint32_t)((size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size);
+
+ start_index = (size_t)(
+ (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
+ (j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
+ (k * tv_ptr->edge_size * tv_ptr->edge_size) + (l * tv_ptr->edge_size));
stop_index = start_index + tv_ptr->small_ds_slice_size - 1;
- HDassert( start_index < stop_index );
- HDassert( stop_index < tv_ptr->large_ds_size );
+ HDassert(start_index < stop_index);
+ HDassert(stop_index < tv_ptr->large_ds_size);
- for ( n = 0; n < tv_ptr->large_ds_size; n++ ) {
+ for (n = 0; n < tv_ptr->large_ds_size; n++) {
- if ( ( n >= start_index ) && ( n <= stop_index ) ) {
+ if ((n >= start_index) && (n <= stop_index)) {
- if ( *ptr_1 != expected_value ) {
+ if (*ptr_1 != expected_value) {
mis_match = TRUE;
}
expected_value++;
+ }
+ else {
- } else {
-
- if ( *ptr_1 != 0 ) {
+ if (*ptr_1 != 0) {
mis_match = TRUE;
}
@@ -1951,8 +1673,7 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
ptr_1++;
}
- VRFY((mis_match == FALSE),
- "small ds slice write to large ds slice data good.");
+ VRFY((mis_match == FALSE), "small ds slice write to large ds slice data good.");
(tv_ptr->tests_run)++;
}
@@ -1961,47 +1682,25 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
(tv_ptr->total_tests)++;
- } while ( ( tv_ptr->large_rank > 2 ) &&
- ( (tv_ptr->small_rank - 1) <= 1 ) &&
- ( l < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 2) && ((tv_ptr->small_rank - 1) <= 1) && (l < tv_ptr->edge_size));
k++;
- } while ( ( tv_ptr->large_rank > 3 ) &&
- ( (tv_ptr->small_rank - 1) <= 2 ) &&
- ( k < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 3) && ((tv_ptr->small_rank - 1) <= 2) && (k < tv_ptr->edge_size));
j++;
- } while ( ( tv_ptr->large_rank > 4 ) &&
- ( (tv_ptr->small_rank - 1) <= 3 ) &&
- ( j < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 4) && ((tv_ptr->small_rank - 1) <= 3) && (j < tv_ptr->edge_size));
return;
} /* contig_hs_dr_pio_test__m2d_s2l() */
-
/*-------------------------------------------------------------------------
- * Function: contig_hs_dr_pio_test__run_test()
- *
- * Purpose: Test I/O to/from hyperslab selections of different rank in
- * the parallel.
+ * Function: contig_hs_dr_pio_test__run_test()
*
- * Return: void
+ * Purpose: Test I/O to/from hyperslab selections of different rank in
+ * the parallel.
*
- * Programmer: JRM -- 9/18/09
+ * Return: void
*
- * Modifications:
- *
- * JRM -- 9/16/10
- * Added express_test parameter. Use it to control whether
- * we set up the chunks so that no chunk is shared between
- * processes, and also whether we set an alignment when we
- * create the test file.
- *
- * JRM -- 8/11/11
- * Refactored function heavily & broke it into six functions.
- * Added the skips_ptr, max_skips, total_tests_ptr,
- * tests_run_ptr, and tests_skiped_ptr parameters to support
- * skipping portions of the test according to the express
- * test value.
+ * Programmer: JRM -- 9/18/09
*
*-------------------------------------------------------------------------
*/
@@ -2009,27 +1708,17 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
#define CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG 0
static void
-contig_hs_dr_pio_test__run_test(const int test_num,
- const int edge_size,
- const int chunk_edge_size,
- const int small_rank,
- const int large_rank,
- const hbool_t use_collective_io,
- const hid_t dset_type,
- int express_test,
- int * skips_ptr,
- int max_skips,
- int64_t * total_tests_ptr,
- int64_t * tests_run_ptr,
- int64_t * tests_skipped_ptr)
+contig_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const int chunk_edge_size,
+ const int small_rank, const int large_rank, const hbool_t use_collective_io,
+ const hid_t dset_type, int express_test, int *skips_ptr, int max_skips,
+ int64_t *total_tests_ptr, int64_t *tests_run_ptr, int64_t *tests_skipped_ptr)
{
-#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
+#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
const char *fcnName = "contig_hs_dr_pio_test__run_test()";
#endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
- int mpi_rank;
- struct hs_dr_pio_test_vars_t test_vars =
- {
- /* int mpi_size = */ -1,
+ int mpi_rank;
+ struct hs_dr_pio_test_vars_t test_vars = {
+ /* int mpi_size = */ -1,
/* int mpi_rank = */ -1,
/* MPI_Comm mpi_comm = */ MPI_COMM_NULL,
/* MPI_Inf mpi_info = */ MPI_INFO_NULL,
@@ -2045,12 +1734,12 @@ contig_hs_dr_pio_test__run_test(const int test_num,
/* uint32_t * small_ds_buf_2 = */ NULL,
/* uint32_t * small_ds_slice_buf = */ NULL,
/* uint32_t * large_ds_buf_0 = */ NULL,
- /* uint32_t * large_ds_buf_1 = */ NULL,
+ /* uint32_t * large_ds_buf_1 = */ NULL,
/* uint32_t * large_ds_buf_2 = */ NULL,
/* uint32_t * large_ds_slice_buf = */ NULL,
/* int small_ds_offset = */ -1,
/* int large_ds_offset = */ -1,
- /* hid_t fid = */ -1, /* HDF5 file ID */
+ /* hid_t fid = */ -1, /* HDF5 file ID */
/* hid_t xfer_plist = */ H5P_DEFAULT,
/* hid_t full_mem_small_ds_sid = */ -1,
/* hid_t full_file_small_ds_sid = */ -1,
@@ -2066,45 +1755,42 @@ contig_hs_dr_pio_test__run_test(const int test_num,
/* hid_t file_large_ds_process_slice_sid = */ -1,
/* hid_t mem_large_ds_process_slice_sid = */ -1,
/* hid_t large_ds_slice_sid = */ -1,
- /* hid_t small_dataset = */ -1, /* Dataset ID */
- /* hid_t large_dataset = */ -1, /* Dataset ID */
+ /* hid_t small_dataset = */ -1, /* Dataset ID */
+ /* hid_t large_dataset = */ -1, /* Dataset ID */
/* size_t small_ds_size = */ 1,
/* size_t small_ds_slice_size = */ 1,
/* size_t large_ds_size = */ 1,
/* size_t large_ds_slice_size = */ 1,
- /* hsize_t dims[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t chunk_dims[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t start[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t stride[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t count[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t block[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
+ /* hsize_t dims[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t chunk_dims[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t start[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t stride[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t count[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t block[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
/* hsize_t * start_ptr = */ NULL,
/* hsize_t * stride_ptr = */ NULL,
/* hsize_t * count_ptr = */ NULL,
/* hsize_t * block_ptr = */ NULL,
- /* int skips = */ 0,
- /* int max_skips = */ 0,
+ /* int skips = */ 0,
+ /* int max_skips = */ 0,
/* int64_t total_tests = */ 0,
/* int64_t tests_run = */ 0,
- /* int64_t tests_skipped = */ 0
- };
- struct hs_dr_pio_test_vars_t * tv_ptr = &test_vars;
+ /* int64_t tests_skipped = */ 0};
+ struct hs_dr_pio_test_vars_t *tv_ptr = &test_vars;
- hs_dr_pio_test__setup(test_num, edge_size, -1, chunk_edge_size,
- small_rank, large_rank, use_collective_io,
+ hs_dr_pio_test__setup(test_num, edge_size, -1, chunk_edge_size, small_rank, large_rank, use_collective_io,
dset_type, express_test, tv_ptr);
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
/* initialize skips & max_skips */
- tv_ptr->skips = *skips_ptr;
+ tv_ptr->skips = *skips_ptr;
tv_ptr->max_skips = max_skips;
-#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
- HDfprintf(stdout, "test %d: small rank = %d, large rank = %d.\n",
- test_num, small_rank, large_rank);
+#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
+ if (MAINPROCESS) {
+ HDfprintf(stdout, "test %d: small rank = %d, large rank = %d.\n", test_num, small_rank, large_rank);
HDfprintf(stdout, "test %d: Initialization complete.\n", test_num);
}
#endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
@@ -2113,79 +1799,75 @@ contig_hs_dr_pio_test__run_test(const int test_num,
* of different rank that H5S_select_shape_same() views as being of the
* same shape.
*
- * Start by reading small_rank - 1 dimensional slice from the on disk
- * large cube, and verifying that the data read is correct. Verify that
+ * Start by reading small_rank - 1 dimensional slice from the on disk
+ * large cube, and verifying that the data read is correct. Verify that
* H5S_select_shape_same() returns true on the memory and file selections.
*/
-#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
+#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
+ if (MAINPROCESS) {
HDfprintf(stdout, "test %d: running contig_hs_dr_pio_test__d2m_l2s.\n", test_num);
}
#endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
contig_hs_dr_pio_test__d2m_l2s(tv_ptr);
-
- /* Second, read slices of the on disk small data set into slices
- * through the in memory large data set, and verify that the correct
+ /* Second, read slices of the on disk small data set into slices
+ * through the in memory large data set, and verify that the correct
* data (and only the correct data) is read.
*/
-#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
+#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
+ if (MAINPROCESS) {
HDfprintf(stdout, "test %d: running contig_hs_dr_pio_test__d2m_s2l.\n", test_num);
}
#endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
contig_hs_dr_pio_test__d2m_s2l(tv_ptr);
-
/* now we go in the opposite direction, verifying that we can write
* from memory to file using selections of different rank that
* H5S_select_shape_same() views as being of the same shape.
*
* Start by writing small_rank - 1 D slices from the in memory large data
- * set to the on disk small cube dataset. After each write, read the
- * slice of the small dataset back from disk, and verify that it contains
- * the expected data. Verify that H5S_select_shape_same() returns true on
+ * set to the on disk small cube dataset. After each write, read the
+ * slice of the small dataset back from disk, and verify that it contains
+ * the expected data. Verify that H5S_select_shape_same() returns true on
* the memory and file selections.
*/
-#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
+#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
+ if (MAINPROCESS) {
HDfprintf(stdout, "test %d: running contig_hs_dr_pio_test__m2d_l2s.\n", test_num);
}
#endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
contig_hs_dr_pio_test__m2d_l2s(tv_ptr);
-
- /* Now write the contents of the process's slice of the in memory
- * small data set to slices of the on disk large data set. After
+ /* Now write the contents of the process's slice of the in memory
+ * small data set to slices of the on disk large data set. After
* each write, read the process's slice of the large data set back
- * into memory, and verify that it contains the expected data.
- * Verify that H5S_select_shape_same() returns true on the memory
+ * into memory, and verify that it contains the expected data.
+ * Verify that H5S_select_shape_same() returns true on the memory
* and file selections.
*/
-#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
+#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
+ if (MAINPROCESS) {
HDfprintf(stdout, "test %d: running contig_hs_dr_pio_test__m2d_s2l.\n", test_num);
}
#endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
contig_hs_dr_pio_test__m2d_s2l(tv_ptr);
-#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
- HDfprintf(stdout,
- "test %d: Subtests complete -- tests run/skipped/total = %lld/%lld/%lld.\n",
- test_num, (long long)(tv_ptr->tests_run), (long long)(tv_ptr->tests_skipped),
- (long long)(tv_ptr->total_tests));
+#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
+ if (MAINPROCESS) {
+ HDfprintf(stdout, "test %d: Subtests complete -- tests run/skipped/total = %lld/%lld/%lld.\n",
+ test_num, (long long)(tv_ptr->tests_run), (long long)(tv_ptr->tests_skipped),
+ (long long)(tv_ptr->total_tests));
}
#endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
hs_dr_pio_test__takedown(tv_ptr);
-#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
+#if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG
+ if (MAINPROCESS) {
HDfprintf(stdout, "test %d: Takedown complete.\n", test_num);
}
#endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
@@ -2199,61 +1881,46 @@ contig_hs_dr_pio_test__run_test(const int test_num,
} /* contig_hs_dr_pio_test__run_test() */
-
/*-------------------------------------------------------------------------
- * Function: contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
- *
- * Purpose: Test I/O to/from hyperslab selections of different rank in
- * the parallel case.
+ * Function: contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
*
- * Return: void
+ * Purpose: Test I/O to/from hyperslab selections of different rank in
+ * the parallel case.
*
- * Programmer: JRM -- 9/18/09
+ * Return: void
*
- * Modifications:
- *
- * Modified function to take a sample of the run times
- * of the different tests, and skip some of them if
- * run times are too long.
- *
- * We need to do this because Lustre runns very slowly
- * if two or more processes are banging on the same
- * block of memory.
- * JRM -- 9/10/10
- * Break this one big test into 4 smaller tests according
- * to {independent,collective}x{contigous,chunked} datasets.
- * AKC -- 2010/01/14
+ * Programmer: JRM -- 9/18/09
*
*-------------------------------------------------------------------------
*/
#define CONTIG_HS_DR_PIO_TEST__DEBUG 0
-void
+static void
contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
{
- int express_test;
- int local_express_test;
- int mpi_rank = -1;
- int mpi_size;
- int test_num = 0;
- int edge_size;
- int chunk_edge_size = 0;
- int small_rank;
- int large_rank;
- int mpi_result;
- int skips = 0;
- int max_skips = 0;
- /* The following table list the number of sub-tests skipped between
- * each test that is actually executed as a function of the express
+ int express_test;
+ int local_express_test;
+ int mpi_rank = -1;
+ int mpi_size;
+ int test_num = 0;
+ int edge_size;
+ int chunk_edge_size = 0;
+ int small_rank;
+ int large_rank;
+ int mpi_result;
+ int skips = 0;
+ int max_skips = 0;
+ /* The following table list the number of sub-tests skipped between
+ * each test that is actually executed as a function of the express
* test level. Note that any value in excess of 4880 will cause all
* sub tests to be skipped.
*/
- int max_skips_tbl[4] = {0, 4, 64, 1024};
- hid_t dset_type = H5T_NATIVE_UINT;
- int64_t total_tests = 0;
- int64_t tests_run = 0;
- int64_t tests_skipped = 0;
+ int max_skips_tbl[4] = {0, 4, 64, 1024};
+ hid_t dset_type = H5T_NATIVE_UINT;
+ int64_t total_tests = 0;
+ int64_t tests_run = 0;
+ int64_t tests_skipped = 0;
HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned));
@@ -2264,45 +1931,33 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
local_express_test = GetTestExpress();
- mpi_result = MPI_Allreduce((void *)&local_express_test,
- (void *)&express_test,
- 1,
- MPI_INT,
- MPI_MAX,
+ mpi_result = MPI_Allreduce((void *)&local_express_test, (void *)&express_test, 1, MPI_INT, MPI_MAX,
MPI_COMM_WORLD);
- VRFY((mpi_result == MPI_SUCCESS ), "MPI_Allreduce(0) succeeded");
+ VRFY((mpi_result == MPI_SUCCESS), "MPI_Allreduce(0) succeeded");
- if ( local_express_test < 0 ) {
+ if (local_express_test < 0) {
max_skips = max_skips_tbl[0];
- } else if ( local_express_test > 3 ) {
+ }
+ else if (local_express_test > 3) {
max_skips = max_skips_tbl[3];
- } else {
+ }
+ else {
max_skips = max_skips_tbl[local_express_test];
}
- for ( large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++ ) {
+ for (large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++) {
- for ( small_rank = 2; small_rank < large_rank; small_rank++ ) {
+ for (small_rank = 2; small_rank < large_rank; small_rank++) {
- switch(sstest_type){
+ switch (sstest_type) {
case IND_CONTIG:
/* contiguous data set, independent I/O */
chunk_edge_size = 0;
- contig_hs_dr_pio_test__run_test(test_num,
- edge_size,
- chunk_edge_size,
- small_rank,
- large_rank,
- FALSE,
- dset_type,
- express_test,
- &skips,
- max_skips,
- &total_tests,
- &tests_run,
- &tests_skipped);
+ contig_hs_dr_pio_test__run_test(test_num, edge_size, chunk_edge_size, small_rank,
+ large_rank, FALSE, dset_type, express_test, &skips,
+ max_skips, &total_tests, &tests_run, &tests_skipped);
test_num++;
break;
/* end of case IND_CONTIG */
@@ -2311,19 +1966,9 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
/* contiguous data set, collective I/O */
chunk_edge_size = 0;
- contig_hs_dr_pio_test__run_test(test_num,
- edge_size,
- chunk_edge_size,
- small_rank,
- large_rank,
- TRUE,
- dset_type,
- express_test,
- &skips,
- max_skips,
- &total_tests,
- &tests_run,
- &tests_skipped);
+ contig_hs_dr_pio_test__run_test(test_num, edge_size, chunk_edge_size, small_rank,
+ large_rank, TRUE, dset_type, express_test, &skips,
+ max_skips, &total_tests, &tests_run, &tests_skipped);
test_num++;
break;
/* end of case COL_CONTIG */
@@ -2332,19 +1977,9 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
/* chunked data set, independent I/O */
chunk_edge_size = 5;
- contig_hs_dr_pio_test__run_test(test_num,
- edge_size,
- chunk_edge_size,
- small_rank,
- large_rank,
- FALSE,
- dset_type,
- express_test,
- &skips,
- max_skips,
- &total_tests,
- &tests_run,
- &tests_skipped);
+ contig_hs_dr_pio_test__run_test(test_num, edge_size, chunk_edge_size, small_rank,
+ large_rank, FALSE, dset_type, express_test, &skips,
+ max_skips, &total_tests, &tests_run, &tests_skipped);
test_num++;
break;
/* end of case IND_CHUNKED */
@@ -2353,19 +1988,9 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
/* chunked data set, collective I/O */
chunk_edge_size = 5;
- contig_hs_dr_pio_test__run_test(test_num,
- edge_size,
- chunk_edge_size,
- small_rank,
- large_rank,
- TRUE,
- dset_type,
- express_test,
- &skips,
- max_skips,
- &total_tests,
- &tests_run,
- &tests_skipped);
+ contig_hs_dr_pio_test__run_test(test_num, edge_size, chunk_edge_size, small_rank,
+ large_rank, TRUE, dset_type, express_test, &skips,
+ max_skips, &total_tests, &tests_run, &tests_skipped);
test_num++;
break;
/* end of case COL_CHUNKED */
@@ -2376,98 +2001,91 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
} /* end of switch(sstest_type) */
#if CONTIG_HS_DR_PIO_TEST__DEBUG
- if ( ( MAINPROCESS ) && ( tests_skipped > 0 ) ) {
- HDfprintf(stdout, " run/skipped/total = %lld/%lld/%lld.\n",
- tests_run, tests_skipped, total_tests);
+ if ((MAINPROCESS) && (tests_skipped > 0)) {
+ HDfprintf(stdout, " run/skipped/total = %lld/%lld/%lld.\n", tests_run, tests_skipped,
+ total_tests);
}
#endif /* CONTIG_HS_DR_PIO_TEST__DEBUG */
}
}
- if ( ( MAINPROCESS ) && ( tests_skipped > 0 ) ) {
- HDfprintf(stdout, " %lld of %lld subtests skipped to expedite testing.\n",
- tests_skipped, total_tests);
+ if ((MAINPROCESS) && (tests_skipped > 0)) {
+ HDfprintf(stdout, " %lld of %lld subtests skipped to expedite testing.\n", tests_skipped,
+ total_tests);
}
return;
} /* contig_hs_dr_pio_test() */
-
/****************************************************************
**
-** ckrbrd_hs_dr_pio_test__slct_ckrbrd():
-** Given a data space of tgt_rank, and dimensions:
+** ckrbrd_hs_dr_pio_test__slct_ckrbrd():
+** Given a dataspace of tgt_rank, and dimensions:
**
-** (mpi_size + 1), edge_size, ... , edge_size
+** (mpi_size + 1), edge_size, ... , edge_size
**
-** edge_size, and a checker_edge_size, select a checker
-** board selection of a sel_rank (sel_rank < tgt_rank)
-** dimensional slice through the data space parallel to the
+** edge_size, and a checker_edge_size, select a checker
+** board selection of a sel_rank (sel_rank < tgt_rank)
+** dimensional slice through the dataspace parallel to the
** sel_rank fastest changing indicies, with origin (in the
-** higher indicies) as indicated by the start array.
+** higher indicies) as indicated by the start array.
**
-** Note that this function, like all its relatives, is
-** hard coded to presume a maximum data space rank of 5.
-** While this maximum is declared as a constant, increasing
-** it will require extensive coding in addition to changing
+** Note that this function, like all its relatives, is
+** hard coded to presume a maximum dataspace rank of 5.
+** While this maximum is declared as a constant, increasing
+** it will require extensive coding in addition to changing
** the value of the constant.
**
-** JRM -- 10/8/09
+** JRM -- 10/8/09
**
****************************************************************/
#define CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG 0
static void
-ckrbrd_hs_dr_pio_test__slct_ckrbrd(const int mpi_rank,
- const hid_t tgt_sid,
- const int tgt_rank,
- const int edge_size,
- const int checker_edge_size,
- const int sel_rank,
+ckrbrd_hs_dr_pio_test__slct_ckrbrd(const int mpi_rank, const hid_t tgt_sid, const int tgt_rank,
+ const int edge_size, const int checker_edge_size, const int sel_rank,
hsize_t sel_start[])
{
-#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
- const char * fcnName = "ckrbrd_hs_dr_pio_test__slct_ckrbrd():";
-#endif
- hbool_t first_selection = TRUE;
- int i, j, k, l, m;
- int n_cube_offset;
- int sel_offset;
- const int test_max_rank = PAR_SS_DR_MAX_RANK; /* must update code if */
- /* this changes */
- hsize_t base_count;
- hsize_t offset_count;
- hsize_t start[PAR_SS_DR_MAX_RANK];
- hsize_t stride[PAR_SS_DR_MAX_RANK];
- hsize_t count[PAR_SS_DR_MAX_RANK];
- hsize_t block[PAR_SS_DR_MAX_RANK];
- herr_t ret; /* Generic return value */
-
- HDassert( edge_size >= 6 );
- HDassert( 0 < checker_edge_size );
- HDassert( checker_edge_size <= edge_size );
- HDassert( 0 < sel_rank );
- HDassert( sel_rank <= tgt_rank );
- HDassert( tgt_rank <= test_max_rank );
- HDassert( test_max_rank <= PAR_SS_DR_MAX_RANK );
+#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
+ const char *fcnName = "ckrbrd_hs_dr_pio_test__slct_ckrbrd():";
+#endif
+ hbool_t first_selection = TRUE;
+ int i, j, k, l, m;
+ int n_cube_offset;
+ int sel_offset;
+ const int test_max_rank = PAR_SS_DR_MAX_RANK; /* must update code if */
+ /* this changes */
+ hsize_t base_count;
+ hsize_t offset_count;
+ hsize_t start[PAR_SS_DR_MAX_RANK];
+ hsize_t stride[PAR_SS_DR_MAX_RANK];
+ hsize_t count[PAR_SS_DR_MAX_RANK];
+ hsize_t block[PAR_SS_DR_MAX_RANK];
+ herr_t ret; /* Generic return value */
+
+ HDassert(edge_size >= 6);
+ HDassert(0 < checker_edge_size);
+ HDassert(checker_edge_size <= edge_size);
+ HDassert(0 < sel_rank);
+ HDassert(sel_rank <= tgt_rank);
+ HDassert(tgt_rank <= test_max_rank);
+ HDassert(test_max_rank <= PAR_SS_DR_MAX_RANK);
sel_offset = test_max_rank - sel_rank;
- HDassert( sel_offset >= 0 );
+ HDassert(sel_offset >= 0);
n_cube_offset = test_max_rank - tgt_rank;
- HDassert( n_cube_offset >= 0 );
- HDassert( n_cube_offset <= sel_offset );
-
-#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
- HDfprintf(stdout, "%s:%d: edge_size/checker_edge_size = %d/%d\n",
- fcnName, mpi_rank, edge_size, checker_edge_size);
- HDfprintf(stdout, "%s:%d: sel_rank/sel_offset = %d/%d.\n",
- fcnName, mpi_rank, sel_rank, sel_offset);
- HDfprintf(stdout, "%s:%d: tgt_rank/n_cube_offset = %d/%d.\n",
- fcnName, mpi_rank, tgt_rank, n_cube_offset);
-#endif /* CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG */
+ HDassert(n_cube_offset >= 0);
+ HDassert(n_cube_offset <= sel_offset);
+
+#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
+ HDfprintf(stdout, "%s:%d: edge_size/checker_edge_size = %d/%d\n", fcnName, mpi_rank, edge_size,
+ checker_edge_size);
+ HDfprintf(stdout, "%s:%d: sel_rank/sel_offset = %d/%d.\n", fcnName, mpi_rank, sel_rank, sel_offset);
+ HDfprintf(stdout, "%s:%d: tgt_rank/n_cube_offset = %d/%d.\n", fcnName, mpi_rank, tgt_rank, n_cube_offset);
+#endif /* CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG */
/* First, compute the base count (which assumes start == 0
* for the associated offset) and offset_count (which
@@ -2484,234 +2102,204 @@ ckrbrd_hs_dr_pio_test__slct_ckrbrd(const int mpi_rank,
base_count = (hsize_t)(edge_size / (checker_edge_size * 2));
- if ( (edge_size % (checker_edge_size * 2)) > 0 ) {
+ if ((edge_size % (checker_edge_size * 2)) > 0) {
base_count++;
}
offset_count = (hsize_t)((edge_size - checker_edge_size) / (checker_edge_size * 2));
- if ( ((edge_size - checker_edge_size) % (checker_edge_size * 2)) > 0 ) {
+ if (((edge_size - checker_edge_size) % (checker_edge_size * 2)) > 0) {
offset_count++;
}
/* Now set up the stride and block arrays, and portions of the start
- * and count arrays that will not be altered during the selection of
+ * and count arrays that will not be altered during the selection of
* the checker board.
*/
i = 0;
- while ( i < n_cube_offset ) {
+ while (i < n_cube_offset) {
/* these values should never be used */
- start[i] = 0;
+ start[i] = 0;
stride[i] = 0;
- count[i] = 0;
- block[i] = 0;
+ count[i] = 0;
+ block[i] = 0;
i++;
}
- while ( i < sel_offset ) {
+ while (i < sel_offset) {
- start[i] = sel_start[i];
+ start[i] = sel_start[i];
stride[i] = (hsize_t)(2 * edge_size);
- count[i] = 1;
- block[i] = 1;
+ count[i] = 1;
+ block[i] = 1;
i++;
}
- while ( i < test_max_rank ) {
+ while (i < test_max_rank) {
stride[i] = (hsize_t)(2 * checker_edge_size);
- block[i] = (hsize_t)checker_edge_size;
+ block[i] = (hsize_t)checker_edge_size;
i++;
}
-
+
i = 0;
do {
- if ( 0 >= sel_offset ) {
+ if (0 >= sel_offset) {
- if ( i == 0 ) {
+ if (i == 0) {
start[0] = 0;
count[0] = base_count;
-
- } else {
+ }
+ else {
start[0] = (hsize_t)checker_edge_size;
count[0] = offset_count;
-
}
}
j = 0;
- do {
- if ( 1 >= sel_offset ) {
+ do {
+ if (1 >= sel_offset) {
- if ( j == 0 ) {
+ if (j == 0) {
start[1] = 0;
count[1] = base_count;
-
- } else {
+ }
+ else {
start[1] = (hsize_t)checker_edge_size;
count[1] = offset_count;
-
}
}
k = 0;
do {
- if ( 2 >= sel_offset ) {
+ if (2 >= sel_offset) {
- if ( k == 0 ) {
+ if (k == 0) {
start[2] = 0;
count[2] = base_count;
-
- } else {
+ }
+ else {
start[2] = (hsize_t)checker_edge_size;
count[2] = offset_count;
-
}
}
l = 0;
do {
- if ( 3 >= sel_offset ) {
+ if (3 >= sel_offset) {
- if ( l == 0 ) {
+ if (l == 0) {
start[3] = 0;
count[3] = base_count;
-
- } else {
+ }
+ else {
start[3] = (hsize_t)checker_edge_size;
count[3] = offset_count;
-
}
}
m = 0;
do {
- if ( 4 >= sel_offset ) {
+ if (4 >= sel_offset) {
- if ( m == 0 ) {
+ if (m == 0) {
start[4] = 0;
count[4] = base_count;
-
- } else {
+ }
+ else {
start[4] = (hsize_t)checker_edge_size;
count[4] = offset_count;
-
}
}
- if ( ((i + j + k + l + m) % 2) == 0 ) {
-
-#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
- HDfprintf(stdout, "%s%d: *** first_selection = %d ***\n",
- fcnName, mpi_rank, (int)first_selection);
- HDfprintf(stdout, "%s:%d: i/j/k/l/m = %d/%d/%d/%d/%d\n",
- fcnName, mpi_rank, i, j, k, l, m);
- HDfprintf(stdout,
- "%s:%d: start = %d %d %d %d %d.\n",
- fcnName, mpi_rank, (int)start[0], (int)start[1],
- (int)start[2], (int)start[3], (int)start[4]);
- HDfprintf(stdout,
- "%s:%d: stride = %d %d %d %d %d.\n",
- fcnName, mpi_rank, (int)stride[0], (int)stride[1],
- (int)stride[2], (int)stride[3], (int)stride[4]);
- HDfprintf(stdout,
- "%s:%d: count = %d %d %d %d %d.\n",
- fcnName, mpi_rank, (int)count[0], (int)count[1],
- (int)count[2], (int)count[3], (int)count[4]);
- HDfprintf(stdout,
- "%s:%d: block = %d %d %d %d %d.\n",
- fcnName, mpi_rank, (int)block[0], (int)block[1],
- (int)block[2], (int)block[3], (int)block[4]);
- HDfprintf(stdout, "%s:%d: n-cube extent dims = %d.\n",
- fcnName, mpi_rank,
+ if (((i + j + k + l + m) % 2) == 0) {
+
+#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
+ HDfprintf(stdout, "%s%d: *** first_selection = %d ***\n", fcnName, mpi_rank,
+ (int)first_selection);
+ HDfprintf(stdout, "%s:%d: i/j/k/l/m = %d/%d/%d/%d/%d\n", fcnName, mpi_rank, i, j,
+ k, l, m);
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, mpi_rank,
+ (int)start[0], (int)start[1], (int)start[2], (int)start[3],
+ (int)start[4]);
+ HDfprintf(stdout, "%s:%d: stride = %d %d %d %d %d.\n", fcnName, mpi_rank,
+ (int)stride[0], (int)stride[1], (int)stride[2], (int)stride[3],
+ (int)stride[4]);
+ HDfprintf(stdout, "%s:%d: count = %d %d %d %d %d.\n", fcnName, mpi_rank,
+ (int)count[0], (int)count[1], (int)count[2], (int)count[3],
+ (int)count[4]);
+ HDfprintf(stdout, "%s:%d: block = %d %d %d %d %d.\n", fcnName, mpi_rank,
+ (int)block[0], (int)block[1], (int)block[2], (int)block[3],
+ (int)block[4]);
+ HDfprintf(stdout, "%s:%d: n-cube extent dims = %d.\n", fcnName, mpi_rank,
H5Sget_simple_extent_ndims(tgt_sid));
- HDfprintf(stdout, "%s:%d: selection rank = %d.\n",
- fcnName, mpi_rank, sel_rank);
+ HDfprintf(stdout, "%s:%d: selection rank = %d.\n", fcnName, mpi_rank, sel_rank);
#endif
- if ( first_selection ) {
+ if (first_selection) {
- first_selection = FALSE;
+ first_selection = FALSE;
+
+ ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_SET, &(start[n_cube_offset]),
+ &(stride[n_cube_offset]), &(count[n_cube_offset]),
+ &(block[n_cube_offset]));
- ret = H5Sselect_hyperslab
- (
- tgt_sid,
- H5S_SELECT_SET,
- &(start[n_cube_offset]),
- &(stride[n_cube_offset]),
- &(count[n_cube_offset]),
- &(block[n_cube_offset])
- );
-
VRFY((ret != FAIL), "H5Sselect_hyperslab(SET) succeeded");
+ }
+ else {
- } else {
-
- ret = H5Sselect_hyperslab
- (
- tgt_sid,
- H5S_SELECT_OR,
- &(start[n_cube_offset]),
- &(stride[n_cube_offset]),
- &(count[n_cube_offset]),
- &(block[n_cube_offset])
- );
-
- VRFY((ret != FAIL), "H5Sselect_hyperslab(OR) succeeded");
+ ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_OR, &(start[n_cube_offset]),
+ &(stride[n_cube_offset]), &(count[n_cube_offset]),
+ &(block[n_cube_offset]));
+ VRFY((ret != FAIL), "H5Sselect_hyperslab(OR) succeeded");
}
}
m++;
- } while ( ( m <= 1 ) &&
- ( 4 >= sel_offset ) );
+ } while ((m <= 1) && (4 >= sel_offset));
l++;
- } while ( ( l <= 1 ) &&
- ( 3 >= sel_offset ) );
+ } while ((l <= 1) && (3 >= sel_offset));
k++;
- } while ( ( k <= 1 ) &&
- ( 2 >= sel_offset ) );
+ } while ((k <= 1) && (2 >= sel_offset));
j++;
- } while ( ( j <= 1 ) &&
- ( 1 >= sel_offset ) );
-
+ } while ((j <= 1) && (1 >= sel_offset));
i++;
- } while ( ( i <= 1 ) &&
- ( 0 >= sel_offset ) );
+ } while ((i <= 1) && (0 >= sel_offset));
-#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
- HDfprintf(stdout, "%s%d: H5Sget_select_npoints(tgt_sid) = %d.\n",
- fcnName, mpi_rank, (int)H5Sget_select_npoints(tgt_sid));
+#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
+ HDfprintf(stdout, "%s%d: H5Sget_select_npoints(tgt_sid) = %d.\n", fcnName, mpi_rank,
+ (int)H5Sget_select_npoints(tgt_sid));
#endif /* CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG */
- /* Clip the selection back to the data space proper. */
+ /* Clip the selection back to the dataspace proper. */
- for ( i = 0; i < test_max_rank; i++ ) {
+ for (i = 0; i < test_max_rank; i++) {
start[i] = 0;
stride[i] = (hsize_t)edge_size;
@@ -2719,14 +2307,13 @@ ckrbrd_hs_dr_pio_test__slct_ckrbrd(const int mpi_rank,
block[i] = (hsize_t)edge_size;
}
- ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_AND,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_AND, start, stride, count, block);
VRFY((ret != FAIL), "H5Sselect_hyperslab(AND) succeeded");
-#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
- HDfprintf(stdout, "%s%d: H5Sget_select_npoints(tgt_sid) = %d.\n",
- fcnName, mpi_rank, (int)H5Sget_select_npoints(tgt_sid));
+#if CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG
+ HDfprintf(stdout, "%s%d: H5Sget_select_npoints(tgt_sid) = %d.\n", fcnName, mpi_rank,
+ (int)H5Sget_select_npoints(tgt_sid));
HDfprintf(stdout, "%s%d: done.\n", fcnName, mpi_rank);
#endif /* CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG */
@@ -2734,96 +2321,92 @@ ckrbrd_hs_dr_pio_test__slct_ckrbrd(const int mpi_rank,
} /* ckrbrd_hs_dr_pio_test__slct_ckrbrd() */
-
/****************************************************************
**
-** ckrbrd_hs_dr_pio_test__verify_data():
+** ckrbrd_hs_dr_pio_test__verify_data():
**
-** Examine the supplied buffer to see if it contains the
-** expected data. Return TRUE if it does, and FALSE
+** Examine the supplied buffer to see if it contains the
+** expected data. Return TRUE if it does, and FALSE
** otherwise.
**
-** The supplied buffer is presumed to this process's slice
-** of the target data set. Each such slice will be an
-** n-cube of rank (rank -1) and the supplied edge_size with
-** origin (mpi_rank, 0, ... , 0) in the target data set.
+** The supplied buffer is presumed to this process's slice
+** of the target data set. Each such slice will be an
+** n-cube of rank (rank -1) and the supplied edge_size with
+** origin (mpi_rank, 0, ... , 0) in the target data set.
**
-** Further, the buffer is presumed to be the result of reading
-** or writing a checker board selection of an m (1 <= m <
+** Further, the buffer is presumed to be the result of reading
+** or writing a checker board selection of an m (1 <= m <
** rank) dimensional slice through this processes slice
-** of the target data set. Also, this slice must be parallel
-** to the fastest changing indicies.
+** of the target data set. Also, this slice must be parallel
+** to the fastest changing indicies.
**
-** It is further presumed that the buffer was zeroed before
-** the read/write, and that the full target data set (i.e.
-** the buffer/data set for all processes) was initialized
-** with the natural numbers listed in order from the origin
-** along the fastest changing axis.
+** It is further presumed that the buffer was zeroed before
+** the read/write, and that the full target data set (i.e.
+** the buffer/data set for all processes) was initialized
+** with the natural numbers listed in order from the origin
+** along the fastest changing axis.
**
** Thus for a 20x10x10 dataset, the value stored in location
-** (x, y, z) (assuming that z is the fastest changing index
-** and x the slowest) is assumed to be:
+** (x, y, z) (assuming that z is the fastest changing index
+** and x the slowest) is assumed to be:
**
-** (10 * 10 * x) + (10 * y) + z
+** (10 * 10 * x) + (10 * y) + z
**
-** Further, supposing that this is process 10, this process's
-** slice of the dataset would be a 10 x 10 2-cube with origin
-** (10, 0, 0) in the data set, and would be initialize (prior
-** to the checkerboard selection) as follows:
+** Further, supposing that this is process 10, this process's
+** slice of the dataset would be a 10 x 10 2-cube with origin
+** (10, 0, 0) in the data set, and would be initialize (prior
+** to the checkerboard selection) as follows:
**
-** 1000, 1001, 1002, ... 1008, 1009
-** 1010, 1011, 1012, ... 1018, 1019
-** . . . . .
-** . . . . .
-** . . . . .
-** 1090, 1091, 1092, ... 1098, 1099
+** 1000, 1001, 1002, ... 1008, 1009
+** 1010, 1011, 1012, ... 1018, 1019
+** . . . . .
+** . . . . .
+** . . . . .
+** 1090, 1091, 1092, ... 1098, 1099
**
-** In the case of a read from the processors slice of another
-** data set of different rank, the values expected will have
-** to be adjusted accordingly. This is done via the
-** first_expected_val parameter.
+** In the case of a read from the processors slice of another
+** data set of different rank, the values expected will have
+** to be adjusted accordingly. This is done via the
+** first_expected_val parameter.
**
-** Finally, the function presumes that the first element
-** of the buffer resides either at the origin of either
-** a selected or an unselected checker. (Translation:
-** if partial checkers appear in the buffer, they will
-** intersect the edges of the n-cube oposite the origin.)
+** Finally, the function presumes that the first element
+** of the buffer resides either at the origin of either
+** a selected or an unselected checker. (Translation:
+** if partial checkers appear in the buffer, they will
+** intersect the edges of the n-cube oposite the origin.)
**
****************************************************************/
#define CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG 0
static hbool_t
-ckrbrd_hs_dr_pio_test__verify_data(uint32_t * buf_ptr,
- const int rank,
- const int edge_size,
- const int checker_edge_size,
- uint32_t first_expected_val,
+ckrbrd_hs_dr_pio_test__verify_data(uint32_t *buf_ptr, const int rank, const int edge_size,
+ const int checker_edge_size, uint32_t first_expected_val,
hbool_t buf_starts_in_checker)
{
#if CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG
- const char * fcnName = "ckrbrd_hs_dr_pio_test__verify_data():";
+ const char *fcnName = "ckrbrd_hs_dr_pio_test__verify_data():";
#endif
- hbool_t good_data = TRUE;
- hbool_t in_checker;
- hbool_t start_in_checker[5];
- uint32_t expected_value;
- uint32_t * val_ptr;
- int i, j, k, l, m; /* to track position in n-cube */
- int v, w, x, y, z; /* to track position in checker */
+ hbool_t good_data = TRUE;
+ hbool_t in_checker;
+ hbool_t start_in_checker[5];
+ uint32_t expected_value;
+ uint32_t *val_ptr;
+ int i, j, k, l, m; /* to track position in n-cube */
+ int v, w, x, y, z; /* to track position in checker */
const int test_max_rank = 5; /* code changes needed if this is increased */
- HDassert( buf_ptr != NULL );
- HDassert( 0 < rank );
- HDassert( rank <= test_max_rank );
- HDassert( edge_size >= 6 );
- HDassert( 0 < checker_edge_size );
- HDassert( checker_edge_size <= edge_size );
- HDassert( test_max_rank <= PAR_SS_DR_MAX_RANK );
+ HDassert(buf_ptr != NULL);
+ HDassert(0 < rank);
+ HDassert(rank <= test_max_rank);
+ HDassert(edge_size >= 6);
+ HDassert(0 < checker_edge_size);
+ HDassert(checker_edge_size <= edge_size);
+ HDassert(test_max_rank <= PAR_SS_DR_MAX_RANK);
-#if CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG
+#if CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG
- int mpi_rank;
+ int mpi_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
HDfprintf(stdout, "%s mpi_rank = %d.\n", fcnName, mpi_rank);
@@ -2835,144 +2418,128 @@ ckrbrd_hs_dr_pio_test__verify_data(uint32_t * buf_ptr,
}
#endif
- val_ptr = buf_ptr;
- expected_value = first_expected_val;
+val_ptr = buf_ptr;
+expected_value = first_expected_val;
- i = 0;
- v = 0;
- start_in_checker[0] = buf_starts_in_checker;
- do
- {
- if ( v >= checker_edge_size ) {
+i = 0;
+v = 0;
+start_in_checker[0] = buf_starts_in_checker;
+do {
+ if (v >= checker_edge_size) {
- start_in_checker[0] = ! start_in_checker[0];
- v = 0;
+ start_in_checker[0] = !start_in_checker[0];
+ v = 0;
+ }
+
+ j = 0;
+ w = 0;
+ start_in_checker[1] = start_in_checker[0];
+ do {
+ if (w >= checker_edge_size) {
+
+ start_in_checker[1] = !start_in_checker[1];
+ w = 0;
}
- j = 0;
- w = 0;
- start_in_checker[1] = start_in_checker[0];
- do
- {
- if ( w >= checker_edge_size ) {
-
- start_in_checker[1] = ! start_in_checker[1];
- w = 0;
+ k = 0;
+ x = 0;
+ start_in_checker[2] = start_in_checker[1];
+ do {
+ if (x >= checker_edge_size) {
+
+ start_in_checker[2] = !start_in_checker[2];
+ x = 0;
}
- k = 0;
- x = 0;
- start_in_checker[2] = start_in_checker[1];
- do
- {
- if ( x >= checker_edge_size ) {
-
- start_in_checker[2] = ! start_in_checker[2];
- x = 0;
- }
+ l = 0;
+ y = 0;
+ start_in_checker[3] = start_in_checker[2];
+ do {
+ if (y >= checker_edge_size) {
- l = 0;
- y = 0;
- start_in_checker[3] = start_in_checker[2];
- do
- {
- if ( y >= checker_edge_size ) {
-
- start_in_checker[3] = ! start_in_checker[3];
- y = 0;
- }
+ start_in_checker[3] = !start_in_checker[3];
+ y = 0;
+ }
- m = 0;
- z = 0;
-#if CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG
- HDfprintf(stdout, "%d, %d, %d, %d, %d:", i, j, k, l, m);
+ m = 0;
+ z = 0;
+#if CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG
+ HDfprintf(stdout, "%d, %d, %d, %d, %d:", i, j, k, l, m);
#endif
- in_checker = start_in_checker[3];
- do
- {
-#if CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG
- HDfprintf(stdout, " %d", (int)(*val_ptr));
+ in_checker = start_in_checker[3];
+ do {
+#if CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG
+ HDfprintf(stdout, " %d", (int)(*val_ptr));
#endif
- if ( z >= checker_edge_size ) {
+ if (z >= checker_edge_size) {
- in_checker = ! in_checker;
- z = 0;
- }
-
- if ( in_checker ) {
-
- if ( *val_ptr != expected_value ) {
+ in_checker = !in_checker;
+ z = 0;
+ }
- good_data = FALSE;
- }
-
- /* zero out buffer for re-use */
- *val_ptr = 0;
+ if (in_checker) {
- } else if ( *val_ptr != 0 ) {
+ if (*val_ptr != expected_value) {
good_data = FALSE;
-
- /* zero out buffer for re-use */
- *val_ptr = 0;
-
}
- val_ptr++;
- expected_value++;
- m++;
- z++;
-
- } while ( ( rank >= (test_max_rank - 4) ) &&
- ( m < edge_size ) );
-#if CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG
- HDfprintf(stdout, "\n");
+ /* zero out buffer for re-use */
+ *val_ptr = 0;
+ }
+ else if (*val_ptr != 0) {
+
+ good_data = FALSE;
+
+ /* zero out buffer for re-use */
+ *val_ptr = 0;
+ }
+
+ val_ptr++;
+ expected_value++;
+ m++;
+ z++;
+
+ } while ((rank >= (test_max_rank - 4)) && (m < edge_size));
+#if CKRBRD_HS_DR_PIO_TEST__VERIFY_DATA__DEBUG
+ HDfprintf(stdout, "\n");
#endif
- l++;
- y++;
- } while ( ( rank >= (test_max_rank - 3) ) &&
- ( l < edge_size ) );
- k++;
- x++;
- } while ( ( rank >= (test_max_rank - 2) ) &&
- ( k < edge_size ) );
- j++;
- w++;
- } while ( ( rank >= (test_max_rank - 1) ) &&
- ( j < edge_size ) );
- i++;
- v++;
- } while ( ( rank >= test_max_rank ) &&
- ( i < edge_size ) );
+ l++;
+ y++;
+ } while ((rank >= (test_max_rank - 3)) && (l < edge_size));
+ k++;
+ x++;
+ } while ((rank >= (test_max_rank - 2)) && (k < edge_size));
+ j++;
+ w++;
+ } while ((rank >= (test_max_rank - 1)) && (j < edge_size));
+ i++;
+ v++;
+} while ((rank >= test_max_rank) && (i < edge_size));
- return(good_data);
+return (good_data);
} /* ckrbrd_hs_dr_pio_test__verify_data() */
-
/*-------------------------------------------------------------------------
- * Function: ckrbrd_hs_dr_pio_test__d2m_l2s()
+ * Function: ckrbrd_hs_dr_pio_test__d2m_l2s()
*
- * Purpose: Part one of a series of tests of I/O to/from hyperslab
- * selections of different rank in the parallel.
+ * Purpose: Part one of a series of tests of I/O to/from hyperslab
+ * selections of different rank in the parallel.
*
- * Verify that we can read from disk correctly using checker
- * board selections of different rank that
+ * Verify that we can read from disk correctly using checker
+ * board selections of different rank that
* H5S_select_shape_same() views as being of the same shape.
*
- * In this function, we test this by reading small_rank - 1
- * checker board slices from the on disk large cube, and
- * verifying that the data read is correct. Verify that
- * H5S_select_shape_same() returns true on the memory and
- * file selections.
+ * In this function, we test this by reading small_rank - 1
+ * checker board slices from the on disk large cube, and
+ * verifying that the data read is correct. Verify that
+ * H5S_select_shape_same() returns true on the memory and
+ * file selections.
*
- * Return: void
+ * Return: void
*
- * Programmer: JRM -- 9/15/11
- *
- * Modifications:
- *
- * None.
+ * Programmer: JRM -- 9/15/11
*
*-------------------------------------------------------------------------
*/
@@ -2980,31 +2547,30 @@ ckrbrd_hs_dr_pio_test__verify_data(uint32_t * buf_ptr,
#define CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG 0
static void
-ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
+ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
+#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
const char *fcnName = "ckrbrd_hs_dr_pio_test__d2m_l2s()";
- uint32_t * ptr_0;
+ uint32_t * ptr_0;
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
- hbool_t data_ok = FALSE;
- int i, j, k, l;
- uint32_t expected_value;
- int mpi_rank; /* needed by VRFY */
- hsize_t sel_start[PAR_SS_DR_MAX_RANK];
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hbool_t data_ok = FALSE;
+ int i, j, k, l;
+ uint32_t expected_value;
+ int mpi_rank; /* needed by VRFY */
+ hsize_t sel_start[PAR_SS_DR_MAX_RANK];
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
-
/* first, verify that we can read from disk correctly using selections
* of different rank that H5S_select_shape_same() views as being of the
* same shape.
*
- * Start by reading a (small_rank - 1)-D checker board slice from this
- * processes slice of the on disk large data set, and verifying that the
- * data read is correct. Verify that H5S_select_shape_same() returns
+ * Start by reading a (small_rank - 1)-D checker board slice from this
+ * processes slice of the on disk large data set, and verifying that the
+ * data read is correct. Verify that H5S_select_shape_same() returns
* true on the memory and file selections.
*
* The first step is to set up the needed checker board selection in the
@@ -3012,96 +2578,90 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
*/
sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0;
- sel_start[tv_ptr->small_ds_offset] = (hsize_t)(tv_ptr->mpi_rank);
-
- ckrbrd_hs_dr_pio_test__slct_ckrbrd(tv_ptr->mpi_rank,
- tv_ptr->small_ds_slice_sid,
- tv_ptr->small_rank - 1,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- tv_ptr->small_rank - 1,
+ sel_start[tv_ptr->small_ds_offset] = (hsize_t)(tv_ptr->mpi_rank);
+
+ ckrbrd_hs_dr_pio_test__slct_ckrbrd(tv_ptr->mpi_rank, tv_ptr->small_ds_slice_sid, tv_ptr->small_rank - 1,
+ tv_ptr->edge_size, tv_ptr->checker_edge_size, tv_ptr->small_rank - 1,
sel_start);
/* zero out the buffer we will be reading into */
HDmemset(tv_ptr->small_ds_slice_buf, 0, sizeof(uint32_t) * tv_ptr->small_ds_slice_size);
-#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
- HDfprintf(stdout, "%s:%d: initial small_ds_slice_buf = ",
- fcnName, tv_ptr->mpi_rank);
+#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
+ HDfprintf(stdout, "%s:%d: initial small_ds_slice_buf = ", fcnName, tv_ptr->mpi_rank);
ptr_0 = tv_ptr->small_ds_slice_buf;
- for ( i = 0; i < (int)(tv_ptr->small_ds_slice_size); i++ ) {
+ for (i = 0; i < (int)(tv_ptr->small_ds_slice_size); i++) {
HDfprintf(stdout, "%d ", (int)(*ptr_0));
ptr_0++;
}
HDfprintf(stdout, "\n");
-#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
+#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
/* set up start, stride, count, and block -- note that we will
* change start[] so as to read slices of the large cube.
*/
- for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) {
+ for (i = 0; i < PAR_SS_DR_MAX_RANK; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- if ( (PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1) ) {
+ tv_ptr->count[i] = 1;
+ if ((PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1)) {
tv_ptr->block[i] = 1;
-
- } else {
+ }
+ else {
tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
}
-#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
- HDfprintf(stdout,
- "%s:%d: reading slice from big ds on disk into small ds slice.\n",
- fcnName, tv_ptr->mpi_rank);
-#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
+#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
+ HDfprintf(stdout, "%s:%d: reading slice from big ds on disk into small ds slice.\n", fcnName,
+ tv_ptr->mpi_rank);
+#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
/* in serial versions of this test, we loop through all the dimensions
- * of the large data set. However, in the parallel version, each
+ * of the large data set. However, in the parallel version, each
* process only works with that slice of the large cube indicated
- * by its rank -- hence we set the most slowly changing index to
+ * by its rank -- hence we set the most slowly changing index to
* mpi_rank, and don't itterate over it.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0) {
i = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
i = 0;
}
- /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
+ /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
* loop over it -- either we are setting i to mpi_rank, or
- * we are setting it to zero. It will not change during the
+ * we are setting it to zero. It will not change during the
* test.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1) {
j = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
j = 0;
}
do {
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2) {
k = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
k = 0;
}
do {
- /* since small rank >= 2 and large_rank > small_rank, we
+ /* since small rank >= 2 and large_rank > small_rank, we
* have large_rank >= 3. Since PAR_SS_DR_MAX_RANK == 5
* (baring major re-orgaization), this gives us:
*
@@ -3113,16 +2673,16 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
l = 0;
do {
- if ( (tv_ptr->skips)++ < tv_ptr->max_skips ) { /* skip the test */
+ if ((tv_ptr->skips)++ < tv_ptr->max_skips) { /* skip the test */
(tv_ptr->tests_skipped)++;
-
- } else { /* run the test */
+ }
+ else { /* run the test */
tv_ptr->skips = 0; /* reset the skips counter */
- /* we know that small_rank - 1 >= 1 and that
- * large_rank > small_rank by the assertions at the head
+ /* we know that small_rank - 1 >= 1 and that
+ * large_rank > small_rank by the assertions at the head
* of this function. Thus no need for another inner loop.
*/
tv_ptr->start[0] = (hsize_t)i;
@@ -3131,76 +2691,54 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
tv_ptr->start[3] = (hsize_t)l;
tv_ptr->start[4] = 0;
- HDassert((tv_ptr->start[0] == 0)||(0 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[1] == 0)||(1 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[2] == 0)||(2 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[3] == 0)||(3 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[4] == 0)||(4 < tv_ptr->small_ds_offset + 1));
-
- ckrbrd_hs_dr_pio_test__slct_ckrbrd
- (
- tv_ptr->mpi_rank,
- tv_ptr->file_large_ds_sid_0,
- tv_ptr->large_rank,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- tv_ptr->small_rank - 1,
- tv_ptr->start
- );
+ HDassert((tv_ptr->start[0] == 0) || (0 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[1] == 0) || (1 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[2] == 0) || (2 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[3] == 0) || (3 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[4] == 0) || (4 < tv_ptr->small_ds_offset + 1));
+
+ ckrbrd_hs_dr_pio_test__slct_ckrbrd(
+ tv_ptr->mpi_rank, tv_ptr->file_large_ds_sid_0, tv_ptr->large_rank, tv_ptr->edge_size,
+ tv_ptr->checker_edge_size, tv_ptr->small_rank - 1, tv_ptr->start);
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->small_ds_slice_sid,
- tv_ptr->file_large_ds_sid_0);
+ check =
+ H5S_select_shape_same_test(tv_ptr->small_ds_slice_sid, tv_ptr->file_large_ds_sid_0);
VRFY((check == TRUE), "H5S_select_shape_same_test passed");
-
/* Read selection from disk */
-#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
- HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName,
- tv_ptr->mpi_rank, tv_ptr->start[0], tv_ptr->start[1],
- tv_ptr->start[2], tv_ptr->start[3], tv_ptr->start[4]);
- HDfprintf(stdout, "%s slice/file extent dims = %d/%d.\n",
- fcnName,
+#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, tv_ptr->mpi_rank,
+ tv_ptr->start[0], tv_ptr->start[1], tv_ptr->start[2], tv_ptr->start[3],
+ tv_ptr->start[4]);
+ HDfprintf(stdout, "%s slice/file extent dims = %d/%d.\n", fcnName,
H5Sget_simple_extent_ndims(tv_ptr->small_ds_slice_sid),
H5Sget_simple_extent_ndims(tv_ptr->file_large_ds_sid_0));
-#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
-
- ret = H5Dread(tv_ptr->large_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->small_ds_slice_sid,
- tv_ptr->file_large_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->small_ds_slice_buf);
+#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
+
+ ret =
+ H5Dread(tv_ptr->large_dataset, H5T_NATIVE_UINT32, tv_ptr->small_ds_slice_sid,
+ tv_ptr->file_large_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->small_ds_slice_buf);
VRFY((ret >= 0), "H5Dread() slice from large ds succeeded.");
-#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
- HDfprintf(stdout, "%s:%d: H5Dread() returns.\n",
- fcnName, tv_ptr->mpi_rank);
+#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG
+ HDfprintf(stdout, "%s:%d: H5Dread() returns.\n", fcnName, tv_ptr->mpi_rank);
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_L2S__DEBUG */
/* verify that expected data is retrieved */
- expected_value = (uint32_t)
- ((i * tv_ptr->edge_size * tv_ptr->edge_size *
- tv_ptr->edge_size * tv_ptr->edge_size) +
- (j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
- (k * tv_ptr->edge_size * tv_ptr->edge_size) +
- (l * tv_ptr->edge_size));
-
- data_ok = ckrbrd_hs_dr_pio_test__verify_data
- (
- tv_ptr->small_ds_slice_buf,
- tv_ptr->small_rank - 1,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- expected_value,
- (hbool_t)TRUE
- );
-
- VRFY((data_ok == TRUE),
- "small slice read from large ds data good.");
+ expected_value = (uint32_t)(
+ (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
+ (j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
+ (k * tv_ptr->edge_size * tv_ptr->edge_size) + (l * tv_ptr->edge_size));
+
+ data_ok = ckrbrd_hs_dr_pio_test__verify_data(
+ tv_ptr->small_ds_slice_buf, tv_ptr->small_rank - 1, tv_ptr->edge_size,
+ tv_ptr->checker_edge_size, expected_value, (hbool_t)TRUE);
+
+ VRFY((data_ok == TRUE), "small slice read from large ds data good.");
(tv_ptr->tests_run)++;
}
@@ -3209,45 +2747,34 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
(tv_ptr->total_tests)++;
- } while ( ( tv_ptr->large_rank > 2 ) &&
- ( (tv_ptr->small_rank - 1) <= 1 ) &&
- ( l < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 2) && ((tv_ptr->small_rank - 1) <= 1) && (l < tv_ptr->edge_size));
k++;
- } while ( ( tv_ptr->large_rank > 3 ) &&
- ( (tv_ptr->small_rank - 1) <= 2 ) &&
- ( k < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 3) && ((tv_ptr->small_rank - 1) <= 2) && (k < tv_ptr->edge_size));
j++;
- } while ( ( tv_ptr->large_rank > 4 ) &&
- ( (tv_ptr->small_rank - 1) <= 3 ) &&
- ( j < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 4) && ((tv_ptr->small_rank - 1) <= 3) && (j < tv_ptr->edge_size));
return;
} /* ckrbrd_hs_dr_pio_test__d2m_l2s() */
-
/*-------------------------------------------------------------------------
- * Function: ckrbrd_hs_dr_pio_test__d2m_s2l()
- *
- * Purpose: Part two of a series of tests of I/O to/from hyperslab
- * selections of different rank in the parallel.
+ * Function: ckrbrd_hs_dr_pio_test__d2m_s2l()
*
- * Verify that we can read from disk correctly using
- * selections of different rank that H5S_select_shape_same()
- * views as being of the same shape.
+ * Purpose: Part two of a series of tests of I/O to/from hyperslab
+ * selections of different rank in the parallel.
*
- * In this function, we test this by reading checker board
- * slices of the on disk small data set into slices through
- * the in memory large data set, and verify that the correct
- * data (and only the correct data) is read.
+ * Verify that we can read from disk correctly using
+ * selections of different rank that H5S_select_shape_same()
+ * views as being of the same shape.
*
- * Return: void
+ * In this function, we test this by reading checker board
+ * slices of the on disk small data set into slices through
+ * the in memory large data set, and verify that the correct
+ * data (and only the correct data) is read.
*
- * Programmer: JRM -- 8/15/11
+ * Return: void
*
- * Modifications:
- *
- * None.
+ * Programmer: JRM -- 8/15/11
*
*-------------------------------------------------------------------------
*/
@@ -3255,47 +2782,40 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
#define CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG 0
static void
-ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
+ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG
+#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG
const char *fcnName = "ckrbrd_hs_dr_pio_test__d2m_s2l()";
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG */
- hbool_t data_ok = FALSE;
- int i, j, k, l;
- size_t u;
- size_t start_index;
- size_t stop_index;
- uint32_t expected_value;
- uint32_t * ptr_1;
- int mpi_rank; /* needed by VRFY */
- hsize_t sel_start[PAR_SS_DR_MAX_RANK];
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hbool_t data_ok = FALSE;
+ int i, j, k, l;
+ size_t u;
+ size_t start_index;
+ size_t stop_index;
+ uint32_t expected_value;
+ uint32_t *ptr_1;
+ int mpi_rank; /* needed by VRFY */
+ hsize_t sel_start[PAR_SS_DR_MAX_RANK];
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
-
- /* similarly, read slices of the on disk small data set into slices
- * through the in memory large data set, and verify that the correct
+ /* similarly, read slices of the on disk small data set into slices
+ * through the in memory large data set, and verify that the correct
* data (and only the correct data) is read.
*/
sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0;
- sel_start[tv_ptr->small_ds_offset] = (hsize_t)(tv_ptr->mpi_rank);
-
- ckrbrd_hs_dr_pio_test__slct_ckrbrd(tv_ptr->mpi_rank,
- tv_ptr->file_small_ds_sid_0,
- tv_ptr->small_rank,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- tv_ptr->small_rank - 1,
+ sel_start[tv_ptr->small_ds_offset] = (hsize_t)(tv_ptr->mpi_rank);
+
+ ckrbrd_hs_dr_pio_test__slct_ckrbrd(tv_ptr->mpi_rank, tv_ptr->file_small_ds_sid_0, tv_ptr->small_rank,
+ tv_ptr->edge_size, tv_ptr->checker_edge_size, tv_ptr->small_rank - 1,
sel_start);
-#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG
- HDfprintf(stdout,
- "%s reading slices of on disk small data set into slices of big data set.\n",
- fcnName);
+#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG
+ HDfprintf(stdout, "%s reading slices of on disk small data set into slices of big data set.\n", fcnName);
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG */
/* zero out the buffer we will be reading into */
@@ -3303,70 +2823,69 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
/* set up start, stride, count, and block -- note that we will
* change start[] so as to read the slice of the small data set
- * into different slices of the process slice of the large data
+ * into different slices of the process slice of the large data
* set.
*/
- for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) {
+ for (i = 0; i < PAR_SS_DR_MAX_RANK; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- if ( (PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1) ) {
+ tv_ptr->count[i] = 1;
+ if ((PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1)) {
tv_ptr->block[i] = 1;
-
- } else {
+ }
+ else {
tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
}
/* in serial versions of this test, we loop through all the dimensions
- * of the large data set that don't appear in the small data set.
+ * of the large data set that don't appear in the small data set.
*
- * However, in the parallel version, each process only works with that
- * slice of the large (and small) data set indicated by its rank -- hence
- * we set the most slowly changing index to mpi_rank, and don't itterate
+ * However, in the parallel version, each process only works with that
+ * slice of the large (and small) data set indicated by its rank -- hence
+ * we set the most slowly changing index to mpi_rank, and don't itterate
* over it.
*/
-
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0) {
i = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
i = 0;
}
- /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
+ /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
* loop over it -- either we are setting i to mpi_rank, or
- * we are setting it to zero. It will not change during the
+ * we are setting it to zero. It will not change during the
* test.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1) {
j = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
j = 0;
}
do {
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2) {
k = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
k = 0;
}
do {
- /* since small rank >= 2 and large_rank > small_rank, we
+ /* since small rank >= 2 and large_rank > small_rank, we
* have large_rank >= 3. Since PAR_SS_DR_MAX_RANK == 5
* (baring major re-orgaization), this gives us:
*
@@ -3378,11 +2897,11 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
l = 0;
do {
- if ( (tv_ptr->skips)++ < tv_ptr->max_skips ) { /* skip the test */
+ if ((tv_ptr->skips)++ < tv_ptr->max_skips) { /* skip the test */
(tv_ptr->tests_skipped)++;
-
- } else { /* run the test */
+ }
+ else { /* run the test */
tv_ptr->skips = 0; /* reset the skips counter */
@@ -3396,80 +2915,61 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
tv_ptr->start[3] = (hsize_t)l;
tv_ptr->start[4] = 0;
- HDassert((tv_ptr->start[0] == 0)||(0 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[1] == 0)||(1 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[2] == 0)||(2 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[3] == 0)||(3 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[4] == 0)||(4 < tv_ptr->small_ds_offset + 1));
-
- ckrbrd_hs_dr_pio_test__slct_ckrbrd
- (
- tv_ptr->mpi_rank,
- tv_ptr->mem_large_ds_sid,
- tv_ptr->large_rank,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- tv_ptr->small_rank - 1,
- tv_ptr->start
- );
+ HDassert((tv_ptr->start[0] == 0) || (0 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[1] == 0) || (1 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[2] == 0) || (2 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[3] == 0) || (3 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[4] == 0) || (4 < tv_ptr->small_ds_offset + 1));
+ ckrbrd_hs_dr_pio_test__slct_ckrbrd(
+ tv_ptr->mpi_rank, tv_ptr->mem_large_ds_sid, tv_ptr->large_rank, tv_ptr->edge_size,
+ tv_ptr->checker_edge_size, tv_ptr->small_rank - 1, tv_ptr->start);
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0,
- tv_ptr->mem_large_ds_sid);
+ check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0, tv_ptr->mem_large_ds_sid);
VRFY((check == TRUE), "H5S_select_shape_same_test passed");
-
/* Read selection from disk */
-#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG
- HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n",
- fcnName, tv_ptr->mpi_rank,
- tv_ptr->start[0], tv_ptr->start[1], tv_ptr->start[2],
- tv_ptr->start[3], tv_ptr->start[4]);
- HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n",
- fcnName, tv_ptr->mpi_rank,
+#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, tv_ptr->mpi_rank,
+ tv_ptr->start[0], tv_ptr->start[1], tv_ptr->start[2], tv_ptr->start[3],
+ tv_ptr->start[4]);
+ HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n", fcnName, tv_ptr->mpi_rank,
H5Sget_simple_extent_ndims(tv_ptr->large_ds_slice_sid),
H5Sget_simple_extent_ndims(tv_ptr->file_small_ds_sid_0));
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG */
- ret = H5Dread(tv_ptr->small_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_large_ds_sid,
- tv_ptr->file_small_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->large_ds_buf_1);
+ ret = H5Dread(tv_ptr->small_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_large_ds_sid,
+ tv_ptr->file_small_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->large_ds_buf_1);
VRFY((ret >= 0), "H5Dread() slice from small ds succeeded.");
/* verify that the expected data and only the
* expected data was read.
*/
- data_ok = TRUE;
- ptr_1 = tv_ptr->large_ds_buf_1;
- expected_value =
- (uint32_t)((size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size);
- start_index = (size_t)(
- (i * tv_ptr->edge_size * tv_ptr->edge_size *
- tv_ptr->edge_size * tv_ptr->edge_size) +
+ data_ok = TRUE;
+ ptr_1 = tv_ptr->large_ds_buf_1;
+ expected_value = (uint32_t)((size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size);
+ start_index = (size_t)(
+ (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
(j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
- (k * tv_ptr->edge_size * tv_ptr->edge_size) +
- (l * tv_ptr->edge_size));
+ (k * tv_ptr->edge_size * tv_ptr->edge_size) + (l * tv_ptr->edge_size));
stop_index = start_index + tv_ptr->small_ds_slice_size - 1;
-#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG
+#if CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG
{
int m, n;
- HDfprintf(stdout, "%s:%d: expected_value = %d.\n",
- fcnName, tv_ptr->mpi_rank, expected_value);
- HDfprintf(stdout, "%s:%d: start/stop index = %d/%d.\n",
- fcnName, tv_ptr->mpi_rank, start_index, stop_index);
+ HDfprintf(stdout, "%s:%d: expected_value = %d.\n", fcnName, tv_ptr->mpi_rank,
+ expected_value);
+ HDfprintf(stdout, "%s:%d: start/stop index = %d/%d.\n", fcnName, tv_ptr->mpi_rank,
+ start_index, stop_index);
n = 0;
- for ( m = 0; (unsigned)m < tv_ptr->large_ds_size; m ++ ) {
+ for (m = 0; (unsigned)m < tv_ptr->large_ds_size; m++) {
HDfprintf(stdout, "%d ", (int)(*ptr_1));
ptr_1++;
n++;
- if ( n >= tv_ptr->edge_size ) {
+ if (n >= tv_ptr->edge_size) {
HDfprintf(stdout, "\n");
n = 0;
}
@@ -3479,12 +2979,12 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
}
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__D2M_S2L__DEBUG */
- HDassert( start_index < stop_index );
- HDassert( stop_index <= tv_ptr->large_ds_size );
+ HDassert(start_index < stop_index);
+ HDassert(stop_index <= tv_ptr->large_ds_size);
- for ( u = 0; u < start_index; u++ ) {
+ for (u = 0; u < start_index; u++) {
- if ( *ptr_1 != 0 ) {
+ if (*ptr_1 != 0) {
data_ok = FALSE;
}
@@ -3495,28 +2995,19 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
ptr_1++;
}
- VRFY((data_ok == TRUE),
- "slice read from small to large ds data good(1).");
+ VRFY((data_ok == TRUE), "slice read from small to large ds data good(1).");
- data_ok = ckrbrd_hs_dr_pio_test__verify_data
- (
- ptr_1,
- tv_ptr->small_rank - 1,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- expected_value,
- (hbool_t)TRUE
- );
-
- VRFY((data_ok == TRUE),
- "slice read from small to large ds data good(2).");
+ data_ok = ckrbrd_hs_dr_pio_test__verify_data(ptr_1, tv_ptr->small_rank - 1,
+ tv_ptr->edge_size, tv_ptr->checker_edge_size,
+ expected_value, (hbool_t)TRUE);
+ VRFY((data_ok == TRUE), "slice read from small to large ds data good(2).");
ptr_1 = tv_ptr->large_ds_buf_1 + stop_index + 1;
- for ( u = stop_index + 1; u < tv_ptr->large_ds_size; u++ ) {
+ for (u = stop_index + 1; u < tv_ptr->large_ds_size; u++) {
- if ( *ptr_1 != 0 ) {
+ if (*ptr_1 != 0) {
data_ok = FALSE;
}
@@ -3527,8 +3018,7 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
ptr_1++;
}
- VRFY((data_ok == TRUE),
- "slice read from small to large ds data good(3).");
+ VRFY((data_ok == TRUE), "slice read from small to large ds data good(3).");
(tv_ptr->tests_run)++;
}
@@ -3537,49 +3027,38 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
(tv_ptr->total_tests)++;
- } while ( ( tv_ptr->large_rank > 2 ) &&
- ( (tv_ptr->small_rank - 1) <= 1 ) &&
- ( l < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 2) && ((tv_ptr->small_rank - 1) <= 1) && (l < tv_ptr->edge_size));
k++;
- } while ( ( tv_ptr->large_rank > 3 ) &&
- ( (tv_ptr->small_rank - 1) <= 2 ) &&
- ( k < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 3) && ((tv_ptr->small_rank - 1) <= 2) && (k < tv_ptr->edge_size));
j++;
- } while ( ( tv_ptr->large_rank > 4 ) &&
- ( (tv_ptr->small_rank - 1) <= 3 ) &&
- ( j < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 4) && ((tv_ptr->small_rank - 1) <= 3) && (j < tv_ptr->edge_size));
return;
} /* ckrbrd_hs_dr_pio_test__d2m_s2l() */
-
/*-------------------------------------------------------------------------
- * Function: ckrbrd_hs_dr_pio_test__m2d_l2s()
- *
- * Purpose: Part three of a series of tests of I/O to/from checker
- * board hyperslab selections of different rank in the
- * parallel.
+ * Function: ckrbrd_hs_dr_pio_test__m2d_l2s()
*
- * Verify that we can write from memory to file using checker
- * board selections of different rank that
- * H5S_select_shape_same() views as being of the same shape.
+ * Purpose: Part three of a series of tests of I/O to/from checker
+ * board hyperslab selections of different rank in the
+ * parallel.
*
- * Do this by writing small_rank - 1 dimensional checker
- * board slices from the in memory large data set to the on
- * disk small cube dataset. After each write, read the
- * slice of the small dataset back from disk, and verify
- * that it contains the expected data. Verify that
- * H5S_select_shape_same() returns true on the memory and
- * file selections.
+ * Verify that we can write from memory to file using checker
+ * board selections of different rank that
+ * H5S_select_shape_same() views as being of the same shape.
*
- * Return: void
+ * Do this by writing small_rank - 1 dimensional checker
+ * board slices from the in memory large data set to the on
+ * disk small cube dataset. After each write, read the
+ * slice of the small dataset back from disk, and verify
+ * that it contains the expected data. Verify that
+ * H5S_select_shape_same() returns true on the memory and
+ * file selections.
*
- * Programmer: JRM -- 8/15/11
+ * Return: void
*
- * Modifications:
- *
- * None.
+ * Programmer: JRM -- 8/15/11
*
*-------------------------------------------------------------------------
*/
@@ -3587,94 +3066,79 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
#define CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG 0
static void
-ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
+ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG
+#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG
const char *fcnName = "ckrbrd_hs_dr_pio_test__m2d_l2s()";
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG */
- hbool_t data_ok = FALSE;
- hbool_t mis_match = FALSE;
- int i, j, k, l;
- size_t u;
- size_t start_index;
- size_t stop_index;
- uint32_t expected_value;
- uint32_t * ptr_1;
- int mpi_rank; /* needed by VRFY */
- hsize_t sel_start[PAR_SS_DR_MAX_RANK];
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hbool_t data_ok = FALSE;
+ hbool_t mis_match = FALSE;
+ int i, j, k, l;
+ size_t u;
+ size_t start_index;
+ size_t stop_index;
+ uint32_t expected_value;
+ uint32_t *ptr_1;
+ int mpi_rank; /* needed by VRFY */
+ hsize_t sel_start[PAR_SS_DR_MAX_RANK];
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
-
/* now we go in the opposite direction, verifying that we can write
* from memory to file using selections of different rank that
* H5S_select_shape_same() views as being of the same shape.
*
* Start by writing small_rank - 1 D slices from the in memory large data
- * set to the on disk small dataset. After each write, read the slice of
- * the small dataset back from disk, and verify that it contains the
- * expected data. Verify that H5S_select_shape_same() returns true on
+ * set to the on disk small dataset. After each write, read the slice of
+ * the small dataset back from disk, and verify that it contains the
+ * expected data. Verify that H5S_select_shape_same() returns true on
* the memory and file selections.
*/
- tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
+ tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
tv_ptr->stride[0] = (hsize_t)(2 * (tv_ptr->mpi_size + 1));
- tv_ptr->count[0] = 1;
- tv_ptr->block[0] = 1;
+ tv_ptr->count[0] = 1;
+ tv_ptr->block[0] = 1;
- for ( i = 1; i < tv_ptr->large_rank; i++ ) {
+ for (i = 1; i < tv_ptr->large_rank; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
+ tv_ptr->count[i] = 1;
+ tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
- ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->file_small_ds_sid_0, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(file_small_ds_sid_0, set) suceeded");
- ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->mem_small_ds_sid, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(mem_small_ds_sid, set) suceeded");
-
sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0;
- sel_start[tv_ptr->small_ds_offset] = (hsize_t)(tv_ptr->mpi_rank);
-
- ckrbrd_hs_dr_pio_test__slct_ckrbrd(tv_ptr->mpi_rank,
- tv_ptr->file_small_ds_sid_1,
- tv_ptr->small_rank,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- tv_ptr->small_rank - 1,
- sel_start);
+ sel_start[tv_ptr->small_ds_offset] = (hsize_t)(tv_ptr->mpi_rank);
+ ckrbrd_hs_dr_pio_test__slct_ckrbrd(tv_ptr->mpi_rank, tv_ptr->file_small_ds_sid_1, tv_ptr->small_rank,
+ tv_ptr->edge_size, tv_ptr->checker_edge_size, tv_ptr->small_rank - 1,
+ sel_start);
/* set up start, stride, count, and block -- note that we will
* change start[] so as to read slices of the large cube.
*/
- for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) {
+ for (i = 0; i < PAR_SS_DR_MAX_RANK; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- if ( (PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1) ) {
+ tv_ptr->count[i] = 1;
+ if ((PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1)) {
tv_ptr->block[i] = 1;
-
- } else {
+ }
+ else {
tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
@@ -3683,60 +3147,58 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
/* zero out the in memory small ds */
HDmemset(tv_ptr->small_ds_buf_1, 0, sizeof(uint32_t) * tv_ptr->small_ds_size);
-
-#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG
- HDfprintf(stdout,
- "%s writing checker boards selections of slices from big ds to slices of small ds on disk.\n",
- fcnName);
+#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG
+ HDfprintf(stdout,
+ "%s writing checker boards selections of slices from big ds to slices of small ds on disk.\n",
+ fcnName);
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG */
/* in serial versions of this test, we loop through all the dimensions
- * of the large data set that don't appear in the small data set.
+ * of the large data set that don't appear in the small data set.
*
- * However, in the parallel version, each process only works with that
- * slice of the large (and small) data set indicated by its rank -- hence
- * we set the most slowly changing index to mpi_rank, and don't itterate
+ * However, in the parallel version, each process only works with that
+ * slice of the large (and small) data set indicated by its rank -- hence
+ * we set the most slowly changing index to mpi_rank, and don't itterate
* over it.
*/
-
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0) {
i = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
i = 0;
}
- /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
+ /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
* loop over it -- either we are setting i to mpi_rank, or
- * we are setting it to zero. It will not change during the
+ * we are setting it to zero. It will not change during the
* test.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1) {
j = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
j = 0;
}
j = 0;
do {
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2) {
k = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
k = 0;
}
do {
- /* since small rank >= 2 and large_rank > small_rank, we
+ /* since small rank >= 2 and large_rank > small_rank, we
* have large_rank >= 3. Since PAR_SS_DR_MAX_RANK == 5
* (baring major re-orgaization), this gives us:
*
@@ -3748,11 +3210,11 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
l = 0;
do {
- if ( (tv_ptr->skips)++ < tv_ptr->max_skips ) { /* skip the test */
+ if ((tv_ptr->skips)++ < tv_ptr->max_skips) { /* skip the test */
(tv_ptr->tests_skipped)++;
-
- } else { /* run the test */
+ }
+ else { /* run the test */
tv_ptr->skips = 0; /* reset the skips counter */
@@ -3760,16 +3222,12 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
* by the assertions at the head of this function. Thus no
* need for another inner loop.
*/
-
+
/* zero out this rank's slice of the on disk small data set */
- ret = H5Dwrite(tv_ptr->small_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_small_ds_sid,
- tv_ptr->file_small_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->small_ds_buf_2);
+ ret = H5Dwrite(tv_ptr->small_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_small_ds_sid,
+ tv_ptr->file_small_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->small_ds_buf_2);
VRFY((ret >= 0), "H5Dwrite() zero slice to small ds succeeded.");
-
+
/* select the portion of the in memory large cube from which we
* are going to write data.
*/
@@ -3778,120 +3236,88 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
tv_ptr->start[2] = (hsize_t)k;
tv_ptr->start[3] = (hsize_t)l;
tv_ptr->start[4] = 0;
-
- HDassert((tv_ptr->start[0] == 0)||(0 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[1] == 0)||(1 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[2] == 0)||(2 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[3] == 0)||(3 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[4] == 0)||(4 < tv_ptr->small_ds_offset + 1));
-
- ckrbrd_hs_dr_pio_test__slct_ckrbrd
- (
- tv_ptr->mpi_rank,
- tv_ptr->mem_large_ds_sid,
- tv_ptr->large_rank,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- tv_ptr->small_rank - 1,
- tv_ptr->start
- );
-
-
+
+ HDassert((tv_ptr->start[0] == 0) || (0 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[1] == 0) || (1 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[2] == 0) || (2 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[3] == 0) || (3 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[4] == 0) || (4 < tv_ptr->small_ds_offset + 1));
+
+ ckrbrd_hs_dr_pio_test__slct_ckrbrd(
+ tv_ptr->mpi_rank, tv_ptr->mem_large_ds_sid, tv_ptr->large_rank, tv_ptr->edge_size,
+ tv_ptr->checker_edge_size, tv_ptr->small_rank - 1, tv_ptr->start);
+
/* verify that H5S_select_shape_same() reports the in
- * memory checkerboard selection of the slice through the
+ * memory checkerboard selection of the slice through the
* large dataset and the checkerboard selection of the process
* slice of the small data set as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_1,
- tv_ptr->mem_large_ds_sid);
+ check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_1, tv_ptr->mem_large_ds_sid);
VRFY((check == TRUE), "H5S_select_shape_same_test passed.");
-
-
- /* write the checker board selection of the slice from the in
- * memory large data set to the slice of the on disk small
- * dataset.
+
+ /* write the checker board selection of the slice from the in
+ * memory large data set to the slice of the on disk small
+ * dataset.
*/
-#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG
- HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n",
- fcnName, tv_ptr->mpi_rank,
- tv_ptr->start[0], tv_ptr->start[1], tv_ptr->start[2],
- tv_ptr->start[3], tv_ptr->start[4]);
- HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n",
- fcnName, tv_ptr->mpi_rank,
+#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, tv_ptr->mpi_rank,
+ tv_ptr->start[0], tv_ptr->start[1], tv_ptr->start[2], tv_ptr->start[3],
+ tv_ptr->start[4]);
+ HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n", fcnName, tv_ptr->mpi_rank,
H5Sget_simple_extent_ndims(tv_ptr->mem_large_ds_sid),
H5Sget_simple_extent_ndims(tv_ptr->file_small_ds_sid_1));
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG */
- ret = H5Dwrite(tv_ptr->small_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_large_ds_sid,
- tv_ptr->file_small_ds_sid_1,
- tv_ptr->xfer_plist,
- tv_ptr->large_ds_buf_0);
+ ret = H5Dwrite(tv_ptr->small_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_large_ds_sid,
+ tv_ptr->file_small_ds_sid_1, tv_ptr->xfer_plist, tv_ptr->large_ds_buf_0);
VRFY((ret >= 0), "H5Dwrite() slice to large ds succeeded.");
-
-
+
/* read the on disk process slice of the small dataset into memory */
- ret = H5Dread(tv_ptr->small_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_small_ds_sid,
- tv_ptr->file_small_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->small_ds_buf_1);
+ ret = H5Dread(tv_ptr->small_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_small_ds_sid,
+ tv_ptr->file_small_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->small_ds_buf_1);
VRFY((ret >= 0), "H5Dread() slice from small ds succeeded.");
-
-
+
/* verify that expected data is retrieved */
-
+
mis_match = FALSE;
-
+
expected_value = (uint32_t)(
- (i * tv_ptr->edge_size * tv_ptr->edge_size *
- tv_ptr->edge_size * tv_ptr->edge_size) +
+ (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
(j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
- (k * tv_ptr->edge_size * tv_ptr->edge_size) +
- (l * tv_ptr->edge_size));
-
+ (k * tv_ptr->edge_size * tv_ptr->edge_size) + (l * tv_ptr->edge_size));
+
start_index = (size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size;
- stop_index = start_index + tv_ptr->small_ds_slice_size - 1;
-
- HDassert( start_index < stop_index );
- HDassert( stop_index <= tv_ptr->small_ds_size );
-
+ stop_index = start_index + tv_ptr->small_ds_slice_size - 1;
+
+ HDassert(start_index < stop_index);
+ HDassert(stop_index <= tv_ptr->small_ds_size);
+
data_ok = TRUE;
-
+
ptr_1 = tv_ptr->small_ds_buf_1;
- for ( u = 0; u < start_index; u++, ptr_1++ ) {
-
- if ( *ptr_1 != 0 ) {
+ for (u = 0; u < start_index; u++, ptr_1++) {
+
+ if (*ptr_1 != 0) {
data_ok = FALSE;
- *ptr_1 = 0;
+ *ptr_1 = 0;
}
}
- data_ok &= ckrbrd_hs_dr_pio_test__verify_data
- (
- tv_ptr->small_ds_buf_1 + start_index,
- tv_ptr->small_rank - 1,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- expected_value,
- (hbool_t)TRUE
- );
-
+ data_ok &= ckrbrd_hs_dr_pio_test__verify_data(
+ tv_ptr->small_ds_buf_1 + start_index, tv_ptr->small_rank - 1, tv_ptr->edge_size,
+ tv_ptr->checker_edge_size, expected_value, (hbool_t)TRUE);
ptr_1 = tv_ptr->small_ds_buf_1;
- for ( u = stop_index; u < tv_ptr->small_ds_size; u++, ptr_1++ ) {
+ for (u = stop_index; u < tv_ptr->small_ds_size; u++, ptr_1++) {
- if ( *ptr_1 != 0 ) {
+ if (*ptr_1 != 0) {
data_ok = FALSE;
- *ptr_1 = 0;
+ *ptr_1 = 0;
}
}
- VRFY((data_ok == TRUE),
- "large slice write slice to small slice data good.");
+ VRFY((data_ok == TRUE), "large slice write slice to small slice data good.");
(tv_ptr->tests_run)++;
}
@@ -3900,49 +3326,38 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
(tv_ptr->total_tests)++;
- } while ( ( tv_ptr->large_rank > 2 ) &&
- ( (tv_ptr->small_rank - 1) <= 1 ) &&
- ( l < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 2) && ((tv_ptr->small_rank - 1) <= 1) && (l < tv_ptr->edge_size));
k++;
- } while ( ( tv_ptr->large_rank > 3 ) &&
- ( (tv_ptr->small_rank - 1) <= 2 ) &&
- ( k < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 3) && ((tv_ptr->small_rank - 1) <= 2) && (k < tv_ptr->edge_size));
j++;
- } while ( ( tv_ptr->large_rank > 4 ) &&
- ( (tv_ptr->small_rank - 1) <= 3 ) &&
- ( j < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 4) && ((tv_ptr->small_rank - 1) <= 3) && (j < tv_ptr->edge_size));
return;
} /* ckrbrd_hs_dr_pio_test__m2d_l2s() */
-
/*-------------------------------------------------------------------------
- * Function: ckrbrd_hs_dr_pio_test__m2d_s2l()
- *
- * Purpose: Part four of a series of tests of I/O to/from checker
- * board hyperslab selections of different rank in the parallel.
+ * Function: ckrbrd_hs_dr_pio_test__m2d_s2l()
*
- * Verify that we can write from memory to file using
- * selections of different rank that H5S_select_shape_same()
- * views as being of the same shape.
+ * Purpose: Part four of a series of tests of I/O to/from checker
+ * board hyperslab selections of different rank in the parallel.
*
- * Do this by writing checker board selections of the contents
- * of the process's slice of the in memory small data set to
- * slices of the on disk large data set. After each write,
- * read the process's slice of the large data set back into
- * memory, and verify that it contains the expected data.
+ * Verify that we can write from memory to file using
+ * selections of different rank that H5S_select_shape_same()
+ * views as being of the same shape.
*
- * Verify that H5S_select_shape_same() returns true on the
- * memory and file selections.
+ * Do this by writing checker board selections of the contents
+ * of the process's slice of the in memory small data set to
+ * slices of the on disk large data set. After each write,
+ * read the process's slice of the large data set back into
+ * memory, and verify that it contains the expected data.
*
- * Return: void
+ * Verify that H5S_select_shape_same() returns true on the
+ * memory and file selections.
*
- * Programmer: JRM -- 8/15/11
+ * Return: void
*
- * Modifications:
- *
- * None
+ * Programmer: JRM -- 8/15/11
*
*-------------------------------------------------------------------------
*/
@@ -3950,94 +3365,81 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr)
#define CHECKER_BOARD_HS_DR_PIO_TEST__M2D_S2L__DEBUG 0
static void
-ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
+ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t *tv_ptr)
{
-#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_S2L__DEBUG
+#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_S2L__DEBUG
const char *fcnName = "ckrbrd_hs_dr_pio_test__m2d_s2l()";
#endif /* CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG */
- hbool_t data_ok = FALSE;
- hbool_t mis_match = FALSE;
- int i, j, k, l;
- size_t u;
- size_t start_index;
- size_t stop_index;
- uint32_t expected_value;
- uint32_t * ptr_1;
- int mpi_rank; /* needed by VRFY */
- hsize_t sel_start[PAR_SS_DR_MAX_RANK];
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ hbool_t data_ok = FALSE;
+ hbool_t mis_match = FALSE;
+ int i, j, k, l;
+ size_t u;
+ size_t start_index;
+ size_t stop_index;
+ uint32_t expected_value;
+ uint32_t *ptr_1;
+ int mpi_rank; /* needed by VRFY */
+ hsize_t sel_start[PAR_SS_DR_MAX_RANK];
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
-
- /* Now write the contents of the process's slice of the in memory
- * small data set to slices of the on disk large data set. After
+ /* Now write the contents of the process's slice of the in memory
+ * small data set to slices of the on disk large data set. After
* each write, read the process's slice of the large data set back
- * into memory, and verify that it contains the expected data.
- * Verify that H5S_select_shape_same() returns true on the memory
+ * into memory, and verify that it contains the expected data.
+ * Verify that H5S_select_shape_same() returns true on the memory
* and file selections.
*/
- tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
+ tv_ptr->start[0] = (hsize_t)(tv_ptr->mpi_rank);
tv_ptr->stride[0] = (hsize_t)(2 * (tv_ptr->mpi_size + 1));
- tv_ptr->count[0] = 1;
- tv_ptr->block[0] = 1;
+ tv_ptr->count[0] = 1;
+ tv_ptr->block[0] = 1;
- for ( i = 1; i < tv_ptr->large_rank; i++ ) {
+ for (i = 1; i < tv_ptr->large_rank; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
+ tv_ptr->count[i] = 1;
+ tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
- ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->file_large_ds_sid_0, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(file_large_ds_sid_0, set) suceeded");
- ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid,
- H5S_SELECT_SET,
- tv_ptr->start,
- tv_ptr->stride,
- tv_ptr->count,
- tv_ptr->block);
+ ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid, H5S_SELECT_SET, tv_ptr->start, tv_ptr->stride,
+ tv_ptr->count, tv_ptr->block);
VRFY((ret >= 0), "H5Sselect_hyperslab(tv_ptr->mem_large_ds_sid, set) suceeded");
- /* setup a checkerboard selection of the slice of the in memory small
+ /* setup a checkerboard selection of the slice of the in memory small
* data set associated with the process's mpi rank.
*/
sel_start[0] = sel_start[1] = sel_start[2] = sel_start[3] = sel_start[4] = 0;
- sel_start[tv_ptr->small_ds_offset] = (hsize_t)(tv_ptr->mpi_rank);
-
- ckrbrd_hs_dr_pio_test__slct_ckrbrd(tv_ptr->mpi_rank,
- tv_ptr->mem_small_ds_sid,
- tv_ptr->small_rank,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- tv_ptr->small_rank - 1,
+ sel_start[tv_ptr->small_ds_offset] = (hsize_t)(tv_ptr->mpi_rank);
+
+ ckrbrd_hs_dr_pio_test__slct_ckrbrd(tv_ptr->mpi_rank, tv_ptr->mem_small_ds_sid, tv_ptr->small_rank,
+ tv_ptr->edge_size, tv_ptr->checker_edge_size, tv_ptr->small_rank - 1,
sel_start);
/* set up start, stride, count, and block -- note that we will
- * change start[] so as to write checkerboard selections of slices
+ * change start[] so as to write checkerboard selections of slices
* of the small data set to slices of the large data set.
*/
- for ( i = 0; i < PAR_SS_DR_MAX_RANK; i++ ) {
+ for (i = 0; i < PAR_SS_DR_MAX_RANK; i++) {
- tv_ptr->start[i] = 0;
+ tv_ptr->start[i] = 0;
tv_ptr->stride[i] = (hsize_t)(2 * tv_ptr->edge_size);
- tv_ptr->count[i] = 1;
- if ( (PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1) ) {
+ tv_ptr->count[i] = 1;
+ if ((PAR_SS_DR_MAX_RANK - i) > (tv_ptr->small_rank - 1)) {
tv_ptr->block[i] = 1;
-
- } else {
+ }
+ else {
tv_ptr->block[i] = (hsize_t)(tv_ptr->edge_size);
}
@@ -4047,47 +3449,48 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
HDmemset(tv_ptr->large_ds_buf_1, 0, sizeof(uint32_t) * tv_ptr->large_ds_size);
#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_S2L__DEBUG
- HDfprintf(stdout,
- "%s writing process checkerboard selections of slices of small ds to process slices of large ds on disk.\n",
- fcnName);
+ HDfprintf(stdout,
+ "%s writing process checkerboard selections of slices of small ds to process slices of large "
+ "ds on disk.\n",
+ fcnName);
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__M2D_S2L__DEBUG */
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 0) {
i = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
i = 0;
}
- /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
+ /* since large_rank is at most PAR_SS_DR_MAX_RANK, no need to
* loop over it -- either we are setting i to mpi_rank, or
- * we are setting it to zero. It will not change during the
+ * we are setting it to zero. It will not change during the
* test.
*/
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 1) {
j = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
j = 0;
}
do {
- if ( PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2 ) {
+ if (PAR_SS_DR_MAX_RANK - tv_ptr->large_rank == 2) {
k = tv_ptr->mpi_rank;
-
- } else {
+ }
+ else {
k = 0;
}
do {
- /* since small rank >= 2 and large_rank > small_rank, we
+ /* since small rank >= 2 and large_rank > small_rank, we
* have large_rank >= 3. Since PAR_SS_DR_MAX_RANK == 5
* (baring major re-orgaization), this gives us:
*
@@ -4099,11 +3502,11 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
l = 0;
do {
- if ( (tv_ptr->skips)++ < tv_ptr->max_skips ) { /* skip the test */
+ if ((tv_ptr->skips)++ < tv_ptr->max_skips) { /* skip the test */
(tv_ptr->tests_skipped)++;
-
- } else { /* run the test */
+ }
+ else { /* run the test */
tv_ptr->skips = 0; /* reset the skips counter */
@@ -4116,15 +3519,10 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
* Note that this will leave one slice with its original data
* as there is one more slice than processes.
*/
- ret = H5Dwrite(tv_ptr->large_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_large_ds_sid,
- tv_ptr->file_large_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->large_ds_buf_2);
+ ret = H5Dwrite(tv_ptr->large_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_large_ds_sid,
+ tv_ptr->file_large_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->large_ds_buf_2);
VRFY((ret != FAIL), "H5Dwrite() to zero large ds suceeded");
-
/* select the portion of the in memory large cube to which we
* are going to write data.
*/
@@ -4134,126 +3532,90 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
tv_ptr->start[3] = (hsize_t)l;
tv_ptr->start[4] = 0;
- HDassert((tv_ptr->start[0] == 0)||(0 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[1] == 0)||(1 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[2] == 0)||(2 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[3] == 0)||(3 < tv_ptr->small_ds_offset + 1));
- HDassert((tv_ptr->start[4] == 0)||(4 < tv_ptr->small_ds_offset + 1));
-
- ckrbrd_hs_dr_pio_test__slct_ckrbrd
- (
- tv_ptr->mpi_rank,
- tv_ptr->file_large_ds_sid_1,
- tv_ptr->large_rank,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- tv_ptr->small_rank - 1,
- tv_ptr->start
- );
+ HDassert((tv_ptr->start[0] == 0) || (0 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[1] == 0) || (1 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[2] == 0) || (2 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[3] == 0) || (3 < tv_ptr->small_ds_offset + 1));
+ HDassert((tv_ptr->start[4] == 0) || (4 < tv_ptr->small_ds_offset + 1));
+ ckrbrd_hs_dr_pio_test__slct_ckrbrd(
+ tv_ptr->mpi_rank, tv_ptr->file_large_ds_sid_1, tv_ptr->large_rank, tv_ptr->edge_size,
+ tv_ptr->checker_edge_size, tv_ptr->small_rank - 1, tv_ptr->start);
/* verify that H5S_select_shape_same() reports the in
* memory small data set slice selection and the
* on disk slice through the large data set selection
* as having the same shape.
*/
- check = H5S_select_shape_same_test(tv_ptr->mem_small_ds_sid,
- tv_ptr->file_large_ds_sid_1);
+ check = H5S_select_shape_same_test(tv_ptr->mem_small_ds_sid, tv_ptr->file_large_ds_sid_1);
VRFY((check == TRUE), "H5S_select_shape_same_test passed");
-
- /* write the small data set slice from memory to the
- * target slice of the disk data set
+ /* write the small data set slice from memory to the
+ * target slice of the disk data set
*/
-#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_S2L__DEBUG
- HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n",
- fcnName, tv_ptr->mpi_rank,
- tv_ptr->start[0], tv_ptr->start[1], tv_ptr->start[2],
- tv_ptr->start[3], tv_ptr->start[4]);
- HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n",
- fcnName, tv_ptr->mpi_rank,
+#if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_S2L__DEBUG
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, tv_ptr->mpi_rank,
+ tv_ptr->start[0], tv_ptr->start[1], tv_ptr->start[2], tv_ptr->start[3],
+ tv_ptr->start[4]);
+ HDfprintf(stdout, "%s:%d: mem/file extent dims = %d/%d.\n", fcnName, tv_ptr->mpi_rank,
H5Sget_simple_extent_ndims(tv_ptr->mem_small_ds_sid),
H5Sget_simple_extent_ndims(tv_ptr->file_large_ds_sid_1));
#endif /* CHECKER_BOARD_HS_DR_PIO_TEST__M2D_S2L__DEBUG */
- ret = H5Dwrite(tv_ptr->large_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_small_ds_sid,
- tv_ptr->file_large_ds_sid_1,
- tv_ptr->xfer_plist,
- tv_ptr->small_ds_buf_0);
- VRFY((ret != FAIL),
- "H5Dwrite of small ds slice to large ds succeeded");
-
+ ret = H5Dwrite(tv_ptr->large_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_small_ds_sid,
+ tv_ptr->file_large_ds_sid_1, tv_ptr->xfer_plist, tv_ptr->small_ds_buf_0);
+ VRFY((ret != FAIL), "H5Dwrite of small ds slice to large ds succeeded");
- /* read this processes slice on the on disk large
+ /* read this processes slice on the on disk large
* data set into memory.
*/
- ret = H5Dread(tv_ptr->large_dataset,
- H5T_NATIVE_UINT32,
- tv_ptr->mem_large_ds_sid,
- tv_ptr->file_large_ds_sid_0,
- tv_ptr->xfer_plist,
- tv_ptr->large_ds_buf_1);
- VRFY((ret != FAIL),
- "H5Dread() of process slice of large ds succeeded");
-
+ ret = H5Dread(tv_ptr->large_dataset, H5T_NATIVE_UINT32, tv_ptr->mem_large_ds_sid,
+ tv_ptr->file_large_ds_sid_0, tv_ptr->xfer_plist, tv_ptr->large_ds_buf_1);
+ VRFY((ret != FAIL), "H5Dread() of process slice of large ds succeeded");
/* verify that the expected data and only the
* expected data was read.
*/
- expected_value =
- (uint32_t)((size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size);
-
- start_index = (size_t)
- ((i * tv_ptr->edge_size * tv_ptr->edge_size *
- tv_ptr->edge_size * tv_ptr->edge_size) +
- (j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
- (k * tv_ptr->edge_size * tv_ptr->edge_size) +
- (l * tv_ptr->edge_size));
- stop_index = start_index + tv_ptr->small_ds_slice_size - 1;
+ expected_value = (uint32_t)((size_t)(tv_ptr->mpi_rank) * tv_ptr->small_ds_slice_size);
- HDassert( start_index < stop_index );
- HDassert( stop_index < tv_ptr->large_ds_size );
+ start_index = (size_t)(
+ (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
+ (j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) +
+ (k * tv_ptr->edge_size * tv_ptr->edge_size) + (l * tv_ptr->edge_size));
+ stop_index = start_index + tv_ptr->small_ds_slice_size - 1;
+ HDassert(start_index < stop_index);
+ HDassert(stop_index < tv_ptr->large_ds_size);
mis_match = FALSE;
data_ok = TRUE;
ptr_1 = tv_ptr->large_ds_buf_1;
- for ( u = 0; u < start_index; u++, ptr_1++ ) {
+ for (u = 0; u < start_index; u++, ptr_1++) {
- if ( *ptr_1 != 0 ) {
+ if (*ptr_1 != 0) {
data_ok = FALSE;
- *ptr_1 = 0;
+ *ptr_1 = 0;
}
}
- data_ok &= ckrbrd_hs_dr_pio_test__verify_data
- (
- tv_ptr->large_ds_buf_1 + start_index,
- tv_ptr->small_rank - 1,
- tv_ptr->edge_size,
- tv_ptr->checker_edge_size,
- expected_value,
- (hbool_t)TRUE
- );
-
+ data_ok &= ckrbrd_hs_dr_pio_test__verify_data(
+ tv_ptr->large_ds_buf_1 + start_index, tv_ptr->small_rank - 1, tv_ptr->edge_size,
+ tv_ptr->checker_edge_size, expected_value, (hbool_t)TRUE);
ptr_1 = tv_ptr->large_ds_buf_1;
- for ( u = stop_index; u < tv_ptr->small_ds_size; u++, ptr_1++ ) {
+ for (u = stop_index; u < tv_ptr->small_ds_size; u++, ptr_1++) {
- if ( *ptr_1 != 0 ) {
+ if (*ptr_1 != 0) {
data_ok = FALSE;
- *ptr_1 = 0;
+ *ptr_1 = 0;
}
}
- VRFY((data_ok == TRUE),
- "small ds cb slice write to large ds slice data good.");
+ VRFY((data_ok == TRUE), "small ds cb slice write to large ds slice data good.");
(tv_ptr->tests_run)++;
}
@@ -4262,40 +3624,25 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
(tv_ptr->total_tests)++;
- } while ( ( tv_ptr->large_rank > 2 ) &&
- ( (tv_ptr->small_rank - 1) <= 1 ) &&
- ( l < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 2) && ((tv_ptr->small_rank - 1) <= 1) && (l < tv_ptr->edge_size));
k++;
- } while ( ( tv_ptr->large_rank > 3 ) &&
- ( (tv_ptr->small_rank - 1) <= 2 ) &&
- ( k < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 3) && ((tv_ptr->small_rank - 1) <= 2) && (k < tv_ptr->edge_size));
j++;
- } while ( ( tv_ptr->large_rank > 4 ) &&
- ( (tv_ptr->small_rank - 1) <= 3 ) &&
- ( j < tv_ptr->edge_size ) );
+ } while ((tv_ptr->large_rank > 4) && ((tv_ptr->small_rank - 1) <= 3) && (j < tv_ptr->edge_size));
return;
} /* ckrbrd_hs_dr_pio_test__m2d_s2l() */
-
/*-------------------------------------------------------------------------
- * Function: ckrbrd_hs_dr_pio_test__run_test()
- *
- * Purpose: Test I/O to/from checkerboard selections of hyperslabs of
- * different rank in the parallel.
- *
- * Return: void
+ * Function: ckrbrd_hs_dr_pio_test__run_test()
*
- * Programmer: JRM -- 10/10/09
+ * Purpose: Test I/O to/from checkerboard selections of hyperslabs of
+ * different rank in the parallel.
*
- * Modifications:
+ * Return: void
*
- * JRM -- 9/16/10
- * Added the express_test parameter. Use it to control
- * whether we set an alignment, and whether we allocate
- * chunks such that no two processes will normally touch
- * the same chunk.
+ * Programmer: JRM -- 10/10/09
*
*-------------------------------------------------------------------------
*/
@@ -4303,29 +3650,19 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr)
#define CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG 0
static void
-ckrbrd_hs_dr_pio_test__run_test(const int test_num,
- const int edge_size,
- const int checker_edge_size,
- const int chunk_edge_size,
- const int small_rank,
- const int large_rank,
- const hbool_t use_collective_io,
- const hid_t dset_type,
- const int express_test,
- int * skips_ptr,
- int max_skips,
- int64_t * total_tests_ptr,
- int64_t * tests_run_ptr,
- int64_t * tests_skipped_ptr)
+ckrbrd_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const int checker_edge_size,
+ const int chunk_edge_size, const int small_rank, const int large_rank,
+ const hbool_t use_collective_io, const hid_t dset_type,
+ const int express_test, int *skips_ptr, int max_skips,
+ int64_t *total_tests_ptr, int64_t *tests_run_ptr, int64_t *tests_skipped_ptr)
{
#if CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG
const char *fcnName = "ckrbrd_hs_dr_pio_test__run_test()";
-#endif /* CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
- int mpi_rank; /* needed by VRFY */
- struct hs_dr_pio_test_vars_t test_vars =
- {
- /* int mpi_size = */ -1,
+#endif /* CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
+ int mpi_rank; /* needed by VRFY */
+ struct hs_dr_pio_test_vars_t test_vars = {
+ /* int mpi_size = */ -1,
/* int mpi_rank = */ -1,
/* MPI_Comm mpi_comm = */ MPI_COMM_NULL,
/* MPI_Inf mpi_info = */ MPI_INFO_NULL,
@@ -4341,12 +3678,12 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num,
/* uint32_t * small_ds_buf_2 = */ NULL,
/* uint32_t * small_ds_slice_buf = */ NULL,
/* uint32_t * large_ds_buf_0 = */ NULL,
- /* uint32_t * large_ds_buf_1 = */ NULL,
+ /* uint32_t * large_ds_buf_1 = */ NULL,
/* uint32_t * large_ds_buf_2 = */ NULL,
/* uint32_t * large_ds_slice_buf = */ NULL,
/* int small_ds_offset = */ -1,
/* int large_ds_offset = */ -1,
- /* hid_t fid = */ -1, /* HDF5 file ID */
+ /* hid_t fid = */ -1, /* HDF5 file ID */
/* hid_t xfer_plist = */ H5P_DEFAULT,
/* hid_t full_mem_small_ds_sid = */ -1,
/* hid_t full_file_small_ds_sid = */ -1,
@@ -4362,61 +3699,53 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num,
/* hid_t file_large_ds_process_slice_sid = */ -1,
/* hid_t mem_large_ds_process_slice_sid = */ -1,
/* hid_t large_ds_slice_sid = */ -1,
- /* hid_t small_dataset = */ -1, /* Dataset ID */
- /* hid_t large_dataset = */ -1, /* Dataset ID */
+ /* hid_t small_dataset = */ -1, /* Dataset ID */
+ /* hid_t large_dataset = */ -1, /* Dataset ID */
/* size_t small_ds_size = */ 1,
/* size_t small_ds_slice_size = */ 1,
/* size_t large_ds_size = */ 1,
/* size_t large_ds_slice_size = */ 1,
- /* hsize_t dims[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t chunk_dims[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t start[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t stride[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t count[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
- /* hsize_t block[PAR_SS_DR_MAX_RANK] = */ {0,0,0,0,0},
+ /* hsize_t dims[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t chunk_dims[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t start[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t stride[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t count[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
+ /* hsize_t block[PAR_SS_DR_MAX_RANK] = */ {0, 0, 0, 0, 0},
/* hsize_t * start_ptr = */ NULL,
/* hsize_t * stride_ptr = */ NULL,
/* hsize_t * count_ptr = */ NULL,
/* hsize_t * block_ptr = */ NULL,
- /* int skips = */ 0,
- /* int max_skips = */ 0,
+ /* int skips = */ 0,
+ /* int max_skips = */ 0,
/* int64_t total_tests = */ 0,
/* int64_t tests_run = */ 0,
- /* int64_t tests_skipped = */ 0
- };
- struct hs_dr_pio_test_vars_t * tv_ptr = &test_vars;
-
- hs_dr_pio_test__setup(test_num, edge_size, checker_edge_size,
- chunk_edge_size, small_rank, large_rank,
- use_collective_io, dset_type, express_test,
- tv_ptr);
+ /* int64_t tests_skipped = */ 0};
+ struct hs_dr_pio_test_vars_t *tv_ptr = &test_vars;
+ hs_dr_pio_test__setup(test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank,
+ use_collective_io, dset_type, express_test, tv_ptr);
/* initialize the local copy of mpi_rank */
mpi_rank = tv_ptr->mpi_rank;
-
/* initialize skips & max_skips */
- tv_ptr->skips = *skips_ptr;
+ tv_ptr->skips = *skips_ptr;
tv_ptr->max_skips = max_skips;
-
#if CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
- HDfprintf(stdout, "test %d: small rank = %d, large rank = %d.\n",
- test_num, small_rank, large_rank);
+ if (MAINPROCESS) {
+ HDfprintf(stdout, "test %d: small rank = %d, large rank = %d.\n", test_num, small_rank, large_rank);
HDfprintf(stdout, "test %d: Initialization complete.\n", test_num);
}
#endif /* CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
-
/* first, verify that we can read from disk correctly using selections
* of different rank that H5S_select_shape_same() views as being of the
* same shape.
*
- * Start by reading a (small_rank - 1)-D slice from this processes slice
- * of the on disk large data set, and verifying that the data read is
- * correct. Verify that H5S_select_shape_same() returns true on the
+ * Start by reading a (small_rank - 1)-D slice from this processes slice
+ * of the on disk large data set, and verifying that the data read is
+ * correct. Verify that H5S_select_shape_same() returns true on the
* memory and file selections.
*
* The first step is to set up the needed checker board selection in the
@@ -4425,53 +3754,48 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num,
ckrbrd_hs_dr_pio_test__d2m_l2s(tv_ptr);
-
- /* similarly, read slices of the on disk small data set into slices
- * through the in memory large data set, and verify that the correct
+ /* similarly, read slices of the on disk small data set into slices
+ * through the in memory large data set, and verify that the correct
* data (and only the correct data) is read.
*/
ckrbrd_hs_dr_pio_test__d2m_s2l(tv_ptr);
-
/* now we go in the opposite direction, verifying that we can write
* from memory to file using selections of different rank that
* H5S_select_shape_same() views as being of the same shape.
*
* Start by writing small_rank - 1 D slices from the in memory large data
- * set to the on disk small dataset. After each write, read the slice of
- * the small dataset back from disk, and verify that it contains the
- * expected data. Verify that H5S_select_shape_same() returns true on
+ * set to the on disk small dataset. After each write, read the slice of
+ * the small dataset back from disk, and verify that it contains the
+ * expected data. Verify that H5S_select_shape_same() returns true on
* the memory and file selections.
*/
ckrbrd_hs_dr_pio_test__m2d_l2s(tv_ptr);
-
- /* Now write the contents of the process's slice of the in memory
- * small data set to slices of the on disk large data set. After
+ /* Now write the contents of the process's slice of the in memory
+ * small data set to slices of the on disk large data set. After
* each write, read the process's slice of the large data set back
- * into memory, and verify that it contains the expected data.
- * Verify that H5S_select_shape_same() returns true on the memory
+ * into memory, and verify that it contains the expected data.
+ * Verify that H5S_select_shape_same() returns true on the memory
* and file selections.
*/
ckrbrd_hs_dr_pio_test__m2d_s2l(tv_ptr);
-
#if CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
- HDfprintf(stdout,
- "test %d: Subtests complete -- tests run/skipped/total = %lld/%lld/%lld.\n",
- test_num, (long long)(tv_ptr->tests_run), (long long)(tv_ptr->tests_skipped),
- (long long)(tv_ptr->total_tests));
+ if (MAINPROCESS) {
+ HDfprintf(stdout, "test %d: Subtests complete -- tests run/skipped/total = %lld/%lld/%lld.\n",
+ test_num, (long long)(tv_ptr->tests_run), (long long)(tv_ptr->tests_skipped),
+ (long long)(tv_ptr->total_tests));
}
#endif /* CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
hs_dr_pio_test__takedown(tv_ptr);
#if CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG
- if ( MAINPROCESS ) {
+ if (MAINPROCESS) {
HDfprintf(stdout, "test %d: Takedown complete.\n", test_num);
}
#endif /* CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG */
@@ -4485,30 +3809,15 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num,
} /* ckrbrd_hs_dr_pio_test__run_test() */
-
/*-------------------------------------------------------------------------
- * Function: ckrbrd_hs_dr_pio_test()
- *
- * Purpose: Test I/O to/from hyperslab selections of different rank in
- * the parallel case.
+ * Function: ckrbrd_hs_dr_pio_test()
*
- * Return: void
+ * Purpose: Test I/O to/from hyperslab selections of different rank in
+ * the parallel case.
*
- * Programmer: JRM -- 9/18/09
+ * Return: void
*
- * Modifications:
- *
- * Modified function to take a sample of the run times
- * of the different tests, and skip some of them if
- * run times are too long.
- *
- * We need to do this because Lustre runns very slowly
- * if two or more processes are banging on the same
- * block of memory.
- * JRM -- 9/10/10
- * Break this one big test into 4 smaller tests according
- * to {independent,collective}x{contigous,chunked} datasets.
- * AKC -- 2010/01/17
+ * Programmer: JRM -- 9/18/09
*
*-------------------------------------------------------------------------
*/
@@ -4516,29 +3825,29 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num,
static void
ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
{
- int express_test;
- int local_express_test;
- int mpi_size = -1;
- int mpi_rank = -1;
- int test_num = 0;
- int edge_size;
- int checker_edge_size = 3;
- int chunk_edge_size = 0;
- int small_rank = 3;
- int large_rank = 4;
- int mpi_result;
- hid_t dset_type = H5T_NATIVE_UINT;
- int skips = 0;
- int max_skips = 0;
+ int express_test;
+ int local_express_test;
+ int mpi_size = -1;
+ int mpi_rank = -1;
+ int test_num = 0;
+ int edge_size;
+ int checker_edge_size = 3;
+ int chunk_edge_size = 0;
+ int small_rank = 3;
+ int large_rank = 4;
+ int mpi_result;
+ hid_t dset_type = H5T_NATIVE_UINT;
+ int skips = 0;
+ int max_skips = 0;
/* The following table list the number of sub-tests skipped between
* each test that is actually executed as a function of the express
* test level. Note that any value in excess of 4880 will cause all
* sub tests to be skipped.
*/
- int max_skips_tbl[4] = {0, 4, 64, 1024};
- int64_t total_tests = 0;
- int64_t tests_run = 0;
- int64_t tests_skipped = 0;
+ int max_skips_tbl[4] = {0, 4, 64, 1024};
+ int64_t total_tests = 0;
+ int64_t tests_run = 0;
+ int64_t tests_skipped = 0;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
@@ -4549,73 +3858,50 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned));
- mpi_result = MPI_Allreduce((void *)&local_express_test,
- (void *)&express_test,
- 1,
- MPI_INT,
- MPI_MAX,
+ mpi_result = MPI_Allreduce((void *)&local_express_test, (void *)&express_test, 1, MPI_INT, MPI_MAX,
MPI_COMM_WORLD);
- VRFY((mpi_result == MPI_SUCCESS ), "MPI_Allreduce(0) succeeded");
+ VRFY((mpi_result == MPI_SUCCESS), "MPI_Allreduce(0) succeeded");
- if ( local_express_test < 0 ) {
+ if (local_express_test < 0) {
max_skips = max_skips_tbl[0];
- } else if ( local_express_test > 3 ) {
+ }
+ else if (local_express_test > 3) {
max_skips = max_skips_tbl[3];
- } else {
+ }
+ else {
max_skips = max_skips_tbl[local_express_test];
}
-#if 0
+#if 0
{
int DebugWait = 1;
-
+
while (DebugWait) ;
}
-#endif
+#endif
- for ( large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++ ) {
+ for (large_rank = 3; large_rank <= PAR_SS_DR_MAX_RANK; large_rank++) {
- for ( small_rank = 2; small_rank < large_rank; small_rank++ ) {
- switch(sstest_type){
+ for (small_rank = 2; small_rank < large_rank; small_rank++) {
+ switch (sstest_type) {
case IND_CONTIG:
/* contiguous data set, independent I/O */
chunk_edge_size = 0;
- ckrbrd_hs_dr_pio_test__run_test(test_num,
- edge_size,
- checker_edge_size,
- chunk_edge_size,
- small_rank,
- large_rank,
- FALSE,
- dset_type,
- express_test,
- &skips,
- max_skips,
- &total_tests,
- &tests_run,
+ ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size,
+ small_rank, large_rank, FALSE, dset_type, express_test,
+ &skips, max_skips, &total_tests, &tests_run,
&tests_skipped);
test_num++;
break;
/* end of case IND_CONTIG */
- case COL_CONTIG:
+ case COL_CONTIG:
/* contiguous data set, collective I/O */
chunk_edge_size = 0;
- ckrbrd_hs_dr_pio_test__run_test(test_num,
- edge_size,
- checker_edge_size,
- chunk_edge_size,
- small_rank,
- large_rank,
- TRUE,
- dset_type,
- express_test,
- &skips,
- max_skips,
- &total_tests,
- &tests_run,
- &tests_skipped);
+ ckrbrd_hs_dr_pio_test__run_test(
+ test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank, TRUE,
+ dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped);
test_num++;
break;
/* end of case COL_CONTIG */
@@ -4623,19 +3909,9 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
case IND_CHUNKED:
/* chunked data set, independent I/O */
chunk_edge_size = 5;
- ckrbrd_hs_dr_pio_test__run_test(test_num,
- edge_size,
- checker_edge_size,
- chunk_edge_size,
- small_rank,
- large_rank,
- FALSE,
- dset_type,
- express_test,
- &skips,
- max_skips,
- &total_tests,
- &tests_run,
+ ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size,
+ small_rank, large_rank, FALSE, dset_type, express_test,
+ &skips, max_skips, &total_tests, &tests_run,
&tests_skipped);
test_num++;
break;
@@ -4644,20 +3920,9 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
case COL_CHUNKED:
/* chunked data set, collective I/O */
chunk_edge_size = 5;
- ckrbrd_hs_dr_pio_test__run_test(test_num,
- edge_size,
- checker_edge_size,
- chunk_edge_size,
- small_rank,
- large_rank,
- TRUE,
- dset_type,
- express_test,
- &skips,
- max_skips,
- &total_tests,
- &tests_run,
- &tests_skipped);
+ ckrbrd_hs_dr_pio_test__run_test(
+ test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank, TRUE,
+ dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped);
test_num++;
break;
/* end of case COL_CHUNKED */
@@ -4668,17 +3933,17 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
} /* end of switch(sstest_type) */
#if CONTIG_HS_DR_PIO_TEST__DEBUG
- if ( ( MAINPROCESS ) && ( tests_skipped > 0 ) ) {
- HDfprintf(stdout, " run/skipped/total = %lld/%lld/%lld.\n",
- tests_run, tests_skipped, total_tests);
+ if ((MAINPROCESS) && (tests_skipped > 0)) {
+ HDfprintf(stdout, " run/skipped/total = %lld/%lld/%lld.\n", tests_run, tests_skipped,
+ total_tests);
}
#endif /* CONTIG_HS_DR_PIO_TEST__DEBUG */
}
}
- if ( ( MAINPROCESS ) && ( tests_skipped > 0 ) ) {
- HDfprintf(stdout, " %lld of %lld subtests skipped to expedite testing.\n",
- tests_skipped, total_tests);
+ if ((MAINPROCESS) && (tests_skipped > 0)) {
+ HDfprintf(stdout, " %lld of %lld subtests skipped to expedite testing.\n", tests_skipped,
+ total_tests);
}
return;
@@ -4694,23 +3959,23 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type)
#include "testphdf5.h"
#ifndef PATH_MAX
-#define PATH_MAX 512
-#endif /* !PATH_MAX */
+#define PATH_MAX 512
+#endif /* !PATH_MAX */
/* global variables */
int dim0;
int dim1;
int chunkdim0;
int chunkdim1;
-int nerrors = 0; /* errors count */
-int ndatasets = 300; /* number of datasets to create*/
-int ngroups = 512; /* number of groups to create in root
- * group. */
-int facc_type = FACC_MPIO; /*Test file access type */
+int nerrors = 0; /* errors count */
+int ndatasets = 300; /* number of datasets to create*/
+int ngroups = 512; /* number of groups to create in root
+ * group. */
+int facc_type = FACC_MPIO; /*Test file access type */
int dxfer_coll_type = DXFER_COLLECTIVE_IO;
-H5E_auto2_t old_func; /* previous error handler */
-void *old_client_data; /* previous error handler arg.*/
+H5E_auto2_t old_func; /* previous error handler */
+void * old_client_data; /* previous error handler arg.*/
/* other option flags */
@@ -4719,13 +3984,11 @@ void *old_client_data; /* previous error handler arg.*/
* created in one test is accessed by a different test.
* filenames[0] is reserved as the file name for PARATESTFILE.
*/
-#define NFILENAME 2
+#define NFILENAME 2
#define PARATESTFILE filenames[0]
-const char *FILENAME[NFILENAME]={
- "ShapeSameTest",
- NULL};
-char filenames[NFILENAME][PATH_MAX];
-hid_t fapl; /* file access property list */
+const char *FILENAME[NFILENAME] = {"ShapeSameTest", NULL};
+char filenames[NFILENAME][PATH_MAX];
+hid_t fapl; /* file access property list */
#ifdef USE_PAUSE
/* pause the process for a moment to allow debugger to attach if desired. */
@@ -4734,15 +3997,16 @@ hid_t fapl; /* file access property list */
#include <sys/types.h>
#include <sys/stat.h>
-void pause_proc(void)
+void
+pause_proc(void)
{
- int pid;
- h5_stat_t statbuf;
- char greenlight[] = "go";
- int maxloop = 10;
- int loops = 0;
- int time_int = 10;
+ int pid;
+ h5_stat_t statbuf;
+ char greenlight[] = "go";
+ int maxloop = 10;
+ int loops = 0;
+ int time_int = 10;
/* mpi variables */
int mpi_size, mpi_rank;
@@ -4755,28 +4019,28 @@ void pause_proc(void)
MPI_Get_processor_name(mpi_name, &mpi_namelen);
if (MAINPROCESS)
- while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){
- if (!loops++){
- printf("Proc %d (%*s, %d): to debug, attach %d\n",
- mpi_rank, mpi_namelen, mpi_name, pid, pid);
- }
- printf("waiting(%ds) for file %s ...\n", time_int, greenlight);
- fflush(stdout);
- sleep(time_int);
- }
+ while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop) {
+ if (!loops++) {
+ HDprintf("Proc %d (%*s, %d): to debug, attach %d\n", mpi_rank, mpi_namelen, mpi_name, pid,
+ pid);
+ }
+ HDprintf("waiting(%ds) for file %s ...\n", time_int, greenlight);
+ fflush(stdout);
+ HDsleep(time_int);
+ }
MPI_Barrier(MPI_COMM_WORLD);
}
/* Use the Profile feature of MPI to call the pause_proc() */
-int MPI_Init(int *argc, char ***argv)
+int
+MPI_Init(int *argc, char ***argv)
{
int ret_code;
- ret_code=PMPI_Init(argc, argv);
+ ret_code = PMPI_Init(argc, argv);
pause_proc();
return (ret_code);
}
-#endif /* USE_PAUSE */
-
+#endif /* USE_PAUSE */
/*
* Show command usage
@@ -4784,195 +4048,195 @@ int MPI_Init(int *argc, char ***argv)
static void
usage(void)
{
- printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] "
- "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
- printf("\t-m<n_datasets>"
- "\tset number of datasets for the multiple dataset test\n");
- printf("\t-n<n_groups>"
- "\tset number of groups for the multiple group test\n");
- printf("\t-f <prefix>\tfilename prefix\n");
- printf("\t-2\t\tuse Split-file together with MPIO\n");
- printf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n",
- ROW_FACTOR, COL_FACTOR);
- printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n");
- printf("\n");
+ HDprintf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] "
+ "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
+ HDprintf("\t-m<n_datasets>"
+ "\tset number of datasets for the multiple dataset test\n");
+ HDprintf("\t-n<n_groups>"
+ "\tset number of groups for the multiple group test\n");
+ HDprintf("\t-f <prefix>\tfilename prefix\n");
+ HDprintf("\t-2\t\tuse Split-file together with MPIO\n");
+ HDprintf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n", ROW_FACTOR,
+ COL_FACTOR);
+ HDprintf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n");
+ HDprintf("\n");
}
-
/*
* parse the command line options
*/
static int
parse_options(int argc, char **argv)
{
- int mpi_size, mpi_rank; /* mpi variables */
+ int mpi_size, mpi_rank; /* mpi variables */
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* setup default chunk-size. Make sure sizes are > 0 */
- chunkdim0 = (dim0+9)/10;
- chunkdim1 = (dim1+9)/10;
-
- while (--argc){
- if (**(++argv) != '-'){
- break;
- }else{
- switch(*(*argv+1)){
- case 'm': ndatasets = atoi((*argv+1)+1);
- if (ndatasets < 0){
- nerrors++;
- return(1);
- }
- break;
- case 'n': ngroups = atoi((*argv+1)+1);
- if (ngroups < 0){
- nerrors++;
- return(1);
- }
- break;
- case 'f': if (--argc < 1) {
- nerrors++;
- return(1);
- }
- if (**(++argv) == '-') {
- nerrors++;
- return(1);
- }
- paraprefix = *argv;
- break;
- case 'i': /* Collective MPI-IO access with independent IO */
- dxfer_coll_type = DXFER_INDEPENDENT_IO;
- break;
- case '2': /* Use the split-file driver with MPIO access */
- /* Can use $HDF5_METAPREFIX to define the */
- /* meta-file-prefix. */
- facc_type = FACC_MPIO | FACC_SPLIT;
- break;
- case 'd': /* dimensizes */
- if (--argc < 2){
- nerrors++;
- return(1);
- }
- dim0 = atoi(*(++argv))*mpi_size;
- argc--;
- dim1 = atoi(*(++argv))*mpi_size;
- /* set default chunkdim sizes too */
- chunkdim0 = (dim0+9)/10;
- chunkdim1 = (dim1+9)/10;
- break;
- case 'c': /* chunk dimensions */
- if (--argc < 2){
- nerrors++;
- return(1);
- }
- chunkdim0 = atoi(*(++argv));
- argc--;
- chunkdim1 = atoi(*(++argv));
- break;
- case 'h': /* print help message--return with nerrors set */
- return(1);
- default: printf("Illegal option(%s)\n", *argv);
- nerrors++;
- return(1);
- }
- }
+ chunkdim0 = (dim0 + 9) / 10;
+ chunkdim1 = (dim1 + 9) / 10;
+
+ while (--argc) {
+ if (**(++argv) != '-') {
+ break;
+ }
+ else {
+ switch (*(*argv + 1)) {
+ case 'm':
+ ndatasets = atoi((*argv + 1) + 1);
+ if (ndatasets < 0) {
+ nerrors++;
+ return (1);
+ }
+ break;
+ case 'n':
+ ngroups = atoi((*argv + 1) + 1);
+ if (ngroups < 0) {
+ nerrors++;
+ return (1);
+ }
+ break;
+ case 'f':
+ if (--argc < 1) {
+ nerrors++;
+ return (1);
+ }
+ if (**(++argv) == '-') {
+ nerrors++;
+ return (1);
+ }
+ paraprefix = *argv;
+ break;
+ case 'i': /* Collective MPI-IO access with independent IO */
+ dxfer_coll_type = DXFER_INDEPENDENT_IO;
+ break;
+ case '2': /* Use the split-file driver with MPIO access */
+ /* Can use $HDF5_METAPREFIX to define the */
+ /* meta-file-prefix. */
+ facc_type = FACC_MPIO | FACC_SPLIT;
+ break;
+ case 'd': /* dimensizes */
+ if (--argc < 2) {
+ nerrors++;
+ return (1);
+ }
+ dim0 = atoi(*(++argv)) * mpi_size;
+ argc--;
+ dim1 = atoi(*(++argv)) * mpi_size;
+ /* set default chunkdim sizes too */
+ chunkdim0 = (dim0 + 9) / 10;
+ chunkdim1 = (dim1 + 9) / 10;
+ break;
+ case 'c': /* chunk dimensions */
+ if (--argc < 2) {
+ nerrors++;
+ return (1);
+ }
+ chunkdim0 = atoi(*(++argv));
+ argc--;
+ chunkdim1 = atoi(*(++argv));
+ break;
+ case 'h': /* print help message--return with nerrors set */
+ return (1);
+ default:
+ HDprintf("Illegal option(%s)\n", *argv);
+ nerrors++;
+ return (1);
+ }
+ }
} /*while*/
/* check validity of dimension and chunk sizes */
- if (dim0 <= 0 || dim1 <= 0){
- printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
- nerrors++;
- return(1);
+ if (dim0 <= 0 || dim1 <= 0) {
+ HDprintf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
+ nerrors++;
+ return (1);
}
- if (chunkdim0 <= 0 || chunkdim1 <= 0){
- printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
- nerrors++;
- return(1);
+ if (chunkdim0 <= 0 || chunkdim1 <= 0) {
+ HDprintf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
+ nerrors++;
+ return (1);
}
/* Make sure datasets can be divided into equal portions by the processes */
- if ((dim0 % mpi_size) || (dim1 % mpi_size)){
- if (MAINPROCESS)
- printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n",
- dim0, dim1, mpi_size);
- nerrors++;
- return(1);
+ if ((dim0 % mpi_size) || (dim1 % mpi_size)) {
+ if (MAINPROCESS)
+ HDprintf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", dim0, dim1, mpi_size);
+ nerrors++;
+ return (1);
}
/* compose the test filenames */
{
- int i, n;
-
- n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
-
- for (i=0; i < n; i++)
- if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
- == NULL){
- printf("h5_fixname failed\n");
- nerrors++;
- return(1);
- }
- printf("Test filenames are:\n");
- for (i=0; i < n; i++)
- printf(" %s\n", filenames[i]);
+ int i, n;
+
+ n = sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; /* exclude the NULL */
+
+ for (i = 0; i < n; i++)
+ if (h5_fixname(FILENAME[i], fapl, filenames[i], sizeof(filenames[i])) == NULL) {
+ HDprintf("h5_fixname failed\n");
+ nerrors++;
+ return (1);
+ }
+ HDprintf("Test filenames are:\n");
+ for (i = 0; i < n; i++)
+ HDprintf(" %s\n", filenames[i]);
}
- return(0);
+ return (0);
}
-
/*
* Create the appropriate File access property list
*/
hid_t
create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type)
{
- hid_t ret_pl = -1;
- herr_t ret; /* generic return value */
- int mpi_rank; /* mpi variables */
+ hid_t ret_pl = -1;
+ herr_t ret; /* generic return value */
+ int mpi_rank; /* mpi variables */
/* need the rank for error checking macros */
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- ret_pl = H5Pcreate (H5P_FILE_ACCESS);
+ ret_pl = H5Pcreate(H5P_FILE_ACCESS);
VRFY((ret_pl >= 0), "H5P_FILE_ACCESS");
if (l_facc_type == FACC_DEFAULT)
- return (ret_pl);
+ return (ret_pl);
- if (l_facc_type == FACC_MPIO){
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_mpio(ret_pl, comm, info);
- VRFY((ret >= 0), "");
- return(ret_pl);
+ if (l_facc_type == FACC_MPIO) {
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_mpio(ret_pl, comm, info);
+ VRFY((ret >= 0), "");
+ return (ret_pl);
}
- if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){
- hid_t mpio_pl;
-
- mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((mpio_pl >= 0), "");
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
- VRFY((ret >= 0), "");
-
- /* setup file access template */
- ret_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((ret_pl >= 0), "");
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
- VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
- H5Pclose(mpio_pl);
- return(ret_pl);
+ if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) {
+ hid_t mpio_pl;
+
+ mpio_pl = H5Pcreate(H5P_FILE_ACCESS);
+ VRFY((mpio_pl >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
+ VRFY((ret >= 0), "");
+
+ /* setup file access template */
+ ret_pl = H5Pcreate(H5P_FILE_ACCESS);
+ VRFY((ret_pl >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
+ VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
+ H5Pclose(mpio_pl);
+ return (ret_pl);
}
/* unknown file access types */
return (ret_pl);
}
-
/* Shape Same test using contigous hyperslab using independent IO on contigous datasets */
static void
sscontig1(void)
@@ -5001,7 +4265,6 @@ sscontig4(void)
contig_hs_dr_pio_test(COL_CHUNKED);
}
-
/* Shape Same test using checker hyperslab using independent IO on contigous datasets */
static void
sschecker1(void)
@@ -5030,10 +4293,10 @@ sschecker4(void)
ckrbrd_hs_dr_pio_test(COL_CHUNKED);
}
-
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- int mpi_size, mpi_rank; /* mpi variables */
+ int mpi_size, mpi_rank; /* mpi variables */
#ifndef H5_HAVE_WIN32_API
/* Un-buffer the stdout and stderr */
@@ -5045,14 +4308,14 @@ int main(int argc, char **argv)
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- dim0 = ROW_FACTOR*mpi_size;
- dim1 = COL_FACTOR*mpi_size;
+ dim0 = ROW_FACTOR * mpi_size;
+ dim1 = COL_FACTOR * mpi_size;
- if (MAINPROCESS){
- printf("===================================\n");
- printf("Shape Same Tests Start\n");
- printf(" express_test = %d.\n", GetTestExpress());
- printf("===================================\n");
+ if (MAINPROCESS) {
+ HDprintf("===================================\n");
+ HDprintf("Shape Same Tests Start\n");
+ HDprintf(" express_test = %d.\n", GetTestExpress());
+ HDprintf("===================================\n");
}
/* Attempt to turn off atexit post processing so that in case errors
@@ -5060,8 +4323,8 @@ int main(int argc, char **argv)
* hang in the atexit post processing in which it may try to make MPI
* calls. By then, MPI calls may not work.
*/
- if (H5dont_atexit() < 0){
- printf("%d: Failed to turn off atexit processing. Continue.\n", mpi_rank);
+ if (H5dont_atexit() < 0) {
+ HDprintf("%d: Failed to turn off atexit processing. Continue.\n", mpi_rank);
};
H5open();
h5_show_hostname();
@@ -5070,44 +4333,33 @@ int main(int argc, char **argv)
TestInit(argv[0], usage, parse_options);
/* Shape Same tests using contigous hyperslab */
-#if 1
- AddTest("sscontig1", sscontig1, NULL,
- "Shape Same, contigous hyperslab, ind IO, contig datasets", PARATESTFILE);
- AddTest("sscontig2", sscontig2, NULL,
- "Shape Same, contigous hyperslab, col IO, contig datasets", PARATESTFILE);
- AddTest("sscontig3", sscontig3, NULL,
- "Shape Same, contigous hyperslab, ind IO, chunked datasets", PARATESTFILE);
- AddTest("sscontig4", sscontig4, NULL,
- "Shape Same, contigous hyperslab, col IO, chunked datasets", PARATESTFILE);
-#endif
+ AddTest("sscontig1", sscontig1, NULL, "Cntg hslab, ind IO, cntg dsets", PARATESTFILE);
+ AddTest("sscontig2", sscontig2, NULL, "Cntg hslab, col IO, cntg dsets", PARATESTFILE);
+ AddTest("sscontig3", sscontig3, NULL, "Cntg hslab, ind IO, chnk dsets", PARATESTFILE);
+ AddTest("sscontig4", sscontig4, NULL, "Cntg hslab, col IO, chnk dsets", PARATESTFILE);
/* Shape Same tests using checker board hyperslab */
- AddTest("sschecker1", sschecker1, NULL,
- "Shape Same, checker hyperslab, ind IO, contig datasets", PARATESTFILE);
- AddTest("sschecker2", sschecker2, NULL,
- "Shape Same, checker hyperslab, col IO, contig datasets", PARATESTFILE);
- AddTest("sschecker3", sschecker3, NULL,
- "Shape Same, checker hyperslab, ind IO, chunked datasets", PARATESTFILE);
- AddTest("sschecker4", sschecker4, NULL,
- "Shape Same, checker hyperslab, col IO, chunked datasets", PARATESTFILE);
+ AddTest("sschecker1", sschecker1, NULL, "Check hslab, ind IO, cntg dsets", PARATESTFILE);
+ AddTest("sschecker2", sschecker2, NULL, "Check hslab, col IO, cntg dsets", PARATESTFILE);
+ AddTest("sschecker3", sschecker3, NULL, "Check hslab, ind IO, chnk dsets", PARATESTFILE);
+ AddTest("sschecker4", sschecker4, NULL, "Check hslab, col IO, chnk dsets", PARATESTFILE);
/* Display testing information */
TestInfo(argv[0]);
/* setup file access property list */
- fapl = H5Pcreate (H5P_FILE_ACCESS);
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
/* Parse command line arguments */
TestParseCmdLine(argc, argv);
- if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){
- printf("===================================\n"
- " Using Independent I/O with file set view to replace collective I/O \n"
- "===================================\n");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS) {
+ HDprintf("===================================\n"
+ " Using Independent I/O with file set view to replace collective I/O \n"
+ "===================================\n");
}
-
/* Perform requested testing */
PerformTests();
@@ -5129,20 +4381,26 @@ int main(int argc, char **argv)
{
int temp;
MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
- nerrors=temp;
+ nerrors = temp;
}
- if (MAINPROCESS){ /* only process 0 reports */
- printf("===================================\n");
- if (nerrors)
- printf("***Shape Same tests detected %d errors***\n", nerrors);
- else
- printf("Shape Same tests finished with no errors\n");
- printf("===================================\n");
+ if (MAINPROCESS) { /* only process 0 reports */
+ HDprintf("===================================\n");
+ if (nerrors)
+ HDprintf("***Shape Same tests detected %d errors***\n", nerrors);
+ else
+ HDprintf("Shape Same tests finished with no errors\n");
+ HDprintf("===================================\n");
}
+ /* close HDF5 library */
+ H5close();
+
+ /* Release test infrastructure */
+ TestShutdown();
+
MPI_Finalize();
/* cannot just return (nerrors) because exit code is limited to 1byte */
- return(nerrors!=0);
+ return (nerrors != 0);
}
diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c
index 53ce7b1..5530584 100644
--- a/testpar/t_span_tree.c
+++ b/testpar/t_span_tree.c
@@ -7,7 +7,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -23,38 +23,39 @@
2) We will read two datasets with the same hyperslab selection settings,
1. independent read to read independent output,
independent read to read collecive output,
- Compare the result,
- If the result is the same, then collective write succeeds.
+ Compare the result,
+ If the result is the same, then collective write succeeds.
2. collective read to read independent output,
independent read to read independent output,
- Compare the result,
- If the result is the same, then collective read succeeds.
+ Compare the result,
+ If the result is the same, then collective read succeeds.
*/
-#include "hdf5.h"
+#define H5S_PACKAGE /*suppress error about including H5Spkg */
+
+/* Define this macro to indicate that the testing APIs should be available */
+#define H5S_TESTING
+
#include "H5private.h"
+#include "H5Spkg.h"
#include "testphdf5.h"
-
static void coll_write_test(int chunk_factor);
static void coll_read_test(int chunk_factor);
-
/*-------------------------------------------------------------------------
- * Function: coll_irregular_cont_write
- *
- * Purpose: Wrapper to test the collectively irregular hyperslab write in
- contiguous storage
+ * Function: coll_irregular_cont_write
*
- * Return: Success: 0
+ * Purpose: Wrapper to test the collectively irregular hyperslab write in
+ * contiguous storage
*
- * Failure: -1
+ * Return: Success: 0
*
- * Programmer: Unknown
- * Dec 2nd, 2004
+ * Failure: -1
*
- * Modifications:
+ * Programmer: Unknown
+ * Dec 2nd, 2004
*
*-------------------------------------------------------------------------
*/
@@ -62,26 +63,21 @@ void
coll_irregular_cont_write(void)
{
- coll_write_test(0);
-
+ coll_write_test(0);
}
-
-
/*-------------------------------------------------------------------------
- * Function: coll_irregular_cont_read
+ * Function: coll_irregular_cont_read
*
- * Purpose: Wrapper to test the collectively irregular hyperslab read in
- contiguous storage
+ * Purpose: Wrapper to test the collectively irregular hyperslab read in
+ * contiguous storage
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Unknown
- * Dec 2nd, 2004
- *
- * Modifications:
+ * Programmer: Unknown
+ * Dec 2nd, 2004
*
*-------------------------------------------------------------------------
*/
@@ -89,25 +85,21 @@ void
coll_irregular_cont_read(void)
{
- coll_read_test(0);
-
+ coll_read_test(0);
}
-
/*-------------------------------------------------------------------------
- * Function: coll_irregular_simple_chunk_write
- *
- * Purpose: Wrapper to test the collectively irregular hyperslab write in
- chunk storage(1 chunk)
+ * Function: coll_irregular_simple_chunk_write
*
- * Return: Success: 0
+ * Purpose: Wrapper to test the collectively irregular hyperslab write in
+ * chunk storage(1 chunk)
*
- * Failure: -1
+ * Return: Success: 0
*
- * Programmer: Unknown
- * Dec 2nd, 2004
+ * Failure: -1
*
- * Modifications:
+ * Programmer: Unknown
+ * Dec 2nd, 2004
*
*-------------------------------------------------------------------------
*/
@@ -115,26 +107,21 @@ void
coll_irregular_simple_chunk_write(void)
{
- coll_write_test(1);
-
+ coll_write_test(1);
}
-
-
/*-------------------------------------------------------------------------
- * Function: coll_irregular_simple_chunk_read
+ * Function: coll_irregular_simple_chunk_read
*
- * Purpose: Wrapper to test the collectively irregular hyperslab read in chunk
- storage(1 chunk)
+ * Purpose: Wrapper to test the collectively irregular hyperslab read in chunk
+ * storage(1 chunk)
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Unknown
- * Dec 2nd, 2004
- *
- * Modifications:
+ * Programmer: Unknown
+ * Dec 2nd, 2004
*
*-------------------------------------------------------------------------
*/
@@ -142,24 +129,21 @@ void
coll_irregular_simple_chunk_read(void)
{
- coll_read_test(1);
-
+ coll_read_test(1);
}
/*-------------------------------------------------------------------------
- * Function: coll_irregular_complex_chunk_write
+ * Function: coll_irregular_complex_chunk_write
*
- * Purpose: Wrapper to test the collectively irregular hyperslab write in chunk
- storage(4 chunks)
+ * Purpose: Wrapper to test the collectively irregular hyperslab write in chunk
+ * storage(4 chunks)
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Unknown
- * Dec 2nd, 2004
- *
- * Modifications:
+ * Programmer: Unknown
+ * Dec 2nd, 2004
*
*-------------------------------------------------------------------------
*/
@@ -167,26 +151,21 @@ void
coll_irregular_complex_chunk_write(void)
{
- coll_write_test(4);
-
+ coll_write_test(4);
}
-
-
/*-------------------------------------------------------------------------
- * Function: coll_irregular_complex_chunk_read
- *
- * Purpose: Wrapper to test the collectively irregular hyperslab read in chunk
- storage(1 chunk)
+ * Function: coll_irregular_complex_chunk_read
*
- * Return: Success: 0
+ * Purpose: Wrapper to test the collectively irregular hyperslab read in chunk
+ * storage(1 chunk)
*
- * Failure: -1
+ * Return: Success: 0
*
- * Programmer: Unknown
- * Dec 2nd, 2004
+ * Failure: -1
*
- * Modifications:
+ * Programmer: Unknown
+ * Dec 2nd, 2004
*
*-------------------------------------------------------------------------
*/
@@ -194,834 +173,791 @@ void
coll_irregular_complex_chunk_read(void)
{
- coll_read_test(4);
-
+ coll_read_test(4);
}
-
/*-------------------------------------------------------------------------
- * Function: coll_write_test
+ * Function: coll_write_test
*
- * Purpose: To test the collectively irregular hyperslab write in chunk
- storage
+ * Purpose: To test the collectively irregular hyperslab write in chunk
+ * storage
* Input: number of chunks on each dimension
- if number is equal to 0, contiguous storage
- * Return: Success: 0
+ * if number is equal to 0, contiguous storage
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Unknown
- * Dec 2nd, 2004
- *
- * Modifications: Oct 18th, 2005
+ * Programmer: Unknown
+ * Dec 2nd, 2004
*
*-------------------------------------------------------------------------
*/
-void coll_write_test(int chunk_factor)
+void
+coll_write_test(int chunk_factor)
{
- const char *filename;
- hid_t facc_plist,dxfer_plist,dcrt_plist;
- hid_t file, datasetc,dataseti; /* File and dataset identifiers */
- hid_t mspaceid1, mspaceid, fspaceid,fspaceid1; /* Dataspace identifiers */
+ const char *filename;
+ hid_t facc_plist, dxfer_plist, dcrt_plist;
+ hid_t file, datasetc, dataseti; /* File and dataset identifiers */
+ hid_t mspaceid1, mspaceid, fspaceid, fspaceid1; /* Dataspace identifiers */
- hsize_t mdim1[1],fsdim[2],mdim[2];
+ hsize_t mdim1[1]; /* Dimension size of the first dataset (in memory) */
+ hsize_t fsdim[2]; /* Dimension sizes of the dataset (on disk) */
+ hsize_t mdim[2]; /* Dimension sizes of the dataset in memory when we
+ * read selection from the dataset on the disk
+ */
-#if 0
- hsize_t mdim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
- (in memory) */
- hsize_t fsdim[] = {FSPACE_DIM1, FSPACE_DIM2}; /* Dimension sizes of the dataset
- (on disk) */
+ hsize_t start[2]; /* Start of hyperslab */
+ hsize_t stride[2]; /* Stride of hyperslab */
+ hsize_t count[2]; /* Block count */
+ hsize_t block[2]; /* Block sizes */
+ hsize_t chunk_dims[2];
- hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the
- dataset in memory when we
- read selection from the
- dataset on the disk */
-#endif
+ herr_t ret;
+ unsigned i;
+ int fillvalue = 0; /* Fill value for the dataset */
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
- hsize_t chunk_dims[2];
-
- herr_t ret;
- unsigned i;
- int fillvalue = 0; /* Fill value for the dataset */
-
-#if 0
- int matrix_out[MSPACE_DIM1][MSPACE_DIM2];
- int matrix_out1[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the
- dataset */
- int vector[MSPACE1_DIM];
-#endif
+ int *matrix_out = NULL;
+ int *matrix_out1 = NULL; /* Buffer to read from the dataset */
+ int *vector = NULL;
+
+ int mpi_size, mpi_rank;
+
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
+
+ /*set up MPI parameters */
+ MPI_Comm_size(comm, &mpi_size);
+ MPI_Comm_rank(comm, &mpi_rank);
+
+ /* Obtain file name */
+ filename = GetTestParameters();
+
+ /*
+ * Buffers' initialization.
+ */
+
+ mdim1[0] = MSPACE1_DIM * mpi_size;
+ mdim[0] = MSPACE_DIM1;
+ mdim[1] = MSPACE_DIM2 * mpi_size;
+ fsdim[0] = FSPACE_DIM1;
+ fsdim[1] = FSPACE_DIM2 * mpi_size;
+
+ vector = (int *)HDmalloc(sizeof(int) * mdim1[0] * mpi_size);
+ matrix_out = (int *)HDmalloc(sizeof(int) * mdim[0] * mdim[1] * mpi_size);
+ matrix_out1 = (int *)HDmalloc(sizeof(int) * mdim[0] * mdim[1] * mpi_size);
+
+ HDmemset(vector, 0, sizeof(int) * mdim1[0] * mpi_size);
+ vector[0] = vector[MSPACE1_DIM * mpi_size - 1] = -1;
+ for (i = 1; i < MSPACE1_DIM * mpi_size - 1; i++)
+ vector[i] = i;
+
+ /* Grab file access property list */
+ facc_plist = create_faccess_plist(comm, info, facc_type);
+ VRFY((facc_plist >= 0), "");
+
+ /*
+ * Create a file.
+ */
+ file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, facc_plist);
+ VRFY((file >= 0), "H5Fcreate succeeded");
+
+ /*
+ * Create property list for a dataset and set up fill values.
+ */
+ dcrt_plist = H5Pcreate(H5P_DATASET_CREATE);
+ VRFY((dcrt_plist >= 0), "");
+
+ ret = H5Pset_fill_value(dcrt_plist, H5T_NATIVE_INT, &fillvalue);
+ VRFY((ret >= 0), "Fill value creation property list succeeded");
+
+ if (chunk_factor != 0) {
+ chunk_dims[0] = fsdim[0] / chunk_factor;
+ chunk_dims[1] = fsdim[1] / chunk_factor;
+ ret = H5Pset_chunk(dcrt_plist, 2, chunk_dims);
+ VRFY((ret >= 0), "chunk creation property list succeeded");
+ }
+
+ /*
+ *
+ * Create dataspace for the first dataset in the disk.
+ * dim1 = 9
+ * dim2 = 3600
+ *
+ *
+ */
+ fspaceid = H5Screate_simple(FSPACE_RANK, fsdim, NULL);
+ VRFY((fspaceid >= 0), "file dataspace created succeeded");
+
+ /*
+ * Create dataset in the file. Notice that creation
+ * property list dcrt_plist is used.
+ */
+ datasetc =
+ H5Dcreate2(file, "collect_write", H5T_NATIVE_INT, fspaceid, H5P_DEFAULT, dcrt_plist, H5P_DEFAULT);
+ VRFY((datasetc >= 0), "dataset created succeeded");
+
+ dataseti =
+ H5Dcreate2(file, "independ_write", H5T_NATIVE_INT, fspaceid, H5P_DEFAULT, dcrt_plist, H5P_DEFAULT);
+ VRFY((dataseti >= 0), "dataset created succeeded");
+
+ /* The First selection for FILE
+ *
+ * block (3,2)
+ * stride(4,3)
+ * count (1,768/mpi_size)
+ * start (0,1+768*3*mpi_rank/mpi_size)
+ *
+ */
+
+ start[0] = FHSTART0;
+ start[1] = FHSTART1 + mpi_rank * FHSTRIDE1 * FHCOUNT1;
+ stride[0] = FHSTRIDE0;
+ stride[1] = FHSTRIDE1;
+ count[0] = FHCOUNT0;
+ count[1] = FHCOUNT1;
+ block[0] = FHBLOCK0;
+ block[1] = FHBLOCK1;
+
+ ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /* The Second selection for FILE
+ *
+ * block (3,768)
+ * stride (1,1)
+ * count (1,1)
+ * start (4,768*mpi_rank/mpi_size)
+ *
+ */
+
+ start[0] = SHSTART0;
+ start[1] = SHSTART1 + SHCOUNT1 * SHBLOCK1 * mpi_rank;
+ stride[0] = SHSTRIDE0;
+ stride[1] = SHSTRIDE1;
+ count[0] = SHCOUNT0;
+ count[1] = SHCOUNT1;
+ block[0] = SHBLOCK0;
+ block[1] = SHBLOCK1;
+
+ ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /*
+ * Create dataspace for the first dataset in the memory
+ * dim1 = 27000
+ *
+ */
+ mspaceid1 = H5Screate_simple(MSPACE1_RANK, mdim1, NULL);
+ VRFY((mspaceid1 >= 0), "memory dataspace created succeeded");
+
+ /*
+ * Memory space is 1-D, this is a good test to check
+ * whether a span-tree derived datatype needs to be built.
+ * block 1
+ * stride 1
+ * count 6912/mpi_size
+ * start 1
+ *
+ */
+ start[0] = MHSTART0;
+ stride[0] = MHSTRIDE0;
+ count[0] = MHCOUNT0;
+ block[0] = MHBLOCK0;
+
+ ret = H5Sselect_hyperslab(mspaceid1, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /* independent write */
+ ret = H5Dwrite(dataseti, H5T_NATIVE_INT, mspaceid1, fspaceid, H5P_DEFAULT, vector);
+ VRFY((ret >= 0), "dataset independent write succeed");
+
+ dxfer_plist = H5Pcreate(H5P_DATASET_XFER);
+ VRFY((dxfer_plist >= 0), "");
+
+ ret = H5Pset_dxpl_mpio(dxfer_plist, H5FD_MPIO_COLLECTIVE);
+ VRFY((ret >= 0), "MPIO data transfer property list succeed");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(dxfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
+ }
+
+ /* collective write */
+ ret = H5Dwrite(datasetc, H5T_NATIVE_INT, mspaceid1, fspaceid, dxfer_plist, vector);
+ VRFY((ret >= 0), "dataset collective write succeed");
+
+ ret = H5Sclose(mspaceid1);
+ VRFY((ret >= 0), "");
+
+ ret = H5Sclose(fspaceid);
+ VRFY((ret >= 0), "");
+
+ /*
+ * Close dataset.
+ */
+ ret = H5Dclose(datasetc);
+ VRFY((ret >= 0), "");
+ ret = H5Dclose(dataseti);
+ VRFY((ret >= 0), "");
- int *matrix_out, *matrix_out1, *vector;
-
- int mpi_size,mpi_rank;
-
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
-
- /*set up MPI parameters */
- MPI_Comm_size(comm,&mpi_size);
- MPI_Comm_rank(comm,&mpi_rank);
-
- /* Obtain file name */
- filename = GetTestParameters();
-
- /*
- * Buffers' initialization.
- */
-
- mdim1[0] = MSPACE1_DIM *mpi_size;
- mdim[0] = MSPACE_DIM1;
- mdim[1] = MSPACE_DIM2*mpi_size;
- fsdim[0] = FSPACE_DIM1;
- fsdim[1] = FSPACE_DIM2*mpi_size;
-
- vector = (int*)HDmalloc(sizeof(int)*mdim1[0]*mpi_size);
- matrix_out = (int*)HDmalloc(sizeof(int)*mdim[0]*mdim[1]*mpi_size);
- matrix_out1 = (int*)HDmalloc(sizeof(int)*mdim[0]*mdim[1]*mpi_size);
-
- HDmemset(vector,0,sizeof(int)*mdim1[0]*mpi_size);
- vector[0] = vector[MSPACE1_DIM*mpi_size - 1] = -1;
- for (i = 1; i < MSPACE1_DIM*mpi_size - 1; i++) vector[i] = i;
-
- /* Grab file access property list */
- facc_plist = create_faccess_plist(comm, info, facc_type);
- VRFY((facc_plist >= 0),"");
-
- /*
- * Create a file.
- */
- file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, facc_plist);
- VRFY((file >= 0),"H5Fcreate succeeded");
-
- /*
- * Create property list for a dataset and set up fill values.
- */
- dcrt_plist = H5Pcreate(H5P_DATASET_CREATE);
- VRFY((dcrt_plist >= 0),"");
-
- ret = H5Pset_fill_value(dcrt_plist, H5T_NATIVE_INT, &fillvalue);
- VRFY((ret >= 0),"Fill value creation property list succeeded");
-
- if(chunk_factor != 0) {
- chunk_dims[0] = fsdim[0] / chunk_factor;
- chunk_dims[1] = fsdim[1] / chunk_factor;
- ret = H5Pset_chunk(dcrt_plist, 2, chunk_dims);
- VRFY((ret >= 0),"chunk creation property list succeeded");
- }
-
- /*
- *
- * Create dataspace for the first dataset in the disk.
- * dim1 = 9
- * dim2 = 3600
- *
- *
- */
- fspaceid = H5Screate_simple(FSPACE_RANK, fsdim, NULL);
- VRFY((fspaceid >= 0),"file dataspace created succeeded");
-
- /*
- * Create dataset in the file. Notice that creation
- * property list dcrt_plist is used.
- */
- datasetc = H5Dcreate2(file, "collect_write", H5T_NATIVE_INT, fspaceid, H5P_DEFAULT, dcrt_plist, H5P_DEFAULT);
- VRFY((datasetc >= 0),"dataset created succeeded");
-
- dataseti = H5Dcreate2(file, "independ_write", H5T_NATIVE_INT, fspaceid, H5P_DEFAULT, dcrt_plist, H5P_DEFAULT);
- VRFY((dataseti >= 0),"dataset created succeeded");
-
- /* The First selection for FILE
- *
- * block (3,2)
- * stride(4,3)
- * count (1,768/mpi_size)
- * start (0,1+768*3*mpi_rank/mpi_size)
- *
- */
-
- start[0] = FHSTART0;
- start[1] = FHSTART1 + mpi_rank * FHSTRIDE1 * FHCOUNT1;
- stride[0] = FHSTRIDE0;
- stride[1] = FHSTRIDE1;
- count[0] = FHCOUNT0;
- count[1] = FHCOUNT1;
- block[0] = FHBLOCK0;
- block[1] = FHBLOCK1;
-
- ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /* The Second selection for FILE
- *
- * block (3,768)
- * stride (1,1)
- * count (1,1)
- * start (4,768*mpi_rank/mpi_size)
- *
- */
-
- start[0] = SHSTART0;
- start[1] = SHSTART1+SHCOUNT1*SHBLOCK1*mpi_rank;
- stride[0] = SHSTRIDE0;
- stride[1] = SHSTRIDE1;
- count[0] = SHCOUNT0;
- count[1] = SHCOUNT1;
- block[0] = SHBLOCK0;
- block[1] = SHBLOCK1;
-
- ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_OR, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /*
- * Create dataspace for the first dataset in the memory
- * dim1 = 27000
- *
- */
- mspaceid1 = H5Screate_simple(MSPACE1_RANK, mdim1, NULL);
- VRFY((mspaceid1 >= 0),"memory dataspace created succeeded");
-
- /*
- * Memory space is 1-D, this is a good test to check
- * whether a span-tree derived datatype needs to be built.
- * block 1
- * stride 1
- * count 6912/mpi_size
- * start 1
- *
- */
- start[0] = MHSTART0;
- stride[0] = MHSTRIDE0;
- count[0] = MHCOUNT0;
- block[0] = MHBLOCK0;
-
- ret = H5Sselect_hyperslab(mspaceid1, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /* independent write */
- ret = H5Dwrite(dataseti, H5T_NATIVE_INT, mspaceid1, fspaceid, H5P_DEFAULT, vector);
- VRFY((ret >= 0),"dataset independent write succeed");
-
- dxfer_plist = H5Pcreate(H5P_DATASET_XFER);
- VRFY((dxfer_plist >= 0),"");
-
- ret = H5Pset_dxpl_mpio(dxfer_plist, H5FD_MPIO_COLLECTIVE);
- VRFY((ret >= 0),"MPIO data transfer property list succeed");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(dxfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
- }
-
-
- /* collective write */
- ret = H5Dwrite(datasetc, H5T_NATIVE_INT, mspaceid1, fspaceid, dxfer_plist, vector);
- VRFY((ret >= 0),"dataset collective write succeed");
-
- ret = H5Sclose(mspaceid1);
- VRFY((ret >= 0),"");
-
- ret = H5Sclose(fspaceid);
- VRFY((ret >= 0),"");
-
- /*
- * Close dataset.
- */
- ret = H5Dclose(datasetc);
- VRFY((ret >= 0),"");
-
- ret = H5Dclose(dataseti);
- VRFY((ret >= 0),"");
-
- /*
- * Close the file.
- */
- ret = H5Fclose(file);
- VRFY((ret >= 0),"");
- /*
- * Close property list
- */
-
- ret = H5Pclose(facc_plist);
- VRFY((ret >= 0),"");
- ret = H5Pclose(dxfer_plist);
- VRFY((ret >= 0),"");
- ret = H5Pclose(dcrt_plist);
- VRFY((ret >= 0),"");
-
- /*
- * Open the file.
- */
-
- /***
-
- For testing collective hyperslab selection write
- In this test, we are using independent read to check
- the correctedness of collective write compared with
- independent write,
-
- In order to throughly test this feature, we choose
- a different selection set for reading the data out.
-
-
- ***/
-
- /* Obtain file access property list with MPI-IO driver */
- facc_plist = create_faccess_plist(comm, info, facc_type);
- VRFY((facc_plist >= 0),"");
-
- file = H5Fopen(filename, H5F_ACC_RDONLY, facc_plist);
- VRFY((file >= 0),"H5Fopen succeeded");
-
- /*
- * Open the dataset.
- */
- datasetc = H5Dopen2(file,"collect_write", H5P_DEFAULT);
- VRFY((datasetc >= 0),"H5Dopen2 succeeded");
-
- dataseti = H5Dopen2(file,"independ_write", H5P_DEFAULT);
- VRFY((dataseti >= 0),"H5Dopen2 succeeded");
-
- /*
- * Get dataspace of the open dataset.
- */
- fspaceid = H5Dget_space(datasetc);
- VRFY((fspaceid >= 0),"file dataspace obtained succeeded");
-
- fspaceid1 = H5Dget_space(dataseti);
- VRFY((fspaceid1 >= 0),"file dataspace obtained succeeded");
-
-
- /* The First selection for FILE to read
- *
- * block (1,1)
- * stride(1.1)
- * count (3,768/mpi_size)
- * start (1,2+768*mpi_rank/mpi_size)
- *
- */
- start[0] = RFFHSTART0;
- start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1;
- block[0] = RFFHBLOCK0;
- block[1] = RFFHBLOCK1;
- stride[0] = RFFHSTRIDE0;
- stride[1] = RFFHSTRIDE1;
- count[0] = RFFHCOUNT0;
- count[1] = RFFHCOUNT1;
-
-
- /* The first selection of the dataset generated by collective write */
- ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /* The first selection of the dataset generated by independent write */
- ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /* The Second selection for FILE to read
- *
- * block (1,1)
- * stride(1.1)
- * count (3,1536/mpi_size)
- * start (2,4+1536*mpi_rank/mpi_size)
- *
- */
-
- start[0] = RFSHSTART0;
- start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank;
- block[0] = RFSHBLOCK0;
- block[1] = RFSHBLOCK1;
- stride[0] = RFSHSTRIDE0;
- stride[1] = RFSHSTRIDE0;
- count[0] = RFSHCOUNT0;
- count[1] = RFSHCOUNT1;
-
- /* The second selection of the dataset generated by collective write */
- ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_OR, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /* The second selection of the dataset generated by independent write */
- ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_OR, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /*
- * Create memory dataspace.
- * rank = 2
- * mdim1 = 9
- * mdim2 = 3600
- *
- */
- mspaceid = H5Screate_simple(MSPACE_RANK, mdim, NULL);
-
- /*
- * Select two hyperslabs in memory. Hyperslabs has the same
- * size and shape as the selected hyperslabs for the file dataspace
- * Only the starting point is different.
- * The first selection
- * block (1,1)
- * stride(1.1)
- * count (3,768/mpi_size)
- * start (0,768*mpi_rank/mpi_size)
- *
- */
-
-
- start[0] = RMFHSTART0;
- start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1;
- block[0] = RMFHBLOCK0;
- block[1] = RMFHBLOCK1;
- stride[0] = RMFHSTRIDE0;
- stride[1] = RMFHSTRIDE1;
- count[0] = RMFHCOUNT0;
- count[1] = RMFHCOUNT1;
-
- ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /*
- * Select two hyperslabs in memory. Hyperslabs has the same
- * size and shape as the selected hyperslabs for the file dataspace
- * Only the starting point is different.
- * The second selection
- * block (1,1)
- * stride(1,1)
- * count (3,1536/mpi_size)
- * start (1,2+1536*mpi_rank/mpi_size)
- *
- */
- start[0] = RMSHSTART0;
- start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1;
- block[0] = RMSHBLOCK0;
- block[1] = RMSHBLOCK1;
- stride[0] = RMSHSTRIDE0;
- stride[1] = RMSHSTRIDE1;
- count[0] = RMSHCOUNT0;
- count[1] = RMSHCOUNT1;
-
- ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_OR, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /*
- * Initialize data buffer.
- */
-
- HDmemset(matrix_out,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size);
- HDmemset(matrix_out1,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size);
- /*
- * Read data back to the buffer matrix_out.
- */
-
- ret = H5Dread(datasetc, H5T_NATIVE_INT, mspaceid, fspaceid,
- H5P_DEFAULT, matrix_out);
- VRFY((ret >= 0),"H5D independent read succeed");
-
-
- ret = H5Dread(dataseti, H5T_NATIVE_INT, mspaceid, fspaceid,
- H5P_DEFAULT, matrix_out1);
- VRFY((ret >= 0),"H5D independent read succeed");
-
- ret = 0;
-
- for (i = 0; i < MSPACE_DIM1*MSPACE_DIM2*mpi_size; i++){
- if(matrix_out[i]!=matrix_out1[i]) ret = -1;
- if(ret < 0) break;
+ /*
+ * Close the file.
+ */
+ ret = H5Fclose(file);
+ VRFY((ret >= 0), "");
+ /*
+ * Close property list
+ */
+
+ ret = H5Pclose(facc_plist);
+ VRFY((ret >= 0), "");
+ ret = H5Pclose(dxfer_plist);
+ VRFY((ret >= 0), "");
+ ret = H5Pclose(dcrt_plist);
+ VRFY((ret >= 0), "");
+
+ /*
+ * Open the file.
+ */
+
+ /***
+
+ For testing collective hyperslab selection write
+ In this test, we are using independent read to check
+ the correctedness of collective write compared with
+ independent write,
+
+ In order to throughly test this feature, we choose
+ a different selection set for reading the data out.
+
+
+ ***/
+
+ /* Obtain file access property list with MPI-IO driver */
+ facc_plist = create_faccess_plist(comm, info, facc_type);
+ VRFY((facc_plist >= 0), "");
+
+ file = H5Fopen(filename, H5F_ACC_RDONLY, facc_plist);
+ VRFY((file >= 0), "H5Fopen succeeded");
+
+ /*
+ * Open the dataset.
+ */
+ datasetc = H5Dopen2(file, "collect_write", H5P_DEFAULT);
+ VRFY((datasetc >= 0), "H5Dopen2 succeeded");
+
+ dataseti = H5Dopen2(file, "independ_write", H5P_DEFAULT);
+ VRFY((dataseti >= 0), "H5Dopen2 succeeded");
+
+ /*
+ * Get dataspace of the open dataset.
+ */
+ fspaceid = H5Dget_space(datasetc);
+ VRFY((fspaceid >= 0), "file dataspace obtained succeeded");
+
+ fspaceid1 = H5Dget_space(dataseti);
+ VRFY((fspaceid1 >= 0), "file dataspace obtained succeeded");
+
+ /* The First selection for FILE to read
+ *
+ * block (1,1)
+ * stride(1.1)
+ * count (3,768/mpi_size)
+ * start (1,2+768*mpi_rank/mpi_size)
+ *
+ */
+ start[0] = RFFHSTART0;
+ start[1] = RFFHSTART1 + mpi_rank * RFFHCOUNT1;
+ block[0] = RFFHBLOCK0;
+ block[1] = RFFHBLOCK1;
+ stride[0] = RFFHSTRIDE0;
+ stride[1] = RFFHSTRIDE1;
+ count[0] = RFFHCOUNT0;
+ count[1] = RFFHCOUNT1;
+
+ /* The first selection of the dataset generated by collective write */
+ ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /* The first selection of the dataset generated by independent write */
+ ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /* The Second selection for FILE to read
+ *
+ * block (1,1)
+ * stride(1.1)
+ * count (3,1536/mpi_size)
+ * start (2,4+1536*mpi_rank/mpi_size)
+ *
+ */
+
+ start[0] = RFSHSTART0;
+ start[1] = RFSHSTART1 + RFSHCOUNT1 * mpi_rank;
+ block[0] = RFSHBLOCK0;
+ block[1] = RFSHBLOCK1;
+ stride[0] = RFSHSTRIDE0;
+ stride[1] = RFSHSTRIDE0;
+ count[0] = RFSHCOUNT0;
+ count[1] = RFSHCOUNT1;
+
+ /* The second selection of the dataset generated by collective write */
+ ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /* The second selection of the dataset generated by independent write */
+ ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /*
+ * Create memory dataspace.
+ * rank = 2
+ * mdim1 = 9
+ * mdim2 = 3600
+ *
+ */
+ mspaceid = H5Screate_simple(MSPACE_RANK, mdim, NULL);
+
+ /*
+ * Select two hyperslabs in memory. Hyperslabs has the same
+ * size and shape as the selected hyperslabs for the file dataspace
+ * Only the starting point is different.
+ * The first selection
+ * block (1,1)
+ * stride(1.1)
+ * count (3,768/mpi_size)
+ * start (0,768*mpi_rank/mpi_size)
+ *
+ */
+
+ start[0] = RMFHSTART0;
+ start[1] = RMFHSTART1 + mpi_rank * RMFHCOUNT1;
+ block[0] = RMFHBLOCK0;
+ block[1] = RMFHBLOCK1;
+ stride[0] = RMFHSTRIDE0;
+ stride[1] = RMFHSTRIDE1;
+ count[0] = RMFHCOUNT0;
+ count[1] = RMFHCOUNT1;
+
+ ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /*
+ * Select two hyperslabs in memory. Hyperslabs has the same
+ * size and shape as the selected hyperslabs for the file dataspace
+ * Only the starting point is different.
+ * The second selection
+ * block (1,1)
+ * stride(1,1)
+ * count (3,1536/mpi_size)
+ * start (1,2+1536*mpi_rank/mpi_size)
+ *
+ */
+ start[0] = RMSHSTART0;
+ start[1] = RMSHSTART1 + mpi_rank * RMSHCOUNT1;
+ block[0] = RMSHBLOCK0;
+ block[1] = RMSHBLOCK1;
+ stride[0] = RMSHSTRIDE0;
+ stride[1] = RMSHSTRIDE1;
+ count[0] = RMSHCOUNT0;
+ count[1] = RMSHCOUNT1;
+
+ ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /*
+ * Initialize data buffer.
+ */
+
+ HDmemset(matrix_out, 0, sizeof(int) * MSPACE_DIM1 * MSPACE_DIM2 * mpi_size);
+ HDmemset(matrix_out1, 0, sizeof(int) * MSPACE_DIM1 * MSPACE_DIM2 * mpi_size);
+ /*
+ * Read data back to the buffer matrix_out.
+ */
+
+ ret = H5Dread(datasetc, H5T_NATIVE_INT, mspaceid, fspaceid, H5P_DEFAULT, matrix_out);
+ VRFY((ret >= 0), "H5D independent read succeed");
+
+ ret = H5Dread(dataseti, H5T_NATIVE_INT, mspaceid, fspaceid, H5P_DEFAULT, matrix_out1);
+ VRFY((ret >= 0), "H5D independent read succeed");
+
+ ret = 0;
+
+ for (i = 0; i < MSPACE_DIM1 * MSPACE_DIM2 * mpi_size; i++) {
+ if (matrix_out[i] != matrix_out1[i])
+ ret = -1;
+ if (ret < 0)
+ break;
}
- VRFY((ret >= 0),"H5D irregular collective write succeed");
+ VRFY((ret >= 0), "H5D irregular collective write succeed");
- /*
- * Close memory file and memory dataspaces.
- */
- ret = H5Sclose(mspaceid);
- VRFY((ret >= 0),"");
- ret = H5Sclose(fspaceid);
- VRFY((ret >= 0),"");
+ /*
+ * Close memory file and memory dataspaces.
+ */
+ ret = H5Sclose(mspaceid);
+ VRFY((ret >= 0), "");
+ ret = H5Sclose(fspaceid);
+ VRFY((ret >= 0), "");
- /*
- * Close dataset.
- */
- ret = H5Dclose(dataseti);
- VRFY((ret >= 0),"");
+ /*
+ * Close dataset.
+ */
+ ret = H5Dclose(dataseti);
+ VRFY((ret >= 0), "");
- ret = H5Dclose(datasetc);
- VRFY((ret >= 0),"");
+ ret = H5Dclose(datasetc);
+ VRFY((ret >= 0), "");
- /*
- * Close property list
- */
+ /*
+ * Close property list
+ */
- ret = H5Pclose(facc_plist);
- VRFY((ret >= 0),"");
+ ret = H5Pclose(facc_plist);
+ VRFY((ret >= 0), "");
+ /*
+ * Close the file.
+ */
+ ret = H5Fclose(file);
+ VRFY((ret >= 0), "");
- /*
- * Close the file.
- */
- ret = H5Fclose(file);
- VRFY((ret >= 0),"");
+ if (vector)
+ HDfree(vector);
+ if (matrix_out)
+ HDfree(matrix_out);
+ if (matrix_out1)
+ HDfree(matrix_out1);
- return ;
+ return;
}
/*-------------------------------------------------------------------------
- * Function: coll_read_test
+ * Function: coll_read_test
*
- * Purpose: To test the collectively irregular hyperslab read in chunk
- storage
+ * Purpose: To test the collectively irregular hyperslab read in chunk
+ * storage
* Input: number of chunks on each dimension
- if number is equal to 0, contiguous storage
- * Return: Success: 0
+ * if number is equal to 0, contiguous storage
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Unknown
- * Dec 2nd, 2004
+ * Programmer: Unknown
+ * Dec 2nd, 2004
*
- * Modifications: Oct 18th, 2005
- * Note: This test must be used with the correpsonding
- coll_write_test.
*-------------------------------------------------------------------------
*/
static void
coll_read_test(int chunk_factor)
{
- const char *filename;
- hid_t facc_plist,dxfer_plist;
- hid_t file, dataseti; /* File and dataset identifiers */
- hid_t mspaceid, fspaceid1; /* Dataspace identifiers */
+ const char *filename;
+ hid_t facc_plist, dxfer_plist;
+ hid_t file, dataseti; /* File and dataset identifiers */
+ hid_t mspaceid, fspaceid1; /* Dataspace identifiers */
+ /* Dimension sizes of the dataset (on disk) */
+ hsize_t mdim[2]; /* Dimension sizes of the dataset in memory when we
+ * read selection from the dataset on the disk
+ */
- /* Dimension sizes of the dataset (on disk) */
-#if 0
- hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the
- dataset in memory when we
- read selection from the
- dataset on the disk */
+ hsize_t start[2]; /* Start of hyperslab */
+ hsize_t stride[2]; /* Stride of hyperslab */
+ hsize_t count[2]; /* Block count */
+ hsize_t block[2]; /* Block sizes */
+ herr_t ret;
-#endif
- hsize_t mdim[2];
- hsize_t start[2]; /* Start of hyperslab */
- hsize_t stride[2]; /* Stride of hyperslab */
- hsize_t count[2]; /* Block count */
- hsize_t block[2]; /* Block sizes */
- herr_t ret;
-
- unsigned i;
-
- int *matrix_out;
- int *matrix_out1;
-#if 0
- int matrix_out[MSPACE_DIM1][MSPACE_DIM2];
- int matrix_out1[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the
- dataset */
+ unsigned i;
-#endif
- int mpi_size,mpi_rank;
-
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
-
- /*set up MPI parameters */
- MPI_Comm_size(comm,&mpi_size);
- MPI_Comm_rank(comm,&mpi_rank);
-
-
- /* Obtain file name */
- filename = GetTestParameters();
-
-
- /* Initialize the buffer */
-
- mdim[0] = MSPACE_DIM1;
- mdim[1] = MSPACE_DIM2*mpi_size;
- matrix_out =(int*)HDmalloc(sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size);
- matrix_out1=(int*)HDmalloc(sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size);
-
- /*** For testing collective hyperslab selection read ***/
-
- /* Obtain file access property list */
- facc_plist = create_faccess_plist(comm, info, facc_type);
- VRFY((facc_plist >= 0),"");
-
- /*
- * Open the file.
- */
- file = H5Fopen(filename, H5F_ACC_RDONLY, facc_plist);
- VRFY((file >= 0),"H5Fopen succeeded");
-
- /*
- * Open the dataset.
- */
- dataseti = H5Dopen2(file,"independ_write", H5P_DEFAULT);
- VRFY((dataseti >= 0),"H5Dopen2 succeeded");
-
- /*
- * Get dataspace of the open dataset.
- */
- fspaceid1 = H5Dget_space(dataseti);
- VRFY((fspaceid1 >= 0),"file dataspace obtained succeeded");
-
- /* The First selection for FILE to read
- *
- * block (1,1)
- * stride(1.1)
- * count (3,768/mpi_size)
- * start (1,2+768*mpi_rank/mpi_size)
- *
- */
- start[0] = RFFHSTART0;
- start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1;
- block[0] = RFFHBLOCK0;
- block[1] = RFFHBLOCK1;
- stride[0] = RFFHSTRIDE0;
- stride[1] = RFFHSTRIDE1;
- count[0] = RFFHCOUNT0;
- count[1] = RFFHCOUNT1;
-
- ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /* The Second selection for FILE to read
- *
- * block (1,1)
- * stride(1.1)
- * count (3,1536/mpi_size)
- * start (2,4+1536*mpi_rank/mpi_size)
- *
- */
- start[0] = RFSHSTART0;
- start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank;
- block[0] = RFSHBLOCK0;
- block[1] = RFSHBLOCK1;
- stride[0] = RFSHSTRIDE0;
- stride[1] = RFSHSTRIDE0;
- count[0] = RFSHCOUNT0;
- count[1] = RFSHCOUNT1;
-
- ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_OR, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
-
- /*
- * Create memory dataspace.
- */
- mspaceid = H5Screate_simple(MSPACE_RANK, mdim, NULL);
-
- /*
- * Select two hyperslabs in memory. Hyperslabs has the same
- * size and shape as the selected hyperslabs for the file dataspace.
- * Only the starting point is different.
- * The first selection
- * block (1,1)
- * stride(1.1)
- * count (3,768/mpi_size)
- * start (0,768*mpi_rank/mpi_size)
- *
- */
-
- start[0] = RMFHSTART0;
- start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1;
- block[0] = RMFHBLOCK0;
- block[1] = RMFHBLOCK1;
- stride[0] = RMFHSTRIDE0;
- stride[1] = RMFHSTRIDE1;
- count[0] = RMFHCOUNT0;
- count[1] = RMFHCOUNT1;
- ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_SET, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
- /*
- * Select two hyperslabs in memory. Hyperslabs has the same
- * size and shape as the selected hyperslabs for the file dataspace
- * Only the starting point is different.
- * The second selection
- * block (1,1)
- * stride(1,1)
- * count (3,1536/mpi_size)
- * start (1,2+1536*mpi_rank/mpi_size)
- *
- */
- start[0] = RMSHSTART0;
- start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1;
- block[0] = RMSHBLOCK0;
- block[1] = RMSHBLOCK1;
- stride[0] = RMSHSTRIDE0;
- stride[1] = RMSHSTRIDE1;
- count[0] = RMSHCOUNT0;
- count[1] = RMSHCOUNT1;
- ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_OR, start, stride, count, block);
- VRFY((ret >= 0),"hyperslab selection succeeded");
-
-
- /*
- * Initialize data buffer.
- */
-
- HDmemset(matrix_out,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size);
- HDmemset(matrix_out1,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size);
-
- /*
- * Read data back to the buffer matrix_out.
- */
-
- dxfer_plist = H5Pcreate(H5P_DATASET_XFER);
- VRFY((dxfer_plist >= 0),"");
-
- ret = H5Pset_dxpl_mpio(dxfer_plist, H5FD_MPIO_COLLECTIVE);
- VRFY((ret >= 0),"MPIO data transfer property list succeed");
- if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
- ret = H5Pset_dxpl_mpio_collective_opt(dxfer_plist,H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0),"set independent IO collectively succeeded");
- }
-
-
- /* Collective read */
- ret = H5Dread(dataseti, H5T_NATIVE_INT, mspaceid, fspaceid1,
- dxfer_plist, matrix_out);
- VRFY((ret >= 0),"H5D collecive read succeed");
-
- ret = H5Pclose(dxfer_plist);
- VRFY((ret >= 0),"");
-
- /* Independent read */
- ret = H5Dread(dataseti, H5T_NATIVE_INT, mspaceid, fspaceid1,
- H5P_DEFAULT, matrix_out1);
- VRFY((ret >= 0),"H5D independent read succeed");
-
- ret = 0;
- for (i = 0; i < MSPACE_DIM1*MSPACE_DIM2*mpi_size; i++){
- if(matrix_out[i]!=matrix_out1[i])ret = -1;
- if(ret < 0) break;
- }
- VRFY((ret >= 0),"H5D contiguous irregular collective read succeed");
-
- /*
- * Close memory file and memory dataspaces.
- */
- ret = H5Sclose(mspaceid);
- VRFY((ret >= 0),"");
- ret = H5Sclose(fspaceid1);
- VRFY((ret >= 0),"");
-
- /*
- * Close dataset.
- */
- ret = H5Dclose(dataseti);
- VRFY((ret >= 0),"");
-
- /*
- * Close property list
- */
- ret = H5Pclose(facc_plist);
- VRFY((ret >= 0),"");
-
-
- /*
- * Close the file.
- */
- ret = H5Fclose(file);
- VRFY((ret >= 0),"");
-
- return ;
-}
+ int *matrix_out;
+ int *matrix_out1; /* Buffer to read from the dataset */
+
+ int mpi_size, mpi_rank;
+
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
+
+ /*set up MPI parameters */
+ MPI_Comm_size(comm, &mpi_size);
+ MPI_Comm_rank(comm, &mpi_rank);
+
+ /* Obtain file name */
+ filename = GetTestParameters();
+
+ /* Initialize the buffer */
+
+ mdim[0] = MSPACE_DIM1;
+ mdim[1] = MSPACE_DIM2 * mpi_size;
+ matrix_out = (int *)HDmalloc(sizeof(int) * MSPACE_DIM1 * MSPACE_DIM2 * mpi_size);
+ matrix_out1 = (int *)HDmalloc(sizeof(int) * MSPACE_DIM1 * MSPACE_DIM2 * mpi_size);
+
+ /*** For testing collective hyperslab selection read ***/
+
+ /* Obtain file access property list */
+ facc_plist = create_faccess_plist(comm, info, facc_type);
+ VRFY((facc_plist >= 0), "");
+
+ /*
+ * Open the file.
+ */
+ file = H5Fopen(filename, H5F_ACC_RDONLY, facc_plist);
+ VRFY((file >= 0), "H5Fopen succeeded");
+
+ /*
+ * Open the dataset.
+ */
+ dataseti = H5Dopen2(file, "independ_write", H5P_DEFAULT);
+ VRFY((dataseti >= 0), "H5Dopen2 succeeded");
+
+ /*
+ * Get dataspace of the open dataset.
+ */
+ fspaceid1 = H5Dget_space(dataseti);
+ VRFY((fspaceid1 >= 0), "file dataspace obtained succeeded");
+
+ /* The First selection for FILE to read
+ *
+ * block (1,1)
+ * stride(1.1)
+ * count (3,768/mpi_size)
+ * start (1,2+768*mpi_rank/mpi_size)
+ *
+ */
+ start[0] = RFFHSTART0;
+ start[1] = RFFHSTART1 + mpi_rank * RFFHCOUNT1;
+ block[0] = RFFHBLOCK0;
+ block[1] = RFFHBLOCK1;
+ stride[0] = RFFHSTRIDE0;
+ stride[1] = RFFHSTRIDE1;
+ count[0] = RFFHCOUNT0;
+ count[1] = RFFHCOUNT1;
+
+ ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /* The Second selection for FILE to read
+ *
+ * block (1,1)
+ * stride(1.1)
+ * count (3,1536/mpi_size)
+ * start (2,4+1536*mpi_rank/mpi_size)
+ *
+ */
+ start[0] = RFSHSTART0;
+ start[1] = RFSHSTART1 + RFSHCOUNT1 * mpi_rank;
+ block[0] = RFSHBLOCK0;
+ block[1] = RFSHBLOCK1;
+ stride[0] = RFSHSTRIDE0;
+ stride[1] = RFSHSTRIDE0;
+ count[0] = RFSHCOUNT0;
+ count[1] = RFSHCOUNT1;
+
+ ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /*
+ * Create memory dataspace.
+ */
+ mspaceid = H5Screate_simple(MSPACE_RANK, mdim, NULL);
+
+ /*
+ * Select two hyperslabs in memory. Hyperslabs has the same
+ * size and shape as the selected hyperslabs for the file dataspace.
+ * Only the starting point is different.
+ * The first selection
+ * block (1,1)
+ * stride(1.1)
+ * count (3,768/mpi_size)
+ * start (0,768*mpi_rank/mpi_size)
+ *
+ */
+
+ start[0] = RMFHSTART0;
+ start[1] = RMFHSTART1 + mpi_rank * RMFHCOUNT1;
+ block[0] = RMFHBLOCK0;
+ block[1] = RMFHBLOCK1;
+ stride[0] = RMFHSTRIDE0;
+ stride[1] = RMFHSTRIDE1;
+ count[0] = RMFHCOUNT0;
+ count[1] = RMFHCOUNT1;
+ ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /*
+ * Select two hyperslabs in memory. Hyperslabs has the same
+ * size and shape as the selected hyperslabs for the file dataspace
+ * Only the starting point is different.
+ * The second selection
+ * block (1,1)
+ * stride(1,1)
+ * count (3,1536/mpi_size)
+ * start (1,2+1536*mpi_rank/mpi_size)
+ *
+ */
+ start[0] = RMSHSTART0;
+ start[1] = RMSHSTART1 + mpi_rank * RMSHCOUNT1;
+ block[0] = RMSHBLOCK0;
+ block[1] = RMSHBLOCK1;
+ stride[0] = RMSHSTRIDE0;
+ stride[1] = RMSHSTRIDE1;
+ count[0] = RMSHCOUNT0;
+ count[1] = RMSHCOUNT1;
+ ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "hyperslab selection succeeded");
+
+ /*
+ * Initialize data buffer.
+ */
+
+ HDmemset(matrix_out, 0, sizeof(int) * MSPACE_DIM1 * MSPACE_DIM2 * mpi_size);
+ HDmemset(matrix_out1, 0, sizeof(int) * MSPACE_DIM1 * MSPACE_DIM2 * mpi_size);
+
+ /*
+ * Read data back to the buffer matrix_out.
+ */
+
+ dxfer_plist = H5Pcreate(H5P_DATASET_XFER);
+ VRFY((dxfer_plist >= 0), "");
+
+ ret = H5Pset_dxpl_mpio(dxfer_plist, H5FD_MPIO_COLLECTIVE);
+ VRFY((ret >= 0), "MPIO data transfer property list succeed");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO) {
+ ret = H5Pset_dxpl_mpio_collective_opt(dxfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "set independent IO collectively succeeded");
+ }
+
+ /* Collective read */
+ ret = H5Dread(dataseti, H5T_NATIVE_INT, mspaceid, fspaceid1, dxfer_plist, matrix_out);
+ VRFY((ret >= 0), "H5D collecive read succeed");
+
+ ret = H5Pclose(dxfer_plist);
+ VRFY((ret >= 0), "");
+
+ /* Independent read */
+ ret = H5Dread(dataseti, H5T_NATIVE_INT, mspaceid, fspaceid1, H5P_DEFAULT, matrix_out1);
+ VRFY((ret >= 0), "H5D independent read succeed");
+
+ ret = 0;
+ for (i = 0; i < MSPACE_DIM1 * MSPACE_DIM2 * mpi_size; i++) {
+ if (matrix_out[i] != matrix_out1[i])
+ ret = -1;
+ if (ret < 0)
+ break;
+ }
+ VRFY((ret >= 0), "H5D contiguous irregular collective read succeed");
+
+ /*
+ * Close memory file and memory dataspaces.
+ */
+ ret = H5Sclose(mspaceid);
+ VRFY((ret >= 0), "");
+ ret = H5Sclose(fspaceid1);
+ VRFY((ret >= 0), "");
+
+ /*
+ * Close dataset.
+ */
+ ret = H5Dclose(dataseti);
+ VRFY((ret >= 0), "");
+
+ /*
+ * Close property list
+ */
+ ret = H5Pclose(facc_plist);
+ VRFY((ret >= 0), "");
+ /*
+ * Close the file.
+ */
+ ret = H5Fclose(file);
+ VRFY((ret >= 0), "");
+
+ return;
+}
/****************************************************************
**
-** lower_dim_size_comp_test__select_checker_board():
+** lower_dim_size_comp_test__select_checker_board():
**
-** Given a data space of tgt_rank, and dimensions:
+** Given a dataspace of tgt_rank, and dimensions:
**
-** (mpi_size + 1), edge_size, ... , edge_size
+** (mpi_size + 1), edge_size, ... , edge_size
**
-** edge_size, and a checker_edge_size, select a checker
-** board selection of a sel_rank (sel_rank < tgt_rank)
-** dimensional slice through the data space parallel to the
+** edge_size, and a checker_edge_size, select a checker
+** board selection of a sel_rank (sel_rank < tgt_rank)
+** dimensional slice through the dataspace parallel to the
** sel_rank fastest changing indicies, with origin (in the
-** higher indicies) as indicated by the start array.
+** higher indicies) as indicated by the start array.
**
-** Note that this function, is hard coded to presume a
-** maximum data space rank of 5.
+** Note that this function, is hard coded to presume a
+** maximum dataspace rank of 5.
**
-** While this maximum is declared as a constant, increasing
-** it will require extensive coding in addition to changing
+** While this maximum is declared as a constant, increasing
+** it will require extensive coding in addition to changing
** the value of the constant.
**
-** JRM -- 11/11/09
+** JRM -- 11/11/09
**
****************************************************************/
-#define LDSCT_DS_RANK 5
+#define LDSCT_DS_RANK 5
#define LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK 0
#define LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG 0
static void
-lower_dim_size_comp_test__select_checker_board(
- const int mpi_rank,
- const hid_t tgt_sid,
- const int tgt_rank,
- const hsize_t dims[LDSCT_DS_RANK],
- const int checker_edge_size,
- const int sel_rank,
- hsize_t sel_start[])
+lower_dim_size_comp_test__select_checker_board(const int mpi_rank, const hid_t tgt_sid, const int tgt_rank,
+ const hsize_t dims[LDSCT_DS_RANK], const int checker_edge_size,
+ const int sel_rank, hsize_t sel_start[])
{
-#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
- const char * fcnName =
- "lower_dim_size_comp_test__select_checker_board():";
-#endif
- hbool_t first_selection = TRUE;
- int i, j, k, l, m;
- int ds_offset;
- int sel_offset;
- const int test_max_rank = LDSCT_DS_RANK; /* must update code if */
- /* this changes */
- hsize_t base_count;
- hsize_t offset_count;
- hsize_t start[LDSCT_DS_RANK];
- hsize_t stride[LDSCT_DS_RANK];
- hsize_t count[LDSCT_DS_RANK];
- hsize_t block[LDSCT_DS_RANK];
- herr_t ret; /* Generic return value */
-
-#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout,
- "%s:%d: dims/checker_edge_size = %d %d %d %d %d / %d\n",
- fcnName, mpi_rank, (int)dims[0], (int)dims[1], (int)dims[2],
- (int)dims[3], (int)dims[4], checker_edge_size);
+#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
+ const char *fcnName = "lower_dim_size_comp_test__select_checker_board():";
+#endif
+ hbool_t first_selection = TRUE;
+ int i, j, k, l, m;
+ int ds_offset;
+ int sel_offset;
+ const int test_max_rank = LDSCT_DS_RANK; /* must update code if */
+ /* this changes */
+ hsize_t base_count;
+ hsize_t offset_count;
+ hsize_t start[LDSCT_DS_RANK];
+ hsize_t stride[LDSCT_DS_RANK];
+ hsize_t count[LDSCT_DS_RANK];
+ hsize_t block[LDSCT_DS_RANK];
+ herr_t ret; /* Generic return value */
+
+#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: dims/checker_edge_size = %d %d %d %d %d / %d\n", fcnName, mpi_rank,
+ (int)dims[0], (int)dims[1], (int)dims[2], (int)dims[3], (int)dims[4], checker_edge_size);
}
-#endif /* LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG */
+#endif /* LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG */
- HDassert( 0 < checker_edge_size );
- HDassert( 0 < sel_rank );
- HDassert( sel_rank <= tgt_rank );
- HDassert( tgt_rank <= test_max_rank );
- HDassert( test_max_rank <= LDSCT_DS_RANK );
+ HDassert(0 < checker_edge_size);
+ HDassert(0 < sel_rank);
+ HDassert(sel_rank <= tgt_rank);
+ HDassert(tgt_rank <= test_max_rank);
+ HDassert(test_max_rank <= LDSCT_DS_RANK);
sel_offset = test_max_rank - sel_rank;
- HDassert( sel_offset >= 0 );
+ HDassert(sel_offset >= 0);
ds_offset = test_max_rank - tgt_rank;
- HDassert( ds_offset >= 0 );
- HDassert( ds_offset <= sel_offset );
-
- HDassert( (hsize_t)checker_edge_size <= dims[sel_offset] );
- HDassert( dims[sel_offset] == 10 );
-
-#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: sel_rank/sel_offset = %d/%d.\n",
- fcnName, mpi_rank, sel_rank, sel_offset);
- HDfprintf(stdout, "%s:%d: tgt_rank/ds_offset = %d/%d.\n",
- fcnName, mpi_rank, tgt_rank, ds_offset);
+ HDassert(ds_offset >= 0);
+ HDassert(ds_offset <= sel_offset);
+
+ HDassert((hsize_t)checker_edge_size <= dims[sel_offset]);
+ HDassert(dims[sel_offset] == 10);
+
+#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: sel_rank/sel_offset = %d/%d.\n", fcnName, mpi_rank, sel_rank, sel_offset);
+ HDfprintf(stdout, "%s:%d: tgt_rank/ds_offset = %d/%d.\n", fcnName, mpi_rank, tgt_rank, ds_offset);
}
-#endif /* LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG */
+#endif /* LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG */
/* First, compute the base count (which assumes start == 0
* for the associated offset) and offset_count (which
@@ -1038,262 +974,218 @@ lower_dim_size_comp_test__select_checker_board(
base_count = dims[sel_offset] / (checker_edge_size * 2);
- if ( (dims[sel_rank] % (checker_edge_size * 2)) > 0 ) {
+ if ((dims[sel_rank] % (checker_edge_size * 2)) > 0) {
base_count++;
}
- offset_count =
- (hsize_t)((dims[sel_offset] - (hsize_t)checker_edge_size) /
- ((hsize_t)(checker_edge_size * 2)));
+ offset_count =
+ (hsize_t)((dims[sel_offset] - (hsize_t)checker_edge_size) / ((hsize_t)(checker_edge_size * 2)));
- if ( ((dims[sel_rank] - (hsize_t)checker_edge_size) %
- ((hsize_t)(checker_edge_size * 2))) > 0 ) {
+ if (((dims[sel_rank] - (hsize_t)checker_edge_size) % ((hsize_t)(checker_edge_size * 2))) > 0) {
offset_count++;
}
-#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: base_count/offset_count = %d/%d.\n",
- fcnName, mpi_rank, base_count, offset_count);
+#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: base_count/offset_count = %d/%d.\n", fcnName, mpi_rank, base_count,
+ offset_count);
}
-#endif /* LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG */
+#endif /* LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG */
/* Now set up the stride and block arrays, and portions of the start
- * and count arrays that will not be altered during the selection of
+ * and count arrays that will not be altered during the selection of
* the checker board.
*/
i = 0;
- while ( i < ds_offset ) {
+ while (i < ds_offset) {
/* these values should never be used */
- start[i] = 0;
+ start[i] = 0;
stride[i] = 0;
- count[i] = 0;
- block[i] = 0;
+ count[i] = 0;
+ block[i] = 0;
i++;
}
- while ( i < sel_offset ) {
+ while (i < sel_offset) {
- start[i] = sel_start[i];
+ start[i] = sel_start[i];
stride[i] = 2 * dims[i];
- count[i] = 1;
- block[i] = 1;
+ count[i] = 1;
+ block[i] = 1;
i++;
}
- while ( i < test_max_rank ) {
+ while (i < test_max_rank) {
stride[i] = (hsize_t)(2 * checker_edge_size);
- block[i] = (hsize_t)checker_edge_size;
+ block[i] = (hsize_t)checker_edge_size;
i++;
}
-
+
i = 0;
do {
- if ( 0 >= sel_offset ) {
+ if (0 >= sel_offset) {
- if ( i == 0 ) {
+ if (i == 0) {
start[0] = 0;
count[0] = base_count;
-
- } else {
+ }
+ else {
start[0] = (hsize_t)checker_edge_size;
count[0] = offset_count;
-
}
}
j = 0;
- do {
- if ( 1 >= sel_offset ) {
+ do {
+ if (1 >= sel_offset) {
- if ( j == 0 ) {
+ if (j == 0) {
start[1] = 0;
count[1] = base_count;
-
- } else {
+ }
+ else {
start[1] = (hsize_t)checker_edge_size;
count[1] = offset_count;
-
}
}
k = 0;
do {
- if ( 2 >= sel_offset ) {
+ if (2 >= sel_offset) {
- if ( k == 0 ) {
+ if (k == 0) {
start[2] = 0;
count[2] = base_count;
-
- } else {
+ }
+ else {
start[2] = (hsize_t)checker_edge_size;
count[2] = offset_count;
-
}
}
l = 0;
do {
- if ( 3 >= sel_offset ) {
+ if (3 >= sel_offset) {
- if ( l == 0 ) {
+ if (l == 0) {
start[3] = 0;
count[3] = base_count;
-
- } else {
+ }
+ else {
start[3] = (hsize_t)checker_edge_size;
count[3] = offset_count;
-
}
}
m = 0;
do {
- if ( 4 >= sel_offset ) {
+ if (4 >= sel_offset) {
- if ( m == 0 ) {
+ if (m == 0) {
start[4] = 0;
count[4] = base_count;
-
- } else {
+ }
+ else {
start[4] = (hsize_t)checker_edge_size;
count[4] = offset_count;
-
}
}
- if ( ((i + j + k + l + m) % 2) == 0 ) {
-
-#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
- if ( mpi_rank ==
- LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
-
- HDfprintf(stdout,
- "%s%d: *** first_selection = %d ***\n",
- fcnName, mpi_rank, (int)first_selection);
- HDfprintf(stdout,
- "%s:%d: i/j/k/l/m = %d/%d/%d/%d/%d\n",
- fcnName, mpi_rank, i, j, k, l, m);
- HDfprintf(stdout,
- "%s:%d: start = %d %d %d %d %d.\n",
- fcnName, mpi_rank,
- (int)start[0], (int)start[1],
- (int)start[2], (int)start[3],
- (int)start[4]);
- HDfprintf(stdout,
- "%s:%d: stride = %d %d %d %d %d.\n",
- fcnName, mpi_rank,
- (int)stride[0], (int)stride[1],
- (int)stride[2], (int)stride[3],
- (int)stride[4]);
- HDfprintf(stdout,
- "%s:%d: count = %d %d %d %d %d.\n",
- fcnName, mpi_rank,
- (int)count[0], (int)count[1],
- (int)count[2], (int)count[3],
- (int)count[4]);
- HDfprintf(stdout,
- "%s:%d: block = %d %d %d %d %d.\n",
- fcnName, mpi_rank,
- (int)block[0], (int)block[1],
- (int)block[2], (int)block[3],
- (int)block[4]);
- HDfprintf(stdout,
- "%s:%d: n-cube extent dims = %d.\n",
- fcnName, mpi_rank,
- H5Sget_simple_extent_ndims(tgt_sid));
- HDfprintf(stdout,
- "%s:%d: selection rank = %d.\n",
- fcnName, mpi_rank, sel_rank);
+ if (((i + j + k + l + m) % 2) == 0) {
+
+#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+
+ HDfprintf(stdout, "%s%d: *** first_selection = %d ***\n", fcnName, mpi_rank,
+ (int)first_selection);
+ HDfprintf(stdout, "%s:%d: i/j/k/l/m = %d/%d/%d/%d/%d\n", fcnName, mpi_rank, i,
+ j, k, l, m);
+ HDfprintf(stdout, "%s:%d: start = %d %d %d %d %d.\n", fcnName, mpi_rank,
+ (int)start[0], (int)start[1], (int)start[2], (int)start[3],
+ (int)start[4]);
+ HDfprintf(stdout, "%s:%d: stride = %d %d %d %d %d.\n", fcnName, mpi_rank,
+ (int)stride[0], (int)stride[1], (int)stride[2], (int)stride[3],
+ (int)stride[4]);
+ HDfprintf(stdout, "%s:%d: count = %d %d %d %d %d.\n", fcnName, mpi_rank,
+ (int)count[0], (int)count[1], (int)count[2], (int)count[3],
+ (int)count[4]);
+ HDfprintf(stdout, "%s:%d: block = %d %d %d %d %d.\n", fcnName, mpi_rank,
+ (int)block[0], (int)block[1], (int)block[2], (int)block[3],
+ (int)block[4]);
+ HDfprintf(stdout, "%s:%d: n-cube extent dims = %d.\n", fcnName, mpi_rank,
+ H5Sget_simple_extent_ndims(tgt_sid));
+ HDfprintf(stdout, "%s:%d: selection rank = %d.\n", fcnName, mpi_rank,
+ sel_rank);
}
#endif
- if ( first_selection ) {
+ if (first_selection) {
+
+ first_selection = FALSE;
- first_selection = FALSE;
+ ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_SET, &(start[ds_offset]),
+ &(stride[ds_offset]), &(count[ds_offset]),
+ &(block[ds_offset]));
- ret = H5Sselect_hyperslab
- (
- tgt_sid,
- H5S_SELECT_SET,
- &(start[ds_offset]),
- &(stride[ds_offset]),
- &(count[ds_offset]),
- &(block[ds_offset])
- );
-
VRFY((ret != FAIL), "H5Sselect_hyperslab(SET) succeeded");
+ }
+ else {
- } else {
-
- ret = H5Sselect_hyperslab
- (
- tgt_sid,
- H5S_SELECT_OR,
- &(start[ds_offset]),
- &(stride[ds_offset]),
- &(count[ds_offset]),
- &(block[ds_offset])
- );
-
- VRFY((ret != FAIL), "H5Sselect_hyperslab(OR) succeeded");
+ ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_OR, &(start[ds_offset]),
+ &(stride[ds_offset]), &(count[ds_offset]),
+ &(block[ds_offset]));
+ VRFY((ret != FAIL), "H5Sselect_hyperslab(OR) succeeded");
}
}
m++;
- } while ( ( m <= 1 ) &&
- ( 4 >= sel_offset ) );
+ } while ((m <= 1) && (4 >= sel_offset));
l++;
- } while ( ( l <= 1 ) &&
- ( 3 >= sel_offset ) );
+ } while ((l <= 1) && (3 >= sel_offset));
k++;
- } while ( ( k <= 1 ) &&
- ( 2 >= sel_offset ) );
+ } while ((k <= 1) && (2 >= sel_offset));
j++;
- } while ( ( j <= 1 ) &&
- ( 1 >= sel_offset ) );
-
+ } while ((j <= 1) && (1 >= sel_offset));
i++;
- } while ( ( i <= 1 ) &&
- ( 0 >= sel_offset ) );
+ } while ((i <= 1) && (0 >= sel_offset));
-#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s%d: H5Sget_select_npoints(tgt_sid) = %d.\n",
- fcnName, mpi_rank, (int)H5Sget_select_npoints(tgt_sid));
+#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s%d: H5Sget_select_npoints(tgt_sid) = %d.\n", fcnName, mpi_rank,
+ (int)H5Sget_select_npoints(tgt_sid));
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG */
- /* Clip the selection back to the data space proper. */
+ /* Clip the selection back to the dataspace proper. */
- for ( i = 0; i < test_max_rank; i++ ) {
+ for (i = 0; i < test_max_rank; i++) {
start[i] = 0;
stride[i] = dims[i];
@@ -1301,15 +1193,14 @@ lower_dim_size_comp_test__select_checker_board(
block[i] = dims[i];
}
- ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_AND,
- start, stride, count, block);
+ ret = H5Sselect_hyperslab(tgt_sid, H5S_SELECT_AND, start, stride, count, block);
VRFY((ret != FAIL), "H5Sselect_hyperslab(AND) succeeded");
-#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s%d: H5Sget_select_npoints(tgt_sid) = %d.\n",
- fcnName, mpi_rank, (int)H5Sget_select_npoints(tgt_sid));
+#if LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s%d: H5Sget_select_npoints(tgt_sid) = %d.\n", fcnName, mpi_rank,
+ (int)H5Sget_select_npoints(tgt_sid));
HDfprintf(stdout, "%s%d: done.\n", fcnName, mpi_rank);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG */
@@ -1318,345 +1209,314 @@ lower_dim_size_comp_test__select_checker_board(
} /* lower_dim_size_comp_test__select_checker_board() */
-
/****************************************************************
**
-** lower_dim_size_comp_test__verify_data():
+** lower_dim_size_comp_test__verify_data():
**
-** Examine the supplied buffer to see if it contains the
-** expected data. Return TRUE if it does, and FALSE
+** Examine the supplied buffer to see if it contains the
+** expected data. Return TRUE if it does, and FALSE
** otherwise.
**
-** The supplied buffer is presumed to this process's slice
-** of the target data set. Each such slice will be an
-** n-cube of rank (rank -1) and the supplied edge_size with
-** origin (mpi_rank, 0, ... , 0) in the target data set.
+** The supplied buffer is presumed to this process's slice
+** of the target data set. Each such slice will be an
+** n-cube of rank (rank -1) and the supplied edge_size with
+** origin (mpi_rank, 0, ... , 0) in the target data set.
**
-** Further, the buffer is presumed to be the result of reading
-** or writing a checker board selection of an m (1 <= m <
+** Further, the buffer is presumed to be the result of reading
+** or writing a checker board selection of an m (1 <= m <
** rank) dimensional slice through this processes slice
-** of the target data set. Also, this slice must be parallel
-** to the fastest changing indicies.
+** of the target data set. Also, this slice must be parallel
+** to the fastest changing indicies.
**
-** It is further presumed that the buffer was zeroed before
-** the read/write, and that the full target data set (i.e.
-** the buffer/data set for all processes) was initialized
-** with the natural numbers listed in order from the origin
-** along the fastest changing axis.
+** It is further presumed that the buffer was zeroed before
+** the read/write, and that the full target data set (i.e.
+** the buffer/data set for all processes) was initialized
+** with the natural numbers listed in order from the origin
+** along the fastest changing axis.
**
** Thus for a 20x10x10 dataset, the value stored in location
-** (x, y, z) (assuming that z is the fastest changing index
-** and x the slowest) is assumed to be:
+** (x, y, z) (assuming that z is the fastest changing index
+** and x the slowest) is assumed to be:
**
-** (10 * 10 * x) + (10 * y) + z
+** (10 * 10 * x) + (10 * y) + z
**
-** Further, supposing that this is process 10, this process's
-** slice of the dataset would be a 10 x 10 2-cube with origin
-** (10, 0, 0) in the data set, and would be initialize (prior
-** to the checkerboard selection) as follows:
+** Further, supposing that this is process 10, this process's
+** slice of the dataset would be a 10 x 10 2-cube with origin
+** (10, 0, 0) in the data set, and would be initialize (prior
+** to the checkerboard selection) as follows:
**
-** 1000, 1001, 1002, ... 1008, 1009
-** 1010, 1011, 1012, ... 1018, 1019
-** . . . . .
-** . . . . .
-** . . . . .
-** 1090, 1091, 1092, ... 1098, 1099
+** 1000, 1001, 1002, ... 1008, 1009
+** 1010, 1011, 1012, ... 1018, 1019
+** . . . . .
+** . . . . .
+** . . . . .
+** 1090, 1091, 1092, ... 1098, 1099
**
-** In the case of a read from the processors slice of another
-** data set of different rank, the values expected will have
-** to be adjusted accordingly. This is done via the
-** first_expected_val parameter.
+** In the case of a read from the processors slice of another
+** data set of different rank, the values expected will have
+** to be adjusted accordingly. This is done via the
+** first_expected_val parameter.
**
-** Finally, the function presumes that the first element
-** of the buffer resides either at the origin of either
-** a selected or an unselected checker. (Translation:
-** if partial checkers appear in the buffer, they will
-** intersect the edges of the n-cube oposite the origin.)
+** Finally, the function presumes that the first element
+** of the buffer resides either at the origin of either
+** a selected or an unselected checker. (Translation:
+** if partial checkers appear in the buffer, they will
+** intersect the edges of the n-cube oposite the origin.)
**
****************************************************************/
#define LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG 0
static hbool_t
-lower_dim_size_comp_test__verify_data(uint32_t * buf_ptr,
-#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
+lower_dim_size_comp_test__verify_data(uint32_t *buf_ptr,
+#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
const int mpi_rank,
#endif /* LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG */
- const int rank,
- const int edge_size,
- const int checker_edge_size,
- uint32_t first_expected_val,
- hbool_t buf_starts_in_checker)
+ const int rank, const int edge_size, const int checker_edge_size,
+ uint32_t first_expected_val, hbool_t buf_starts_in_checker)
{
#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
- const char * fcnName =
- "lower_dim_size_comp_test__verify_data():";
+ const char *fcnName = "lower_dim_size_comp_test__verify_data():";
#endif
- hbool_t good_data = TRUE;
- hbool_t in_checker;
- hbool_t start_in_checker[5];
- uint32_t expected_value;
- uint32_t * val_ptr;
- int i, j, k, l, m; /* to track position in n-cube */
- int v, w, x, y, z; /* to track position in checker */
+ hbool_t good_data = TRUE;
+ hbool_t in_checker;
+ hbool_t start_in_checker[5];
+ uint32_t expected_value;
+ uint32_t *val_ptr;
+ int i, j, k, l, m; /* to track position in n-cube */
+ int v, w, x, y, z; /* to track position in checker */
const int test_max_rank = 5; /* code changes needed if this is increased */
- HDassert( buf_ptr != NULL );
- HDassert( 0 < rank );
- HDassert( rank <= test_max_rank );
- HDassert( edge_size >= 6 );
- HDassert( 0 < checker_edge_size );
- HDassert( checker_edge_size <= edge_size );
- HDassert( test_max_rank <= LDSCT_DS_RANK );
+ HDassert(buf_ptr != NULL);
+ HDassert(0 < rank);
+ HDassert(rank <= test_max_rank);
+ HDassert(edge_size >= 6);
+ HDassert(0 < checker_edge_size);
+ HDassert(checker_edge_size <= edge_size);
+ HDassert(test_max_rank <= LDSCT_DS_RANK);
-#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
+#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
HDfprintf(stdout, "%s mpi_rank = %d.\n", fcnName, mpi_rank);
HDfprintf(stdout, "%s rank = %d.\n", fcnName, rank);
HDfprintf(stdout, "%s edge_size = %d.\n", fcnName, edge_size);
- HDfprintf(stdout, "%s checker_edge_size = %d.\n",
- fcnName, checker_edge_size);
- HDfprintf(stdout, "%s first_expected_val = %d.\n",
- fcnName, (int)first_expected_val);
- HDfprintf(stdout, "%s starts_in_checker = %d.\n",
- fcnName, (int)buf_starts_in_checker);
+ HDfprintf(stdout, "%s checker_edge_size = %d.\n", fcnName, checker_edge_size);
+ HDfprintf(stdout, "%s first_expected_val = %d.\n", fcnName, (int)first_expected_val);
+ HDfprintf(stdout, "%s starts_in_checker = %d.\n", fcnName, (int)buf_starts_in_checker);
}
#endif
- val_ptr = buf_ptr;
+ val_ptr = buf_ptr;
expected_value = first_expected_val;
- i = 0;
- v = 0;
+ i = 0;
+ v = 0;
start_in_checker[0] = buf_starts_in_checker;
- do
- {
- if ( v >= checker_edge_size ) {
+ do {
+ if (v >= checker_edge_size) {
- start_in_checker[0] = ! start_in_checker[0];
- v = 0;
+ start_in_checker[0] = !start_in_checker[0];
+ v = 0;
}
- j = 0;
- w = 0;
+ j = 0;
+ w = 0;
start_in_checker[1] = start_in_checker[0];
- do
- {
- if ( w >= checker_edge_size ) {
+ do {
+ if (w >= checker_edge_size) {
- start_in_checker[1] = ! start_in_checker[1];
- w = 0;
+ start_in_checker[1] = !start_in_checker[1];
+ w = 0;
}
- k = 0;
- x = 0;
+ k = 0;
+ x = 0;
start_in_checker[2] = start_in_checker[1];
- do
- {
- if ( x >= checker_edge_size ) {
+ do {
+ if (x >= checker_edge_size) {
- start_in_checker[2] = ! start_in_checker[2];
- x = 0;
+ start_in_checker[2] = !start_in_checker[2];
+ x = 0;
}
- l = 0;
- y = 0;
+ l = 0;
+ y = 0;
start_in_checker[3] = start_in_checker[2];
- do
- {
- if ( y >= checker_edge_size ) {
+ do {
+ if (y >= checker_edge_size) {
- start_in_checker[3] = ! start_in_checker[3];
- y = 0;
+ start_in_checker[3] = !start_in_checker[3];
+ y = 0;
}
m = 0;
z = 0;
-#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
- if ( mpi_rank ==
- LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
+#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
HDfprintf(stdout, "%d, %d, %d, %d, %d:", i, j, k, l, m);
}
#endif
in_checker = start_in_checker[3];
- do
- {
-#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
- if ( mpi_rank ==
- LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
+ do {
+#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
HDfprintf(stdout, " %d", (int)(*val_ptr));
}
#endif
- if ( z >= checker_edge_size ) {
+ if (z >= checker_edge_size) {
- in_checker = ! in_checker;
- z = 0;
+ in_checker = !in_checker;
+ z = 0;
}
-
- if ( in_checker ) {
-
- if ( *val_ptr != expected_value ) {
+
+ if (in_checker) {
+
+ if (*val_ptr != expected_value) {
good_data = FALSE;
}
-
+
/* zero out buffer for re-use */
*val_ptr = 0;
-
- } else if ( *val_ptr != 0 ) {
+ }
+ else if (*val_ptr != 0) {
good_data = FALSE;
-
+
/* zero out buffer for re-use */
*val_ptr = 0;
-
}
val_ptr++;
expected_value++;
m++;
z++;
-
- } while ( ( rank >= (test_max_rank - 4) ) &&
- ( m < edge_size ) );
-#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
- if ( mpi_rank ==
- LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
+
+ } while ((rank >= (test_max_rank - 4)) && (m < edge_size));
+#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
HDfprintf(stdout, "\n");
}
#endif
l++;
y++;
- } while ( ( rank >= (test_max_rank - 3) ) &&
- ( l < edge_size ) );
+ } while ((rank >= (test_max_rank - 3)) && (l < edge_size));
k++;
x++;
- } while ( ( rank >= (test_max_rank - 2) ) &&
- ( k < edge_size ) );
+ } while ((rank >= (test_max_rank - 2)) && (k < edge_size));
j++;
w++;
- } while ( ( rank >= (test_max_rank - 1) ) &&
- ( j < edge_size ) );
+ } while ((rank >= (test_max_rank - 1)) && (j < edge_size));
i++;
v++;
- } while ( ( rank >= test_max_rank ) &&
- ( i < edge_size ) );
+ } while ((rank >= test_max_rank) && (i < edge_size));
- return(good_data);
+ return (good_data);
} /* lower_dim_size_comp_test__verify_data() */
-
/*-------------------------------------------------------------------------
- * Function: lower_dim_size_comp_test__run_test()
+ * Function: lower_dim_size_comp_test__run_test()
*
- * Purpose: Verify that a bug in the computation of the size of the
- * lower dimensions of a data space in H5S_obtain_datatype()
- * has been corrected.
+ * Purpose: Verify that a bug in the computation of the size of the
+ * lower dimensions of a dataspace in H5S_obtain_datatype()
+ * has been corrected.
*
- * Return: void
+ * Return: void
*
- * Programmer: JRM -- 11/11/09
- *
- * Modifications:
+ * Programmer: JRM -- 11/11/09
*
*-------------------------------------------------------------------------
*/
-#define LDSCT_DS_RANK 5
+#define LDSCT_DS_RANK 5
#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0
static void
-lower_dim_size_comp_test__run_test(const int chunk_edge_size,
- const hbool_t use_collective_io,
+lower_dim_size_comp_test__run_test(const int chunk_edge_size, const hbool_t use_collective_io,
const hid_t dset_type)
{
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- const char *fcnName = "lower_dim_size_comp_test__run_test()";
- int rank;
- hsize_t dims[32];
- hsize_t max_dims[32];
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ const char *fcnName = "lower_dim_size_comp_test__run_test()";
+ int rank;
+ hsize_t dims[32];
+ hsize_t max_dims[32];
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
- const char *filename;
- hbool_t data_ok = FALSE;
- hbool_t mis_match = FALSE;
- int i;
- int start_index;
- int stop_index;
- int mrc;
- int mpi_rank;
- int mpi_size;
- MPI_Comm mpi_comm = MPI_COMM_NULL;
- MPI_Info mpi_info = MPI_INFO_NULL;
- hid_t fid; /* HDF5 file ID */
- hid_t acc_tpl; /* File access templates */
- hid_t xfer_plist = H5P_DEFAULT;
- size_t small_ds_size;
- size_t small_ds_slice_size;
- size_t large_ds_size;
- size_t large_ds_slice_size;
- uint32_t expected_value;
- uint32_t * small_ds_buf_0 = NULL;
- uint32_t * small_ds_buf_1 = NULL;
- uint32_t * large_ds_buf_0 = NULL;
- uint32_t * large_ds_buf_1 = NULL;
- uint32_t * ptr_0;
- uint32_t * ptr_1;
- hsize_t small_chunk_dims[LDSCT_DS_RANK];
- hsize_t large_chunk_dims[LDSCT_DS_RANK];
- hsize_t small_dims[LDSCT_DS_RANK];
- hsize_t large_dims[LDSCT_DS_RANK];
- hsize_t start[LDSCT_DS_RANK];
- hsize_t stride[LDSCT_DS_RANK];
- hsize_t count[LDSCT_DS_RANK];
- hsize_t block[LDSCT_DS_RANK];
- hsize_t small_sel_start[LDSCT_DS_RANK];
- hsize_t large_sel_start[LDSCT_DS_RANK];
- hid_t full_mem_small_ds_sid;
- hid_t full_file_small_ds_sid;
- hid_t mem_small_ds_sid;
- hid_t file_small_ds_sid;
- hid_t full_mem_large_ds_sid;
- hid_t full_file_large_ds_sid;
- hid_t mem_large_ds_sid;
- hid_t file_large_ds_sid;
- hid_t small_ds_dcpl_id = H5P_DEFAULT;
- hid_t large_ds_dcpl_id = H5P_DEFAULT;
- hid_t small_dataset; /* Dataset ID */
- hid_t large_dataset; /* Dataset ID */
- htri_t check; /* Shape comparison return value */
- herr_t ret; /* Generic return value */
+ const char *filename;
+ hbool_t data_ok = FALSE;
+ hbool_t mis_match = FALSE;
+ int i;
+ int start_index;
+ int stop_index;
+ int mrc;
+ int mpi_rank;
+ int mpi_size;
+ MPI_Comm mpi_comm = MPI_COMM_NULL;
+ MPI_Info mpi_info = MPI_INFO_NULL;
+ hid_t fid; /* HDF5 file ID */
+ hid_t acc_tpl; /* File access templates */
+ hid_t xfer_plist = H5P_DEFAULT;
+ size_t small_ds_size;
+ size_t small_ds_slice_size;
+ size_t large_ds_size;
+ size_t large_ds_slice_size;
+ uint32_t expected_value;
+ uint32_t * small_ds_buf_0 = NULL;
+ uint32_t * small_ds_buf_1 = NULL;
+ uint32_t * large_ds_buf_0 = NULL;
+ uint32_t * large_ds_buf_1 = NULL;
+ uint32_t * ptr_0;
+ uint32_t * ptr_1;
+ hsize_t small_chunk_dims[LDSCT_DS_RANK];
+ hsize_t large_chunk_dims[LDSCT_DS_RANK];
+ hsize_t small_dims[LDSCT_DS_RANK];
+ hsize_t large_dims[LDSCT_DS_RANK];
+ hsize_t start[LDSCT_DS_RANK];
+ hsize_t stride[LDSCT_DS_RANK];
+ hsize_t count[LDSCT_DS_RANK];
+ hsize_t block[LDSCT_DS_RANK];
+ hsize_t small_sel_start[LDSCT_DS_RANK];
+ hsize_t large_sel_start[LDSCT_DS_RANK];
+ hid_t full_mem_small_ds_sid;
+ hid_t full_file_small_ds_sid;
+ hid_t mem_small_ds_sid;
+ hid_t file_small_ds_sid;
+ hid_t full_mem_large_ds_sid;
+ hid_t full_file_large_ds_sid;
+ hid_t mem_large_ds_sid;
+ hid_t file_large_ds_sid;
+ hid_t small_ds_dcpl_id = H5P_DEFAULT;
+ hid_t large_ds_dcpl_id = H5P_DEFAULT;
+ hid_t small_dataset; /* Dataset ID */
+ hid_t large_dataset; /* Dataset ID */
+ htri_t check; /* Shape comparison return value */
+ herr_t ret; /* Generic return value */
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- HDassert( mpi_size >= 1 );
+ HDassert(mpi_size >= 1);
mpi_comm = MPI_COMM_WORLD;
mpi_info = MPI_INFO_NULL;
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: chunk_edge_size = %d.\n",
- fcnName, mpi_rank, (int)chunk_edge_size);
- HDfprintf(stdout, "%s:%d: use_collective_io = %d.\n",
- fcnName, mpi_rank, (int)use_collective_io);
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: chunk_edge_size = %d.\n", fcnName, mpi_rank, (int)chunk_edge_size);
+ HDfprintf(stdout, "%s:%d: use_collective_io = %d.\n", fcnName, mpi_rank, (int)use_collective_io);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
-
- small_ds_size = (size_t)((mpi_size + 1) * 1 * 1 * 10 * 10);
- small_ds_slice_size = (size_t) ( 1 * 1 * 10 * 10);
+ small_ds_size = (size_t)((mpi_size + 1) * 1 * 1 * 10 * 10);
+ small_ds_slice_size = (size_t)(1 * 1 * 10 * 10);
large_ds_size = (size_t)((mpi_size + 1) * 10 * 10 * 10 * 10);
- large_ds_slice_size = (size_t) (10 * 10 * 10 * 10);
+ large_ds_slice_size = (size_t)(10 * 10 * 10 * 10);
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: small ds size / slice size = %d / %d.\n",
- fcnName, mpi_rank,
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: small ds size / slice size = %d / %d.\n", fcnName, mpi_rank,
(int)small_ds_size, (int)small_ds_slice_size);
- HDfprintf(stdout, "%s:%d: large ds size / slice size = %d / %d.\n",
- fcnName, mpi_rank,
+ HDfprintf(stdout, "%s:%d: large ds size / slice size = %d / %d.\n", fcnName, mpi_rank,
(int)large_ds_size, (int)large_ds_slice_size);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
@@ -1674,13 +1534,12 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
large_ds_buf_1 = (uint32_t *)HDmalloc(sizeof(uint32_t) * large_ds_size);
VRFY((large_ds_buf_1 != NULL), "malloc of large_ds_buf_1 succeeded");
-
/* initialize the buffers */
ptr_0 = small_ds_buf_0;
ptr_1 = small_ds_buf_1;
- for ( i = 0; i < (int)small_ds_size; i++ ) {
+ for (i = 0; i < (int)small_ds_size; i++) {
*ptr_0 = (uint32_t)i;
*ptr_1 = 0;
@@ -1692,7 +1551,7 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ptr_0 = large_ds_buf_0;
ptr_1 = large_ds_buf_1;
- for ( i = 0; i < (int)large_ds_size; i++ ) {
+ for (i = 0; i < (int)large_ds_size; i++) {
*ptr_0 = (uint32_t)i;
*ptr_1 = 0;
@@ -1701,12 +1560,10 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ptr_1++;
}
-
/* get the file name */
filename = (const char *)GetTestParameters();
- HDassert( filename != NULL );
-
+ HDassert(filename != NULL);
/* ----------------------------------------
* CREATE AN HDF5 FILE WITH PARALLEL ACCESS
@@ -1725,11 +1582,10 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ret = H5Pclose(acc_tpl);
VRFY((ret >= 0), "H5Pclose(acc_tpl) succeeded");
-
/* setup dims: */
small_dims[0] = (hsize_t)(mpi_size + 1);
- small_dims[1] = 1;
- small_dims[2] = 1;
+ small_dims[1] = 1;
+ small_dims[2] = 1;
small_dims[3] = 10;
small_dims[4] = 10;
@@ -1739,52 +1595,40 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
large_dims[3] = 10;
large_dims[4] = 10;
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: small_dims[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)small_dims[0], (int)small_dims[1],
- (int)small_dims[2], (int)small_dims[3], (int)small_dims[4]);
- HDfprintf(stdout, "%s:%d: large_dims[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)large_dims[0], (int)large_dims[1],
- (int)large_dims[2], (int)large_dims[3], (int)large_dims[4]);
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: small_dims[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)small_dims[0],
+ (int)small_dims[1], (int)small_dims[2], (int)small_dims[3], (int)small_dims[4]);
+ HDfprintf(stdout, "%s:%d: large_dims[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)large_dims[0],
+ (int)large_dims[1], (int)large_dims[2], (int)large_dims[3], (int)large_dims[4]);
}
-#endif
+#endif
- /* create data spaces */
+ /* create dataspaces */
full_mem_small_ds_sid = H5Screate_simple(5, small_dims, NULL);
- VRFY((full_mem_small_ds_sid != 0),
- "H5Screate_simple() full_mem_small_ds_sid succeeded");
+ VRFY((full_mem_small_ds_sid != 0), "H5Screate_simple() full_mem_small_ds_sid succeeded");
full_file_small_ds_sid = H5Screate_simple(5, small_dims, NULL);
- VRFY((full_file_small_ds_sid != 0),
- "H5Screate_simple() full_file_small_ds_sid succeeded");
+ VRFY((full_file_small_ds_sid != 0), "H5Screate_simple() full_file_small_ds_sid succeeded");
mem_small_ds_sid = H5Screate_simple(5, small_dims, NULL);
- VRFY((mem_small_ds_sid != 0),
- "H5Screate_simple() mem_small_ds_sid succeeded");
+ VRFY((mem_small_ds_sid != 0), "H5Screate_simple() mem_small_ds_sid succeeded");
file_small_ds_sid = H5Screate_simple(5, small_dims, NULL);
- VRFY((file_small_ds_sid != 0),
- "H5Screate_simple() file_small_ds_sid succeeded");
-
+ VRFY((file_small_ds_sid != 0), "H5Screate_simple() file_small_ds_sid succeeded");
full_mem_large_ds_sid = H5Screate_simple(5, large_dims, NULL);
- VRFY((full_mem_large_ds_sid != 0),
- "H5Screate_simple() full_mem_large_ds_sid succeeded");
+ VRFY((full_mem_large_ds_sid != 0), "H5Screate_simple() full_mem_large_ds_sid succeeded");
full_file_large_ds_sid = H5Screate_simple(5, large_dims, NULL);
- VRFY((full_file_large_ds_sid != 0),
- "H5Screate_simple() full_file_large_ds_sid succeeded");
+ VRFY((full_file_large_ds_sid != 0), "H5Screate_simple() full_file_large_ds_sid succeeded");
mem_large_ds_sid = H5Screate_simple(5, large_dims, NULL);
- VRFY((mem_large_ds_sid != 0),
- "H5Screate_simple() mem_large_ds_sid succeeded");
+ VRFY((mem_large_ds_sid != 0), "H5Screate_simple() mem_large_ds_sid succeeded");
file_large_ds_sid = H5Screate_simple(5, large_dims, NULL);
- VRFY((file_large_ds_sid != 0),
- "H5Screate_simple() file_large_ds_sid succeeded");
-
+ VRFY((file_large_ds_sid != 0), "H5Screate_simple() file_large_ds_sid succeeded");
/* Select the entire extent of the full small ds dataspaces */
ret = H5Sselect_all(full_mem_small_ds_sid);
@@ -1793,7 +1637,6 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ret = H5Sselect_all(full_file_small_ds_sid);
VRFY((ret != FAIL), "H5Sselect_all(full_file_small_ds_sid) succeeded");
-
/* Select the entire extent of the full large ds dataspaces */
ret = H5Sselect_all(full_mem_large_ds_sid);
VRFY((ret != FAIL), "H5Sselect_all(full_mem_large_ds_sid) succeeded");
@@ -1801,25 +1644,23 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ret = H5Sselect_all(full_file_large_ds_sid);
VRFY((ret != FAIL), "H5Sselect_all(full_file_large_ds_sid) succeeded");
-
/* if chunk edge size is greater than zero, set up the small and
* large data set creation property lists to specify chunked
* datasets.
*/
- if ( chunk_edge_size > 0 ) {
+ if (chunk_edge_size > 0) {
small_chunk_dims[0] = (hsize_t)(1);
small_chunk_dims[1] = small_chunk_dims[2] = (hsize_t)1;
small_chunk_dims[3] = small_chunk_dims[4] = (hsize_t)chunk_edge_size;
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: small chunk dims[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)small_chunk_dims[0],
- (int)small_chunk_dims[1], (int)small_chunk_dims[2],
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: small chunk dims[] = %d %d %d %d %d\n", fcnName, mpi_rank,
+ (int)small_chunk_dims[0], (int)small_chunk_dims[1], (int)small_chunk_dims[2],
(int)small_chunk_dims[3], (int)small_chunk_dims[4]);
}
-#endif
+#endif
small_ds_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
VRFY((ret != FAIL), "H5Pcreate() small_ds_dcpl_id succeeded");
@@ -1831,18 +1672,16 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
VRFY((ret != FAIL), "H5Pset_chunk() small_ds_dcpl_id succeeded");
large_chunk_dims[0] = (hsize_t)(1);
- large_chunk_dims[1] = large_chunk_dims[2] =
- large_chunk_dims[3] = large_chunk_dims[4] = (hsize_t)chunk_edge_size;
+ large_chunk_dims[1] = large_chunk_dims[2] = large_chunk_dims[3] = large_chunk_dims[4] =
+ (hsize_t)chunk_edge_size;
-
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: large chunk dims[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)large_chunk_dims[0],
- (int)large_chunk_dims[1], (int)large_chunk_dims[2],
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: large chunk dims[] = %d %d %d %d %d\n", fcnName, mpi_rank,
+ (int)large_chunk_dims[0], (int)large_chunk_dims[1], (int)large_chunk_dims[2],
(int)large_chunk_dims[3], (int)large_chunk_dims[4]);
}
-#endif
+#endif
large_ds_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
VRFY((ret != FAIL), "H5Pcreate() large_ds_dcpl_id succeeded");
@@ -1854,30 +1693,23 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
VRFY((ret != FAIL), "H5Pset_chunk() large_ds_dcpl_id succeeded");
}
-
/* create the small dataset */
- small_dataset = H5Dcreate2(fid, "small_dataset", dset_type,
- file_small_ds_sid, H5P_DEFAULT,
+ small_dataset = H5Dcreate2(fid, "small_dataset", dset_type, file_small_ds_sid, H5P_DEFAULT,
small_ds_dcpl_id, H5P_DEFAULT);
VRFY((ret >= 0), "H5Dcreate2() small_dataset succeeded");
-
/* create the large dataset */
- large_dataset = H5Dcreate2(fid, "large_dataset", dset_type,
- file_large_ds_sid, H5P_DEFAULT,
+ large_dataset = H5Dcreate2(fid, "large_dataset", dset_type, file_large_ds_sid, H5P_DEFAULT,
large_ds_dcpl_id, H5P_DEFAULT);
VRFY((ret >= 0), "H5Dcreate2() large_dataset succeeded");
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout,
- "%s:%d: small/large ds id = %d / %d.\n",
- fcnName, mpi_rank, (int)small_dataset,
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: small/large ds id = %d / %d.\n", fcnName, mpi_rank, (int)small_dataset,
(int)large_dataset);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
-
/* setup xfer property list */
xfer_plist = H5Pcreate(H5P_DATASET_XFER);
VRFY((xfer_plist >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded");
@@ -1885,14 +1717,12 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
- if ( ! use_collective_io ) {
+ if (!use_collective_io) {
- ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,
- H5FD_MPIO_INDIVIDUAL_IO);
- VRFY((ret>= 0), "H5Pset_dxpl_mpio_collective_opt() suceeded");
+ ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO);
+ VRFY((ret >= 0), "H5Pset_dxpl_mpio_collective_opt() suceeded");
}
-
/* setup selection to write initial data to the small data sets */
start[0] = (hsize_t)(mpi_rank + 1);
start[1] = start[2] = start[3] = start[4] = 0;
@@ -1906,136 +1736,90 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
block[0] = block[1] = block[2] = 1;
block[3] = block[4] = 10;
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout,
- "%s:%d: settings for small data set initialization.\n",
- fcnName, mpi_rank);
- HDfprintf(stdout, "%s:%d: start[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)start[0], (int)start[1],
- (int)start[2], (int)start[3], (int)start[4]);
- HDfprintf(stdout, "%s:%d: stride[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)stride[0], (int)stride[1],
- (int)stride[2], (int)stride[3], (int)stride[4]);
- HDfprintf(stdout, "%s:%d: count[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)count[0], (int)count[1],
- (int)count[2], (int)count[3], (int)count[4]);
- HDfprintf(stdout, "%s:%d: block[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)block[0], (int)block[1],
- (int)block[2], (int)block[3], (int)block[4]);
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: settings for small data set initialization.\n", fcnName, mpi_rank);
+ HDfprintf(stdout, "%s:%d: start[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)start[0],
+ (int)start[1], (int)start[2], (int)start[3], (int)start[4]);
+ HDfprintf(stdout, "%s:%d: stride[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)stride[0],
+ (int)stride[1], (int)stride[2], (int)stride[3], (int)stride[4]);
+ HDfprintf(stdout, "%s:%d: count[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)count[0],
+ (int)count[1], (int)count[2], (int)count[3], (int)count[4]);
+ HDfprintf(stdout, "%s:%d: block[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)block[0],
+ (int)block[1], (int)block[2], (int)block[3], (int)block[4]);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
/* setup selections for writing initial data to the small data set */
- ret = H5Sselect_hyperslab(mem_small_ds_sid,
- H5S_SELECT_SET,
- start,
- stride,
- count,
- block);
+ ret = H5Sselect_hyperslab(mem_small_ds_sid, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sselect_hyperslab(mem_small_ds_sid, set) suceeded");
- ret = H5Sselect_hyperslab(file_small_ds_sid,
- H5S_SELECT_SET,
- start,
- stride,
- count,
- block);
+ ret = H5Sselect_hyperslab(file_small_ds_sid, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sselect_hyperslab(file_small_ds_sid, set) suceeded");
- if ( MAINPROCESS ) { /* add an additional slice to the selections */
+ if (MAINPROCESS) { /* add an additional slice to the selections */
start[0] = 0;
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout,
- "%s:%d: added settings for main process.\n",
- fcnName, mpi_rank);
- HDfprintf(stdout, "%s:%d: start[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)start[0], (int)start[1],
- (int)start[2], (int)start[3], (int)start[4]);
- HDfprintf(stdout, "%s:%d: stride[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)stride[0], (int)stride[1],
- (int)stride[2], (int)stride[3], (int)stride[4]);
- HDfprintf(stdout, "%s:%d: count[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)count[0], (int)count[1],
- (int)count[2], (int)count[3], (int)count[4]);
- HDfprintf(stdout, "%s:%d: block[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)block[0], (int)block[1],
- (int)block[2], (int)block[3], (int)block[4]);
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: added settings for main process.\n", fcnName, mpi_rank);
+ HDfprintf(stdout, "%s:%d: start[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)start[0],
+ (int)start[1], (int)start[2], (int)start[3], (int)start[4]);
+ HDfprintf(stdout, "%s:%d: stride[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)stride[0],
+ (int)stride[1], (int)stride[2], (int)stride[3], (int)stride[4]);
+ HDfprintf(stdout, "%s:%d: count[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)count[0],
+ (int)count[1], (int)count[2], (int)count[3], (int)count[4]);
+ HDfprintf(stdout, "%s:%d: block[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)block[0],
+ (int)block[1], (int)block[2], (int)block[3], (int)block[4]);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
- ret = H5Sselect_hyperslab(mem_small_ds_sid,
- H5S_SELECT_OR,
- start,
- stride,
- count,
- block);
- VRFY((ret>= 0), "H5Sselect_hyperslab(mem_small_ds_sid, or) suceeded");
-
- ret = H5Sselect_hyperslab(file_small_ds_sid,
- H5S_SELECT_OR,
- start,
- stride,
- count,
- block);
- VRFY((ret>= 0), "H5Sselect_hyperslab(file_small_ds_sid, or) suceeded");
- }
+ ret = H5Sselect_hyperslab(mem_small_ds_sid, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(mem_small_ds_sid, or) suceeded");
- check = H5Sselect_valid(mem_small_ds_sid);
- VRFY((check == TRUE),"H5Sselect_valid(mem_small_ds_sid) returns TRUE");
+ ret = H5Sselect_hyperslab(file_small_ds_sid, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(file_small_ds_sid, or) suceeded");
+ }
- check = H5Sselect_valid(file_small_ds_sid);
- VRFY((check == TRUE),"H5Sselect_valid(file_small_ds_sid) returns TRUE");
+ check = H5Sselect_valid(mem_small_ds_sid);
+ VRFY((check == TRUE), "H5Sselect_valid(mem_small_ds_sid) returns TRUE");
+ check = H5Sselect_valid(file_small_ds_sid);
+ VRFY((check == TRUE), "H5Sselect_valid(file_small_ds_sid) returns TRUE");
/* write the initial value of the small data set to file */
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: writing init value of small ds to file.\n",
- fcnName, mpi_rank);
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: writing init value of small ds to file.\n", fcnName, mpi_rank);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
- ret = H5Dwrite(small_dataset,
- dset_type,
- mem_small_ds_sid,
- file_small_ds_sid,
- xfer_plist,
- small_ds_buf_0);
+ ret = H5Dwrite(small_dataset, dset_type, mem_small_ds_sid, file_small_ds_sid, xfer_plist, small_ds_buf_0);
VRFY((ret >= 0), "H5Dwrite() small_dataset initial write succeeded");
-
- /* read the small data set back to verify that it contains the
- * expected data. Note that each process reads in the entire
+ /* read the small data set back to verify that it contains the
+ * expected data. Note that each process reads in the entire
* data set and verifies it.
*/
- ret = H5Dread(small_dataset,
- H5T_NATIVE_UINT32,
- full_mem_small_ds_sid,
- full_file_small_ds_sid,
- xfer_plist,
+ ret = H5Dread(small_dataset, H5T_NATIVE_UINT32, full_mem_small_ds_sid, full_file_small_ds_sid, xfer_plist,
small_ds_buf_1);
VRFY((ret >= 0), "H5Dread() small_dataset initial read succeeded");
-
/* sync with the other processes before checking data */
mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after small dataset writes");
-
+ VRFY((mrc == MPI_SUCCESS), "Sync after small dataset writes");
/* verify that the correct data was written to the small data set,
* and reset the buffer to zero in passing.
*/
expected_value = 0;
- mis_match = FALSE;
- ptr_1 = small_ds_buf_1;
+ mis_match = FALSE;
+ ptr_1 = small_ds_buf_1;
i = 0;
- for ( i = 0; i < (int)small_ds_size; i++ ) {
+ for (i = 0; i < (int)small_ds_size; i++) {
- if ( *ptr_1 != expected_value ) {
+ if (*ptr_1 != expected_value) {
mis_match = TRUE;
}
@@ -2045,9 +1829,7 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ptr_1++;
expected_value++;
}
- VRFY( (mis_match == FALSE), "small ds init data good.");
-
-
+ VRFY((mis_match == FALSE), "small ds init data good.");
/* setup selections for writing initial data to the large data set */
start[0] = (hsize_t)(mpi_rank + 1);
@@ -2061,110 +1843,70 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
block[0] = (hsize_t)1;
block[1] = block[2] = block[3] = block[4] = (hsize_t)10;
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout,
- "%s:%d: settings for large data set initialization.\n",
- fcnName, mpi_rank);
- HDfprintf(stdout, "%s:%d: start[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)start[0], (int)start[1],
- (int)start[2], (int)start[3], (int)start[4]);
- HDfprintf(stdout, "%s:%d: stride[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)stride[0], (int)stride[1],
- (int)stride[2], (int)stride[3], (int)stride[4]);
- HDfprintf(stdout, "%s:%d: count[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)count[0], (int)count[1],
- (int)count[2], (int)count[3], (int)count[4]);
- HDfprintf(stdout, "%s:%d: block[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)block[0], (int)block[1],
- (int)block[2], (int)block[3], (int)block[4]);
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: settings for large data set initialization.\n", fcnName, mpi_rank);
+ HDfprintf(stdout, "%s:%d: start[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)start[0],
+ (int)start[1], (int)start[2], (int)start[3], (int)start[4]);
+ HDfprintf(stdout, "%s:%d: stride[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)stride[0],
+ (int)stride[1], (int)stride[2], (int)stride[3], (int)stride[4]);
+ HDfprintf(stdout, "%s:%d: count[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)count[0],
+ (int)count[1], (int)count[2], (int)count[3], (int)count[4]);
+ HDfprintf(stdout, "%s:%d: block[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)block[0],
+ (int)block[1], (int)block[2], (int)block[3], (int)block[4]);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
- ret = H5Sselect_hyperslab(mem_large_ds_sid,
- H5S_SELECT_SET,
- start,
- stride,
- count,
- block);
+ ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sselect_hyperslab(mem_large_ds_sid, set) suceeded");
- ret = H5Sselect_hyperslab(file_large_ds_sid,
- H5S_SELECT_SET,
- start,
- stride,
- count,
- block);
+ ret = H5Sselect_hyperslab(file_large_ds_sid, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sselect_hyperslab(file_large_ds_sid, set) suceeded");
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout,
- "%s%d: H5Sget_select_npoints(mem_large_ds_sid) = %d.\n",
- fcnName, mpi_rank,
- (int)H5Sget_select_npoints(mem_large_ds_sid));
- HDfprintf(stdout,
- "%s%d: H5Sget_select_npoints(file_large_ds_sid) = %d.\n",
- fcnName, mpi_rank,
- (int)H5Sget_select_npoints(file_large_ds_sid));
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s%d: H5Sget_select_npoints(mem_large_ds_sid) = %d.\n", fcnName, mpi_rank,
+ (int)H5Sget_select_npoints(mem_large_ds_sid));
+ HDfprintf(stdout, "%s%d: H5Sget_select_npoints(file_large_ds_sid) = %d.\n", fcnName, mpi_rank,
+ (int)H5Sget_select_npoints(file_large_ds_sid));
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
- if ( MAINPROCESS ) { /* add an additional slice to the selections */
+ if (MAINPROCESS) { /* add an additional slice to the selections */
start[0] = (hsize_t)0;
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout,
- "%s:%d: added settings for main process.\n",
- fcnName, mpi_rank);
- HDfprintf(stdout, "%s:%d: start[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)start[0], (int)start[1],
- (int)start[2], (int)start[3], (int)start[4]);
- HDfprintf(stdout, "%s:%d: stride[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)stride[0], (int)stride[1],
- (int)stride[2], (int)stride[3], (int)stride[4]);
- HDfprintf(stdout, "%s:%d: count[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)count[0], (int)count[1],
- (int)count[2], (int)count[3], (int)count[4]);
- HDfprintf(stdout, "%s:%d: block[] = %d %d %d %d %d\n",
- fcnName, mpi_rank, (int)block[0], (int)block[1],
- (int)block[2], (int)block[3], (int)block[4]);
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: added settings for main process.\n", fcnName, mpi_rank);
+ HDfprintf(stdout, "%s:%d: start[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)start[0],
+ (int)start[1], (int)start[2], (int)start[3], (int)start[4]);
+ HDfprintf(stdout, "%s:%d: stride[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)stride[0],
+ (int)stride[1], (int)stride[2], (int)stride[3], (int)stride[4]);
+ HDfprintf(stdout, "%s:%d: count[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)count[0],
+ (int)count[1], (int)count[2], (int)count[3], (int)count[4]);
+ HDfprintf(stdout, "%s:%d: block[] = %d %d %d %d %d\n", fcnName, mpi_rank, (int)block[0],
+ (int)block[1], (int)block[2], (int)block[3], (int)block[4]);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
- ret = H5Sselect_hyperslab(mem_large_ds_sid,
- H5S_SELECT_OR,
- start,
- stride,
- count,
- block);
- VRFY((ret>= 0), "H5Sselect_hyperslab(mem_large_ds_sid, or) suceeded");
-
- ret = H5Sselect_hyperslab(file_large_ds_sid,
- H5S_SELECT_OR,
- start,
- stride,
- count,
- block);
- VRFY((ret>= 0), "H5Sselect_hyperslab(file_large_ds_sid, or) suceeded");
-
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout,
- "%s%d: H5Sget_select_npoints(mem_large_ds_sid) = %d.\n",
- fcnName, mpi_rank,
- (int)H5Sget_select_npoints(mem_large_ds_sid));
- HDfprintf(stdout,
- "%s%d: H5Sget_select_npoints(file_large_ds_sid) = %d.\n",
- fcnName, mpi_rank,
- (int)H5Sget_select_npoints(file_large_ds_sid));
+ ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(mem_large_ds_sid, or) suceeded");
+
+ ret = H5Sselect_hyperslab(file_large_ds_sid, H5S_SELECT_OR, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sselect_hyperslab(file_large_ds_sid, or) suceeded");
+
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s%d: H5Sget_select_npoints(mem_large_ds_sid) = %d.\n", fcnName, mpi_rank,
+ (int)H5Sget_select_npoints(mem_large_ds_sid));
+ HDfprintf(stdout, "%s%d: H5Sget_select_npoints(file_large_ds_sid) = %d.\n", fcnName, mpi_rank,
+ (int)H5Sget_select_npoints(file_large_ds_sid));
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
}
- /* try clipping the selection back to the large data space proper */
+ /* try clipping the selection back to the large dataspace proper */
start[0] = start[1] = start[2] = start[3] = start[4] = (hsize_t)0;
stride[0] = (hsize_t)(2 * (mpi_size + 1));
@@ -2175,93 +1917,70 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
block[0] = (hsize_t)(mpi_size + 1);
block[1] = block[2] = block[3] = block[4] = (hsize_t)10;
- ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_AND,
- start, stride, count, block);
- VRFY((ret != FAIL),"H5Sselect_hyperslab(mem_large_ds_sid, and) succeeded");
+ ret = H5Sselect_hyperslab(mem_large_ds_sid, H5S_SELECT_AND, start, stride, count, block);
+ VRFY((ret != FAIL), "H5Sselect_hyperslab(mem_large_ds_sid, and) succeeded");
- ret = H5Sselect_hyperslab(file_large_ds_sid, H5S_SELECT_AND,
- start, stride, count, block);
- VRFY((ret != FAIL),"H5Sselect_hyperslab(file_large_ds_sid, and) succeeded");
+ ret = H5Sselect_hyperslab(file_large_ds_sid, H5S_SELECT_AND, start, stride, count, block);
+ VRFY((ret != FAIL), "H5Sselect_hyperslab(file_large_ds_sid, and) succeeded");
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
rank = H5Sget_simple_extent_dims(mem_large_ds_sid, dims, max_dims);
- HDfprintf(stdout,
- "%s:%d: mem_large_ds_sid dims[%d] = %d %d %d %d %d\n",
- fcnName, mpi_rank, rank, (int)dims[0], (int)dims[1],
- (int)dims[2], (int)dims[3], (int)dims[4]);
+ HDfprintf(stdout, "%s:%d: mem_large_ds_sid dims[%d] = %d %d %d %d %d\n", fcnName, mpi_rank, rank,
+ (int)dims[0], (int)dims[1], (int)dims[2], (int)dims[3], (int)dims[4]);
rank = H5Sget_simple_extent_dims(file_large_ds_sid, dims, max_dims);
- HDfprintf(stdout,
- "%s:%d: file_large_ds_sid dims[%d] = %d %d %d %d %d\n",
- fcnName, mpi_rank, rank, (int)dims[0], (int)dims[1],
- (int)dims[2], (int)dims[3], (int)dims[4]);
+ HDfprintf(stdout, "%s:%d: file_large_ds_sid dims[%d] = %d %d %d %d %d\n", fcnName, mpi_rank, rank,
+ (int)dims[0], (int)dims[1], (int)dims[2], (int)dims[3], (int)dims[4]);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
- check = H5Sselect_valid(mem_large_ds_sid);
- VRFY((check == TRUE),"H5Sselect_valid(mem_large_ds_sid) returns TRUE");
-
- check = H5Sselect_valid(file_large_ds_sid);
- VRFY((check == TRUE),"H5Sselect_valid(file_large_ds_sid) returns TRUE");
+ check = H5Sselect_valid(mem_large_ds_sid);
+ VRFY((check == TRUE), "H5Sselect_valid(mem_large_ds_sid) returns TRUE");
+ check = H5Sselect_valid(file_large_ds_sid);
+ VRFY((check == TRUE), "H5Sselect_valid(file_large_ds_sid) returns TRUE");
/* write the initial value of the large data set to file */
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: writing init value of large ds to file.\n",
- fcnName, mpi_rank);
- HDfprintf(stdout,
- "%s:%d: large_dataset = %d.\n",
- fcnName, mpi_rank,
- (int)large_dataset);
- HDfprintf(stdout,
- "%s:%d: mem_large_ds_sid = %d, file_large_ds_sid = %d.\n",
- fcnName, mpi_rank,
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: writing init value of large ds to file.\n", fcnName, mpi_rank);
+ HDfprintf(stdout, "%s:%d: large_dataset = %d.\n", fcnName, mpi_rank, (int)large_dataset);
+ HDfprintf(stdout, "%s:%d: mem_large_ds_sid = %d, file_large_ds_sid = %d.\n", fcnName, mpi_rank,
(int)mem_large_ds_sid, (int)file_large_ds_sid);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
- ret = H5Dwrite(large_dataset,
- dset_type,
- mem_large_ds_sid,
- file_large_ds_sid,
- xfer_plist,
- large_ds_buf_0);
+ ret = H5Dwrite(large_dataset, dset_type, mem_large_ds_sid, file_large_ds_sid, xfer_plist, large_ds_buf_0);
- if ( ret < 0 ) H5Eprint2(H5E_DEFAULT, stderr);
+ if (ret < 0)
+ H5Eprint2(H5E_DEFAULT, stderr);
VRFY((ret >= 0), "H5Dwrite() large_dataset initial write succeeded");
-
/* sync with the other processes before checking data */
mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after large dataset writes");
+ VRFY((mrc == MPI_SUCCESS), "Sync after large dataset writes");
- /* read the large data set back to verify that it contains the
- * expected data. Note that each process reads in the entire
+ /* read the large data set back to verify that it contains the
+ * expected data. Note that each process reads in the entire
* data set.
*/
- ret = H5Dread(large_dataset,
- H5T_NATIVE_UINT32,
- full_mem_large_ds_sid,
- full_file_large_ds_sid,
- xfer_plist,
+ ret = H5Dread(large_dataset, H5T_NATIVE_UINT32, full_mem_large_ds_sid, full_file_large_ds_sid, xfer_plist,
large_ds_buf_1);
VRFY((ret >= 0), "H5Dread() large_dataset initial read succeeded");
-
/* verify that the correct data was written to the large data set.
* in passing, reset the buffer to zeros
*/
expected_value = 0;
- mis_match = FALSE;
- ptr_1 = large_ds_buf_1;
+ mis_match = FALSE;
+ ptr_1 = large_ds_buf_1;
i = 0;
- for ( i = 0; i < (int)large_ds_size; i++ ) {
+ for (i = 0; i < (int)large_ds_size; i++) {
- if ( *ptr_1 != expected_value ) {
+ if (*ptr_1 != expected_value) {
mis_match = TRUE;
}
@@ -2271,72 +1990,53 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ptr_1++;
expected_value++;
}
- VRFY( (mis_match == FALSE), "large ds init data good.");
+ VRFY((mis_match == FALSE), "large ds init data good.");
/***********************************/
/***** INITIALIZATION COMPLETE *****/
/***********************************/
-
- /* read a checkerboard selection of the process slice of the
- * small on disk data set into the process slice of the large
+ /* read a checkerboard selection of the process slice of the
+ * small on disk data set into the process slice of the large
* in memory data set, and verify the data read.
*/
small_sel_start[0] = (hsize_t)(mpi_rank + 1);
- small_sel_start[1] = small_sel_start[2] =
- small_sel_start[3] = small_sel_start[4] = 0;
-
- lower_dim_size_comp_test__select_checker_board(mpi_rank,
- file_small_ds_sid,
- /* tgt_rank = */ 5,
- small_dims,
- /* checker_edge_size = */ 3,
- /* sel_rank */ 2,
- small_sel_start);
-
- expected_value = (uint32_t)
- ((small_sel_start[0] * small_dims[1] * small_dims[2] *
- small_dims[3] * small_dims[4]) +
- (small_sel_start[1] * small_dims[2] * small_dims[3] *
- small_dims[4]) +
- (small_sel_start[2] * small_dims[3] * small_dims[4]) +
- (small_sel_start[3] * small_dims[4]) +
- (small_sel_start[4]));
+ small_sel_start[1] = small_sel_start[2] = small_sel_start[3] = small_sel_start[4] = 0;
+ lower_dim_size_comp_test__select_checker_board(mpi_rank, file_small_ds_sid,
+ /* tgt_rank = */ 5, small_dims,
+ /* checker_edge_size = */ 3,
+ /* sel_rank */ 2, small_sel_start);
+
+ expected_value =
+ (uint32_t)((small_sel_start[0] * small_dims[1] * small_dims[2] * small_dims[3] * small_dims[4]) +
+ (small_sel_start[1] * small_dims[2] * small_dims[3] * small_dims[4]) +
+ (small_sel_start[2] * small_dims[3] * small_dims[4]) +
+ (small_sel_start[3] * small_dims[4]) + (small_sel_start[4]));
large_sel_start[0] = (hsize_t)(mpi_rank + 1);
large_sel_start[1] = 5;
large_sel_start[2] = large_sel_start[3] = large_sel_start[4] = 0;
- lower_dim_size_comp_test__select_checker_board(mpi_rank,
- mem_large_ds_sid,
- /* tgt_rank = */ 5,
- large_dims,
- /* checker_edge_size = */ 3,
- /* sel_rank = */ 2,
- large_sel_start);
-
+ lower_dim_size_comp_test__select_checker_board(mpi_rank, mem_large_ds_sid,
+ /* tgt_rank = */ 5, large_dims,
+ /* checker_edge_size = */ 3,
+ /* sel_rank = */ 2, large_sel_start);
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(mem_large_ds_sid,
- file_small_ds_sid);
+ check = H5S_select_shape_same_test(mem_large_ds_sid, file_small_ds_sid);
VRFY((check == TRUE), "H5S_select_shape_same_test passed (1)");
-
- ret = H5Dread(small_dataset,
- H5T_NATIVE_UINT32,
- mem_large_ds_sid,
- file_small_ds_sid,
- xfer_plist,
+ ret = H5Dread(small_dataset, H5T_NATIVE_UINT32, mem_large_ds_sid, file_small_ds_sid, xfer_plist,
large_ds_buf_1);
VRFY((ret >= 0), "H5Sread() slice from small ds succeeded.");
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
HDfprintf(stdout, "%s:%d: H5Dread() returns.\n", fcnName, mpi_rank);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
@@ -2345,28 +2045,25 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
data_ok = TRUE;
- start_index = (int)((large_sel_start[0] * large_dims[1] * large_dims[2] *
- large_dims[3] * large_dims[4]) +
- (large_sel_start[1] * large_dims[2] * large_dims[3] *
- large_dims[4]) +
+ start_index = (int)((large_sel_start[0] * large_dims[1] * large_dims[2] * large_dims[3] * large_dims[4]) +
+ (large_sel_start[1] * large_dims[2] * large_dims[3] * large_dims[4]) +
(large_sel_start[2] * large_dims[3] * large_dims[4]) +
- (large_sel_start[3] * large_dims[4]) +
- (large_sel_start[4]));
+ (large_sel_start[3] * large_dims[4]) + (large_sel_start[4]));
- stop_index = start_index + (int)small_ds_slice_size;
+ stop_index = start_index + (int)small_ds_slice_size;
- HDassert( 0 <= start_index );
- HDassert( start_index < stop_index );
- HDassert( stop_index <= (int)large_ds_size );
+ HDassert(0 <= start_index);
+ HDassert(start_index < stop_index);
+ HDassert(stop_index <= (int)large_ds_size);
ptr_1 = large_ds_buf_1;
- for ( i = 0; i < start_index; i++ ) {
+ for (i = 0; i < start_index; i++) {
- if ( *ptr_1 != (uint32_t)0 ) {
+ if (*ptr_1 != (uint32_t)0) {
data_ok = FALSE;
- *ptr_1 = (uint32_t)0;
+ *ptr_1 = (uint32_t)0;
}
ptr_1++;
@@ -2374,16 +2071,14 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
VRFY((data_ok == TRUE), "slice read from small ds data good(1).");
-
data_ok = lower_dim_size_comp_test__verify_data(ptr_1,
#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
- mpi_rank,
+ mpi_rank,
#endif /* LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG */
- /* rank */ 2,
- /* edge_size */ 10,
- /* checker_edge_size */ 3,
- expected_value,
- /* buf_starts_in_checker */ TRUE);
+ /* rank */ 2,
+ /* edge_size */ 10,
+ /* checker_edge_size */ 3, expected_value,
+ /* buf_starts_in_checker */ TRUE);
VRFY((data_ok == TRUE), "slice read from small ds data good(2).");
@@ -2391,13 +2086,12 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ptr_1 += small_ds_slice_size;
+ for (i = stop_index; i < (int)large_ds_size; i++) {
- for ( i = stop_index; i < (int)large_ds_size; i++ ) {
-
- if ( *ptr_1 != (uint32_t)0 ) {
+ if (*ptr_1 != (uint32_t)0) {
data_ok = FALSE;
- *ptr_1 = (uint32_t)0;
+ *ptr_1 = (uint32_t)0;
}
ptr_1++;
@@ -2405,59 +2099,41 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
VRFY((data_ok == TRUE), "slice read from small ds data good(3).");
-
-
-
-
- /* read a checkerboard selection of a slice of the process slice of
- * the large on disk data set into the process slice of the small
+ /* read a checkerboard selection of a slice of the process slice of
+ * the large on disk data set into the process slice of the small
* in memory data set, and verify the data read.
*/
small_sel_start[0] = (hsize_t)(mpi_rank + 1);
- small_sel_start[1] = small_sel_start[2] =
- small_sel_start[3] = small_sel_start[4] = 0;
+ small_sel_start[1] = small_sel_start[2] = small_sel_start[3] = small_sel_start[4] = 0;
- lower_dim_size_comp_test__select_checker_board(mpi_rank,
- mem_small_ds_sid,
- /* tgt_rank = */ 5,
- small_dims,
- /* checker_edge_size = */ 3,
- /* sel_rank */ 2,
- small_sel_start);
+ lower_dim_size_comp_test__select_checker_board(mpi_rank, mem_small_ds_sid,
+ /* tgt_rank = */ 5, small_dims,
+ /* checker_edge_size = */ 3,
+ /* sel_rank */ 2, small_sel_start);
large_sel_start[0] = (hsize_t)(mpi_rank + 1);
large_sel_start[1] = 5;
large_sel_start[2] = large_sel_start[3] = large_sel_start[4] = 0;
- lower_dim_size_comp_test__select_checker_board(mpi_rank,
- file_large_ds_sid,
- /* tgt_rank = */ 5,
- large_dims,
- /* checker_edge_size = */ 3,
- /* sel_rank = */ 2,
- large_sel_start);
-
+ lower_dim_size_comp_test__select_checker_board(mpi_rank, file_large_ds_sid,
+ /* tgt_rank = */ 5, large_dims,
+ /* checker_edge_size = */ 3,
+ /* sel_rank = */ 2, large_sel_start);
/* verify that H5S_select_shape_same() reports the two
* selections as having the same shape.
*/
- check = H5S_select_shape_same_test(mem_small_ds_sid,
- file_large_ds_sid);
+ check = H5S_select_shape_same_test(mem_small_ds_sid, file_large_ds_sid);
VRFY((check == TRUE), "H5S_select_shape_same_test passed (2)");
-
- ret = H5Dread(large_dataset,
- H5T_NATIVE_UINT32,
- mem_small_ds_sid,
- file_large_ds_sid,
- xfer_plist,
+ ret = H5Dread(large_dataset, H5T_NATIVE_UINT32, mem_small_ds_sid, file_large_ds_sid, xfer_plist,
small_ds_buf_1);
VRFY((ret >= 0), "H5Sread() slice from large ds succeeded.");
-#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
+#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
HDfprintf(stdout, "%s:%d: H5Dread() returns.\n", fcnName, mpi_rank);
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */
@@ -2466,31 +2142,28 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
data_ok = TRUE;
- expected_value = (uint32_t)
- ((large_sel_start[0] * large_dims[1] * large_dims[2] *
- large_dims[3] * large_dims[4]) +
- (large_sel_start[1] * large_dims[2] * large_dims[3] *
- large_dims[4]) +
- (large_sel_start[2] * large_dims[3] * large_dims[4]) +
- (large_sel_start[3] * large_dims[4]) +
- (large_sel_start[4]));
+ expected_value =
+ (uint32_t)((large_sel_start[0] * large_dims[1] * large_dims[2] * large_dims[3] * large_dims[4]) +
+ (large_sel_start[1] * large_dims[2] * large_dims[3] * large_dims[4]) +
+ (large_sel_start[2] * large_dims[3] * large_dims[4]) +
+ (large_sel_start[3] * large_dims[4]) + (large_sel_start[4]));
start_index = (int)(mpi_rank + 1) * (int)small_ds_slice_size;
- stop_index = start_index + (int)small_ds_slice_size;
+ stop_index = start_index + (int)small_ds_slice_size;
- HDassert( 0 <= start_index );
- HDassert( start_index < stop_index );
- HDassert( stop_index <= (int)small_ds_size );
+ HDassert(0 <= start_index);
+ HDassert(start_index < stop_index);
+ HDassert(stop_index <= (int)small_ds_size);
ptr_1 = small_ds_buf_1;
- for ( i = 0; i < start_index; i++ ) {
+ for (i = 0; i < start_index; i++) {
- if ( *ptr_1 != (uint32_t)0 ) {
+ if (*ptr_1 != (uint32_t)0) {
data_ok = FALSE;
- *ptr_1 = (uint32_t)0;
+ *ptr_1 = (uint32_t)0;
}
ptr_1++;
@@ -2498,15 +2171,13 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
VRFY((data_ok == TRUE), "slice read from large ds data good(1).");
-
data_ok = lower_dim_size_comp_test__verify_data(ptr_1,
#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
mpi_rank,
#endif /* LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG */
/* rank */ 2,
/* edge_size */ 10,
- /* checker_edge_size */ 3,
- expected_value,
+ /* checker_edge_size */ 3, expected_value,
/* buf_starts_in_checker */ TRUE);
VRFY((data_ok == TRUE), "slice read from large ds data good(2).");
@@ -2515,20 +2186,19 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ptr_1 += small_ds_slice_size;
+ for (i = stop_index; i < (int)small_ds_size; i++) {
- for ( i = stop_index; i < (int)small_ds_size; i++ ) {
-
- if ( *ptr_1 != (uint32_t)0 ) {
+ if (*ptr_1 != (uint32_t)0) {
#if LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG
- if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) {
- HDfprintf(stdout, "%s:%d: unexpected value at index %d: %d.\n",
- fcnName, mpi_rank, (int)i, (int)(*ptr_1));
+ if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) {
+ HDfprintf(stdout, "%s:%d: unexpected value at index %d: %d.\n", fcnName, mpi_rank, (int)i,
+ (int)(*ptr_1));
}
#endif /* LOWER_DIM_SIZE_COMP_TEST__VERIFY_DATA__DEBUG */
data_ok = FALSE;
- *ptr_1 = (uint32_t)0;
+ *ptr_1 = (uint32_t)0;
}
ptr_1++;
@@ -2536,7 +2206,6 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
VRFY((data_ok == TRUE), "slice read from large ds data good(3).");
-
/* Close dataspaces */
ret = H5Sclose(full_mem_small_ds_sid);
VRFY((ret != FAIL), "H5Sclose(full_mem_small_ds_sid) succeeded");
@@ -2550,7 +2219,6 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ret = H5Sclose(file_small_ds_sid);
VRFY((ret != FAIL), "H5Sclose(file_small_ds_sid) succeeded");
-
ret = H5Sclose(full_mem_large_ds_sid);
VRFY((ret != FAIL), "H5Sclose(full_mem_large_ds_sid) succeeded");
@@ -2563,7 +2231,6 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ret = H5Sclose(file_large_ds_sid);
VRFY((ret != FAIL), "H5Sclose(file_large_ds_sid) succeeded");
-
/* Close Datasets */
ret = H5Dclose(small_dataset);
VRFY((ret != FAIL), "H5Dclose(small_dataset) succeeded");
@@ -2571,36 +2238,36 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size,
ret = H5Dclose(large_dataset);
VRFY((ret != FAIL), "H5Dclose(large_dataset) succeeded");
-
/* close the file collectively */
MESG("about to close file.");
ret = H5Fclose(fid);
VRFY((ret != FAIL), "file close succeeded");
/* Free memory buffers */
- if ( small_ds_buf_0 != NULL ) HDfree(small_ds_buf_0);
- if ( small_ds_buf_1 != NULL ) HDfree(small_ds_buf_1);
+ if (small_ds_buf_0 != NULL)
+ HDfree(small_ds_buf_0);
+ if (small_ds_buf_1 != NULL)
+ HDfree(small_ds_buf_1);
- if ( large_ds_buf_0 != NULL ) HDfree(large_ds_buf_0);
- if ( large_ds_buf_1 != NULL ) HDfree(large_ds_buf_1);
+ if (large_ds_buf_0 != NULL)
+ HDfree(large_ds_buf_0);
+ if (large_ds_buf_1 != NULL)
+ HDfree(large_ds_buf_1);
return;
} /* lower_dim_size_comp_test__run_test() */
-
/*-------------------------------------------------------------------------
- * Function: lower_dim_size_comp_test()
- *
- * Purpose: Test to see if an error in the computation of the size
- * of the lower dimensions in H5S_obtain_datatype() has
- * been corrected.
+ * Function: lower_dim_size_comp_test()
*
- * Return: void
+ * Purpose: Test to see if an error in the computation of the size
+ * of the lower dimensions in H5S_obtain_datatype() has
+ * been corrected.
*
- * Programmer: JRM -- 11/11/09
+ * Return: void
*
- * Modifications:
+ * Programmer: JRM -- 11/11/09
*
*-------------------------------------------------------------------------
*/
@@ -2609,107 +2276,92 @@ void
lower_dim_size_comp_test(void)
{
/* const char *fcnName = "lower_dim_size_comp_test()"; */
- int chunk_edge_size = 0;
- int use_collective_io = 1;
- hid_t dset_type = H5T_NATIVE_UINT;
-#if 0
- sleep(60);
-#endif
- HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned));
- for ( use_collective_io = (hbool_t)0;
- (int)use_collective_io <= 1;
- (hbool_t)(use_collective_io++) ) {
+ int chunk_edge_size = 0;
+ int use_collective_io;
+ HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned));
+ for (use_collective_io = 0; use_collective_io <= 1; use_collective_io++) {
chunk_edge_size = 0;
- lower_dim_size_comp_test__run_test(chunk_edge_size,
- (hbool_t)use_collective_io,
- dset_type);
-
+ lower_dim_size_comp_test__run_test(chunk_edge_size, (hbool_t)use_collective_io, H5T_NATIVE_UINT);
chunk_edge_size = 5;
- lower_dim_size_comp_test__run_test(chunk_edge_size,
- (hbool_t)use_collective_io,
- dset_type);
- }
+ lower_dim_size_comp_test__run_test(chunk_edge_size, (hbool_t)use_collective_io, H5T_NATIVE_UINT);
+ } /* end for */
return;
-
} /* lower_dim_size_comp_test() */
-
/*-------------------------------------------------------------------------
- * Function: link_chunk_collective_io_test()
+ * Function: link_chunk_collective_io_test()
*
- * Purpose: Test to verify that an error in MPI type management in
- * H5D_link_chunk_collective_io() has been corrected.
- * In this bug, we used to free MPI types regardless of
- * whether they were basic or derived.
+ * Purpose: Test to verify that an error in MPI type management in
+ * H5D_link_chunk_collective_io() has been corrected.
+ * In this bug, we used to free MPI types regardless of
+ * whether they were basic or derived.
*
- * This test is based on a bug report kindly provided by
- * Rob Latham of the MPICH team and ANL.
+ * This test is based on a bug report kindly provided by
+ * Rob Latham of the MPICH team and ANL.
*
- * The basic thrust of the test is to cause a process
- * to participate in a collective I/O in which it:
+ * The basic thrust of the test is to cause a process
+ * to participate in a collective I/O in which it:
*
- * 1) Reads or writes exactly one chunk,
+ * 1) Reads or writes exactly one chunk,
*
- * 2) Has no in memory buffer for any other chunk.
+ * 2) Has no in memory buffer for any other chunk.
*
- * The test differers from Rob Latham's bug report in
- * that is runs with an arbitrary number of proceeses,
- * and uses a 1 dimensional dataset.
+ * The test differers from Rob Latham's bug report in
+ * that is runs with an arbitrary number of proceeses,
+ * and uses a 1 dimensional dataset.
*
- * Return: void
+ * Return: void
*
- * Programmer: JRM -- 12/16/09
- *
- * Modifications:
+ * Programmer: JRM -- 12/16/09
*
*-------------------------------------------------------------------------
*/
-#define LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE 16
+#define LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE 16
void
link_chunk_collective_io_test(void)
{
/* const char *fcnName = "link_chunk_collective_io_test()"; */
const char *filename;
- hbool_t mis_match = FALSE;
- int i;
- int mrc;
- int mpi_rank;
- int mpi_size;
- MPI_Comm mpi_comm = MPI_COMM_WORLD;
- MPI_Info mpi_info = MPI_INFO_NULL;
- hsize_t count[1] = {1};
- hsize_t stride[1] = {2 * LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE};
- hsize_t block[1] = {LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE};
- hsize_t start[1];
- hsize_t dims[1];
- hsize_t chunk_dims[1] = {LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE};
- herr_t ret; /* Generic return value */
- hid_t file_id;
- hid_t acc_tpl;
- hid_t dset_id;
- hid_t file_ds_sid;
- hid_t write_mem_ds_sid;
- hid_t read_mem_ds_sid;
- hid_t ds_dcpl_id;
- hid_t xfer_plist;
- double diff;
- double expected_value;
- double local_data_written[LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE];
- double local_data_read[LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE];
+ hbool_t mis_match = FALSE;
+ int i;
+ int mrc;
+ int mpi_rank;
+ int mpi_size;
+ MPI_Comm mpi_comm = MPI_COMM_WORLD;
+ MPI_Info mpi_info = MPI_INFO_NULL;
+ hsize_t count[1] = {1};
+ hsize_t stride[1] = {2 * LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE};
+ hsize_t block[1] = {LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE};
+ hsize_t start[1];
+ hsize_t dims[1];
+ hsize_t chunk_dims[1] = {LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE};
+ herr_t ret; /* Generic return value */
+ hid_t file_id;
+ hid_t acc_tpl;
+ hid_t dset_id;
+ hid_t file_ds_sid;
+ hid_t write_mem_ds_sid;
+ hid_t read_mem_ds_sid;
+ hid_t ds_dcpl_id;
+ hid_t xfer_plist;
+ double diff;
+ double expected_value;
+ double local_data_written[LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE];
+ double local_data_read[LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE];
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- HDassert( mpi_size > 0 );
+ HDassert(mpi_size > 0);
/* get the file name */
filename = (const char *)GetTestParameters();
- HDassert( filename != NULL );
+ HDassert(filename != NULL);
/* setup file access template */
acc_tpl = create_faccess_plist(mpi_comm, mpi_info, facc_type);
@@ -2728,18 +2380,15 @@ link_chunk_collective_io_test(void)
/* setup dims */
dims[0] = ((hsize_t)mpi_size) * ((hsize_t)(LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE));
- /* setup mem and file data spaces */
+ /* setup mem and file dataspaces */
write_mem_ds_sid = H5Screate_simple(1, chunk_dims, NULL);
- VRFY((write_mem_ds_sid != 0),
- "H5Screate_simple() write_mem_ds_sid succeeded");
+ VRFY((write_mem_ds_sid != 0), "H5Screate_simple() write_mem_ds_sid succeeded");
read_mem_ds_sid = H5Screate_simple(1, chunk_dims, NULL);
- VRFY((read_mem_ds_sid != 0),
- "H5Screate_simple() read_mem_ds_sid succeeded");
+ VRFY((read_mem_ds_sid != 0), "H5Screate_simple() read_mem_ds_sid succeeded");
file_ds_sid = H5Screate_simple(1, dims, NULL);
- VRFY((file_ds_sid != 0),
- "H5Screate_simple() file_ds_sid succeeded");
+ VRFY((file_ds_sid != 0), "H5Screate_simple() file_ds_sid succeeded");
/* setup data set creation property list */
ds_dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
@@ -2752,9 +2401,8 @@ link_chunk_collective_io_test(void)
VRFY((ret != FAIL), "H5Pset_chunk() small_ds_dcpl_id succeeded");
/* create the data set */
- dset_id = H5Dcreate2(file_id, "dataset", H5T_NATIVE_DOUBLE,
- file_ds_sid, H5P_DEFAULT,
- ds_dcpl_id, H5P_DEFAULT);
+ dset_id =
+ H5Dcreate2(file_id, "dataset", H5T_NATIVE_DOUBLE, file_ds_sid, H5P_DEFAULT, ds_dcpl_id, H5P_DEFAULT);
VRFY((dset_id >= 0), "H5Dcreate2() dataset succeeded");
/* close the dataset creation property list */
@@ -2762,23 +2410,17 @@ link_chunk_collective_io_test(void)
VRFY((ret >= 0), "H5Pclose(ds_dcpl_id) succeeded");
/* setup local data */
- expected_value = (double)(LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE) *
- (double)(mpi_rank);
- for ( i = 0; i < LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE; i++ ) {
+ expected_value = (double)(LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE) * (double)(mpi_rank);
+ for (i = 0; i < LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE; i++) {
local_data_written[i] = expected_value;
- local_data_read[i] = 0.0;
- expected_value += 1.0;
+ local_data_read[i] = 0.0;
+ expected_value += 1.0;
}
/* select the file and mem spaces */
start[0] = (hsize_t)(mpi_rank * LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE);
- ret = H5Sselect_hyperslab(file_ds_sid,
- H5S_SELECT_SET,
- start,
- stride,
- count,
- block);
+ ret = H5Sselect_hyperslab(file_ds_sid, H5S_SELECT_SET, start, stride, count, block);
VRFY((ret >= 0), "H5Sselect_hyperslab(file_ds_sid, set) suceeded");
ret = H5Sselect_all(write_mem_ds_sid);
@@ -2794,26 +2436,16 @@ link_chunk_collective_io_test(void)
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
/* write the data set */
- ret = H5Dwrite(dset_id,
- H5T_NATIVE_DOUBLE,
- write_mem_ds_sid,
- file_ds_sid,
- xfer_plist,
- local_data_written);
+ ret = H5Dwrite(dset_id, H5T_NATIVE_DOUBLE, write_mem_ds_sid, file_ds_sid, xfer_plist, local_data_written);
VRFY((ret >= 0), "H5Dwrite() dataset initial write succeeded");
-
+
/* sync with the other processes before checking data */
mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after dataset write");
+ VRFY((mrc == MPI_SUCCESS), "Sync after dataset write");
/* read this processes slice of the dataset back in */
- ret = H5Dread(dset_id,
- H5T_NATIVE_DOUBLE,
- read_mem_ds_sid,
- file_ds_sid,
- xfer_plist,
- local_data_read);
+ ret = H5Dread(dset_id, H5T_NATIVE_DOUBLE, read_mem_ds_sid, file_ds_sid, xfer_plist, local_data_read);
VRFY((ret >= 0), "H5Dread() dataset read succeeded");
/* close the xfer property list */
@@ -2822,17 +2454,17 @@ link_chunk_collective_io_test(void)
/* verify the data */
mis_match = FALSE;
- for ( i = 0; i < LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE; i++ ) {
+ for (i = 0; i < LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE; i++) {
diff = local_data_written[i] - local_data_read[i];
diff = fabs(diff);
- if ( diff >= 0.001 ) {
+ if (diff >= 0.001) {
mis_match = TRUE;
- }
+ }
}
- VRFY( (mis_match == FALSE), "dataset data good.");
+ VRFY((mis_match == FALSE), "dataset data good.");
/* Close dataspaces */
ret = H5Sclose(write_mem_ds_sid);
@@ -2855,4 +2487,3 @@ link_chunk_collective_io_test(void)
return;
} /* link_chunk_collective_io_test() */
-
diff --git a/testpar/testpar.h b/testpar/testpar.h
index 84c073f..24e803a 100644
--- a/testpar/testpar.h
+++ b/testpar/testpar.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -22,7 +22,7 @@
#include "h5test.h"
/* Constants definitions */
-#define MAX_ERR_REPORT 10 /* Maximum number of errors reported */
+#define MAX_ERR_REPORT 10 /* Maximum number of errors reported */
/* Define some handy debugging shorthands, routines, ... */
/* debugging tools */
@@ -30,11 +30,11 @@
/* Print message mesg if verbose level is at least medium and
* mesg is not an empty string.
*/
-#define MESG(mesg) \
- if (VERBOSE_MED && *mesg != '\0') \
- printf("%s\n", mesg)
+#define MESG(mesg) \
+ if (VERBOSE_MED && *mesg != '\0') \
+ HDprintf("%s\n", mesg)
-/*
+/*
* VRFY: Verify if the condition val is true.
* If it is true, then call MESG to print mesg, depending on the verbose
* level.
@@ -44,56 +44,60 @@
* This will allow program to continue and can be used for debugging.
* (The "do {...} while(0)" is to group all the statements as one unit.)
*/
-#define VRFY(val, mesg) do { \
- if (val) { \
- MESG(mesg); \
- } else { \
- printf("Proc %d: ", mpi_rank); \
- printf("*** Parallel ERROR ***\n"); \
- printf(" VRFY (%s) failed at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
- ++nerrors; \
- fflush(stdout); \
- if (!VERBOSE_MED) { \
- printf("aborting MPI processes\n"); \
- MPI_Abort(MPI_COMM_WORLD, 1); \
- } \
- } \
-} while(0)
+#define VRFY(val, mesg) \
+ do { \
+ if (val) { \
+ MESG(mesg); \
+ } \
+ else { \
+ HDprintf("Proc %d: ", mpi_rank); \
+ HDprintf("*** Parallel ERROR ***\n"); \
+ HDprintf(" VRFY (%s) failed at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \
+ ++nerrors; \
+ fflush(stdout); \
+ if (!VERBOSE_MED) { \
+ HDprintf("aborting MPI processes\n"); \
+ MPI_Abort(MPI_COMM_WORLD, 1); \
+ } \
+ } \
+ } while (0)
/*
* Checking for information purpose.
* If val is false, print mesg; else nothing.
* Either case, no error setting.
*/
-#define INFO(val, mesg) do { \
- if (val) { \
- MESG(mesg); \
- } else { \
- printf("Proc %d: ", mpi_rank); \
- printf("*** PHDF5 REMARK (not an error) ***\n"); \
- printf(" Condition (%s) failed at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
- fflush(stdout); \
- } \
-} while(0)
+#define INFO(val, mesg) \
+ do { \
+ if (val) { \
+ MESG(mesg); \
+ } \
+ else { \
+ HDprintf("Proc %d: ", mpi_rank); \
+ HDprintf("*** PHDF5 REMARK (not an error) ***\n"); \
+ HDprintf(" Condition (%s) failed at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \
+ fflush(stdout); \
+ } \
+ } while (0)
-#define MPI_BANNER(mesg) do { \
- if (VERBOSE_MED || MAINPROCESS){ \
- printf("--------------------------------\n"); \
- printf("Proc %d: ", mpi_rank); \
- printf("*** %s\n", mesg); \
- printf("--------------------------------\n"); \
- } \
-} while(0)
+#define MPI_BANNER(mesg) \
+ do { \
+ if (VERBOSE_MED || MAINPROCESS) { \
+ HDprintf("--------------------------------\n"); \
+ HDprintf("Proc %d: ", mpi_rank); \
+ HDprintf("*** %s\n", mesg); \
+ HDprintf("--------------------------------\n"); \
+ } \
+ } while (0)
-#define MAINPROCESS (!mpi_rank) /* define process 0 as main process */
+#define MAINPROCESS (!mpi_rank) /* define process 0 as main process */
-#define SYNC(comm) do { \
- MPI_BANNER("doing a SYNC"); \
- MPI_Barrier(comm); \
- MPI_BANNER("SYNC DONE"); \
-} while(0)
+#define SYNC(comm) \
+ do { \
+ MPI_BANNER("doing a SYNC"); \
+ MPI_Barrier(comm); \
+ MPI_BANNER("SYNC DONE"); \
+ } while (0)
/* End of Define some handy debugging shorthands, routines, ... */
diff --git a/testpar/testpflush.sh.in b/testpar/testpflush.sh.in
new file mode 100644
index 0000000..be0dcb3
--- /dev/null
+++ b/testpar/testpflush.sh.in
@@ -0,0 +1,64 @@
+#! /bin/sh
+#
+# 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://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
+#
+# Test script for the parallel flush test
+#
+# The parallel flush test uses two programs to test flush operations
+# in parallel HDF5. The first program purposely exits without calling
+# MPI_Finalize(), which is an error under the MPI standard and mpiexec
+# in some implementations will return an error code even though all
+# processes exit successfully. This script lets us swallow the error
+# from the first program.
+#
+# True errors in the first program will be detected as errors in the
+# second program, so watch out for that.
+#
+# Programmer: Dana Robinson
+# Fall 2018
+
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+# Turn the $$ we use to avoid Autotools munging into $
+#
+# Allowing $$ to substitute in both the RUNPARALLEL string and the
+# regexp is intentional. There doesn't seem to be a way around
+# this using quote shenanigans. The downside is that there is a remote
+# chance that the shell's pid will match a number in the RUNPARALLEL
+# variable, but that seems less likely to cause problems than expecting
+# library builders to specify two almost identical versions of the
+# RUNPARALLEL command, one for use in scripts and one via Makefiles.
+RUNPARALLELSCRIPT=`echo "@RUNPARALLEL@" | sed "s/$$/\$/g"`
+
+# ==========================================
+# Run the first parallel flush test program
+# (note that we ignore any errors here)
+# ==========================================
+echo "*** NOTE ***********************************************************"
+echo "You may see complaints from mpiexec et al. that not all processes"
+echo "called MPI_Finalize(). This is an intended characteristic of the"
+echo "test and should not be considered an error."
+echo "********************************************************************"
+eval ${RUNPARALLELSCRIPT} ./t_pflush1
+
+
+# ===========================================
+# Run the second parallel flush test program
+# The return code of this call is the return
+# code of the script.
+# ===========================================
+eval ${RUNPARALLELSCRIPT} ./t_pflush2
+
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index ce0c69b..653e112 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,23 +18,23 @@
#include "testphdf5.h"
#ifndef PATH_MAX
-#define PATH_MAX 512
-#endif /* !PATH_MAX */
+#define PATH_MAX 512
+#endif /* !PATH_MAX */
/* global variables */
int dim0;
int dim1;
int chunkdim0;
int chunkdim1;
-int nerrors = 0; /* errors count */
-int ndatasets = 300; /* number of datasets to create*/
-int ngroups = 512; /* number of groups to create in root
- * group. */
-int facc_type = FACC_MPIO; /*Test file access type */
+int nerrors = 0; /* errors count */
+int ndatasets = 300; /* number of datasets to create*/
+int ngroups = 512; /* number of groups to create in root
+ * group. */
+int facc_type = FACC_MPIO; /*Test file access type */
int dxfer_coll_type = DXFER_COLLECTIVE_IO;
-H5E_auto2_t old_func; /* previous error handler */
-void *old_client_data; /* previous error handler arg.*/
+H5E_auto2_t old_func; /* previous error handler */
+void * old_client_data; /* previous error handler arg.*/
/* other option flags */
@@ -43,13 +43,11 @@ void *old_client_data; /* previous error handler arg.*/
* created in one test is accessed by a different test.
* filenames[0] is reserved as the file name for PARATESTFILE.
*/
-#define NFILENAME 2
+#define NFILENAME 2
#define PARATESTFILE filenames[0]
-const char *FILENAME[NFILENAME]={
- "ParaTest",
- NULL};
-char filenames[NFILENAME][PATH_MAX];
-hid_t fapl; /* file access property list */
+const char *FILENAME[NFILENAME] = {"ParaTest", NULL};
+char filenames[NFILENAME][PATH_MAX];
+hid_t fapl; /* file access property list */
#ifdef USE_PAUSE
/* pause the process for a moment to allow debugger to attach if desired. */
@@ -58,15 +56,16 @@ hid_t fapl; /* file access property list */
#include <sys/types.h>
#include <sys/stat.h>
-void pause_proc(void)
+void
+pause_proc(void)
{
- int pid;
- h5_stat_t statbuf;
- char greenlight[] = "go";
- int maxloop = 10;
- int loops = 0;
- int time_int = 10;
+ int pid;
+ h5_stat_t statbuf;
+ char greenlight[] = "go";
+ int maxloop = 10;
+ int loops = 0;
+ int time_int = 10;
/* mpi variables */
int mpi_size, mpi_rank;
@@ -79,28 +78,28 @@ void pause_proc(void)
MPI_Get_processor_name(mpi_name, &mpi_namelen);
if (MAINPROCESS)
- while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){
- if (!loops++){
- printf("Proc %d (%*s, %d): to debug, attach %d\n",
- mpi_rank, mpi_namelen, mpi_name, pid, pid);
- }
- printf("waiting(%ds) for file %s ...\n", time_int, greenlight);
- fflush(stdout);
- sleep(time_int);
- }
+ while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop) {
+ if (!loops++) {
+ HDprintf("Proc %d (%*s, %d): to debug, attach %d\n", mpi_rank, mpi_namelen, mpi_name, pid,
+ pid);
+ }
+ HDprintf("waiting(%ds) for file %s ...\n", time_int, greenlight);
+ HDfflush(stdout);
+ HDsleep(time_int);
+ }
MPI_Barrier(MPI_COMM_WORLD);
}
/* Use the Profile feature of MPI to call the pause_proc() */
-int MPI_Init(int *argc, char ***argv)
+int
+MPI_Init(int *argc, char ***argv)
{
int ret_code;
- ret_code=PMPI_Init(argc, argv);
+ ret_code = PMPI_Init(argc, argv);
pause_proc();
return (ret_code);
}
-#endif /* USE_PAUSE */
-
+#endif /* USE_PAUSE */
/*
* Show command usage
@@ -108,198 +107,199 @@ int MPI_Init(int *argc, char ***argv)
static void
usage(void)
{
- printf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] "
- "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
- printf("\t-m<n_datasets>"
- "\tset number of datasets for the multiple dataset test\n");
- printf("\t-n<n_groups>"
- "\tset number of groups for the multiple group test\n");
- printf("\t-f <prefix>\tfilename prefix\n");
- printf("\t-2\t\tuse Split-file together with MPIO\n");
- printf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n",
- ROW_FACTOR, COL_FACTOR);
- printf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n");
- printf("\n");
+ HDprintf(" [-r] [-w] [-m<n_datasets>] [-n<n_groups>] "
+ "[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
+ HDprintf("\t-m<n_datasets>"
+ "\tset number of datasets for the multiple dataset test\n");
+ HDprintf("\t-n<n_groups>"
+ "\tset number of groups for the multiple group test\n");
+ HDprintf("\t-f <prefix>\tfilename prefix\n");
+ HDprintf("\t-2\t\tuse Split-file together with MPIO\n");
+ HDprintf("\t-d <factor0> <factor1>\tdataset dimensions factors. Defaults (%d,%d)\n", ROW_FACTOR,
+ COL_FACTOR);
+ HDprintf("\t-c <dim0> <dim1>\tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n");
+ HDprintf("\n");
}
-
/*
* parse the command line options
*/
static int
parse_options(int argc, char **argv)
{
- int mpi_size, mpi_rank; /* mpi variables */
+ int mpi_size, mpi_rank; /* mpi variables */
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
/* setup default chunk-size. Make sure sizes are > 0 */
- chunkdim0 = (dim0+9)/10;
- chunkdim1 = (dim1+9)/10;
-
- while (--argc){
- if (**(++argv) != '-'){
- break;
- }else{
- switch(*(*argv+1)){
- case 'm': ndatasets = atoi((*argv+1)+1);
- if (ndatasets < 0){
- nerrors++;
- return(1);
- }
- break;
- case 'n': ngroups = atoi((*argv+1)+1);
- if (ngroups < 0){
- nerrors++;
- return(1);
- }
- break;
- case 'f': if (--argc < 1) {
- nerrors++;
- return(1);
- }
- if (**(++argv) == '-') {
- nerrors++;
- return(1);
- }
- paraprefix = *argv;
- break;
- case 'i': /* Collective MPI-IO access with independent IO */
- dxfer_coll_type = DXFER_INDEPENDENT_IO;
- break;
- case '2': /* Use the split-file driver with MPIO access */
- /* Can use $HDF5_METAPREFIX to define the */
- /* meta-file-prefix. */
- facc_type = FACC_MPIO | FACC_SPLIT;
- break;
- case 'd': /* dimensizes */
- if (--argc < 2){
- nerrors++;
- return(1);
- }
- dim0 = atoi(*(++argv))*mpi_size;
- argc--;
- dim1 = atoi(*(++argv))*mpi_size;
- /* set default chunkdim sizes too */
- chunkdim0 = (dim0+9)/10;
- chunkdim1 = (dim1+9)/10;
- break;
- case 'c': /* chunk dimensions */
- if (--argc < 2){
- nerrors++;
- return(1);
- }
- chunkdim0 = atoi(*(++argv));
- argc--;
- chunkdim1 = atoi(*(++argv));
- break;
- case 'h': /* print help message--return with nerrors set */
- return(1);
- default: printf("Illegal option(%s)\n", *argv);
- nerrors++;
- return(1);
- }
- }
+ chunkdim0 = (dim0 + 9) / 10;
+ chunkdim1 = (dim1 + 9) / 10;
+
+ while (--argc) {
+ if (**(++argv) != '-') {
+ break;
+ }
+ else {
+ switch (*(*argv + 1)) {
+ case 'm':
+ ndatasets = atoi((*argv + 1) + 1);
+ if (ndatasets < 0) {
+ nerrors++;
+ return (1);
+ }
+ break;
+ case 'n':
+ ngroups = atoi((*argv + 1) + 1);
+ if (ngroups < 0) {
+ nerrors++;
+ return (1);
+ }
+ break;
+ case 'f':
+ if (--argc < 1) {
+ nerrors++;
+ return (1);
+ }
+ if (**(++argv) == '-') {
+ nerrors++;
+ return (1);
+ }
+ paraprefix = *argv;
+ break;
+ case 'i': /* Collective MPI-IO access with independent IO */
+ dxfer_coll_type = DXFER_INDEPENDENT_IO;
+ break;
+ case '2': /* Use the split-file driver with MPIO access */
+ /* Can use $HDF5_METAPREFIX to define the */
+ /* meta-file-prefix. */
+ facc_type = FACC_MPIO | FACC_SPLIT;
+ break;
+ case 'd': /* dimensizes */
+ if (--argc < 2) {
+ nerrors++;
+ return (1);
+ }
+ dim0 = atoi(*(++argv)) * mpi_size;
+ argc--;
+ dim1 = atoi(*(++argv)) * mpi_size;
+ /* set default chunkdim sizes too */
+ chunkdim0 = (dim0 + 9) / 10;
+ chunkdim1 = (dim1 + 9) / 10;
+ break;
+ case 'c': /* chunk dimensions */
+ if (--argc < 2) {
+ nerrors++;
+ return (1);
+ }
+ chunkdim0 = atoi(*(++argv));
+ argc--;
+ chunkdim1 = atoi(*(++argv));
+ break;
+ case 'h': /* print help message--return with nerrors set */
+ return (1);
+ default:
+ HDprintf("Illegal option(%s)\n", *argv);
+ nerrors++;
+ return (1);
+ }
+ }
} /*while*/
/* check validity of dimension and chunk sizes */
- if (dim0 <= 0 || dim1 <= 0){
- printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
- nerrors++;
- return(1);
+ if (dim0 <= 0 || dim1 <= 0) {
+ HDprintf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
+ nerrors++;
+ return (1);
}
- if (chunkdim0 <= 0 || chunkdim1 <= 0){
- printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
- nerrors++;
- return(1);
+ if (chunkdim0 <= 0 || chunkdim1 <= 0) {
+ HDprintf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
+ nerrors++;
+ return (1);
}
/* Make sure datasets can be divided into equal portions by the processes */
- if ((dim0 % mpi_size) || (dim1 % mpi_size)){
- if (MAINPROCESS)
- printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n",
- dim0, dim1, mpi_size);
- nerrors++;
- return(1);
+ if ((dim0 % mpi_size) || (dim1 % mpi_size)) {
+ if (MAINPROCESS)
+ HDprintf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", dim0, dim1, mpi_size);
+ nerrors++;
+ return (1);
}
/* compose the test filenames */
{
- int i, n;
-
- n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
-
- for (i=0; i < n; i++)
- if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
- == NULL){
- printf("h5_fixname failed\n");
- nerrors++;
- return(1);
- }
- printf("Test filenames are:\n");
- for (i=0; i < n; i++)
- printf(" %s\n", filenames[i]);
+ int i, n;
+
+ n = sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; /* exclude the NULL */
+
+ for (i = 0; i < n; i++)
+ if (h5_fixname(FILENAME[i], fapl, filenames[i], sizeof(filenames[i])) == NULL) {
+ HDprintf("h5_fixname failed\n");
+ nerrors++;
+ return (1);
+ }
+ HDprintf("Test filenames are:\n");
+ for (i = 0; i < n; i++)
+ HDprintf(" %s\n", filenames[i]);
}
- return(0);
+ return (0);
}
-
/*
* Create the appropriate File access property list
*/
hid_t
create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type)
{
- hid_t ret_pl = -1;
- herr_t ret; /* generic return value */
- int mpi_rank; /* mpi variables */
+ hid_t ret_pl = -1;
+ herr_t ret; /* generic return value */
+ int mpi_rank; /* mpi variables */
/* need the rank for error checking macros */
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- ret_pl = H5Pcreate (H5P_FILE_ACCESS);
+ ret_pl = H5Pcreate(H5P_FILE_ACCESS);
VRFY((ret_pl >= 0), "H5P_FILE_ACCESS");
if (l_facc_type == FACC_DEFAULT)
- return (ret_pl);
+ return (ret_pl);
- if (l_facc_type == FACC_MPIO){
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_mpio(ret_pl, comm, info);
- VRFY((ret >= 0), "");
- return(ret_pl);
+ if (l_facc_type == FACC_MPIO) {
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_mpio(ret_pl, comm, info);
+ VRFY((ret >= 0), "");
+ return (ret_pl);
}
- if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){
- hid_t mpio_pl;
-
- mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((mpio_pl >= 0), "");
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
- VRFY((ret >= 0), "");
-
- /* setup file access template */
- ret_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((ret_pl >= 0), "");
- /* set Parallel access with communicator */
- ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
- VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
- H5Pclose(mpio_pl);
- return(ret_pl);
+ if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) {
+ hid_t mpio_pl;
+
+ mpio_pl = H5Pcreate(H5P_FILE_ACCESS);
+ VRFY((mpio_pl >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
+ VRFY((ret >= 0), "");
+
+ /* setup file access template */
+ ret_pl = H5Pcreate(H5P_FILE_ACCESS);
+ VRFY((ret_pl >= 0), "");
+ /* set Parallel access with communicator */
+ ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
+ VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
+ H5Pclose(mpio_pl);
+ return (ret_pl);
}
/* unknown file access types */
return (ret_pl);
}
-
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- int mpi_size, mpi_rank; /* mpi variables */
+ int mpi_size, mpi_rank; /* mpi variables */
H5Ptest_param_t ndsets_params, ngroups_params;
H5Ptest_param_t collngroups_params;
H5Ptest_param_t io_mode_confusion_params;
@@ -315,13 +315,13 @@ int main(int argc, char **argv)
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
- dim0 = ROW_FACTOR*mpi_size;
- dim1 = COL_FACTOR*mpi_size;
+ dim0 = ROW_FACTOR * mpi_size;
+ dim1 = COL_FACTOR * mpi_size;
- if (MAINPROCESS){
- printf("===================================\n");
- printf("PHDF5 TESTS START\n");
- printf("===================================\n");
+ if (MAINPROCESS) {
+ HDprintf("===================================\n");
+ HDprintf("PHDF5 TESTS START\n");
+ HDprintf("===================================\n");
}
/* Attempt to turn off atexit post processing so that in case errors
@@ -329,8 +329,8 @@ int main(int argc, char **argv)
* hang in the atexit post processing in which it may try to make MPI
* calls. By then, MPI calls may not work.
*/
- if (H5dont_atexit() < 0){
- printf("Failed to turn off atexit processing. Continue.\n");
+ if (H5dont_atexit() < 0) {
+ HDprintf("Failed to turn off atexit processing. Continue.\n");
};
H5open();
h5_show_hostname();
@@ -339,217 +339,158 @@ int main(int argc, char **argv)
TestInit(argv[0], usage, parse_options);
/* Tests are generally arranged from least to most complexity... */
- AddTest("mpiodup", test_fapl_mpio_dup, NULL,
- "fapl_mpio duplicate", NULL);
-
- AddTest("split", test_split_comm_access, NULL,
- "dataset using split communicators", PARATESTFILE);
-
- AddTest("idsetw", dataset_writeInd, NULL,
- "dataset independent write", PARATESTFILE);
- AddTest("idsetr", dataset_readInd, NULL,
- "dataset independent read", PARATESTFILE);
-
- AddTest("cdsetw", dataset_writeAll, NULL,
- "dataset collective write", PARATESTFILE);
- AddTest("cdsetr", dataset_readAll, NULL,
- "dataset collective read", PARATESTFILE);
-
- AddTest("eidsetw", extend_writeInd, NULL,
- "extendible dataset independent write", PARATESTFILE);
- AddTest("eidsetr", extend_readInd, NULL,
- "extendible dataset independent read", PARATESTFILE);
- AddTest("ecdsetw", extend_writeAll, NULL,
- "extendible dataset collective write", PARATESTFILE);
- AddTest("ecdsetr", extend_readAll, NULL,
- "extendible dataset collective read", PARATESTFILE);
- AddTest("eidsetw2", extend_writeInd2, NULL,
- "extendible dataset independent write #2", PARATESTFILE);
- AddTest("selnone", none_selection_chunk, NULL,
- "chunked dataset with none-selection", PARATESTFILE);
- AddTest("calloc", test_chunk_alloc, NULL,
- "parallel extend Chunked allocation on serial file", PARATESTFILE);
- AddTest("fltread", test_filter_read, NULL,
- "parallel read of dataset written serially with filters", PARATESTFILE);
+ AddTest("mpiodup", test_fapl_mpio_dup, NULL, "fapl_mpio duplicate", NULL);
+
+ AddTest("split", test_split_comm_access, NULL, "dataset using split communicators", PARATESTFILE);
+
+ AddTest("idsetw", dataset_writeInd, NULL, "dataset independent write", PARATESTFILE);
+ AddTest("idsetr", dataset_readInd, NULL, "dataset independent read", PARATESTFILE);
+
+ AddTest("cdsetw", dataset_writeAll, NULL, "dataset collective write", PARATESTFILE);
+ AddTest("cdsetr", dataset_readAll, NULL, "dataset collective read", PARATESTFILE);
+
+ AddTest("eidsetw", extend_writeInd, NULL, "extendible dataset independent write", PARATESTFILE);
+ AddTest("eidsetr", extend_readInd, NULL, "extendible dataset independent read", PARATESTFILE);
+ AddTest("ecdsetw", extend_writeAll, NULL, "extendible dataset collective write", PARATESTFILE);
+ AddTest("ecdsetr", extend_readAll, NULL, "extendible dataset collective read", PARATESTFILE);
+ AddTest("eidsetw2", extend_writeInd2, NULL, "extendible dataset independent write #2", PARATESTFILE);
+ AddTest("selnone", none_selection_chunk, NULL, "chunked dataset with none-selection", PARATESTFILE);
+ AddTest("calloc", test_chunk_alloc, NULL, "parallel extend Chunked allocation on serial file",
+ PARATESTFILE);
+ AddTest("fltread", test_filter_read, NULL, "parallel read of dataset written serially with filters",
+ PARATESTFILE);
#ifdef H5_HAVE_FILTER_DEFLATE
- AddTest("cmpdsetr", compress_readAll, NULL,
- "compressed dataset collective read", PARATESTFILE);
+ AddTest("cmpdsetr", compress_readAll, NULL, "compressed dataset collective read", PARATESTFILE);
#endif /* H5_HAVE_FILTER_DEFLATE */
- AddTest("zerodsetr", zero_dim_dset, NULL,
- "zero dim dset", PARATESTFILE);
+ AddTest("zerodsetr", zero_dim_dset, NULL, "zero dim dset", PARATESTFILE);
- ndsets_params.name = PARATESTFILE;
+ ndsets_params.name = PARATESTFILE;
ndsets_params.count = ndatasets;
- AddTest("ndsetw", multiple_dset_write, NULL,
- "multiple datasets write", &ndsets_params);
+ AddTest("ndsetw", multiple_dset_write, NULL, "multiple datasets write", &ndsets_params);
- ngroups_params.name = PARATESTFILE;
+ ngroups_params.name = PARATESTFILE;
ngroups_params.count = ngroups;
- AddTest("ngrpw", multiple_group_write, NULL,
- "multiple groups write", &ngroups_params);
- AddTest("ngrpr", multiple_group_read, NULL,
- "multiple groups read", &ngroups_params);
+ AddTest("ngrpw", multiple_group_write, NULL, "multiple groups write", &ngroups_params);
+ AddTest("ngrpr", multiple_group_read, NULL, "multiple groups read", &ngroups_params);
- AddTest("compact", compact_dataset, NULL,
- "compact dataset test", PARATESTFILE);
+ AddTest("compact", compact_dataset, NULL, "compact dataset test", PARATESTFILE);
- collngroups_params.name = PARATESTFILE;
+ collngroups_params.name = PARATESTFILE;
collngroups_params.count = ngroups;
- AddTest("cngrpw", collective_group_write, NULL,
- "collective group and dataset write", &collngroups_params);
- AddTest("ingrpr", independent_group_read, NULL,
- "independent group and dataset read", &collngroups_params);
+ /* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */
+ AddTest("cngrpw-ingrpr", collective_group_write_independent_group_read, NULL,
+ "collective grp/dset write - independent grp/dset read", &collngroups_params);
#ifndef H5_HAVE_WIN32_API
- AddTest("bigdset", big_dataset, NULL,
- "big dataset test", PARATESTFILE);
+ AddTest("bigdset", big_dataset, NULL, "big dataset test", PARATESTFILE);
#else
- printf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n");
+ HDprintf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n");
#endif
- AddTest("fill", dataset_fillvalue, NULL,
- "dataset fill value", PARATESTFILE);
-
- AddTest("cchunk1",
- coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE);
- AddTest("cchunk2",
- coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE);
- AddTest("cchunk3",
- coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE);
- AddTest("cchunk4",
- coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE);
-
- if((mpi_size < 3)&& MAINPROCESS ) {
- printf("Collective chunk IO optimization APIs ");
- printf("needs at least 3 processes to participate\n");
- printf("Collective chunk IO API tests will be skipped \n");
+ AddTest("fill", dataset_fillvalue, NULL, "dataset fill value", PARATESTFILE);
+
+ AddTest("cchunk1", coll_chunk1, NULL, "simple collective chunk io", PARATESTFILE);
+ AddTest("cchunk2", coll_chunk2, NULL, "noncontiguous collective chunk io", PARATESTFILE);
+ AddTest("cchunk3", coll_chunk3, NULL, "multi-chunk collective chunk io", PARATESTFILE);
+ AddTest("cchunk4", coll_chunk4, NULL, "collective chunk io with partial non-selection ", PARATESTFILE);
+
+ if ((mpi_size < 3) && MAINPROCESS) {
+ HDprintf("Collective chunk IO optimization APIs ");
+ HDprintf("needs at least 3 processes to participate\n");
+ HDprintf("Collective chunk IO API tests will be skipped \n");
}
- AddTest((mpi_size <3)? "-cchunk5":"cchunk5" ,
- coll_chunk5,NULL,
- "linked chunk collective IO without optimization",PARATESTFILE);
- AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6",
- coll_chunk6,NULL,
- "multi-chunk collective IO with direct request",PARATESTFILE);
- AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7",
- coll_chunk7,NULL,
- "linked chunk collective IO with optimization",PARATESTFILE);
- AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8",
- coll_chunk8,NULL,
- "linked chunk collective IO transferring to multi-chunk",PARATESTFILE);
- AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9",
- coll_chunk9,NULL,
- "multiple chunk collective IO with optimization",PARATESTFILE);
- AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10",
- coll_chunk10,NULL,
- "multiple chunk collective IO transferring to independent IO",PARATESTFILE);
-
-
-
-/* irregular collective IO tests*/
- AddTest("ccontw",
- coll_irregular_cont_write,NULL,
- "collective irregular contiguous write",PARATESTFILE);
- AddTest("ccontr",
- coll_irregular_cont_read,NULL,
- "collective irregular contiguous read",PARATESTFILE);
- AddTest("cschunkw",
- coll_irregular_simple_chunk_write,NULL,
- "collective irregular simple chunk write",PARATESTFILE);
- AddTest("cschunkr",
- coll_irregular_simple_chunk_read,NULL,
- "collective irregular simple chunk read",PARATESTFILE);
- AddTest("ccchunkw",
- coll_irregular_complex_chunk_write,NULL,
- "collective irregular complex chunk write",PARATESTFILE);
- AddTest("ccchunkr",
- coll_irregular_complex_chunk_read,NULL,
- "collective irregular complex chunk read",PARATESTFILE);
-
- AddTest("null", null_dataset, NULL,
- "null dataset test", PARATESTFILE);
+ AddTest((mpi_size < 3) ? "-cchunk5" : "cchunk5", coll_chunk5, NULL,
+ "linked chunk collective IO without optimization", PARATESTFILE);
+ AddTest((mpi_size < 3) ? "-cchunk6" : "cchunk6", coll_chunk6, NULL,
+ "multi-chunk collective IO with direct request", PARATESTFILE);
+ AddTest((mpi_size < 3) ? "-cchunk7" : "cchunk7", coll_chunk7, NULL,
+ "linked chunk collective IO with optimization", PARATESTFILE);
+ AddTest((mpi_size < 3) ? "-cchunk8" : "cchunk8", coll_chunk8, NULL,
+ "linked chunk collective IO transferring to multi-chunk", PARATESTFILE);
+ AddTest((mpi_size < 3) ? "-cchunk9" : "cchunk9", coll_chunk9, NULL,
+ "multiple chunk collective IO with optimization", PARATESTFILE);
+ AddTest((mpi_size < 3) ? "-cchunk10" : "cchunk10", coll_chunk10, NULL,
+ "multiple chunk collective IO transferring to independent IO", PARATESTFILE);
+
+ /* irregular collective IO tests*/
+ AddTest("ccontw", coll_irregular_cont_write, NULL, "collective irregular contiguous write", PARATESTFILE);
+ AddTest("ccontr", coll_irregular_cont_read, NULL, "collective irregular contiguous read", PARATESTFILE);
+ AddTest("cschunkw", coll_irregular_simple_chunk_write, NULL, "collective irregular simple chunk write",
+ PARATESTFILE);
+ AddTest("cschunkr", coll_irregular_simple_chunk_read, NULL, "collective irregular simple chunk read",
+ PARATESTFILE);
+ AddTest("ccchunkw", coll_irregular_complex_chunk_write, NULL, "collective irregular complex chunk write",
+ PARATESTFILE);
+ AddTest("ccchunkr", coll_irregular_complex_chunk_read, NULL, "collective irregular complex chunk read",
+ PARATESTFILE);
+
+ AddTest("null", null_dataset, NULL, "null dataset test", PARATESTFILE);
io_mode_confusion_params.name = PARATESTFILE;
io_mode_confusion_params.count = 0; /* value not used */
- AddTest("I/Omodeconf", io_mode_confusion, NULL,
- "I/O mode confusion test -- hangs quickly on failure",
+ AddTest("I/Omodeconf", io_mode_confusion, NULL, "I/O mode confusion test -- hangs quickly on failure",
&io_mode_confusion_params);
- if((mpi_size < 3) && MAINPROCESS) {
- printf("rr_obj_hdr_flush_confusion test needs at least 3 processes.\n");
- printf("rr_obj_hdr_flush_confusion test will be skipped \n");
+ if ((mpi_size < 3) && MAINPROCESS) {
+ HDprintf("rr_obj_hdr_flush_confusion test needs at least 3 processes.\n");
+ HDprintf("rr_obj_hdr_flush_confusion test will be skipped \n");
}
- if(mpi_size > 2) {
- rr_obj_flush_confusion_params.name = PARATESTFILE;
+ if (mpi_size > 2) {
+ rr_obj_flush_confusion_params.name = PARATESTFILE;
rr_obj_flush_confusion_params.count = 0; /* value not used */
AddTest("rrobjflushconf", rr_obj_hdr_flush_confusion, NULL,
- "round robin object header flush confusion test",
- &rr_obj_flush_confusion_params);
+ "round robin object header flush confusion test", &rr_obj_flush_confusion_params);
}
- AddTest("alnbg1",
- chunk_align_bug_1, NULL,
- "Chunk allocation with alignment bug.",
- PARATESTFILE);
+ AddTest("alnbg1", chunk_align_bug_1, NULL, "Chunk allocation with alignment bug.", PARATESTFILE);
- AddTest("tldsc",
- lower_dim_size_comp_test, NULL,
- "test lower dim size comp in span tree to mpi derived type",
- PARATESTFILE);
+ AddTest("tldsc", lower_dim_size_comp_test, NULL,
+ "test lower dim size comp in span tree to mpi derived type", PARATESTFILE);
- AddTest("lccio",
- link_chunk_collective_io_test, NULL,
- "test mpi derived type management",
- PARATESTFILE);
+ AddTest("lccio", link_chunk_collective_io_test, NULL, "test mpi derived type management", PARATESTFILE);
- AddTest("actualio", actual_io_mode_tests, NULL,
- "test actual io mode proprerty",
- PARATESTFILE);
+ AddTest("actualio", actual_io_mode_tests, NULL, "test actual io mode proprerty", PARATESTFILE);
- AddTest("nocolcause", no_collective_cause_tests, NULL,
- "test cause for broken collective io",
+ AddTest("nocolcause", no_collective_cause_tests, NULL, "test cause for broken collective io",
PARATESTFILE);
- if((mpi_size < 2) && MAINPROCESS) {
- printf("File Image Ops daisy chain test needs at least 2 processes.\n");
- printf("File Image Ops daisy chain test will be skipped \n");
+ if ((mpi_size < 2) && MAINPROCESS) {
+ HDprintf("File Image Ops daisy chain test needs at least 2 processes.\n");
+ HDprintf("File Image Ops daisy chain test will be skipped \n");
}
- AddTest((mpi_size < 2)? "-fiodc" : "fiodc", file_image_daisy_chain_test, NULL,
+ AddTest((mpi_size < 2) ? "-fiodc" : "fiodc", file_image_daisy_chain_test, NULL,
"file image ops daisy chain", NULL);
- if((mpi_size < 2)&& MAINPROCESS ) {
- printf("Atomicity tests need at least 2 processes to participate\n");
- printf("8 is more recommended.. Atomicity tests will be skipped \n");
+ if ((mpi_size < 2) && MAINPROCESS) {
+ HDprintf("Atomicity tests need at least 2 processes to participate\n");
+ HDprintf("8 is more recommended.. Atomicity tests will be skipped \n");
}
else if (facc_type != FACC_MPIO && MAINPROCESS) {
- printf("Atomicity tests will not work with a non MPIO VFD\n");
+ HDprintf("Atomicity tests will not work with a non MPIO VFD\n");
}
- else if(mpi_size >= 2 && facc_type == FACC_MPIO){
- AddTest("atomicity", dataset_atomicity, NULL,
- "dataset atomic updates", PARATESTFILE);
+ else if (mpi_size >= 2 && facc_type == FACC_MPIO) {
+ AddTest("atomicity", dataset_atomicity, NULL, "dataset atomic updates", PARATESTFILE);
}
- AddTest("denseattr", test_dense_attr, NULL,
- "Store Dense Attributes", PARATESTFILE);
-
+ AddTest("denseattr", test_dense_attr, NULL, "Store Dense Attributes", PARATESTFILE);
/* Display testing information */
TestInfo(argv[0]);
/* setup file access property list */
- fapl = H5Pcreate (H5P_FILE_ACCESS);
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
/* Parse command line arguments */
TestParseCmdLine(argc, argv);
- if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){
- printf("===================================\n"
- " Using Independent I/O with file set view to replace collective I/O \n"
- "===================================\n");
+ if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS) {
+ HDprintf("===================================\n"
+ " Using Independent I/O with file set view to replace collective I/O \n"
+ "===================================\n");
}
-
/* Perform requested testing */
PerformTests();
@@ -571,24 +512,27 @@ int main(int argc, char **argv)
{
int temp;
MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
- nerrors=temp;
+ nerrors = temp;
}
- if (MAINPROCESS){ /* only process 0 reports */
- printf("===================================\n");
- if (nerrors)
- printf("***PHDF5 tests detected %d errors***\n", nerrors);
- else
- printf("PHDF5 tests finished with no errors\n");
- printf("===================================\n");
+ if (MAINPROCESS) { /* only process 0 reports */
+ HDprintf("===================================\n");
+ if (nerrors)
+ HDprintf("***PHDF5 tests detected %d errors***\n", nerrors);
+ else
+ HDprintf("PHDF5 tests finished with no errors\n");
+ HDprintf("===================================\n");
}
+
/* close HDF5 library */
H5close();
+ /* Release test infrastructure */
+ TestShutdown();
+
/* MPI_Finalize must be called AFTER H5close which may use MPI calls */
MPI_Finalize();
/* cannot just return (nerrors) because exit code is limited to 1byte */
- return(nerrors!=0);
+ return (nerrors != 0);
}
-
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index fd19e1f..53234a5 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -18,177 +18,178 @@
#include "testpar.h"
-enum H5TEST_COLL_CHUNK_API {API_NONE=0,API_LINK_HARD,
- API_MULTI_HARD,API_LINK_TRUE,API_LINK_FALSE,
- API_MULTI_COLL,API_MULTI_IND};
+enum H5TEST_COLL_CHUNK_API {
+ API_NONE = 0,
+ API_LINK_HARD,
+ API_MULTI_HARD,
+ API_LINK_TRUE,
+ API_LINK_FALSE,
+ API_MULTI_COLL,
+ API_MULTI_IND
+};
#ifndef FALSE
-#define FALSE 0
+#define FALSE 0
#endif
#ifndef TRUE
-#define TRUE 1
+#define TRUE 1
#endif
-
/* Constants definitions */
-#define DIM0 600 /* Default dataset sizes. */
-#define DIM1 1200 /* Values are from a monitor pixel sizes */
-#define ROW_FACTOR 8 /* Nominal row factor for dataset size */
-#define COL_FACTOR 16 /* Nominal column factor for dataset size */
-#define RANK 2
-#define DATASETNAME1 "Data1"
-#define DATASETNAME2 "Data2"
-#define DATASETNAME3 "Data3"
-#define DATASETNAME4 "Data4"
-#define DATASETNAME5 "Data5"
-#define DATASETNAME6 "Data6"
-#define DATASETNAME7 "Data7"
-#define DATASETNAME8 "Data8"
-#define DATASETNAME9 "Data9"
+#define DIM0 600 /* Default dataset sizes. */
+#define DIM1 1200 /* Values are from a monitor pixel sizes */
+#define ROW_FACTOR 8 /* Nominal row factor for dataset size */
+#define COL_FACTOR 16 /* Nominal column factor for dataset size */
+#define RANK 2
+#define DATASETNAME1 "Data1"
+#define DATASETNAME2 "Data2"
+#define DATASETNAME3 "Data3"
+#define DATASETNAME4 "Data4"
+#define DATASETNAME5 "Data5"
+#define DATASETNAME6 "Data6"
+#define DATASETNAME7 "Data7"
+#define DATASETNAME8 "Data8"
+#define DATASETNAME9 "Data9"
/* point selection order */
-#define IN_ORDER 1
+#define IN_ORDER 1
#define OUT_OF_ORDER 2
/* Hyperslab layout styles */
-#define BYROW 1 /* divide into slabs of rows */
-#define BYCOL 2 /* divide into blocks of columns */
-#define ZROW 3 /* same as BYCOL except process 0 gets 0 rows */
-#define ZCOL 4 /* same as BYCOL except process 0 gets 0 columns */
+#define BYROW 1 /* divide into slabs of rows */
+#define BYCOL 2 /* divide into blocks of columns */
+#define ZROW 3 /* same as BYCOL except process 0 gets 0 rows */
+#define ZCOL 4 /* same as BYCOL except process 0 gets 0 columns */
/* File_Access_type bits */
-#define FACC_DEFAULT 0x0 /* default */
-#define FACC_MPIO 0x1 /* MPIO */
-#define FACC_SPLIT 0x2 /* Split File */
+#define FACC_DEFAULT 0x0 /* default */
+#define FACC_MPIO 0x1 /* MPIO */
+#define FACC_SPLIT 0x2 /* Split File */
-#define DXFER_COLLECTIVE_IO 0x1 /* Collective IO*/
+#define DXFER_COLLECTIVE_IO 0x1 /* Collective IO*/
#define DXFER_INDEPENDENT_IO 0x2 /* Independent IO collectively */
/*Constants for collective chunk definitions */
-#define SPACE_DIM1 24
-#define SPACE_DIM2 4
-#define BYROW_CONT 1
-#define BYROW_DISCONT 2
-#define BYROW_SELECTNONE 3
+#define SPACE_DIM1 24
+#define SPACE_DIM2 4
+#define BYROW_CONT 1
+#define BYROW_DISCONT 2
+#define BYROW_SELECTNONE 3
#define BYROW_SELECTUNBALANCE 4
-#define BYROW_SELECTINCHUNK 5
-
-#define DIMO_NUM_CHUNK 4
-#define DIM1_NUM_CHUNK 2
-#define LINK_TRUE_NUM_CHUNK 2
-#define LINK_FALSE_NUM_CHUNK 6
-#define MULTI_TRUE_PERCENT 50
-#define LINK_TRUE_CHUNK_NAME "h5_link_chunk_true"
+#define BYROW_SELECTINCHUNK 5
+
+#define DIMO_NUM_CHUNK 4
+#define DIM1_NUM_CHUNK 2
+#define LINK_TRUE_NUM_CHUNK 2
+#define LINK_FALSE_NUM_CHUNK 6
+#define MULTI_TRUE_PERCENT 50
+#define LINK_TRUE_CHUNK_NAME "h5_link_chunk_true"
#define LINK_FALSE_CHUNK_NAME "h5_link_chunk_false"
-#define LINK_HARD_CHUNK_NAME "h5_link_chunk_hard"
+#define LINK_HARD_CHUNK_NAME "h5_link_chunk_hard"
#define MULTI_HARD_CHUNK_NAME "h5_multi_chunk_hard"
#define MULTI_COLL_CHUNK_NAME "h5_multi_chunk_coll"
#define MULTI_INDP_CHUNK_NAME "h5_multi_chunk_indp"
#define DSET_COLLECTIVE_CHUNK_NAME "coll_chunk_name"
-
/*Constants for MPI derived data type generated from span tree */
-#define MSPACE1_RANK 1 /* Rank of the first dataset in memory */
-#define MSPACE1_DIM 27000 /* Dataset size in memory */
-#define FSPACE_RANK 2 /* Dataset rank as it is stored in the file */
-#define FSPACE_DIM1 9 /* Dimension sizes of the dataset as it is stored in the file */
-#define FSPACE_DIM2 3600 /* We will read dataset back from the file to the dataset in memory with these dataspace parameters. */
-#define MSPACE_RANK 2
-#define MSPACE_DIM1 9
-#define MSPACE_DIM2 3600
-#define FHCOUNT0 1 /* Count of the first dimension of the first hyperslab selection*/
-#define FHCOUNT1 768 /* Count of the second dimension of the first hyperslab selection*/
-#define FHSTRIDE0 4 /* Stride of the first dimension of the first hyperslab selection*/
-#define FHSTRIDE1 3 /* Stride of the second dimension of the first hyperslab selection*/
-#define FHBLOCK0 3 /* Block of the first dimension of the first hyperslab selection*/
-#define FHBLOCK1 2 /* Block of the second dimension of the first hyperslab selection*/
-#define FHSTART0 0 /* start of the first dimension of the first hyperslab selection*/
-#define FHSTART1 1 /* start of the second dimension of the first hyperslab selection*/
-
-#define SHCOUNT0 1 /* Count of the first dimension of the first hyperslab selection*/
-#define SHCOUNT1 1 /* Count of the second dimension of the first hyperslab selection*/
-#define SHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
-#define SHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
-#define SHBLOCK0 3 /* Block of the first dimension of the first hyperslab selection*/
-#define SHBLOCK1 768 /* Block of the second dimension of the first hyperslab selection*/
-#define SHSTART0 4 /* start of the first dimension of the first hyperslab selection*/
-#define SHSTART1 0 /* start of the second dimension of the first hyperslab selection*/
-
-#define MHCOUNT0 6912 /* Count of the first dimension of the first hyperslab selection*/
-#define MHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
-#define MHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
-#define MHSTART0 1 /* start of the first dimension of the first hyperslab selection*/
-
-
-
-#define RFFHCOUNT0 3 /* Count of the first dimension of the first hyperslab selection*/
-#define RFFHCOUNT1 768 /* Count of the second dimension of the first hyperslab selection*/
-#define RFFHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
-#define RFFHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
-#define RFFHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
-#define RFFHBLOCK1 1 /* Block of the second dimension of the first hyperslab selection*/
-#define RFFHSTART0 1 /* start of the first dimension of the first hyperslab selection*/
-#define RFFHSTART1 2 /* start of the second dimension of the first hyperslab selection*/
-
-
-#define RFSHCOUNT0 3 /* Count of the first dimension of the first hyperslab selection*/
-#define RFSHCOUNT1 1536 /* Count of the second dimension of the first hyperslab selection*/
-#define RFSHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
-#define RFSHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
-#define RFSHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
-#define RFSHBLOCK1 1 /* Block of the second dimension of the first hyperslab selection*/
-#define RFSHSTART0 2 /* start of the first dimension of the first hyperslab selection*/
-#define RFSHSTART1 4 /* start of the second dimension of the first hyperslab selection*/
-
-
-#define RMFHCOUNT0 3 /* Count of the first dimension of the first hyperslab selection*/
-#define RMFHCOUNT1 768 /* Count of the second dimension of the first hyperslab selection*/
-#define RMFHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
-#define RMFHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
-#define RMFHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
-#define RMFHBLOCK1 1 /* Block of the second dimension of the first hyperslab selection*/
-#define RMFHSTART0 0 /* start of the first dimension of the first hyperslab selection*/
-#define RMFHSTART1 0 /* start of the second dimension of the first hyperslab selection*/
-
-#define RMSHCOUNT0 3 /* Count of the first dimension of the first hyperslab selection*/
-#define RMSHCOUNT1 1536 /* Count of the second dimension of the first hyperslab selection*/
-#define RMSHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
-#define RMSHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
-#define RMSHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
-#define RMSHBLOCK1 1 /* Block of the second dimension of the first hyperslab selection*/
-#define RMSHSTART0 1 /* start of the first dimension of the first hyperslab selection*/
-#define RMSHSTART1 2 /* start of the second dimension of the first hyperslab selection*/
-
-
-#define NPOINTS 4 /* Number of points that will be selected
- and overwritten */
+#define MSPACE1_RANK 1 /* Rank of the first dataset in memory */
+#define MSPACE1_DIM 27000 /* Dataset size in memory */
+#define FSPACE_RANK 2 /* Dataset rank as it is stored in the file */
+#define FSPACE_DIM1 9 /* Dimension sizes of the dataset as it is stored in the file */
+#define FSPACE_DIM2 3600
+/* We will read dataset back from the file to the dataset in memory with these dataspace parameters. */
+#define MSPACE_RANK 2
+#define MSPACE_DIM1 9
+#define MSPACE_DIM2 3600
+#define FHCOUNT0 1 /* Count of the first dimension of the first hyperslab selection*/
+#define FHCOUNT1 768 /* Count of the second dimension of the first hyperslab selection*/
+#define FHSTRIDE0 4 /* Stride of the first dimension of the first hyperslab selection*/
+#define FHSTRIDE1 3 /* Stride of the second dimension of the first hyperslab selection*/
+#define FHBLOCK0 3 /* Block of the first dimension of the first hyperslab selection*/
+#define FHBLOCK1 2 /* Block of the second dimension of the first hyperslab selection*/
+#define FHSTART0 0 /* start of the first dimension of the first hyperslab selection*/
+#define FHSTART1 1 /* start of the second dimension of the first hyperslab selection*/
+
+#define SHCOUNT0 1 /* Count of the first dimension of the first hyperslab selection*/
+#define SHCOUNT1 1 /* Count of the second dimension of the first hyperslab selection*/
+#define SHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
+#define SHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
+#define SHBLOCK0 3 /* Block of the first dimension of the first hyperslab selection*/
+#define SHBLOCK1 768 /* Block of the second dimension of the first hyperslab selection*/
+#define SHSTART0 4 /* start of the first dimension of the first hyperslab selection*/
+#define SHSTART1 0 /* start of the second dimension of the first hyperslab selection*/
+
+#define MHCOUNT0 6912 /* Count of the first dimension of the first hyperslab selection*/
+#define MHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
+#define MHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
+#define MHSTART0 1 /* start of the first dimension of the first hyperslab selection*/
+
+#define RFFHCOUNT0 3 /* Count of the first dimension of the first hyperslab selection*/
+#define RFFHCOUNT1 768 /* Count of the second dimension of the first hyperslab selection*/
+#define RFFHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
+#define RFFHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
+#define RFFHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
+#define RFFHBLOCK1 1 /* Block of the second dimension of the first hyperslab selection*/
+#define RFFHSTART0 1 /* start of the first dimension of the first hyperslab selection*/
+#define RFFHSTART1 2 /* start of the second dimension of the first hyperslab selection*/
+
+#define RFSHCOUNT0 3 /* Count of the first dimension of the first hyperslab selection*/
+#define RFSHCOUNT1 1536 /* Count of the second dimension of the first hyperslab selection*/
+#define RFSHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
+#define RFSHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
+#define RFSHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
+#define RFSHBLOCK1 1 /* Block of the second dimension of the first hyperslab selection*/
+#define RFSHSTART0 2 /* start of the first dimension of the first hyperslab selection*/
+#define RFSHSTART1 4 /* start of the second dimension of the first hyperslab selection*/
+
+#define RMFHCOUNT0 3 /* Count of the first dimension of the first hyperslab selection*/
+#define RMFHCOUNT1 768 /* Count of the second dimension of the first hyperslab selection*/
+#define RMFHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
+#define RMFHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
+#define RMFHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
+#define RMFHBLOCK1 1 /* Block of the second dimension of the first hyperslab selection*/
+#define RMFHSTART0 0 /* start of the first dimension of the first hyperslab selection*/
+#define RMFHSTART1 0 /* start of the second dimension of the first hyperslab selection*/
+
+#define RMSHCOUNT0 3 /* Count of the first dimension of the first hyperslab selection*/
+#define RMSHCOUNT1 1536 /* Count of the second dimension of the first hyperslab selection*/
+#define RMSHSTRIDE0 1 /* Stride of the first dimension of the first hyperslab selection*/
+#define RMSHSTRIDE1 1 /* Stride of the second dimension of the first hyperslab selection*/
+#define RMSHBLOCK0 1 /* Block of the first dimension of the first hyperslab selection*/
+#define RMSHBLOCK1 1 /* Block of the second dimension of the first hyperslab selection*/
+#define RMSHSTART0 1 /* start of the first dimension of the first hyperslab selection*/
+#define RMSHSTART1 2 /* start of the second dimension of the first hyperslab selection*/
+
+#define NPOINTS \
+ 4 /* Number of points that will be selected \
+ and overwritten */
/* Definitions of the selection mode for the test_actual_io_function. */
-#define TEST_ACTUAL_IO_NO_COLLECTIVE 0
-#define TEST_ACTUAL_IO_RESET 1
-#define TEST_ACTUAL_IO_MULTI_CHUNK_IND 2
-#define TEST_ACTUAL_IO_MULTI_CHUNK_COL 3
-#define TEST_ACTUAL_IO_MULTI_CHUNK_MIX 4
-#define TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE 5
-#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND 6
-#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL 7
-#define TEST_ACTUAL_IO_LINK_CHUNK 8
-#define TEST_ACTUAL_IO_CONTIGUOUS 9
+#define TEST_ACTUAL_IO_NO_COLLECTIVE 0
+#define TEST_ACTUAL_IO_RESET 1
+#define TEST_ACTUAL_IO_MULTI_CHUNK_IND 2
+#define TEST_ACTUAL_IO_MULTI_CHUNK_COL 3
+#define TEST_ACTUAL_IO_MULTI_CHUNK_MIX 4
+#define TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE 5
+#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND 6
+#define TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL 7
+#define TEST_ACTUAL_IO_LINK_CHUNK 8
+#define TEST_ACTUAL_IO_CONTIGUOUS 9
/* Definitions of the selection mode for the no_collective_cause_tests function. */
#define TEST_COLLECTIVE 0x001
-#define TEST_SET_INDEPENDENT 0x002
+#define TEST_SET_INDEPENDENT 0x002
#define TEST_DATATYPE_CONVERSION 0x004
#define TEST_DATA_TRANSFORMS 0x008
#define TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES 0x010
#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT 0x020
#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL 0x040
#define TEST_FILTERS 0x080
-/* TEST_FILTERS will take place of this after supporting mpio + filter for
+/* TEST_FILTERS will take place of this after supporting mpio + filter for
* H5Dcreate and H5Dwrite */
-#define TEST_FILTERS_READ 0x100
+#define TEST_FILTERS_READ 0x100
/* Don't erase these lines, they are put here for debugging purposes */
/*
@@ -205,12 +206,11 @@ enum H5TEST_COLL_CHUNK_API {API_NONE=0,API_LINK_HARD,
#define NPOINTS 4
*/ /* end of debugging macro */
-
/* type definitions */
-typedef struct H5Ptest_param_t /* holds extra test parameters */
+typedef struct H5Ptest_param_t /* holds extra test parameters */
{
- char *name;
- int count;
+ char *name;
+ int count;
} H5Ptest_param_t;
/* Dataset data type. Int's can be easily octo dumped. */
@@ -218,26 +218,27 @@ typedef int DATATYPE;
/* Shape Same Tests Definitions */
typedef enum {
- IND_CONTIG, /* Independent IO on contigous datasets */
- COL_CONTIG, /* Collective IO on contigous datasets */
- IND_CHUNKED, /* Independent IO on chunked datasets */
- COL_CHUNKED /* Collective IO on chunked datasets */
+ IND_CONTIG, /* Independent IO on contigous datasets */
+ COL_CONTIG, /* Collective IO on contigous datasets */
+ IND_CHUNKED, /* Independent IO on chunked datasets */
+ COL_CHUNKED /* Collective IO on chunked datasets */
} ShapeSameTestMethods;
/* Shared global variables */
-extern int dim0, dim1; /*Dataset dimensions */
-extern int chunkdim0, chunkdim1; /*Chunk dimensions */
-extern int nerrors; /*errors count */
-extern H5E_auto2_t old_func; /* previous error handler */
-extern void *old_client_data; /*previous error handler arg.*/
-extern int facc_type; /*Test file access type */
-extern int dxfer_coll_type;
+extern int dim0, dim1; /*Dataset dimensions */
+extern int chunkdim0, chunkdim1; /*Chunk dimensions */
+extern int nerrors; /*errors count */
+extern H5E_auto2_t old_func; /* previous error handler */
+extern void * old_client_data; /*previous error handler arg.*/
+extern int facc_type; /*Test file access type */
+extern int dxfer_coll_type;
/* Test program prototypes */
void zero_dim_dset(void);
void multiple_dset_write(void);
void multiple_group_write(void);
void multiple_group_read(void);
+void collective_group_write_independent_group_read(void);
void collective_group_write(void);
void independent_group_read(void);
void test_fapl_mpio_dup(void);
@@ -293,10 +294,10 @@ void compress_readAll(void);
void test_dense_attr(void);
/* commonly used prototypes */
-hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type);
+hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type);
MPI_Offset h5_mpi_get_file_size(const char *filename, MPI_Comm comm, MPI_Info info);
-int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[],
- hsize_t block[], DATATYPE *dataset, DATATYPE *original);
-void point_set (hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[],
- size_t num_points, hsize_t coords[], int order);
+int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset,
+ DATATYPE *original);
+void point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points,
+ hsize_t coords[], int order);
#endif /* PHDF5TEST_H */