2
0
mirror of https://github.com/HDFGroup/hdf5.git synced 2025-04-24 17:51:25 +08:00

Merge remote-tracking branch 'hdf5/develop' into add-werror-and-squash-some

This commit is contained in:
David Young 2019-11-25 16:38:21 -06:00
commit d07aeef6ad
31 changed files with 667 additions and 180 deletions

@ -119,8 +119,12 @@ set(CTEST_CONFIGURE_TOOLSET "")
if(CMAKE_GENERATOR_TOOLSET)
set(CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}")
endif()
set(CTEST_CONFIGURE_ARCHITECTURE "")
if(CMAKE_GENERATOR_ARCHITECTURE)
set(CTEST_CONFIGURE_ARCHITECTURE "-A${CMAKE_GENERATOR_ARCHITECTURE}")
endif()
set (CTEST_CONFIGURE_COMMAND
"${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
"${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_ARCHITECTURE}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
#-----------------------------------------------------------------------------

@ -20,6 +20,9 @@ set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
if("@CMAKE_GENERATOR_TOOLSET@")
set(CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@")
endif()
if("@CMAKE_GENERATOR_ARCHITECTURE@")
set(CMAKE_GENERATOR_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@")
endif()
set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
# handle input parameters to script.

@ -46,6 +46,7 @@ set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @H5_ENABLE_SHARED_LIB@)
set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS @H5_ENABLE_STATIC_LIB@)
set (${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@)
set (${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF5_LIBRARIES_TO_EXPORT@)
set (${HDF5_PACKAGE_NAME}_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@")
set (${HDF5_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@")
set (${HDF5_PACKAGE_NAME}_DEFAULT_API_VERSION "@DEFAULT_API_VERSION@")
set (${HDF5_PACKAGE_NAME}_PARALLEL_FILTERED_WRITES "@PARALLEL_FILTERED_WRITES@")

@ -195,20 +195,28 @@ if (CMAKE_GENERATOR_TOOLSET)
else ()
set (CTEST_CONFIGURE_TOOLSET "")
endif()
if (CMAKE_GENERATOR_ARCHITECTURE)
set (CTEST_CONFIGURE_ARCHITECTURE "-A${CMAKE_GENERATOR_ARCHITECTURE}")
else ()
set (CTEST_CONFIGURE_ARCHITECTURE "")
endif()
if (LOCAL_MEMCHECK_TEST)
find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
set (CTEST_CONFIGURE_COMMAND
"${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
"${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_ARCHITECTURE}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
else ()
if (LOCAL_COVERAGE_TEST)
find_program (CTEST_COVERAGE_COMMAND NAMES gcov)
endif ()
set (CTEST_CONFIGURE_COMMAND
"${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
"${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_ARCHITECTURE}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
)
endif ()
set(CTEST_USE_LAUNCHERS 1)
set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 1)
#-----------------------------------------------------------------------------
## -- set output to english
set ($ENV{LC_MESSAGES} "en_EN")

@ -22,6 +22,8 @@ cmake_minimum_required (VERSION 3.10)
# where valid options for OPTION are:
# BUILD_GENERATOR - The cmake build generator:
# Unix * Unix Makefiles
# VS2019 * Visual Studio 16 2019
# VS201964 * Visual Studio 16 2019
# VS2017 * Visual Studio 15 2017
# VS201764 * Visual Studio 15 2017 Win64
# VS2015 * Visual Studio 14 2015
@ -106,8 +108,20 @@ if (NOT DEFINED HPC)
endif ()
if (WIN32 AND NOT MINGW)
set (SITE_OS_NAME "Windows")
set (SITE_OS_VERSION "WIN7")
if (BUILD_GENERATOR STREQUAL "VS201764")
set (SITE_OS_VERSION "WIN10")
if (BUILD_GENERATOR STREQUAL "VS201964")
set (CTEST_CMAKE_GENERATOR "Visual Studio 16 2019")
set (CMAKE_GENERATOR_ARCHITECTURE "x64")
set (SITE_OS_BITS "64")
set (SITE_COMPILER_NAME "vs2019")
set (SITE_COMPILER_VERSION "16")
elseif (BUILD_GENERATOR STREQUAL "VS2019")
set (CTEST_CMAKE_GENERATOR "Visual Studio 16 2019")
set (CMAKE_GENERATOR_ARCHITECTURE "Win32")
set (SITE_OS_BITS "32")
set (SITE_COMPILER_NAME "vs2019")
set (SITE_COMPILER_VERSION "16")
elseif (BUILD_GENERATOR STREQUAL "VS201764")
set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017 Win64")
set (SITE_OS_BITS "64")
set (SITE_COMPILER_NAME "vs2017")

@ -261,6 +261,10 @@ macro (HDF_README_PROPERTIES target_fortran)
set (BINARY_PLATFORM "${BINARY_PLATFORM} Intel")
if (${CMAKE_C_COMPILER_VERSION} MATCHES "^17.*")
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 17")
elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^18.*")
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 18")
elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*")
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 19")
else ()
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel ${CMAKE_C_COMPILER_VERSION}")
endif ()
@ -277,8 +281,10 @@ macro (HDF_README_PROPERTIES target_fortran)
elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*")
if (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.0.*")
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015")
else ()
elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.16.*")
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2017")
else () #19.23
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2019")
endif ()
else ()
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}")

@ -192,7 +192,7 @@ CHECK_FORTRAN_FEATURE(iso_c_binding
#-----------------------------------------------------------------------------
if (CMAKE_Fortran_COMPILER MATCHES ifort)
if (WIN32 AND NOT MINGW)
set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE)
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE)
set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE STRING "flags" FORCE)
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "flags" FORCE)
endif ()
endif ()

@ -13,8 +13,8 @@ find_program(
DOC "Path to clang-tidy executable"
)
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*)
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*)
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*,-clang-analyzer-cplusplus*,-readability-*,-google*)
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}" -checks=*,clang-analyzer-*,-clang-analyzer-cplusplus*,-readability-*,-google*)
#find_program(
# CLANG_FORMAT_EXE

@ -31,7 +31,8 @@ Obtaining HDF5 source code
CMake version
1. We suggest you obtain the latest CMake from the Kitware web site.
The HDF5 1.10."X" product requires a minimum CMake version 3.10,
where "X" is the current HDF5 release version.
where "X" is the current HDF5 release version. If you are using
VS2019, the minimum version is 3.15.
Note:
To change the install prefix from the platform defaults initialize
@ -90,6 +91,10 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to:
5. From the "myhdfstuff" directory execute the CTest Script with the
following options:
On 32-bit Windows with Visual Studio 2019, execute:
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2019 -C Release -VV -O hdf5.log
On 64-bit Windows with Visual Studio 2019, execute:
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201964 -C Release -VV -O hdf5.log
On 32-bit Windows with Visual Studio 2017, execute:
ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2017 -C Release -VV -O hdf5.log
On 64-bit Windows with Visual Studio 2017, execute:
@ -439,12 +444,11 @@ These five steps are described in detail below.
* MinGW Makefiles
* NMake Makefiles
* Unix Makefiles
* Visual Studio 11 2012
* Visual Studio 11 2012 Win64
* Visual Studio 12 2013
* Visual Studio 12 2013 Win64
* Visual Studio 14 2015
* Visual Studio 14 2015 Win64
* Visual Studio 15 2017
* Visual Studio 15 2017 Win64
* Visual Studio 16 2019
<options> is:
* SZIP_INCLUDE_DIR:PATH=<path to szip includes directory>

@ -48,6 +48,14 @@ New Features
Configuration:
-------------
- Update CMake for VS2019 support
CMake added support for VS2019 in version 3.15. Changes to the CMake
generator setting required changes to scripts. Also updated version
references in CMake files as necessary.
(ADB - 2019/11/18, HDFFV-10962)
- Update CMake tests to use FIXTURES
CMake test fixtures allow setup/cleanup tests and other dependency
@ -991,17 +999,16 @@ Supported Platforms
(emu) Sun Fortran 95 8.6 SunOS_sparc
Sun C++ 5.12 SunOS_sparc
Windows 7 Visual Studio 2015 w/ Intel Fortran 16 (cmake)
Windows 7 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
Windows 7 x64 Visual Studio 2013
Visual Studio 2015 w/ Intel Fortran 16 (cmake)
Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake)
Windows 7 x64 Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake)
Visual Studio 2015 w/ MSMPI 8 (cmake)
Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
Visual Studio 2017 w/ Intel Fortran 18 (cmake)
Visual Studio 2017 w/ Intel Fortran 19 (cmake)
Visual Studio 2019 w/ Intel Fortran 19 (cmake)
Mac OS X Yosemite 10.10.5 Apple clang/clang++ version 6.1 from Xcode 7.0
64-bit gfortran GNU Fortran (GCC) 4.9.2
@ -1109,24 +1116,10 @@ The following platforms are not supported but have been tested for this release.
#1 SMP ppc64 GNU/Linux IBM XL C/C++ for Linux, V13.1
(ostrich) and IBM XL Fortran for Linux, V15.1
Debian 8.4 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1 x86_64 GNU/Linux
gcc, g++ (Debian 4.9.2-10) 4.9.2
GNU Fortran (Debian 4.9.2-10) 4.9.2
(cmake and autotools)
Fedora 24 4.7.2-201.fc24.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
gcc, g++ (GCC) 6.1.1 20160621
(Red Hat 6.1.1-3)
GNU Fortran (GCC) 6.1.1 20160621
(Red Hat 6.1.1-3)
(cmake and autotools)
Ubuntu 16.04.1 4.4.0-38-generic #57-Ubuntu SMP x86_64 GNU/Linux
gcc, g++ (Ubuntu 5.4.0-6ubuntu1~16.04.2)
5.4.0 20160609
GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.2)
5.4.0 20160609
(cmake and autotools)
Fedora30 5.3.11-200.fc30.x86_64
#1 SMP x86_64 GNU/Linux GNU gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1 20190827)
GNU Fortran (GCC) 9.2.1 20190827 (Red Hat 9.2.1 20190827)
(cmake and autotools)
Known Problems

@ -22,7 +22,7 @@ I. Preconditions
1. We suggest you obtain the latest CMake for windows from the Kitware
web site. The HDF5 1.10.x product requires a minimum CMake version
of 3.10.2.
of 3.10.2. If you are using VS2019, the minimum version is 3.15.
2. You have installed the HDF5 library built with CMake, by executing
the HDF Install Utility (the *.msi file in the binary package for

@ -254,7 +254,7 @@ set (H5FD_HDRS
${HDF5_SRC_DIR}/H5FDmulti.h
${HDF5_SRC_DIR}/H5FDpublic.h
${HDF5_SRC_DIR}/H5FDros3.h
${HDF5_SRC_DIR}/H5FDs3comms.c
${HDF5_SRC_DIR}/H5FDs3comms.h
${HDF5_SRC_DIR}/H5FDsec2.h
${HDF5_SRC_DIR}/H5FDstdio.h
${HDF5_SRC_DIR}/H5FDwindows.h

@ -181,6 +181,10 @@ typedef struct H5CX_t {
hid_t dxpl_id; /* DXPL ID for API operation */
H5P_genplist_t *dxpl; /* Dataset Transfer Property List */
/* LCPL */
hid_t lcpl_id; /* LCPL ID for API operation */
H5P_genplist_t *lcpl; /* Link Creation Property List */
/* LAPL */
hid_t lapl_id; /* LAPL ID for API operation */
H5P_genplist_t *lapl; /* Link Access Property List */
@ -278,6 +282,12 @@ typedef struct H5CX_t {
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
/* Cached LCPL properties */
H5T_cset_t encoding; /* Link name character encoding */
hbool_t encoding_valid; /* Whether link name character encoding is valid */
unsigned intermediate_group; /* Whether to create intermediate groups */
hbool_t intermediate_group_valid; /* Whether create intermediate group flag is valid */
/* Cached LAPL properties */
size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */
hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */
@ -285,6 +295,8 @@ typedef struct H5CX_t {
/* Cached DCPL properties */
hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
hbool_t do_min_dset_ohdr_valid; /* Whether minimize dataset object header flag is valid */
uint8_t ohdr_flags; /* Object header flags */
hbool_t ohdr_flags_valid; /* Whether the object headers flags are valid */
/* Cached DAPL properties */
const char *extfile_prefix; /* Prefix for external file */
@ -346,6 +358,13 @@ typedef struct H5CX_dxpl_cache_t {
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
} H5CX_dxpl_cache_t;
/* Typedef for cached default link creation property list information */
/* (Same as the cached DXPL struct, above, except for the default LCPL) */
typedef struct H5CX_lcpl_cache_t {
H5T_cset_t encoding; /* Link name character encoding */
unsigned intermediate_group; /* Whether to create intermediate groups */
} H5CX_lcpl_cache_t;
/* Typedef for cached default link access property list information */
/* (Same as the cached DXPL struct, above, except for the default LAPL) */
typedef struct H5CX_lapl_cache_t {
@ -356,6 +375,7 @@ typedef struct H5CX_lapl_cache_t {
/* (Same as the cached DXPL struct, above, except for the default DCPL) */
typedef struct H5CX_dcpl_cache_t {
hbool_t do_min_dset_ohdr; /* Whether to minimize dataset object header */
uint8_t ohdr_flags; /* Object header flags */
} H5CX_dcpl_cache_t;
/* Typedef for cached default dataset access property list information */
@ -401,6 +421,9 @@ static H5CX_node_t *H5CX_head_g = NULL; /* Pointer to head of context st
/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
static H5CX_dxpl_cache_t H5CX_def_dxpl_cache;
/* Define a "default" link creation property list cache structure to use for default LCPLs */
static H5CX_lcpl_cache_t H5CX_def_lcpl_cache;
/* Define a "default" link access property list cache structure to use for default LAPLs */
static H5CX_lapl_cache_t H5CX_def_lapl_cache;
@ -435,6 +458,7 @@ herr_t
H5CX__init_package(void)
{
H5P_genplist_t *dx_plist; /* Data transfer property list */
H5P_genplist_t *lc_plist; /* Link creation property list */
H5P_genplist_t *la_plist; /* Link access property list */
H5P_genplist_t *dc_plist; /* Dataset creation property list */
H5P_genplist_t *da_plist; /* Dataset access property list */
@ -525,6 +549,23 @@ H5CX__init_package(void)
if(H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback")
/* Reset the "default LCPL cache" information */
HDmemset(&H5CX_def_lcpl_cache, 0, sizeof(H5CX_lcpl_cache_t));
/* Get the default LCPL cache information */
/* Get the default link creation property list */
if(NULL == (lc_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_CREATE_DEFAULT)))
HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link creation property list")
/* Get link name character encoding */
if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &H5CX_def_lcpl_cache.encoding) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve link name encoding")
/* Get flag whether to create intermediate groups */
if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &H5CX_def_lcpl_cache.intermediate_group) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve intermediate group creation flag")
/* Reset the "default LAPL cache" information */
HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t));
@ -552,6 +593,10 @@ H5CX__init_package(void)
if(H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag")
/* Get object header flags */
if(H5P_get(dc_plist, H5O_CRT_OHDR_FLAGS_NAME, &H5CX_def_dcpl_cache.ohdr_flags) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve object header flags")
/* Reset the "default DAPL cache" information */
HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t));
@ -710,6 +755,7 @@ H5CX__push_common(H5CX_node_t *cnode)
cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT;
cnode->ctx.dcpl_id = H5P_DATASET_CREATE_DEFAULT;
cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT;
cnode->ctx.lcpl_id = H5P_LINK_CREATE_DEFAULT;
cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT;
cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT;
cnode->ctx.tag = H5AC__INVALID_TAG;
@ -820,6 +866,18 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
if(NULL == (*api_state = H5FL_CALLOC(H5CX_state_t)))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new API context state")
/* Check for non-default DCPL */
if(H5P_DATASET_CREATE_DEFAULT != (*head)->ctx.dcpl_id) {
/* Retrieve the DCPL property list */
H5CX_RETRIEVE_PLIST(dcpl, FAIL)
/* Copy the DCPL ID */
if(((*api_state)->dcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dcpl, FALSE)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
} /* end if */
else
(*api_state)->dcpl_id = H5P_DATASET_CREATE_DEFAULT;
/* Check for non-default DXPL */
if(H5P_DATASET_XFER_DEFAULT != (*head)->ctx.dxpl_id) {
/* Retrieve the DXPL property list */
@ -844,6 +902,18 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
else
(*api_state)->lapl_id = H5P_LINK_ACCESS_DEFAULT;
/* Check for non-default LCPL */
if(H5P_LINK_CREATE_DEFAULT != (*head)->ctx.lcpl_id) {
/* Retrieve the LCPL property list */
H5CX_RETRIEVE_PLIST(lcpl, FAIL)
/* Copy the LCPL ID */
if(((*api_state)->lcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lcpl, FALSE)) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list")
} /* end if */
else
(*api_state)->lcpl_id = H5P_LINK_CREATE_DEFAULT;
/* Keep a reference to the current VOL wrapping context */
(*api_state)->vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx;
if(NULL != (*api_state)->vol_wrap_ctx)
@ -916,6 +986,10 @@ H5CX_restore_state(const H5CX_state_t *api_state)
HDassert(head && *head);
HDassert(api_state);
/* Restore the DCPL info */
(*head)->ctx.dcpl_id = api_state->dcpl_id;
(*head)->ctx.dcpl = NULL;
/* Restore the DXPL info */
(*head)->ctx.dxpl_id = api_state->dxpl_id;
(*head)->ctx.dxpl = NULL;
@ -924,6 +998,10 @@ H5CX_restore_state(const H5CX_state_t *api_state)
(*head)->ctx.lapl_id = api_state->lapl_id;
(*head)->ctx.lapl = NULL;
/* Restore the LCPL info */
(*head)->ctx.lcpl_id = api_state->lcpl_id;
(*head)->ctx.lcpl = NULL;
/* Restore the VOL wrapper context */
(*head)->ctx.vol_wrap_ctx = api_state->vol_wrap_ctx;
@ -964,6 +1042,11 @@ H5CX_free_state(H5CX_state_t *api_state)
/* Sanity check */
HDassert(api_state);
/* Release the DCPL */
if(api_state->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
if(H5I_dec_ref(api_state->dcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DCPL")
/* Release the DXPL */
if(api_state->dxpl_id != H5P_DATASET_XFER_DEFAULT)
if(H5I_dec_ref(api_state->dxpl_id) < 0)
@ -974,6 +1057,11 @@ H5CX_free_state(H5CX_state_t *api_state)
if(H5I_dec_ref(api_state->lapl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL")
/* Release the LCPL */
if(api_state->lcpl_id != H5P_LINK_CREATE_DEFAULT)
if(H5I_dec_ref(api_state->lcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LCPL")
/* Release the VOL wrapper context */
if(api_state->vol_wrap_ctx)
if(H5VL_dec_vol_wrapper(api_state->vol_wrap_ctx) < 0)
@ -1117,6 +1205,35 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_set_libver_bounds() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_lcpl
*
* Purpose: Sets the LCPL for the current API call context.
*
* Return: <none>
*
* Programmer: Chris Hogan
* October 28, 2019
*
*-------------------------------------------------------------------------
*/
void
H5CX_set_lcpl(hid_t lcpl_id)
{
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
HDassert(*head);
/* Set the API context's LCPL to a new value */
(*head)->ctx.lcpl_id = lcpl_id;
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_lcpl() */
/*-------------------------------------------------------------------------
* Function: H5CX_set_lapl
@ -2369,6 +2486,76 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_dt_conv_cb() */
/*-------------------------------------------------------------------------
* Function: H5CX_get_encoding
*
* Purpose: Retrieves the character encoding for the current API call context.
*
* Return: Non-negative on success / Negative on failure
*
* Programmer: Gerd Heber
* October 21, 2019
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_get_encoding(H5T_cset_t* encoding)
{
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(encoding);
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5P_STRCRT_CHAR_ENCODING_NAME, encoding)
/* Get the value */
*encoding = (*head)->ctx.encoding;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_encoding() */
/*-------------------------------------------------------------------------
* Function: H5CX_get_intermediate_group
*
* Purpose: Retrieves the create intermediate group flag for the current API call context.
*
* Return: Non-negative on success / Negative on failure
*
* Programmer: Gerd Heber
* October 21, 2019
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_get_intermediate_group(unsigned* crt_intermed_group)
{
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(crt_intermed_group);
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5L_CRT_INTERMEDIATE_GROUP_NAME, intermediate_group)
/* Get the value */
*crt_intermed_group = (*head)->ctx.intermediate_group;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_get_create_intermediate_group() */
/*-------------------------------------------------------------------------
* Function: H5CX_get_nlinks
@ -3282,6 +3469,41 @@ done:
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
* Function: H5CX_get_ohdr_flags
*
* Purpose: Retrieves the object header flags for the current API call context.
*
* Return: Non-negative on success / Negative on failure
*
* Programmer: Chris Hogan
* November 15, 2019
*
*-------------------------------------------------------------------------
*/
herr_t
H5CX_get_ohdr_flags(uint8_t *ohdr_flags)
{
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(ohdr_flags);
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5O_CRT_OHDR_FLAGS_NAME, ohdr_flags)
/* Get the value */
*ohdr_flags = (*head)->ctx.ohdr_flags;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* End H5CX_get_ohdr_flags() */
/*-------------------------------------------------------------------------
* Function: H5CX__pop_common

@ -41,8 +41,10 @@
/* API context state */
typedef struct H5CX_state_t {
hid_t dcpl_id; /* DCPL for operation */
hid_t dxpl_id; /* DXPL for operation */
hid_t lapl_id; /* LAPL for operation */
hid_t lcpl_id; /* LCPL for operation */
void *vol_wrap_ctx; /* VOL connector's "wrap context" for creating IDs */
H5VL_connector_prop_t vol_connector_prop; /* VOL connector property */
@ -77,6 +79,7 @@ H5_DLL herr_t H5CX_free_state(H5CX_state_t *api_state);
/* "Setter" routines for API context info */
H5_DLL void H5CX_set_dxpl(hid_t dxpl_id);
H5_DLL void H5CX_set_lcpl(hid_t lcpl_id);
H5_DLL void H5CX_set_lapl(hid_t lapl_id);
H5_DLL void H5CX_set_dcpl(hid_t dcpl_id);
H5_DLL herr_t H5CX_set_libver_bounds(H5F_t *f);
@ -122,11 +125,16 @@ H5_DLL herr_t H5CX_get_data_transform(H5Z_data_xform_t **data_transform);
H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info);
H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
/* "Getter" routines for LCPL properties cached in API context */
H5_DLL herr_t H5CX_get_encoding(H5T_cset_t* encoding);
H5_DLL herr_t H5CX_get_intermediate_group(unsigned* crt_intermed_group);
/* "Getter" routines for LAPL properties cached in API context */
H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks);
/* "Getter" routines for DCPL properties cached in API context */
H5_DLL herr_t H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag);
H5_DLL herr_t H5CX_get_ohdr_flags(uint8_t *ohdr_flags);
/* "Getter" routines for DAPL properties cached in API context */
H5_DLL herr_t H5CX_get_ext_file_prefix(const char **prefix_extfile);

@ -137,6 +137,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
/* Set the DCPL for the API context */
H5CX_set_dcpl(dcpl_id);
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")

@ -2406,7 +2406,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
/* Project intersection of virtual space and clipped
* virtual space onto source space (create
* clipped_source_select) */
if(H5S_select_project_intersection(storage->list[i].sub_dset[j].virtual_select, storage->list[i].source_select, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].clipped_source_select) < 0)
if(H5S_select_project_intersection(storage->list[i].sub_dset[j].virtual_select, storage->list[i].source_select, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].clipped_source_select, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Set extents of virtual_select and
@ -2423,7 +2423,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
if(storage->list[i].sub_dset[j].clipped_virtual_select) {
/* Project intersection of file space and mapping virtual space
* onto memory space */
if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].projected_mem_space) < 0)
if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].projected_mem_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Check number of elements selected */
@ -2460,7 +2460,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info,
if(storage->list[i].source_dset.clipped_virtual_select) {
/* Project intersection of file space and mapping virtual space onto
* memory space */
if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space) < 0)
if(H5S_select_project_intersection(file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Check number of elements selected, add to tot_nelmts */
@ -2590,7 +2590,7 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Project intersection of file space and mapping virtual space onto
* mapping source space */
if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space) < 0)
if(H5S_select_project_intersection(source_dset->clipped_virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
/* Perform read on source dataset */
@ -2781,7 +2781,7 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
* extent in the unlimited dimension. -NAF */
/* Project intersection of file space and mapping virtual space onto
* mapping source space */
if(H5S_select_project_intersection(source_dset->virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space) < 0)
if(H5S_select_project_intersection(source_dset->virtual_select, source_dset->clipped_source_select, file_space, &projected_src_space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
/* Perform write on source dataset */

@ -345,6 +345,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list")
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")

@ -299,6 +299,9 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC,
((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0)
@ -386,6 +389,9 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC,
((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0)
@ -473,10 +479,13 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
/* Check the group access property list */
/* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Set location fields */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = link_name;
@ -549,6 +558,9 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
@ -635,10 +647,13 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
if(!udata && udata_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata cannot be NULL if udata_size is non-zero")
/* Check the group access property list */
/* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
@ -1850,8 +1865,8 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT
/* Check for non-default link creation properties */
if(udata->lc_plist) {
/* Get character encoding property */
if(H5P_get(udata->lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &udata->lnk->cset) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get property value for character encoding")
if(H5CX_get_encoding(&udata->lnk->cset) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'character set' property")
} /* end if */
else
udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */
@ -1992,8 +2007,8 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Get intermediate group creation property */
if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
if(H5CX_get_intermediate_group(&crt_intmd_group) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property")
if(crt_intmd_group > 0)
target_flags |= H5G_CRT_INTMD_GROUP;
@ -2881,7 +2896,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Get intermediate group creation property */
if(H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0)
if(H5CX_get_intermediate_group(&crt_intmd_group) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups")
/* Set target flags for source and destination */
@ -2889,7 +2904,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo
dst_target_flags |= H5G_CRT_INTMD_GROUP;
/* Get character encoding property */
if(H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &char_encoding) < 0)
if(H5CX_get_encoding(&char_encoding) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding")
} /* end if */

@ -364,10 +364,13 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
if(!link_name || !*link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified")
/* Check the group access property list */
/* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Get normalized copy of the link target */
if(NULL == (norm_obj_name = H5G_normalize(obj_name)))
HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name")

@ -360,10 +360,13 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
/* Check the group access property list */
/* Get the link creation property list */
if(H5P_DEFAULT == lcpl_id)
lcpl_id = H5P_LINK_CREATE_DEFAULT;
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")

@ -227,6 +227,9 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list")
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(src_loc_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info")

@ -352,8 +352,18 @@ H5O__create_ohdr(H5F_t *f, hid_t ocpl_id)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list")
/* Get any object header status flags set by properties */
if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
if(H5P_DATASET_CREATE_DEFAULT == ocpl_id)
{
/* If the OCPL is the default DCPL, we can get the header flags from the
* API context. Otherwise we have to call H5P_get */
if(H5CX_get_ohdr_flags(&oh_flags) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
}
else
{
if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
}
if(H5O_set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header")

@ -96,6 +96,7 @@ typedef struct {
hsize_t skip; /* Number of elements to skip in projected space */
hsize_t nelem; /* Number of elements to add to projected space (after skip) */
uint64_t op_gen; /* Operation generation for counting elements */
hbool_t share_selection; /* Whether span trees in dst_space can be shared with proj_space */
} H5S_hyper_project_intersect_ud_t;
/* Assert that H5S_MAX_RANK is <= 32 so our trick with using a 32 bit bitmap
@ -112,6 +113,9 @@ typedef struct {
static H5S_hyper_span_t *H5S__hyper_new_span(hsize_t low, hsize_t high,
H5S_hyper_span_info_t *down, H5S_hyper_span_t *next);
static H5S_hyper_span_info_t *H5S__hyper_new_span_info(unsigned rank);
static H5S_hyper_span_info_t *H5S__hyper_copy_span_helper(
H5S_hyper_span_info_t *spans, unsigned rank, unsigned op_info_i,
uint64_t op_gen);
static H5S_hyper_span_info_t *H5S__hyper_copy_span(H5S_hyper_span_info_t *spans,
unsigned rank);
static hbool_t H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1,
@ -132,7 +136,7 @@ static herr_t H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans,
H5S_hyper_span_info_t **a_and_b, H5S_hyper_span_info_t **b_not_a);
static herr_t H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
static hsize_t H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans,
uint64_t op_gen);
unsigned op_info_i, uint64_t op_gen);
static hsize_t H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans);
static herr_t H5S__hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans);
static H5S_hyper_span_info_t *H5S__hyper_make_spans(unsigned rank,
@ -2852,9 +2856,10 @@ done:
PURPOSE
Helper routine to copy a hyperslab span tree
USAGE
H5S_hyper_span_info_t * H5S__hyper_copy_span_helper(spans, rank)
H5S_hyper_span_info_t * H5S__hyper_copy_span_helper(spans, rank, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Span tree to copy
unsigned rank; IN: Rank of span tree
unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
Pointer to the copied span tree on success, NULL on failure
@ -2867,7 +2872,7 @@ done:
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
uint64_t op_gen)
unsigned op_info_i, uint64_t op_gen)
{
H5S_hyper_span_t *span; /* Hyperslab span */
H5S_hyper_span_t *new_span; /* Temporary hyperslab span */
@ -2881,9 +2886,9 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
HDassert(spans);
/* Check if the span tree was already copied */
if(spans->op_gen == op_gen) {
if(spans->op_info[op_info_i].op_gen == op_gen) {
/* Just return the value of the already copied span tree */
ret_value = spans->u.copied;
ret_value = spans->op_info[op_info_i].u.copied;
/* Increment the reference count of the span tree */
ret_value->count++;
@ -2899,10 +2904,10 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
ret_value->count = 1;
/* Set the operation generation for the span info, to avoid future copies */
spans->op_gen = op_gen;
spans->op_info[op_info_i].op_gen = op_gen;
/* Set the 'copied' pointer in the node being copied to the newly allocated node */
spans->u.copied = ret_value;
spans->op_info[op_info_i].u.copied = ret_value;
/* Copy over the nodes in the span list */
span = spans->head;
@ -2920,7 +2925,7 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/* Recurse to copy the 'down' spans, if there are any */
if(span->down != NULL) {
if(NULL == (new_down = H5S__hyper_copy_span_helper(span->down, rank - 1, op_gen)))
if(NULL == (new_down = H5S__hyper_copy_span_helper(span->down, rank - 1, op_info_i, op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab spans")
new_span->down = new_down;
} /* end if */
@ -2976,7 +2981,9 @@ H5S__hyper_copy_span(H5S_hyper_span_info_t *spans, unsigned rank)
op_gen = H5S__hyper_get_op_gen();
/* Copy the hyperslab span tree */
if(NULL == (ret_value = H5S__hyper_copy_span_helper(spans, rank, op_gen)))
/* Always use op_info[0] since we own this op_info, so there can be no
* simultaneous operations */
if(NULL == (ret_value = H5S__hyper_copy_span_helper(spans, rank, 0, op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree")
done:
@ -3315,8 +3322,9 @@ done:
PURPOSE
Helper routine to count the number of blocks in a span tree
USAGE
hsize_t H5S__hyper_span_nblocks_helper(spans)
hsize_t H5S__hyper_span_nblocks_helper(spans, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to count blocks of
unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
Number of blocks in span tree on success; negative on failure
@ -3328,7 +3336,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, unsigned op_info_i,
uint64_t op_gen)
{
hsize_t ret_value = 0; /* Return value */
@ -3338,9 +3347,9 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
HDassert(spans);
/* Check if the span tree was already counted */
if(spans->op_gen == op_gen)
if(spans->op_info[op_info_i].op_gen == op_gen)
/* Just return the # of blocks in the already counted span tree */
ret_value = spans->u.nblocks;
ret_value = spans->op_info[op_info_i].u.nblocks;
else { /* Count the number of elements in the span tree */
H5S_hyper_span_t *span; /* Hyperslab span */
@ -3348,7 +3357,7 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
if(span->down) {
while(span) {
/* If there are down spans, add the total down span blocks */
ret_value += H5S__hyper_span_nblocks_helper(span->down, op_gen);
ret_value += H5S__hyper_span_nblocks_helper(span->down, op_info_i, op_gen);
/* Advance to next span */
span = span->next;
@ -3365,10 +3374,10 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
} /* end else */
/* Set the operation generation for this span tree, to avoid re-computing */
spans->op_gen = op_gen;
spans->op_info[op_info_i].op_gen = op_gen;
/* Hold a copy of the # of blocks */
spans->u.nblocks = ret_value;
spans->op_info[op_info_i].u.nblocks = ret_value;
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
@ -3406,7 +3415,10 @@ H5S__hyper_span_nblocks(H5S_hyper_span_info_t *spans)
/* Acquire an operation generation value for this operation */
op_gen = H5S__hyper_get_op_gen();
ret_value = H5S__hyper_span_nblocks_helper(spans, op_gen);
/* Count the blocks */
/* Always use op_info[0] since we own this op_info, so there can be no
* simultaneous operations */
ret_value = H5S__hyper_span_nblocks_helper(spans, 0, op_gen);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@ -5946,7 +5958,7 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
/* Check if we've compared the 'stop' span's "down tree" to
* this span's "down tree" already.
*/
if(tmp_span->down->op_gen != op_gen) {
if(tmp_span->down->op_info[0].op_gen != op_gen) {
if(H5S__hyper_cmp_spans(tmp_span->down, stop_span->down))
attempt_merge_spans = TRUE;
@ -5954,7 +5966,7 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree,
/* (Because it wasn't the same as the 'stop' span's down tree
* and we don't need to compare it again)
*/
tmp_span->down->op_gen = op_gen;
tmp_span->down->op_info[0].op_gen = op_gen;
} /* end if */
} /* end else */
@ -6159,11 +6171,12 @@ done:
PURPOSE
Helper routine to detect intersections in span trees
USAGE
hbool_t H5S__hyper_intersect_block_helper(spans, start, end)
hbool_t H5S__hyper_intersect_block_helper(spans, rank, start, end, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: First span tree to operate with
unsigned rank; IN: Number of dimensions for span tree
hsize_t *start; IN: Starting coordinate for block
hsize_t *end; IN: Ending coordinate for block
unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURN
Non-negative (TRUE/FALSE) on success, can't fail
@ -6176,7 +6189,8 @@ done:
--------------------------------------------------------------------------*/
static hbool_t
H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
unsigned rank, const hsize_t *start, const hsize_t *end, uint64_t op_gen)
unsigned rank, const hsize_t *start, const hsize_t *end, unsigned op_info_i,
uint64_t op_gen)
{
hbool_t ret_value = FALSE; /* Return value */
@ -6188,7 +6202,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
HDassert(end);
/* Check if we've already visited this span tree */
if(spans->op_gen != op_gen) {
if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_hyper_span_t *curr; /* Pointer to current span in 1st span tree */
unsigned u; /* Local index variable */
@ -6221,7 +6235,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
/* If there is an intersection in the "down" dimensions,
* the span trees overlap.
*/
if(H5S__hyper_intersect_block_helper(curr->down, rank - 1, start + 1, end + 1, op_gen))
if(H5S__hyper_intersect_block_helper(curr->down, rank - 1, start + 1, end + 1, op_info_i, op_gen))
HGOTO_DONE(TRUE)
/* No intersection in down dimensions, advance to next span */
@ -6231,7 +6245,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans,
} /* end while */
/* Set the tree's operation generation */
spans->op_gen = op_gen;
spans->op_info[op_info_i].op_gen = op_gen;
} /* end if */
/* Fall through with 'FALSE' return value */
@ -6363,7 +6377,9 @@ H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, const hsize
op_gen = H5S__hyper_get_op_gen();
/* Perform the span-by-span intersection check */
ret_value = H5S__hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, start, end, op_gen);
/* Always use op_info[0] since we own this op_info, so there can be no
* simultaneous operations */
ret_value = H5S__hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, start, end, 0, op_gen);
} /* end else */
done:
@ -6377,10 +6393,11 @@ done:
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
void H5S__hyper_adjust_u_helper(spans, offset)
void H5S__hyper_adjust_u_helper(spans, rank, offset, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
unsigned rank; IN: Number of dimensions for span tree
const hsize_t *offset; IN: Offset to subtract
unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
None
@ -6393,7 +6410,7 @@ done:
--------------------------------------------------------------------------*/
static void
H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
const hsize_t *offset, uint64_t op_gen)
const hsize_t *offset, unsigned op_info_i, uint64_t op_gen)
{
FUNC_ENTER_STATIC_NOERR
@ -6402,7 +6419,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
HDassert(offset);
/* Check if we've already set this span tree */
if(spans->op_gen != op_gen) {
if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
unsigned u; /* Local index variable */
@ -6423,14 +6440,14 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
H5S__hyper_adjust_u_helper(span->down, rank - 1, offset + 1, op_gen);
H5S__hyper_adjust_u_helper(span->down, rank - 1, offset + 1, op_info_i, op_gen);
/* Advance to next span in this dimension */
span = span->next;
} /* end while */
/* Set the tree's operation generation */
spans->op_gen = op_gen;
spans->op_info[op_info_i].op_gen = op_gen;
} /* end if */
FUNC_LEAVE_NOAPI_VOID
@ -6487,7 +6504,10 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset)
/* Acquire an operation generation value for this operation */
op_gen = H5S__hyper_get_op_gen();
H5S__hyper_adjust_u_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, op_gen);
/* Perform adjustment */
/* Always use op_info[0] since we own this op_info, so there can be no
* simultaneous operations */
H5S__hyper_adjust_u_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, 0, op_gen);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@ -6897,10 +6917,11 @@ done:
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
void H5S__hyper_adjust_s_helper(spans, offset)
void H5S__hyper_adjust_s_helper(spans, rank, offset, op_info_i, op_gen)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
unsigned rank; IN: Number of dimensions for span tree
const hssize_t *offset; IN: Offset to subtract
unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
None
@ -6913,7 +6934,7 @@ done:
--------------------------------------------------------------------------*/
static void
H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
const hssize_t *offset, uint64_t op_gen)
const hssize_t *offset, unsigned op_info_i, uint64_t op_gen)
{
FUNC_ENTER_STATIC_NOERR
@ -6922,7 +6943,7 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
HDassert(offset);
/* Check if we've already set this span tree */
if(spans->op_gen != op_gen) {
if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
unsigned u; /* Local index variable */
@ -6943,14 +6964,14 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank,
/* Recursively adjust spans in next dimension down */
if(span->down != NULL)
H5S__hyper_adjust_s_helper(span->down, rank - 1, offset + 1, op_gen);
H5S__hyper_adjust_s_helper(span->down, rank - 1, offset + 1, op_info_i, op_gen);
/* Advance to next span in this dimension */
span = span->next;
} /* end while */
/* Set the tree's operation generation */
spans->op_gen = op_gen;
spans->op_info[op_info_i].op_gen = op_gen;
} /* end if */
FUNC_LEAVE_NOAPI_VOID
@ -7018,7 +7039,10 @@ H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
/* Acquire an operation generation value for this operation */
op_gen = H5S__hyper_get_op_gen();
H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, op_gen);
/* Perform the adjustment */
/* Always use op_info[0] since we own this op_info, so there can be no
* simultaneous operations */
H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, space->extent.rank, offset, 0, op_gen);
} /* end if */
} /* end if */
@ -8281,8 +8305,9 @@ done:
PURPOSE
Count the number of elements in a span tree
USAGE
hsize_t H5S__hyper_spans_nelem_helper(spans, op_gen)
hsize_t H5S__hyper_spans_nelem_helper(spans, op_info_i, op_gen)
const H5S_hyper_span_info_t *spans; IN: Hyperslan span tree to count elements of
unsigned op_info_i; IN: Index of op info to use
uint64_t op_gen; IN: Operation generation
RETURNS
Number of elements in span tree on success; negative on failure
@ -8294,7 +8319,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hsize_t
H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, unsigned op_info_i,
uint64_t op_gen)
{
hsize_t ret_value = 0; /* Return value */
@ -8304,9 +8330,9 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
HDassert(spans);
/* Check if the span tree was already counted */
if(spans->op_gen == op_gen)
if(spans->op_info[op_info_i].op_gen == op_gen)
/* Just return the # of elements in the already counted span tree */
ret_value = spans->u.nelmts;
ret_value = spans->op_info[op_info_i].u.nelmts;
else { /* Count the number of elements in the span tree */
const H5S_hyper_span_t *span; /* Hyperslab span */
@ -8328,7 +8354,7 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
nelmts = (span->high - span->low) + 1;
/* Multiply the size of this span by the total down span elements */
ret_value += nelmts * H5S__hyper_spans_nelem_helper(span->down, op_gen);
ret_value += nelmts * H5S__hyper_spans_nelem_helper(span->down, op_info_i, op_gen);
/* Advance to next span */
span = span->next;
@ -8336,10 +8362,10 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, uint64_t op_gen)
} /* end else */
/* Set the operation generation for this span tree, to avoid re-computing */
spans->op_gen = op_gen;
spans->op_info[op_info_i].op_gen = op_gen;
/* Hold a copy of the # of elements */
spans->u.nelmts = ret_value;
spans->op_info[op_info_i].u.nelmts = ret_value;
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
@ -8378,7 +8404,9 @@ H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans)
op_gen = H5S__hyper_get_op_gen();
/* Count the number of elements in the span tree */
ret_value = H5S__hyper_spans_nelem_helper(spans, op_gen);
/* Always use op_info[0] since we own this op_info, so there can be no
* simultaneous operations */
ret_value = H5S__hyper_spans_nelem_helper(spans, 0, op_gen);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_spans_nelem() */
@ -8808,10 +8836,8 @@ H5S__hyper_update_diminfo(H5S_t *space, H5S_seloper_t op,
(It can be recovered with regular selection)
USAGE
herr_t H5S__hyper_rebuild_helper(space)
const H5S_hyper_span_t *span; IN: Portion of span tree to check
H5S_hyper_dim_t span_slab[]; OUT: Rebuilt section of hyperslab description
unsigned rank; IN: Current dimension to work on
uint64_t op_gen; IN: Operation generation
const H5S_hyper_span_t *spans; IN: Portion of span tree to check
H5S_hyper_dim_t span_slab_info[]; OUT: Rebuilt section of hyperslab description
RETURNS
TRUE/FALSE for hyperslab selection rebuilt
DESCRIPTION
@ -10833,6 +10859,7 @@ done:
--------------------------------------------------------------------------*/
static herr_t
H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
H5S_hyper_span_info_t *copied_span_info = NULL; /* Temporary span info pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@ -10852,15 +10879,15 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
/* If we will run out of elements to skip in this span,
* advance to the first not fully skipped span and break
* out of this loop (start moving downwards) */
if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts;
udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts;
udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
udata->skip %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
break;
} /* end if */
/* Skip over this entire span */
udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts
udata->skip -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
} /* end if */
} /* end if */
@ -10919,15 +10946,15 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
/* If we will run out of elements to skip in this span,
* advance to the first not fully skipped span and
* continue down */
if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
if(udata->skip < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->u.nelmts;
udata->skip %= udata->ds_span[udata->depth]->down->u.nelmts;
udata->ds_low[udata->depth] += udata->skip / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
udata->skip %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
break;
} /* end if */
/* Skip over this entire span */
udata->skip -= udata->ds_span[udata->depth]->down->u.nelmts
udata->skip -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
/* Advance to next span */
@ -10972,27 +10999,59 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
* any complete spans, advance to the first not fully added
* span, and break out of this loop (start moving downwards)
*/
if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) {
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts;
udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts;
if(udata->nelem >= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) {
if(udata->share_selection) {
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
} /* end if */
else {
/* If we're not sharing the destination space's
* spans, we must copy it first (then release it
* afterwards) */
if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
copied_span_info) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
H5S__hyper_free_span_info(copied_span_info);
copied_span_info = NULL;
} /* end else */
udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
udata->nelem %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
} /* end if */
break;
} /* end if */
/* Append span tree for entire span */
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
if(udata->share_selection) {
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_span[udata->depth]->high,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts
} /* end if */
else {
/* If we're not sharing the destination space's
* spans, we must copy it first (then release it
* afterwards) */
if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_span[udata->depth]->high,
copied_span_info) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
H5S__hyper_free_span_info(copied_span_info);
copied_span_info = NULL;
} /* end else */
udata->nelem -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
} /* end if */
} /* end if */
@ -11063,27 +11122,59 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
* span and continue down
*/
HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high);
if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, udata->op_gen)
if(udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen)
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) {
if(udata->nelem >= udata->ds_span[udata->depth]->down->u.nelmts) {
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts) - 1,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->u.nelmts;
udata->nelem %= udata->ds_span[udata->depth]->down->u.nelmts;
if(udata->nelem >= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) {
if(udata->share_selection) {
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
} /* end if */
else {
/* If we're not sharing the destination space's
* spans, we must copy it first (then release it
* afterwards) */
if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_low[udata->depth] + (udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts) - 1,
copied_span_info) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
H5S__hyper_free_span_info(copied_span_info);
copied_span_info = NULL;
} /* end else */
udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
udata->nelem %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts;
} /* end if */
break;
} /* end if */
/* Append span tree for entire span */
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
if(udata->share_selection) {
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_span[udata->depth]->high,
udata->ds_span[udata->depth]->down) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
udata->nelem -= udata->ds_span[udata->depth]->down->u.nelmts
} /* end if */
else {
/* If we're not sharing the destination space's
* spans, we must copy it first (then release it
* afterwards) */
if(NULL == (copied_span_info = H5S__hyper_copy_span_helper(udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans")
if(H5S__hyper_append_span(&udata->ps_span_info[udata->depth],
udata->ds_rank - udata->depth, udata->ds_low[udata->depth],
udata->ds_span[udata->depth]->high,
copied_span_info) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span")
H5S__hyper_free_span_info(copied_span_info);
copied_span_info = NULL;
} /* end else */
udata->nelem -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts
* (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1);
/* Advance to next span */
@ -11128,6 +11219,13 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) {
udata->ps_clean_bitmap = 0;
done:
/* Cleanup on failure */
if(copied_span_info) {
HDassert(ret_value < 0);
H5S__hyper_free_span_info(copied_span_info);
copied_span_info = NULL;
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_proj_int_build_proj() */
@ -11217,7 +11315,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
/* Add skipped elements if there's a pre-gap */
if(ss_low < sis_low) {
low = sis_low;
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (sis_low - ss_low), FAIL);
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (sis_low - ss_low), FAIL);
} /* end if */
else
low = ss_low;
@ -11273,7 +11371,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
if(ss_span->high < sis_low) {
/* Add skipped elements */
if(ss_span->down)
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
else
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, ss_span->high - ss_low + 1, FAIL);
@ -11295,10 +11393,10 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
if(ss_span && !((depth == 0) && (u == count - 1))) {
/* Count remaining elements in ss_span_info */
if(ss_span->down) {
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (ss_span->high - ss_low + 1), FAIL);
ss_span = ss_span->next;
while(ss_span) {
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, udata->op_gen) * (ss_span->high - ss_span->low + 1), FAIL);
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper(ss_span->down, 0, udata->op_gen) * (ss_span->high - ss_span->low + 1), FAIL);
ss_span = ss_span->next;
} /* end while */
} /* end if */
@ -11356,7 +11454,7 @@ H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
} /* end if */
else if(depth > 0)
/* Just count skipped elements */
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, udata->op_gen) * count, FAIL); /* Casting away const OK -NAF */
H5S_HYPER_PROJ_INT_ADD_SKIP(udata, H5S__hyper_spans_nelem_helper((H5S_hyper_span_info_t *)ss_span_info, 0, udata->op_gen) * count, FAIL); /* Casting away const OK -NAF */
/* Clean up if we are done */
if(depth == 0) {
@ -11391,11 +11489,12 @@ done:
src_intersect_space within the selection of src_space as a selection
within the selection of dst_space
USAGE
herr_t H5S__hyper_project_intersection(src_space,dst_space,src_intersect_space,proj_space)
herr_t H5S__hyper_project_intersection(src_space,dst_space,src_intersect_space,proj_space,share_selection)
H5S_t *src_space; IN: Selection that is mapped to dst_space, and intersected with src_intersect_space
H5S_t *dst_space; IN: Selection that is mapped to src_space, and which contains the result
H5S_t *src_intersect_space; IN: Selection whose intersection with src_space is projected to dst_space to obtain the result
H5S_t *proj_space; OUT: Will contain the result (intersection of src_intersect_space and src_space projected from src_space to dst_space) after the operation
hbool_t share_selection; IN: Whether we are allowed to share structures inside dst_space with proj_space
RETURNS
Non-negative on success/Negative on failure.
DESCRIPTION
@ -11414,7 +11513,8 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
const H5S_t *src_intersect_space, H5S_t *proj_space)
const H5S_t *src_intersect_space, H5S_t *proj_space,
hbool_t share_selection)
{
H5S_hyper_project_intersect_ud_t udata; /* User data for subroutines */
const H5S_hyper_span_info_t *ss_span_info;
@ -11485,12 +11585,14 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "can't construct span tree for source intersect hyperslab selection")
/* Initialize udata */
/* We will use op_info[0] for nelem and op_info[1] for copied spans */
HDmemset(&udata, 0, sizeof(udata));
udata.ds_span[0] = ds_span_info->head;
udata.ds_low[0] = udata.ds_span[0]->low;
udata.ss_rank = H5S_GET_EXTENT_NDIMS(src_space);
udata.ds_rank = H5S_GET_EXTENT_NDIMS(dst_space);
udata.op_gen = H5S__hyper_get_op_gen();
udata.share_selection = share_selection;
/* Iterate over selections and build projected span tree */
if(H5S__hyper_proj_int_iterate(ss_span_info, src_intersect_space->select.sel_info.hslab->span_lst, 1, 0, &udata) < 0)

@ -86,7 +86,7 @@ static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
static herr_t H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list);
static herr_t H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen);
H5S_mpio_mpitype_list_t *type_list, unsigned op_info_i, uint64_t op_gen);
/*****************************/
@ -1007,8 +1007,10 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size,
op_gen = H5S__hyper_get_op_gen();
/* Obtain derived MPI data type */
/* Always use op_info[0] since we own this op_info, so there can be no
* simultaneous operations */
type_list.head = type_list.tail = NULL;
if(H5S__obtain_datatype(space->select.sel_info.hslab->span_lst, down, elmt_size, &elmt_type, &span_type, &type_list, op_gen) < 0)
if(H5S__obtain_datatype(space->select.sel_info.hslab->span_lst, down, elmt_size, &elmt_type, &span_type, &type_list, 0, op_gen) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
if(MPI_SUCCESS != (mpi_code = MPI_Type_dup(span_type, new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code)
@ -1096,7 +1098,7 @@ done:
static herr_t
H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
size_t elmt_size, const MPI_Datatype *elmt_type, MPI_Datatype *span_type,
H5S_mpio_mpitype_list_t *type_list, uint64_t op_gen)
H5S_mpio_mpitype_list_t *type_list, unsigned op_info_i, uint64_t op_gen)
{
H5S_hyper_span_t *span; /* Hyperslab span to iterate with */
hsize_t bigio_count; /* Transition point to create derived type */
@ -1119,7 +1121,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
bigio_count = H5_mpi_get_bigio_count();
/* Check if we've visited this span tree before */
if(spans->op_gen != op_gen) {
if(spans->op_info[op_info_i].op_gen != op_gen) {
H5S_mpio_mpitype_node_t *type_node; /* Pointer to new node in MPI data type list */
/* Allocate the initial displacement & block length buffers */
@ -1172,7 +1174,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Everything fits into integers, so cast them and use hindexed */
if(bigio_count >= outercount && large_block == FALSE) {
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, &spans->u.down_type)))
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, &spans->op_info[op_info_i].u.down_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code)
} /* end if */
else { /* LARGE_DATATYPE:: Something doesn't fit into a 32 bit integer */
@ -1190,17 +1192,17 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Combine the current datatype that is created with this current block type */
if(0 == u) /* first iteration, there is no combined datatype yet */
spans->u.down_type = temp_type;
spans->op_info[op_info_i].u.down_type = temp_type;
else {
int bl[2] = {1, 1};
MPI_Aint ds[2] = {disp[u - 1], disp[u]};
MPI_Datatype dt[2] = {spans->u.down_type, temp_type};
MPI_Datatype dt[2] = {spans->op_info[op_info_i].u.down_type, temp_type};
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, /* count */
bl, /* blocklength */
ds, /* stride in bytes*/
dt, /* old type */
&spans->u.down_type))) /* new type */
&spans->op_info[op_info_i].u.down_type))) /* new type */
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
/* Release previous temporary datatype */
@ -1253,7 +1255,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
blocklen[outercount] = 1;
/* Generate MPI datatype for next dimension down */
if(H5S__obtain_datatype(span->down, down + 1, elmt_size, elmt_type, &down_type, type_list, op_gen) < 0)
if(H5S__obtain_datatype(span->down, down + 1, elmt_size, elmt_type, &down_type, type_list, op_info_i, op_gen) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type")
/* Compute the number of elements to attempt in this span */
@ -1270,7 +1272,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
/* Building the whole vector datatype */
H5_CHECK_OVERFLOW(outercount, size_t, int)
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, &spans->u.down_type)))
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, &spans->op_info[op_info_i].u.down_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code)
/* Release inner node types */
@ -1285,7 +1287,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate MPI data type list node")
/* Set up MPI type node */
type_node->type = spans->u.down_type;
type_node->type = spans->op_info[op_info_i].u.down_type;
type_node->next = NULL;
/* Add MPI type node to list */
@ -1297,11 +1299,11 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down,
} /* end else */
/* Remember that we've visited this span tree */
spans->op_gen = op_gen;
spans->op_info[op_info_i].op_gen = op_gen;
} /* end else */
/* Return MPI data type for span tree */
*span_type = spans->u.down_type;
*span_type = spans->op_info[op_info_i].u.down_type;
done:
/* General cleanup */

@ -147,6 +147,21 @@ struct H5S_hyper_span_t {
struct H5S_hyper_span_t *next; /* Pointer to next span in list */
};
/* "Operation info" struct. Used to hold temporary information during copies,
* 'adjust', 'nelem', and 'rebuild' operations, and higher level algorithms that
* generate this information. */
typedef struct H5S_hyper_op_info_t {
uint64_t op_gen; /* Generation of the scratch info */
union {
struct H5S_hyper_span_info_t *copied; /* Pointer to already copied span tree */
hsize_t nelmts; /* # of elements */
hsize_t nblocks; /* # of blocks */
#ifdef H5_HAVE_PARALLEL
MPI_Datatype down_type; /* MPI datatype for span tree */
#endif /* H5_HAVE_PARALLEL */
}u;
} H5S_hyper_op_info_t;
/* Information about a list of hyperslab spans in one dimension (typedef'd in H5Sprivate.h) */
struct H5S_hyper_span_info_t {
unsigned count; /* Ref. count of number of spans which share this span */
@ -165,17 +180,10 @@ struct H5S_hyper_span_info_t {
hsize_t *low_bounds; /* The smallest element selected in each dimension */
hsize_t *high_bounds; /* The largest element selected in each dimension */
/* "Operation generation" fields */
/* "Operation info" fields */
/* (Used during copies, 'adjust', 'nelem', and 'rebuild' operations) */
uint64_t op_gen; /* Generation of the scratch info */
union {
struct H5S_hyper_span_info_t *copied; /* Pointer to already copied span tree */
hsize_t nelmts; /* # of elements */
hsize_t nblocks; /* # of blocks */
#ifdef H5_HAVE_PARALLEL
MPI_Datatype down_type; /* MPI datatype for span tree */
#endif /* H5_HAVE_PARALLEL */
}u;
/* Currently the maximum number of simultaneous operations is 2 */
H5S_hyper_op_info_t op_info[2];
struct H5S_hyper_span_t *head; /* Pointer to the first span of list of spans in the current dimension */
struct H5S_hyper_span_t *tail; /* Pointer to the last span of list of spans in the current dimension */
@ -377,7 +385,8 @@ H5_DLL uint64_t H5S__hyper_get_op_gen(void);
H5_DLL void H5S__hyper_rebuild(H5S_t *space);
H5_DLL herr_t H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space,
const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space);
const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space,
hbool_t share_space);
/* Testing functions */
#ifdef H5S_TESTING

@ -261,7 +261,7 @@ H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
H5_DLL herr_t H5S_select_project_intersection(const H5S_t *src_space,
const H5S_t *dst_space, const H5S_t *src_intersect_space,
H5S_t **new_space_ptr);
H5S_t **new_space_ptr, hbool_t share_space);
H5_DLL herr_t H5S_select_subtract(H5S_t *space, H5S_t *subtract_space);
/* Operations on all selections */

@ -172,6 +172,8 @@ H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
hsize_t numblocks, hsize_t buf[/*numblocks*/]);
H5_DLL herr_t H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset);
H5_DLL hid_t H5Sselect_project_intersection(hid_t src_space_id,
hid_t dst_space_id, hid_t src_intersect_space_id);
/* Operations on dataspace selection iterators */
H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags);

@ -2533,11 +2533,12 @@ done:
within the selection of dst_space
USAGE
herr_t H5S_select_project_intersection(src_space,dst_space,src_intersect_space,proj_space)
herr_t H5S_select_project_intersection(src_space,dst_space,src_intersect_space,proj_space,share_selection)
H5S_t *src_space; IN: Selection that is mapped to dst_space, and intersected with src_intersect_space
H5S_t *dst_space; IN: Selection that is mapped to src_space, and which contains the result
H5S_t *dst_space; IN: Selection that is mapped to src_space
H5S_t *src_intersect_space; IN: Selection whose intersection with src_space is projected to dst_space to obtain the result
H5S_t **new_space_ptr; OUT: Will contain the result (intersection of src_intersect_space and src_space projected from src_space to dst_space) after the operation
hbool_t share_selection; IN: Whether we are allowed to share structures inside dst_space with proj_space
RETURNS
Non-negative on success/Negative on failure.
@ -2555,7 +2556,8 @@ done:
--------------------------------------------------------------------------*/
herr_t
H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
const H5S_t *src_intersect_space, H5S_t **new_space_ptr)
const H5S_t *src_intersect_space, H5S_t **new_space_ptr,
hbool_t share_selection)
{
H5S_t *new_space = NULL; /* New dataspace constructed */
herr_t ret_value = SUCCEED; /* Return value */
@ -2602,8 +2604,8 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Intersecting space is hyperslab selection. Call the hyperslab
* routine to project to another hyperslab selection. */
if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab ondot destination selection")
if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection")
} /* end else */
/* load the address of the new space into *new_space_ptr */
@ -2618,6 +2620,75 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_project_intersection() */
/*--------------------------------------------------------------------------
NAME
H5Sselect_project_intersection
PURPOSE
Projects the intersection of of the selections of src_space_id and
src_intersect_space_id within the selection of src_space_id as a
selection within the selection of dst_space_id. Currently does not
support point selections.
USAGE
hid_t H5Sselect_project_intersection(src_space_id,dst_space_d,src_intersect_space_id)
hid_t src_space_id; IN: Selection that is mapped to dst_space_id, and intersected with src_intersect_space_id
hid_t dst_space_id; IN: Selection that is mapped to src_space_id
hid_t src_intersect_space_id; IN: Selection whose intersection with src_space_id is projected to dst_space_id to obtain the result
RETURNS
A dataspace with a selection equal to the intersection of
src_intersect_space_id and src_space_id projected from src_space to
dst_space on success, negative on failure.
DESCRIPTION
Projects the intersection of of the selections of src_space and
src_intersect_space within the selection of src_space as a selection
within the selection of dst_space. The result is placed in the
selection of new_space_ptr.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id,
hid_t src_intersect_space_id)
{
H5S_t *src_space, *dst_space, *src_intersect_space; /* Input dataspaces */
H5S_t *proj_space = NULL; /* Output dataspace */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("i", "iii", src_space_id, dst_space_id, src_intersect_space_id);
/* Check args */
if(NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
if(NULL == (dst_space = (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
if(NULL == (src_intersect_space = (H5S_t *)H5I_object_verify(src_intersect_space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
/* Perform operation */
if(H5S_select_project_intersection(src_space, dst_space,
src_intersect_space, &proj_space, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project dataspace intersection")
/* Atomize */
if((ret_value = H5I_register(H5I_DATASPACE, proj_space, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
if(ret_value < 0)
if(proj_space && H5S_close(proj_space) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
FUNC_LEAVE_API(ret_value)
} /* end H5Sselect_project_intersection() */
/*--------------------------------------------------------------------------
NAME
@ -2836,7 +2907,7 @@ H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes,
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "length array pointer is NULL")
/* Get the sequences of bytes */
if(maxseq > 0 && maxbytes > 0) {
if(maxseq > 0 && maxbytes > 0 && sel_iter->elmt_left > 0) {
if(H5S_SELECT_ITER_GET_SEQ_LIST(sel_iter, maxseq, maxbytes, nseq, nbytes, off, len) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed")
} /* end if */

@ -137,6 +137,9 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list")
/* Set the LCPL for the API context */
H5CX_set_lcpl(lcpl_id);
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")

@ -43,15 +43,10 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id,
hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Get the plist structure */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
switch(create_type) {
case H5VL_LINK_CREATE_HARD:
{

@ -2688,7 +2688,7 @@ H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **ful
#ifdef H5_HAVE_PARALLEL
/* Generic MPI functions */
H5_DLL hsize_t H5_mpi_set_bigio_count(hsize_t new_count);
H5_DLL hsize_t H5_mpi_get_bigio_count();
H5_DLL hsize_t H5_mpi_get_bigio_count(void);
H5_DLL herr_t H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new);
H5_DLL herr_t H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new);
H5_DLL herr_t H5_mpi_comm_free(MPI_Comm *comm);