Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
extensions: 'c,h,cpp,hpp,java'
clangFormatVersion: 17
style: file
exclude: './community ./ZFP/H5Z-ZFP'
exclude: './community ./ZFP/H5Z-ZFP ./SZ3/SZ3'
2 changes: 1 addition & 1 deletion .github/workflows/clang-format-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
clangFormatVersion: 17
inplace: True
style: file
exclude: './community ./ZFP/H5Z-ZFP'
exclude: './community ./ZFP/H5Z-ZFP ./SZ3/SZ3'

- uses: EndBug/add-and-commit@cc9c08ba6c8df3b93a8f2db63e89b98368ae2ae8 # v11.1.1
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/main-fetchcontent-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
-DENABLE_BITGROOM=ON \
-DENABLE_GRANULAR_BITROUND=ON \
-DENABLE_BITROUND=ON \
-DENABLE_SZ3=ON \
-DENABLE_BSHUF=ON \
..
cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
Expand Down Expand Up @@ -168,6 +169,7 @@ jobs:
-DENABLE_BITGROOM=ON \
-DENABLE_GRANULAR_BITROUND=ON \
-DENABLE_BITROUND=ON \
-DENABLE_SZ3=ON \
-DENABLE_BSHUF=ON \
$GITHUB_WORKSPACE
cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
Expand Down Expand Up @@ -244,6 +246,7 @@ jobs:
-DENABLE_BITGROOM=ON \
-DENABLE_GRANULAR_BITROUND=ON \
-DENABLE_BITROUND=ON \
-DENABLE_SZ3=ON \
-DENABLE_BSHUF=ON \
$GITHUB_WORKSPACE
cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/main-fetchcontent-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
-DENABLE_BITGROOM=ON \
-DENABLE_GRANULAR_BITROUND=ON \
-DENABLE_BITROUND=ON \
-DENABLE_SZ3=ON \
-DENABLE_BSHUF=ON \
..
# NOTE: Currently a serial build has to be forced, as Blosc and Blosc2
Expand Down Expand Up @@ -160,6 +161,7 @@ jobs:
-DENABLE_BITGROOM=ON \
-DENABLE_GRANULAR_BITROUND=ON \
-DENABLE_BITROUND=ON \
-DENABLE_SZ3=ON \
-DENABLE_BSHUF=ON \
$GITHUB_WORKSPACE
# NOTE: Currently, a serial build has to be forced as Blosc and Blosc2
Expand Down Expand Up @@ -238,6 +240,7 @@ jobs:
-DENABLE_BITGROOM=ON \
-DENABLE_GRANULAR_BITROUND=ON \
-DENABLE_BITROUND=ON \
-DENABLE_SZ3=ON \
-DENABLE_BSHUF=ON \
$GITHUB_WORKSPACE
# NOTE: Currently, a serial build has to be forced as Blosc and Blosc2
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/main-fetchcontent-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ jobs:
-DENABLE_BITGROOM=ON \
-DENABLE_GRANULAR_BITROUND=ON \
-DENABLE_BITROUND=ON \
-DENABLE_SZ3=ON \
-DENABLE_BSHUF=ON \
..
cmake --build . --parallel 4 --config ${{ inputs.build_mode }}
Expand Down Expand Up @@ -177,6 +178,7 @@ jobs:
-DENABLE_BITGROOM=ON \
-DENABLE_GRANULAR_BITROUND=ON \
-DENABLE_BITROUND=ON \
-DENABLE_SZ3=ON \
-DENABLE_BSHUF=ON \
$GITHUB_WORKSPACE
cmake --build . --parallel 4 --config ${{ inputs.build_mode }}
Expand Down Expand Up @@ -264,6 +266,7 @@ jobs:
-DENABLE_BITGROOM=ON \
-DENABLE_GRANULAR_BITROUND=ON \
-DENABLE_BITROUND=ON \
-DENABLE_SZ3=ON \
-DENABLE_BSHUF=ON \
$GITHUB_WORKSPACE
cmake --build . --parallel 4 --config ${{ inputs.build_mode }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main-package-managers-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
-DENABLE_BITGROOM=OFF \
-DENABLE_GRANULAR_BITROUND=OFF \
-DENABLE_BITROUND=OFF \
-DENABLE_SZ3=OFF \
-DENABLE_BSHUF=OFF \
$GITHUB_WORKSPACE
cmake --build . --parallel 3 --config ${{ inputs.build_mode }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main-package-managers-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
-DENABLE_BITGROOM=OFF \
-DENABLE_GRANULAR_BITROUND=OFF \
-DENABLE_BITROUND=OFF \
-DENABLE_SZ3=OFF \
-DENABLE_BLOSC=OFF \
-DENABLE_BSHUF=OFF \
-DENABLE_BZIP2=OFF \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main-package-managers-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ jobs:
-DENABLE_BITGROOM=OFF \
-DENABLE_GRANULAR_BITROUND=OFF \
-DENABLE_BITROUND=OFF \
-DENABLE_SZ3=OFF \
-DENABLE_BSHUF=OFF \
$GITHUB_WORKSPACE
cmake --build . --parallel 4 --config ${{ inputs.build_mode }}
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ else ()
set (ENABLE_LZF OFF CACHE BOOL "" FORCE)
endif ()

# SZ3 filter
# SZ3 has no decode-only build, and its CMake requires CMake 3.19
if (NOT MINGW AND NOT DISABLE_H5PL_ENCODER AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
FILTER_OPTION (SZ3)
else ()
set (ENABLE_SZ3 OFF CACHE BOOL "" FORCE)
endif ()

# ZFP filter
if (WIN32)
if (NOT CMAKE_C_COMPILER_ID MATCHES "Intel")
Expand Down
29 changes: 29 additions & 0 deletions SZ3/Additional_Legal/copyright-and-BSD-license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Copyright © 2016 , UChicago Argonne, LLC
All Rights Reserved

SZ licence is under the BSD license. Details are shown below.

OPEN SOURCE LICENSE (license number: SF-16-105)

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Software changes, modifications, or derivative works, should be noted with comments and the author and organization's name.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the names of UChicago Argonne, LLC or the Department of Energy nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

4. The software and the end-user documentation included with the redistribution, if any, must include the following acknowledgment:

"This product includes software produced by UChicago Argonne, LLC under Contract No. DE-AC02-06CH11357 with the Department of Energy."

******************************************************************************************************
DISCLAIMER

THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND.

NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR UCHICAGO ARGONNE, LLC, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, DATA, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.

***************************************************************************************************

Contact: Sheng Di (sdi1@anl.gov), Franck Cappello(cappello@mcs.anl.gov)
30 changes: 30 additions & 0 deletions SZ3/Additional_Legal/zstd-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
BSD License

For Zstandard software

Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name Facebook, nor Meta, nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
204 changes: 204 additions & 0 deletions SZ3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
#
# Copyright by The HDF Group.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#

# Wrapper CMakeLists.txt for SZ3 subtree integration
# This integrates the upstream H5Z-SZ3 filter (tools/H5Z-SZ3 of SZ3, via git
# subtree) with the HDF Group's hdf5_plugins build system and testing infrastructure.

cmake_minimum_required(VERSION 3.18)
project(H5SZ3 C CXX)

if (POLICY CMP0074)
# find_package() uses <PackageName>_ROOT variables.
cmake_policy(SET CMP0074 NEW)
endif ()

if (POLICY CMP0083)
# To control generation of Position Independent Executable (PIE) or not,
# some flags are required at link time.
cmake_policy(SET CMP0083 NEW)
endif ()

# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()

#-----------------------------------------------------------------------------
# Verify SZ3 subtree exists
#-----------------------------------------------------------------------------
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/SZ3/tools/H5Z-SZ3/CMakeLists.txt")
message(FATAL_ERROR
"SZ3 not found at ${CMAKE_CURRENT_SOURCE_DIR}/SZ3\n"
"The upstream SZ3 code should be present via git subtree.")
endif()

# SZ3's CMake requires CMake 3.19
if (CMAKE_VERSION VERSION_LESS "3.19")
message(FATAL_ERROR "The SZ3 filter plugin requires CMake 3.19 or newer")
endif ()

message(STATUS "Using SZ3 from subtree at ${CMAKE_CURRENT_SOURCE_DIR}/SZ3")

#-----------------------------------------------------------------------------
# Basic H5SZ3 stuff - integrate with HDF Group build system
#-----------------------------------------------------------------------------
if (NOT H5PL_RESOURCES_DIR)
include(${H5SZ3_SOURCE_DIR}/config/cmake/HDFMacros.cmake)
include(${H5SZ3_SOURCE_DIR}/config/cmake/HDFPluginMacros.cmake)

SET_HDF_BUILD_TYPE()
endif ()

# Set up package name for HDF Group infrastructure
if (NOT H5SZ3_PACKAGE_NAME)
set(H5SZ3_PACKAGE_NAME "sz3")
endif()

BASIC_SETTINGS(H5${H5SZ3_PACKAGE_NAME})

# The H5Z-SZ3 filter has no decode-only build
if (DISABLE_H5SZ3_ENCODER)
message(FATAL_ERROR "The ${H5SZ3_PACKAGE_NAME} filter cannot be built without its encoder; set ENABLE_SZ3=OFF instead")
endif ()

#-----------------------------------------------------------------------------
# Version information (read from SZ3)
#-----------------------------------------------------------------------------
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/SZ3/CMakeLists.txt" SZ3_PROJECT_LINE REGEX "^project\\(SZ3 VERSION ")
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" SZ3_PROJECT_VERSION "${SZ3_PROJECT_LINE}")
set(H5SZ3_VERS_MAJOR ${CMAKE_MATCH_1})
set(H5SZ3_VERS_MINOR ${CMAKE_MATCH_2})
set(H5SZ3_VERS_RELEASE ${CMAKE_MATCH_3})

set(H5SZ3_PACKAGE_VERSION "${H5SZ3_VERS_MAJOR}.${H5SZ3_VERS_MINOR}.${H5SZ3_VERS_RELEASE}")
set(H5SZ3_PACKAGE_VERSION_STRING "${H5SZ3_PACKAGE_VERSION}")
set(H5SZ3_PACKAGE_VERSION_MAJOR "${H5SZ3_VERS_MAJOR}")
set(H5SZ3_PACKAGE_VERSION_MINOR "${H5SZ3_VERS_MINOR}")
set(H5SZ3_PACKAGE_STRING "${H5SZ3_PACKAGE_NAME} ${H5SZ3_PACKAGE_VERSION}")
set(H5SZ3_PACKAGE_URL "http://www.hdfgroup.org")
set(H5SZ3_PACKAGE_BUGREPORT "help@hdfgroup.org")

message(STATUS "Configuring SZ3 HDF5 Plugin version: ${H5SZ3_PACKAGE_STRING} (from upstream SZ3)")

#-----------------------------------------------------------------------------
# Include HDF Group macros
#-----------------------------------------------------------------------------
include(${H5SZ3_RESOURCES_DIR}/ConfigureChecks.cmake)

#-----------------------------------------------------------------------------
# HDF5 support
#-----------------------------------------------------------------------------
HDF5_SUPPORT(TRUE)
message(STATUS "H5SZ3 link libs: ${H5PL_LINK_LIBS}")

#-----------------------------------------------------------------------------
# Add the upstream H5Z-SZ3 filter via SZ3's own CMake
# Note: SZ3 is a header-only C++17 library; with BUILD_H5Z_FILTER its
# CMakeLists.txt builds the filter plugin (target hdf5sz3) from tools/H5Z-SZ3
#-----------------------------------------------------------------------------
message(STATUS "Building H5Z-SZ3 filter from subtree")

# Build the filter, and none of SZ3's tools or tests
set(BUILD_H5Z_FILTER ON)
set(BUILD_SZ3_BINARY OFF)
set(BUILD_MDZ OFF)
set(BUILD_PARAVIEW_PLUGIN OFF)

# Compile the Zstd bundled in SZ3 (SZ3/tools/zstd) into the plugin, so the
# plugin needs no Zstd library at build or run time
set(SZ3_USE_BUNDLED_ZSTD ON)

# SZ3 installs the filter plugin into H5Z_SZ3_PLUGIN_INSTALL_DIR (default
# lib/plugin) only when SZ3_INSTALL is ON, which it is not by default under a
# parent project. Point it at this project's lib/plugin convention
# (H5SZ3_INSTALL_LIB_DIR, set above by BASIC_SETTINGS).
set(SZ3_INSTALL ON)
set(H5Z_SZ3_PLUGIN_INSTALL_DIR ${H5SZ3_INSTALL_LIB_DIR} CACHE STRING
"Directory to install the HDF5 filter plugin copy into; empty installs no copy")
add_subdirectory(SZ3)

# Copy the plugin to the global plugins directory for testing
# SZ3 builds it in its own binary dir, but tests expect plugins in build/plugins/
# Use a custom target since add_custom_command(TARGET) only works in same directory
add_custom_target(copy_sz3_plugin ALL
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/plugins"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:hdf5sz3>"
"${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:hdf5sz3>"
DEPENDS hdf5sz3
COMMENT "Copying SZ3 plugin to ${CMAKE_BINARY_DIR}/plugins/"
)

#-----------------------------------------------------------------------------
# Create compatibility alias for the HDF Group target name
#-----------------------------------------------------------------------------
# The HDF Group build names plugin targets ${H5SZ3_LIB_TARGET} (h5sz3)
# SZ3 creates hdf5sz3, so create an alias for compatibility
if (TARGET hdf5sz3)
set(H5SZ3_LIB_CORENAME "h5sz3")
set(H5SZ3_LIB_TARGET ${H5SZ3_LIB_CORENAME})

# Create alias so parent build system can find it by the HDF Group name
add_library(${H5SZ3_LIB_TARGET} ALIAS hdf5sz3)

message(STATUS "Created alias: ${H5SZ3_LIB_TARGET} -> hdf5sz3")
endif ()

#-----------------------------------------------------------------------------
# Export the library for parent build system
#-----------------------------------------------------------------------------
# Export the expected target name for the parent build system
set(H5SZ3_LIBRARIES_TO_EXPORT "${H5SZ3_LIB_TARGET}" CACHE STRING "H5SZ3 libraries to export" FORCE)

#-----------------------------------------------------------------------------
# The SZ3 and Zstd licenses ask binary redistributions to carry their notices
#-----------------------------------------------------------------------------
install(
FILES
${H5SZ3_SOURCE_DIR}/Additional_Legal/copyright-and-BSD-license.txt
${H5SZ3_SOURCE_DIR}/Additional_Legal/zstd-LICENSE
DESTINATION ${H5SZ3_INSTALL_DOC_DIR}/SZ3
COMPONENT libraries
)

#-----------------------------------------------------------------------------
# Dashboard and Testing Settings
#-----------------------------------------------------------------------------
option(H5PL_BUILD_TESTING "Build h5sz3 Unit Testing" OFF)
if (H5PL_BUILD_TESTING)
set(DART_TESTING_TIMEOUT 1200 CACHE STRING
"Timeout in seconds for each test (default 1200=20minutes)")
enable_testing()
include(CTest)
include(${PROJECT_SOURCE_DIR}/CTestConfig.cmake)
configure_file(${${PLUGIN_PACKAGE_NAME}_RESOURCES_DIR}/CTestCustom.cmake ${PROJECT_BINARY_DIR}/CTestCustom.ctest @ONLY)
endif ()

#-----------------------------------------------------------------------------
# Add HDF Group examples
#-----------------------------------------------------------------------------
# Examples are needed for testing, so enable them if testing is enabled
if (H5PL_BUILD_TESTING AND NOT H5PL_BUILD_EXAMPLES)
set(H5PL_BUILD_EXAMPLES ON CACHE BOOL "Build h5sz3 Examples (required for testing)" FORCE)
message(STATUS "Enabling H5PL_BUILD_EXAMPLES (required for H5PL_BUILD_TESTING)")
endif ()

option(H5PL_BUILD_EXAMPLES "Build h5sz3 Examples" OFF)
if (H5PL_BUILD_EXAMPLES)
add_subdirectory(example)
endif ()

#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
INSTALL_SUPPORT(H5SZ3)
Loading