Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/non_rec_rwlock' into locking_pro…
Browse files Browse the repository at this point in the history
…tocol
  • Loading branch information
qkoziol committed Jul 18, 2024
2 parents 714437f + ce70682 commit a509273
Show file tree
Hide file tree
Showing 18 changed files with 164 additions and 113 deletions.
1 change: 0 additions & 1 deletion .github/workflows/vol_adios2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
- name: Checkout HDF5
uses: actions/[email protected]
with:
repository: HDFGroup/hdf5
path: hdf5

- name: Configure HDF5
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/vol_async.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- name: Checkout HDF5
uses: actions/[email protected]
with:
repository: HDFGroup/hdf5
path: hdf5

- name: Checkout Argobots
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/vol_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
- name: Checkout HDF5
uses: actions/[email protected]
with:
repository: HDFGroup/hdf5
path: hdf5

- name: Checkout Argobots
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/vol_ext_passthru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- name: Checkout HDF5
uses: actions/[email protected]
with:
repository: HDFGroup/hdf5
path: hdf5

- name: Checkout vol-external-passthrough
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/vol_log.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
- name: Checkout HDF5
uses: actions/[email protected]
with:
repository: HDFGroup/hdf5
path: hdf5

# Log-based VOL currently doesn't have CMake support
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/vol_rest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
- name: Checkout HDF5
uses: actions/[email protected]
with:
repository: HDFGroup/hdf5
path: hdf5

- name: Configure HDF5 with REST VOL connector
Expand Down
27 changes: 23 additions & 4 deletions CMakeFilters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# [email protected].
#
option (HDF5_USE_ZLIB_NG "Use zlib-ng library as zlib library" OFF)
option (HDF5_USE_LIBAEC_STATIC "Use static AEC library" OFF)
option (HDF5_USE_ZLIB_STATIC "Find static zlib library" OFF)
option (HDF5_USE_LIBAEC_STATIC "Find static AEC library" OFF)
option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF)
option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF)

Expand Down Expand Up @@ -86,16 +87,29 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT)
set (PACKAGE_NAME ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT})
endif ()
set(ZLIB_FOUND FALSE)
find_package (ZLIB NAMES ${PACKAGE_NAME} COMPONENTS static shared)
if (HDF5_USE_ZLIB_STATIC)
set(ZLIB_SEACH_TYPE static)
else ()
set(ZLIB_SEACH_TYPE shared)
endif ()
find_package (ZLIB NAMES ${PACKAGE_NAME} COMPONENTS ${ZLIB_SEACH_TYPE})
if (NOT ZLIB_FOUND)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
set(ZLIB_USE_STATIC_LIBS ${HDF5_USE_ZLIB_STATIC})
endif()
find_package (ZLIB) # Legacy find
endif ()
set(H5_ZLIB_FOUND ${ZLIB_FOUND})
if (H5_ZLIB_FOUND)
set (H5_ZLIB_HEADER "zlib.h")
set (H5_ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
set (H5_ZLIB_INCLUDE_DIRS ${H5_ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES})
# The FindZLIB.cmake module does not set an OUTPUT_NAME
# on the target. The target returned is: ZLIB::ZLIB
get_filename_component (libname ${ZLIB_LIBRARIES} NAME_WLE)
string (REGEX REPLACE "^lib" "" libname ${libname})
set_target_properties (ZLIB::ZLIB PROPERTIES OUTPUT_NAME zlib-static)
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ZLIB::ZLIB)
endif ()
else ()
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
Expand Down Expand Up @@ -131,9 +145,14 @@ option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" ON)
if (HDF5_ENABLE_SZIP_SUPPORT)
option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON)
if (NOT SZIP_USE_EXTERNAL)
if (HDF5_USE_LIBAEC_STATIC)
set(LIBAEC_SEACH_TYPE static)
else ()
set(LIBAEC_SEACH_TYPE shared)
endif ()
set(libaec_USE_STATIC_LIBS ${HDF5_USE_LIBAEC_STATIC})
set(SZIP_FOUND FALSE)
find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS ${LIBAEC_SEACH_TYPE})
if (NOT SZIP_FOUND)
find_package (SZIP) # Legacy find
endif ()
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
)
endif ()

# Whether the most recently called project() command, in the current scope or above,
# was in the top level CMakeLists.txt file.
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.21.0")
if(NOT PROJECT_IS_TOP_LEVEL)
set (HDF5_EXTERNALLY_CONFIGURED 1)
endif()
else()
if (NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set (HDF5_EXTERNALLY_CONFIGURED 1)
endif()
endif()
#-----------------------------------------------------------------------------
# Instructions for use : Sub-Project Build
#
Expand Down
4 changes: 3 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"HDF5_PACKAGE_EXTLIBS": "ON",
"HDF5_USE_ZLIB_NG": "OFF",
"ZLIB_USE_LOCALCONTENT": "OFF",
"LIBAEC_USE_LOCALCONTENT": "OFF"
"LIBAEC_USE_LOCALCONTENT": "OFF",
"HDF5_USE_ZLIB_STATIC": "ON",
"HDF5_USE_LIBAEC_STATIC": "ON"
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions config/cmake/cacheinit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ set (ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.3" C
set (ZLIB_USE_LOCALCONTENT ON CACHE BOOL "Use local file for ZLIB FetchContent" FORCE)
set (ZLIB_GIT_URL "https://github.com/madler/zlib.git" CACHE STRING "Use ZLIB from GitHub repository" FORCE)
set (ZLIB_GIT_BRANCH "develop" CACHE STRING "" FORCE)
set (HDF5_USE_ZLIB_STATIC ON CACHE BOOL "Use static zlib library" FORCE)

set (ZLIBNG_PACKAGE_NAME "zlib-ng" CACHE STRING "Name of ZLIBNG package" FORCE)
set (ZLIBNG_TGZ_NAME "2.1.6.tar.gz" CACHE STRING "Use HDF5_ZLib from compressed file" FORCE)
Expand All @@ -65,6 +66,7 @@ set (LIBAEC_TGZ_ORIGPATH "https://github.com/MathisRosenhauer/libaec/releases/do
set (LIBAEC_USE_LOCALCONTENT ON CACHE BOOL "Use local file for LIBAEC FetchContent" FORCE)
set (LIBAEC_GIT_URL "https://github.com/MathisRosenhauer/libaec.git" CACHE STRING "Use LIBAEC from GitHub repository" FORCE)
set (LIBAEC_GIT_BRANCH "v1.1.3" CACHE STRING "" FORCE)
set (HDF5_USE_LIBAEC_STATIC ON CACHE BOOL "Use static AEC library" FORCE)

########################
# API test options
Expand Down
2 changes: 2 additions & 0 deletions release_docs/INSTALL_CMake.txt
Original file line number Diff line number Diff line change
Expand Up @@ -943,13 +943,15 @@ else
ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13"
ZLIB_TGZ_NAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz"
ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" ON
HDF5_USE_ZLIB_STATIC "Find static zlib library" OFF

SZIP_USE_EXTERNAL "Use External Library Building for SZIP else search" OFF
if (HDF5_ENABLE_SZIP_SUPPORT)
HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON
LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://github.com/MathisRosenhauer/libaec/releases/download/v1.1.3"
LIBAEC_TGZ_NAME "Use LIBAEC from original compressed file" "libaec-1.1.3.tar.gz"
LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" ON
HDF5_USE_LIBAEC_STATIC "Find static AEC library" OFF

PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGINS else search" OFF
if (WINDOWS)
Expand Down
13 changes: 13 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,19 @@ Bug Fixes since HDF5-1.14.0 release

Configuration
-------------
- Fixed usage issue with FindZLIB.cmake module

When building HDF5 with CMake and relying on the FindZLIB.cmake module,
the Find module would correctly find the ZLIB library but not set an OUTPUT_NAME
on the target. Also, the target returned, ZLIB::ZLIB, was not in the ZLIB_LIBRARIES
variable. This caused issues when requesting the OUTPUT_NAME of the target in
the pkg-config settings.

Similar to HDF5_USE_LIBAEC_STATIC, "Find static AEC library", option, we added
a new option, HDF5_USE_ZLIB_STATIC, "Find static zlib library". These options
allow a user to specify whether to use a static or shared version of the compression
library in a find_package call.

- Corrected usage of FetchContent in the HDFLibMacros.cmake file.

CMake version 3.30 changed the behavior of the FetchContent module to deprecate
Expand Down
79 changes: 41 additions & 38 deletions src/H5FDfamily.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ H5FD__family_fapl_get(H5FD_t *_file)
FUNC_ENTER_PACKAGE

if (NULL == (fa = (H5FD_family_fapl_t *)H5MM_calloc(sizeof(H5FD_family_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed");

fa->memb_size = file->memb_size;
if (NULL == (plist = (H5P_genplist_t *)H5I_object(file->memb_fapl_id)))
Expand Down Expand Up @@ -463,7 +463,7 @@ H5FD__family_fapl_copy(const void *_old_fa)
FUNC_ENTER_PACKAGE

if (NULL == (new_fa = (H5FD_family_fapl_t *)H5MM_malloc(sizeof(H5FD_family_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed");

/* Copy the fields of the structure */
H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t));
Expand Down Expand Up @@ -671,7 +671,7 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad

/* Initialize file from file access properties */
if (NULL == (file = (H5FD_family_t *)H5MM_calloc(sizeof(H5FD_family_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct");
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct");
if (H5P_FILE_ACCESS_DEFAULT == fapl_id) {
H5FD_family_fapl_t default_fa;

Expand Down Expand Up @@ -760,7 +760,7 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad

assert(n > 0);
if (NULL == (x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to reallocate members");
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to reallocate members");
file->amembs = n;
file->memb = x;
} /* end if */
Expand All @@ -770,18 +770,23 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
* otherwise an open failure means that we've reached the last member.
* Allow H5F_ACC_CREAT only on the first family member.
*/
H5E_BEGIN_TRY
{
file->memb[file->nmembs] =
H5FDopen(memb_name, (0 == file->nmembs ? flags : t_flags), file->memb_fapl_id, HADDR_UNDEF);
if (0 == file->nmembs) {
if (NULL == (file->memb[file->nmembs] = H5FDopen(memb_name, (0 == file->nmembs ? flags : t_flags),
file->memb_fapl_id, HADDR_UNDEF)))
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open member file");
}
H5E_END_TRY
if (!file->memb[file->nmembs]) {
if (0 == file->nmembs)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open member file");
H5E_clear_stack();
break;
else {
H5E_PAUSE_ERRORS
{
file->memb[file->nmembs] = H5FDopen(memb_name, (0 == file->nmembs ? flags : t_flags),
file->memb_fapl_id, HADDR_UNDEF);
}
H5E_RESUME_ERRORS

if (!file->memb[file->nmembs])
break;
}

file->nmembs++;
}

Expand Down Expand Up @@ -1005,7 +1010,7 @@ H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
H5FD_t **x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *));

if (!x)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block");
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate memory block");
file->amembs = n;
file->memb = x;
file->nmembs = u;
Expand All @@ -1015,14 +1020,9 @@ H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
if (u >= file->nmembs || !file->memb[u]) {
file->nmembs = MAX(file->nmembs, u + 1);
snprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, file->name, u);
H5E_BEGIN_TRY
{
H5_CHECK_OVERFLOW(file->memb_size, hsize_t, haddr_t);
file->memb[u] = H5FDopen(memb_name, file->flags | H5F_ACC_CREAT, file->memb_fapl_id,
(haddr_t)file->memb_size);
}
H5E_END_TRY
if (NULL == file->memb[u])
H5_CHECK_OVERFLOW(file->memb_size, hsize_t, haddr_t);
if (NULL == (file->memb[u] = H5FDopen(memb_name, file->flags | H5F_ACC_CREAT, file->memb_fapl_id,
(haddr_t)file->memb_size)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open member file");
} /* end if */

Expand Down Expand Up @@ -1082,7 +1082,7 @@ H5FD__family_get_eof(const H5FD_t *_file, H5FD_mem_t type)
* loop with i==0.
*/
assert(file->nmembs > 0);
for (i = (int)file->nmembs - 1; i >= 0; --i) {
for (i = (int)(file->nmembs - 1); i >= 0; --i) {
if ((eof = H5FD_get_eof(file->memb[i], type)) != 0)
break;
if (0 == i)
Expand Down Expand Up @@ -1418,10 +1418,9 @@ H5FD__family_delete(const char *filename, hid_t fapl_id)
bool default_config = false;
hid_t memb_fapl_id = H5I_INVALID_HID;
unsigned current_member;
char *member_name = NULL;
char *temp = NULL;
herr_t delete_error = FAIL;
herr_t ret_value = SUCCEED;
char *member_name = NULL;
char *temp = NULL;
herr_t ret_value = SUCCEED;

FUNC_ENTER_PACKAGE

Expand Down Expand Up @@ -1488,18 +1487,22 @@ H5FD__family_delete(const char *filename, hid_t fapl_id)
* Note that this means that any missing files in the family will leave
* undeleted members behind.
*/
H5E_BEGIN_TRY
{
delete_error = H5FD_delete(member_name, memb_fapl_id);
}
H5E_END_TRY
if (FAIL == delete_error) {
if (0 == current_member)
if (0 == current_member) {
if (H5FD_delete(member_name, memb_fapl_id) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete member file");
else
H5E_clear_stack();
break;
}
else {
herr_t delete_error;

H5E_PAUSE_ERRORS
{
delete_error = H5FD_delete(member_name, memb_fapl_id);
}
H5E_RESUME_ERRORS
if (delete_error < 0)
break;
}

current_member++;
} /* end while */

Expand Down
Loading

0 comments on commit a509273

Please sign in to comment.