Skip to content

Commit

Permalink
Squashed 'src/H5Z-ZFP/' changes from 5d9a995..cd5422c
Browse files Browse the repository at this point in the history
cd5422c Compatibility with Visual Studio 2019 (silx-kit#93)
bcff4d2 CMake: (fix) Missing header file. (silx-kit#90)
59b7f38 updating for 1.0.0 (silx-kit#85)
3802c0f Tests: (fix) Makefile - CFLAGS and clean target (silx-kit#84)
111e5a1 Fix Silo doc section and warnings (silx-kit#83)
9dd4546 Use ZFP's version string (silx-kit#80)
557a4f6 Pin zfp version in windows ci (silx-kit#82)
f51ac59 added parameter to fortran const (silx-kit#76)
35a08e0 [github] add windows build config (silx-kit#72)
1844b5b Fixed detection of CFP availability (silx-kit#74)
c8544d3 [windows] enable compilation in windows with ClangCL (silx-kit#71)
7b34cac Update installation.rst (silx-kit#66)
e153bf9 Feature direct write zfp array (silx-kit#43)
20b0f1f Added missing HDF5 include (CMake) (silx-kit#63)
20b893a Test and fix working with HDF5-1.12 (silx-kit#62)
497e942 CMake: (fix) Autotools build HDF5 (silx-kit#59)
8f63f7d Add missing headers for string functions and fix printfs for cd_nelmts (silx-kit#60)
8de12f7 Added generic interface fortran wrappers with tests (silx-kit#58)
983a187 find zfp and hdf5 in lib64 instead of lib (silx-kit#56)
e6c9c14 Fix typos
f7670c4 Fix second typo in h5repack docs (silx-kit#55)
57a849d handle optional/mandatory flag (silx-kit#54)
48126d3 CMake: (feature) Added CMake build configuration (silx-kit#52)
bee7434 fix link to travis badge (silx-kit#51)
00146c1 update to download from github (silx-kit#49)
259feb8 Remove include for HDF5 header file (silx-kit#48)
3d0b176 adding missing call to h5z_zfp_finaliz() (silx-kit#45)
b642fe8 minor fixes to docs and h5repack utility (silx-kit#42)

git-subtree-dir: src/H5Z-ZFP
git-subtree-split: cd5422c146836e17c7a0380bfb05cf52d0c4467c
  • Loading branch information
t20100 committed Nov 8, 2022
1 parent 355e6d8 commit a4e000e
Show file tree
Hide file tree
Showing 33 changed files with 1,634 additions and 306 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: h5z-zfp

# Controls when the action will run.
#Triggers the workflow on push or pull requests.
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that
# can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
linux-build:
strategy:
matrix:
name: ["Ubuntu Latest GCC"]
include:
- name: "Ubuntu Latest GCC"
artifact: "Linux.tar.xz"
os: ubuntu-latest

name: ${{ matrix.name }}
# The type of runner that the job will run on.
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'skip-ci')"

# Steps represent a sequence of tasks that will be executed
# as part of the job.
steps:
- name: Install Dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -qq libhdf5-dev
sudo apt-get install -qq hdf5-tools
echo "HDF5_HOME=/usr/include/hdf5/serial,/usr/lib/x86_64-linux-gnu/hdf5/serial,/usr/bin" >> $GITHUB_ENV
# Set env vars
echo "CC=gcc" >> $GITHUB_ENV
echo "FC=gfortran" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
# Checks-out the repository under $GITHUB_WORKSPACE so the job can access it.
- name: Get Sources
uses: actions/checkout@v2

##################################
# INSTALL ZFP
##################################

- name: install ZFP
run: |
git clone https://github.com/LLNL/zfp.git
export HOME_DIR=$(echo ~)
cd zfp
git checkout 1.0.0
mkdir build;cd build
cmake -D ZFP_BIT_STREAM_WORD_SIZE=8 -D BUILD_CFP=ON -D CMAKE_INSTALL_PREFIX=$PWD/zfp -D BUILD_TESTING=OFF -D BUILD_UTILITIES=OFF ..
make install
echo "ZFP_HOME=$PWD/zfp" >> $GITHUB_ENV
echo "ZFP_DIR=$PWD/zfp" >> $GITHUB_ENV
shell: bash

##################################
# BUILD AND TEST H5Z-ZFP
##################################

- name: build (autotools) and check
run: |
make all
make check
shell: bash

- name: build (cmake)
run: |
mkdir build; cd build
cmake -D FORTRAN_INTERFACE=ON -D CMAKE_BUILD_TYPE=Release ..
make
shell: bash


windows-build:
name: 'Windows MSVC/Clang'
defaults:
run:
shell: bash
runs-on: windows-2019
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: install prerequisites
run: |
choco install \
unzip \
wget
- name: setup MSVC Tools
uses: ilammy/msvc-dev-cmd@v1
- name: download HDF5 for Windows
run: |
wget --quiet \
https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.1/bin/windows/hdf5-1.12.1-Std-win10_64-vs16.zip
unzip hdf5-1.12.1-Std-win10_64-vs16.zip
- name: Install HDF5 for Windows
run: msiexec /i "hdf\HDF5-1.12.1-win64.msi" /qn
shell: cmd
- name: Download and install ZFP
run: |
git clone https://github.com/LLNL/zfp.git
cd zfp
git checkout 1.0.0
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_UTILITIES=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_CFP=ON \
-DZFP_BIT_STREAM_WORD_SIZE=8
cmake --build . -j 3
cmake --build . --target install
- name: update PATH
run: |
echo "C:/Program Files/HDF_Group/HDF5/1.12.1/bin" >> $GITHUB_PATH
- name: configure cmake
run: |
mkdir build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DFORTRAN_INTERFACE=OFF \
-TClangCL
cmake --build . -j 3
cmake --build . --target install
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ before_install:
- pwd
- ls
- pushd /tmp
- wget http://computation.llnl.gov/projects/floating-point-compression/download/zfp-0.5.5.tar.gz
- wget https://github.com/LLNL/zfp/releases/download/0.5.5/zfp-0.5.5.tar.gz
- tar -xzf zfp-0.5.5.tar.gz
- pushd zfp-0.5.5
- make DEFS=-DBIT_STREAM_WORD_TYPE=uint8
Expand Down
68 changes: 68 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 3.9)

# Fail immediately if not using an out-of-source build
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR
"In-source builds are not supported. Please create a build directory "
"separate from the source directory")
endif ()

#------------------------------------------------------------------------------#
# Parse version number from H5Zzfp_version.h
#------------------------------------------------------------------------------#
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/src/H5Zzfp_version.h" H5Z_ZFP_H REGEX "^\#define H5Z_FILTER_ZFP_VERSION_MAJOR")
string(REGEX REPLACE "^.*MAJOR " "" H5Z_ZFP_VERSION_MAJOR "${H5Z_ZFP_H}")
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/src/H5Zzfp_version.h" H5Z_ZFP_H REGEX "^\#define H5Z_FILTER_ZFP_VERSION_MINOR")
string(REGEX REPLACE "^.*MINOR " "" H5Z_ZFP_VERSION_MINOR "${H5Z_ZFP_H}")
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/src/H5Zzfp_version.h" H5Z_ZFP_H REGEX "^\#define H5Z_FILTER_ZFP_VERSION_PATCH")
string(REGEX REPLACE "^.*PATCH " "" H5Z_ZFP_VERSION_PATCH "${H5Z_ZFP_H}")
set(H5Z_ZFP_VERSION "${H5Z_ZFP_VERSION_MAJOR}.${H5Z_ZFP_VERSION_MINOR}.${H5Z_ZFP_VERSION_PATCH}")

project(H5Z_ZFP VERSION ${H5Z_ZFP_VERSION} LANGUAGES C)

#------------------------------------------------------------------------------#
# Compile options.
#------------------------------------------------------------------------------#
option(FORTRAN_INTERFACE "Enable the Fortran interface" ON)
if (FORTRAN_INTERFACE)
enable_language(Fortran)
endif ()

#------------------------------------------------------------------------------#
# Some boilerplate to setup nice output directories
#------------------------------------------------------------------------------#
set(CMAKE_INSTALL_INCLUDEDIR include)
set(CMAKE_INSTALL_CMAKEDIR lib/cmake/h5z_zfp)

#------------------------------------------------------------------------------#
# Required packages
#------------------------------------------------------------------------------#
# Find HDF5, relies on HDF5_DIR or HDF5_ROOT being set in environment.
set(COMPONENTS C)
if (FORTRAN_INTERFACE)
list(APPEND COMPONENTS Fortran)
endif ()
find_package(HDF5 REQUIRED COMPONENTS ${COMPONENTS})

# Find ZFP, relies on ZFP_DIR or ZFP_ROOT being set in environment.
find_package(ZFP REQUIRED CONFIG)

#------------------------------------------------------------------------------#
# Add source
#------------------------------------------------------------------------------#
add_subdirectory(${CMAKE_SOURCE_DIR}/src)

#------------------------------------------------------------------------------#
# Packaging
#------------------------------------------------------------------------------#
# Install h5z_zfp-config.cmake and h5z_zfp-config-version.cmake
set(H5Z_ZFP_CONFIG_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/h5z_zfp-config.cmake.in)
set(H5Z_ZFP_CONFIG_OUT ${CMAKE_CURRENT_BINARY_DIR}/cmake/h5z_zfp-config.cmake)
configure_file(${H5Z_ZFP_CONFIG_IN} ${H5Z_ZFP_CONFIG_OUT} @ONLY)
set(H5Z_ZFP_CONFIG_VERSION_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/h5z_zfp-config-version.cmake.in)
set(H5Z_ZFP_CONFIG_VERSION_OUT ${CMAKE_CURRENT_BINARY_DIR}/cmake/h5z_zfp-config-version.cmake)
configure_file(${H5Z_ZFP_CONFIG_VERSION_IN} ${H5Z_ZFP_CONFIG_VERSION_OUT} @ONLY)
install(FILES ${H5Z_ZFP_CONFIG_OUT}
DESTINATION ${CMAKE_INSTALL_CMAKEDIR})
install(FILES ${H5Z_ZFP_CONFIG_VERSION_OUT}
DESTINATION ${CMAKE_INSTALL_CMAKEDIR})
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ help:
@echo " make CC=<C-compiler> HDF5_HOME=<path> ZFP_HOME=<path> PREFIX=<path> all"
@echo ""
@echo "where <path> is a dir whose children are include/lib/bin subdirs."
@echo "HDF5_HOME can also be specified by the HDF5 include directory,"
@echo "library directory and bin directory separated by commas, i.e. HDF5_HOME=INC,LIB,BIN"
@echo "Standard make variables (e.g. CFLAGS, LD, etc.) can be set as usual."
@echo "Optionally, add FC=<fortran-compiler> to include Fortran support and tests."
@echo ""
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A highly flexible floating point and integer
compression plugin for the HDF5 library using ZFP compression.

[![Build Status](https://travis-ci.org/LLNL/H5Z-ZFP.svg?branch=master)](https://travis-ci.org/LLNL/H5Z-ZFP)
[![Build Status](https://travis-ci.com/LLNL/H5Z-ZFP.svg?branch=master)](https://travis-ci.com/LLNL/H5Z-ZFP)
[![Documentation Status](https://readthedocs.org/projects/h5z-zfp/badge/?version=latest)](http://h5z-zfp.readthedocs.io)
[![codecov](https://codecov.io/gh/LLNL/H5Z-ZFP/branch/master/graph/badge.svg)](https://codecov.io/gh/LLNL/H5Z-ZFP)

Expand All @@ -28,10 +28,11 @@ package due to the likely broad appeal and utility of the ZFP
compression library.

This plugin supports all modes of the ZFP compression library, *rate*,
*accuracy*, *precision* and *expert* and *lossless*. It supports 1, 2 and
3 dimensional datasets of single and double precision integer and floating
point data. It can be applied to HDF5 datasets of more than 3 dimensions
(or 4 dimensions for ZFP versions 0.5.5 and newer) as long as no more than 3
(or 4) dimensions of the HDF5 dataset chunking are of size greater than 1.
*accuracy*, *precision*, *expert* and *lossless*. It supports 1, 2, 3 and
4 dimensional datasets (for ZFP version 0.5.5 and newer) of single and double
precision integer and floating point data. It can be applied to HDF5 datasets
of more than 3 dimensions (or 4 dimensions for ZFP versions 0.5.5 and newer)
as long as no more than 3 (or 4) dimensions of the HDF5 dataset *chunking* are
of size greater than 1.

[**Full documentation**](http://h5z-zfp.readthedocs.io)
15 changes: 15 additions & 0 deletions cmake/h5z_zfp-config-version.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
set(PACKAGE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@)
set(PACKAGE_VERSION_MINOR @PROJECT_VERSION_MINOR@)
set(PACKAGE_VERSION_PATCH @PROJECT_VERSION_PATCH@)
set(PACKAGE_VERSION @PROJECT_VERSION@)

# Check whether the requested PACKAGE_FIND_VERSION is compatible
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR
PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
59 changes: 59 additions & 0 deletions cmake/h5z_zfp-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# h5z_zfp-config.cmake
# --------------------
#
# Finds the H5Z_ZFP library, specify the starting search path in H5Z_ZFP_ROOT
#
# Static vs. shared
# -----------------
# To make use of the static library instead of the shared one, one needs
# to set the variable H5Z_ZFP_USE_STATIC_LIBS to ON before calling find_package.
# Example:
# set(H5Z_ZFP_USE_STATIC_LIBS ON)
# find_package(H5Z_ZFP REQUIRED CONFIG)
#
# This will define the following variables:
#
# H5Z_ZFP_FOUND - True if the system has the H5Z_ZFP library.
# H5Z_ZFP_WITH_OPENMP - True if the zfp library has been built with OpenMP support.
#
# and the following imported targets:
#
# h5z_zfp::h5z_zfp - The H5Z_ZFP library.

find_path(H5Z_ZFP_INCLUDE_DIR NAMES H5Zzfp.h DOC "H5Z_ZFP include directory")
if(H5Z_ZFP_USE_STATIC_LIBS)
find_library(H5Z_ZFP_LIBRARY NAMES libh5zzfp.a DOC "H5Z_ZFP library")
else()
find_library(H5Z_ZFP_LIBRARY NAMES libh5zzfp.so HINTS $ENV{H5Z_ZFP_ROOT}/plugin DOC "H5Z_ZFP library")
endif()

include(FindPackageHandleStandardArgs)
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
find_package_handle_standard_args(H5Z_ZFP
FOUND_VAR H5Z_ZFP_FOUND
REQUIRED_VARS H5Z_ZFP_LIBRARY H5Z_ZFP_INCLUDE_DIR
CONFIG_MODE
)

if(H5Z_ZFP_FOUND)
set(HDF5_USE_STATIC_LIBRARIES ${H5Z_ZFP_USE_STATIC_LIBS})
find_package(HDF5 MODULE REQUIRED COMPONENTS C)
find_package(ZFP REQUIRED CONFIG)
if(H5Z_ZFP_USE_STATIC_LIBS)
add_library(h5z_zfp::h5z_zfp STATIC IMPORTED)
else()
add_library(h5z_zfp::h5z_zfp SHARED IMPORTED)
endif()
set_target_properties(h5z_zfp::h5z_zfp PROPERTIES
IMPORTED_LOCATION "${H5Z_ZFP_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${H5Z_ZFP_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "zfp::zfp;${HDF5_LIBRARIES}"
LINK_LIBRARIES "zfp::zfp;${HDF5_LIBRARIES}"
)
set(H5Z_ZFP_WITH_OPENMP ${ZFP_WITH_OPENMP})
endif()

mark_as_advanced(
H5Z_ZFP_INCLUDE_DIR
H5Z_ZFP_LIBRARY
)
Loading

0 comments on commit a4e000e

Please sign in to comment.