Skip to content

Commit

Permalink
Fix szip handling
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisHeimbigner committed May 1, 2022
1 parent e667afa commit f897b45
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 220 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name: Run macOS-based netCDF Tests


on: [pull_request]
on: [pull_request,push]

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: Run Ubuntu/Linux netCDF Tests

on: [pull_request]
on: [pull_request,push]

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_win_mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name: Run MSYS2, MinGW64-based Tests


on: [pull_request]
on: [pull_request,push]

jobs:

Expand Down
34 changes: 4 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -623,26 +623,6 @@ ENDIF(ENABLE_STRICT_NULL_BYTE_HEADER_PADDING)
# 3. is nczarr enabled?
# We need separate flags for cases 1 and 2

# We need to determine if libsz is available both for HDF5 and NCZarr
# If user has specified the `SZIP_LIBRARY`, use it; otherwise try to find...
IF(NOT SZIP_LIBRARY)
FIND_LIBRARY(SZIP PATH NAMES szip sz sz2)
IF(SZIP)
SET(SZIP_LIBRARY ${SZIP})
ELSE()
UNSET(SZIP_LIBRARY)
UNSET(SZIP)
ENDIF()
ENDIF()

IF(SZIP_LIBRARY)
SET(SZIP_FOUND yes)
SET(HAVE_SZ yes)
ELSE()
SET(SZIP_FOUND no)
SET(HAVE_SZ no)
ENDIF()

##
# Option to Enable HDF5
#
Expand Down Expand Up @@ -905,15 +885,6 @@ IF(USE_HDF5)
int x = 1;}" USE_HDF5_SZIP)
IF(USE_HDF5_SZIP)
SET(HAVE_H5Z_SZIP yes)
# If user has specified the `SZIP_LIBRARY`, use it; otherwise try to find...
IF(SZIP_FOUND)
SET(CMAKE_REQUIRED_LIBRARIES ${SZIP_LIBRARY} ${CMAKE_REQUIRED_LIBRARIES})
MESSAGE(STATUS "HDF5 has szip.")
ELSE()
MESSAGE(FATAL_ERROR "HDF5 Requires SZIP, but cannot find libszip or libsz.")
ENDIF()
ELSE()
SET(HAVE_H5Z_SZIP no)
ENDIF()

####
Expand Down Expand Up @@ -1124,13 +1095,15 @@ ENDIF()
endmacro(set_std_filter)

# Locate some compressors
FIND_PACKAGE(Szip)
FIND_PACKAGE(Bz2)
FIND_PACKAGE(Blosc)
FIND_PACKAGE(Zstd)

# Accumulate standard filters
set(STD_FILTERS "deflate") # Always have deflate*/
set_std_filter(SZIP)
set_std_filter(Szip)
SET(HAVE_SZ ${Szip_FOUND})
set_std_filter(Blosc)
set_std_filter(Zstd)
IF(Bz2_FOUND)
Expand All @@ -1143,6 +1116,7 @@ ELSE()
set(STD_FILTERS "${STD_FILTERS} bz2")
ENDIF()


# If user wants, then install selected plugins
SET(PLUGIN_INSTALL_DIR "" CACHE STRING "Whether and where we should install plugins")
SET(ENABLE_PLUGIN_INSTALL OFF)
Expand Down
179 changes: 0 additions & 179 deletions cmake/modules/FindSZIP.cmake

This file was deleted.

64 changes: 64 additions & 0 deletions cmake/modules/FindSzip.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Searches for an installation of the szip library. On success, it sets the following variables:
#
# Szip_FOUND Set to true to indicate the szip library was found
# Szip_INCLUDE_DIRS The directory containing the header file szip/szip.h
# Szip_LIBRARIES The libraries needed to use the szip library
#
# To specify an additional directory to search, set Szip_ROOT.
#
# Author: Siddhartha Chaudhuri, 2009
#

# Look for the header, first in the user-specified location and then in the system locations
SET(Szip_INCLUDE_DOC "The directory containing the header file szip.h")
FIND_PATH(Szip_INCLUDE_DIRS NAMES szlib.h szip.h szip/szip.h PATHS ${Szip_ROOT} ${Szip_ROOT}/include DOC ${Szip_INCLUDE_DOC} NO_DEFAULT_PATH)
IF(NOT Szip_INCLUDE_DIRS) # now look in system locations
FIND_PATH(Szip_INCLUDE_DIRS NAMES szlib.h szip.h szip/szip.h DOC ${Szip_INCLUDE_DOC})
ENDIF(NOT Szip_INCLUDE_DIRS)

SET(Szip_FOUND FALSE)

IF(Szip_INCLUDE_DIRS)
SET(Szip_LIBRARY_DIRS ${Szip_INCLUDE_DIRS})

IF("${Szip_LIBRARY_DIRS}" MATCHES "/include$")
# Strip off the trailing "/include" in the path.
GET_FILENAME_COMPONENT(Szip_LIBRARY_DIRS ${Szip_LIBRARY_DIRS} PATH)
ENDIF("${Szip_LIBRARY_DIRS}" MATCHES "/include$")

IF(EXISTS "${Szip_LIBRARY_DIRS}/lib")
SET(Szip_LIBRARY_DIRS ${Szip_LIBRARY_DIRS}/lib)
ENDIF(EXISTS "${Szip_LIBRARY_DIRS}/lib")

# Find Szip libraries
FIND_LIBRARY(Szip_DEBUG_LIBRARY NAMES szipd szip_d libszipd libszip_d szip libszip sz2 libsz2
PATH_SUFFIXES Debug ${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_ARCHITECTURE}/Debug
PATHS ${Szip_LIBRARY_DIRS} NO_DEFAULT_PATH)
FIND_LIBRARY(Szip_RELEASE_LIBRARY NAMES szip libszip sz libsz sz2 libsz2
PATH_SUFFIXES Release ${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_ARCHITECTURE}/Release
PATHS ${Szip_LIBRARY_DIRS} NO_DEFAULT_PATH)

SET(Szip_LIBRARIES )
IF(Szip_DEBUG_LIBRARY AND Szip_RELEASE_LIBRARY)
SET(Szip_LIBRARIES debug ${Szip_DEBUG_LIBRARY} optimized ${Szip_RELEASE_LIBRARY})
ELSEIF(Szip_DEBUG_LIBRARY)
SET(Szip_LIBRARIES ${Szip_DEBUG_LIBRARY})
ELSEIF(Szip_RELEASE_LIBRARY)
SET(Szip_LIBRARIES ${Szip_RELEASE_LIBRARY})
ENDIF(Szip_DEBUG_LIBRARY AND Szip_RELEASE_LIBRARY)

IF(Szip_LIBRARIES)
SET(Szip_FOUND TRUE)
ENDIF(Szip_LIBRARIES)
ENDIF(Szip_INCLUDE_DIRS)

IF(Szip_FOUND)
# IF(NOT Szip_FIND_QUIETLY)
MESSAGE(STATUS "Found Szip: headers at ${Szip_INCLUDE_DIRS}, libraries at ${Szip_LIBRARY_DIRS}")
MESSAGE(STATUS " library is ${Szip_LIBRARIES}")
# ENDIF(NOT Szip_FIND_QUIETLY)
ELSE(Szip_FOUND)
IF(Szip_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Szip library not found")
ENDIF(Szip_FIND_REQUIRED)
ENDIF(Szip_FOUND)
14 changes: 10 additions & 4 deletions docs/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -935,10 +935,16 @@ This is for internal use only.
As part of the overall build process, a number of filters are built as shared libraries in the "plugins" directory
— in that directory or the "plugins/.libs" subdirectory.

An option exists to allow some of those filters to be installed into a user-specified directory.
Presumably this directory is part of the value of the HDF5_PLUGIN_PATH environment variable.
The ./configure option is ````--with-plugin-dir=<absolute-directory-path>````.
The corresponding CMake option is ````-DPLUGIN_INSTALL_DIR=<absolute-directory-path>````.
An option exists to allow some of those filters to be installed into a user-specified directory. The relevant options are as follows:
````
./configure: --with-plugin-dir=<absolute-directory-path>
cmake: -DPLUGIN_INSTALL_DIR=<absolute-directory-path>
````
If the value of the environment variable "HDF5_PLUGIN_PATH" is a single directory, then
a good value for the install directory is "$HDF5_PLUGIN_PATH", so for example:
````
./configure ... --with-plugin-dir="$HDF5_PLUGIN_DIR"
````

If this option is specified, then as part of the "install" build action,
a specified set of filter shared libraries will be copied into the specified directory.
Expand Down
7 changes: 7 additions & 0 deletions nc_test4/tst_specific_filters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh

set -x
set -e

if test "x$TESTNCZARR" = x1 ; then
Expand Down Expand Up @@ -96,6 +97,12 @@ rm -f $file
fi
setfilter $zfilt ref_any.cdl "tmp_filt_${zfilt}.cdl" "$zparams" "$zcodec"
if test "x$TESTNCZARR" = x1 ; then
if test "x$zfilt" = xszip ; then
echo "@@@"
find /usr -name 'libsz*'
find ${HDF5_PLUGIN_DIR} -name '*sz*.so'
ldd ${HDF5_PLUGIN_DIR}/libh5szip.so
fi
${NCGEN} -4 -lb -o $fileurl "tmp_filt_${zfilt}.cdl"
${NCDUMP} -n $zfilt -sF $fileurl > "tmp_filt_${zfilt}.tmp"
else
Expand Down
2 changes: 2 additions & 0 deletions ncdump/tst_nccopy3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh

set -x
set -e

echo ""

# get some config.h parameters
Expand Down
1 change: 1 addition & 0 deletions ncdump/tst_output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh

# This shell script tests the output from several previous tests.
set -x
set -e

echo ""
Expand Down
Loading

0 comments on commit f897b45

Please sign in to comment.