From faf3a2fae0c0c7afdc184c61abc918a03e916f68 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 16 Dec 2020 11:59:51 -0600 Subject: OESS-98 convert plugin option to FetchContent, add tests (#155) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * Update other test machines * OESS-98 fix tools test for plugins * HDFFV-10865 performance improvement for java array --- CMakeFilters.cmake | 2 +- CMakeInstallation.cmake | 13 -- CMakeLists.txt | 31 ++-- MANIFEST | 1 + config/cmake/HDF5PluginCache.cmake | 31 ++++ config/cmake/HDF5PluginMacros.cmake | 162 +++++++------------ config/cmake_ext_mod/HDFMacros.cmake | 13 ++ fortran/src/CMakeLists.txt | 2 - hl/c++/src/CMakeLists.txt | 1 - hl/fortran/src/CMakeLists.txt | 48 ++++++ java/src/hdf/hdf5lib/HDFArray.java | 304 ++++++++++++++--------------------- release_docs/RELEASE.txt | 53 ++++-- 12 files changed, 325 insertions(+), 336 deletions(-) create mode 100644 config/cmake/HDF5PluginCache.cmake diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index dda5510..9a0719f 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -12,7 +12,7 @@ option (USE_LIBAEC "Use AEC library as SZip Filter" OFF) include (ExternalProject) -#include(FetchContent) +include (FetchContent) #option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO") set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)") diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index ccd4fbc..be7f252 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -249,19 +249,6 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) endif () endif () -if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - if (CMAKE_HOST_UNIX) - set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" - CACHE PATH "Install path prefix, prepended onto install directories." FORCE) - else () - GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) - set (CMAKE_INSTALL_PREFIX - "${CMAKE_GENERIC_PROGRAM_FILES}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" - CACHE PATH "Install path prefix, prepended onto install directories." FORCE) - set (CMAKE_GENERIC_PROGRAM_FILES) - endif () -endif () - #----------------------------------------------------------------------------- # Set the cpack variables #----------------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index f404c90..b65bdf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -855,17 +855,6 @@ endif () #----------------------------------------------------------------------------- add_subdirectory (src) -#----------------------------------------------------------------------------- -# Include filter plugins -#----------------------------------------------------------------------------- -include (CMakePlugins.cmake) - -if (HDF5_PACKAGE_EXTLIBS AND NOT HDF5_NO_PACKAGES) - if (HDF5_ENABLE_PLUGIN_SUPPORT AND PLUGIN_FOUND) - PACKAGE_PLUGIN_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) - endif () -endif () - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) if (NOT ONLY_SHARED_LIBS) @@ -883,11 +872,6 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT add_dependencies (${HDF5_LIBSH_TARGET} SZIP) endif () endif () - if (PLUGIN_FOUND AND PLUGIN_USE_EXTERNAL) - if (BUILD_SHARED_LIBS) - add_dependencies (PLUGIN ${HDF5_LIBSH_TARGET}) - endif () - endif () endif () #----------------------------------------------------------------------------- @@ -985,6 +969,21 @@ if (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools endif () #----------------------------------------------------------------------------- +# Include filter plugins +#----------------------------------------------------------------------------- +include (CMakePlugins.cmake) + +if (HDF5_PACKAGE_EXTLIBS AND NOT HDF5_NO_PACKAGES) + if (HDF5_ENABLE_PLUGIN_SUPPORT AND PLUGIN_FOUND) + PACKAGE_PLUGIN_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) +# option (HDF5_TEST_PLUGIN "Execute plugin tests" ON) +# mark_as_advanced (HDF5_TEST_PLUGIN) + +# TEST_PLUGIN_LIBRARY () + endif () +endif () + +#----------------------------------------------------------------------------- # Option to build examples #----------------------------------------------------------------------------- if (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") diff --git a/MANIFEST b/MANIFEST index 38da068..5268953 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3505,6 +3505,7 @@ ./config/cmake/HDFFortranCompilerFlags.cmake ./config/cmake/HDF5Macros.cmake ./config/cmake/HDF5PluginMacros.cmake +./config/cmake/HDF5PluginCache.cmake ./config/cmake/HDF5UseFortran.cmake ./config/cmake/jrunTest.cmake ./config/cmake/jvolTest.cmake diff --git a/config/cmake/HDF5PluginCache.cmake b/config/cmake/HDF5PluginCache.cmake new file mode 100644 index 0000000..acf703d --- /dev/null +++ b/config/cmake/HDF5PluginCache.cmake @@ -0,0 +1,31 @@ +# This is the CMakeCache file. + +######################## +# EXTERNAL cache entries +######################## + +# examples are the tests for plugins +set (H5PL_BUILD_TESTING ON CACHE BOOL "Enable h5pl testing" FORCE) +set (BUILD_EXAMPLES ON CACHE BOOL "Build h5pl Examples" FORCE) + +set (HDF5_PACKAGE_NAME "hdf5" CACHE STRING "Name of HDF5 package" FORCE) +set (HDF5_HDF5_HEADER "h5pubconf.h" CACHE STRING "Name of HDF5 header" FORCE) +set (HDF5_LINK_TARGET ${HDF5_LIBSH_TARGET} CACHE STRING "hdf5 target" FORCE) +set (HDF5_LINK_LIBS $ CACHE STRING "hdf5 shared link library" FORCE) +#set (HDF5_INCLUDE_DIR $ CACHE PATH "hdf5 include dirs" FORCE) +set (HDF5_INCLUDE_DIR "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}" CACHE PATH "hdf5 include dirs" FORCE) +set (HDF5_INCLUDE_DIRS "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}" CACHE PATH "hdf5 include dirs" FORCE) +set (HDF5_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "hdf5 build folder" FORCE) + +set (HDF5_DUMP_EXECUTABLE $ CACHE STRING "hdf5 h5dump target" FORCE) +set (HDF5_REPACK_EXECUTABLE $ CACHE STRING "hdf5 h5repack target" FORCE) + +set (H5PL_ALLOW_EXTERNAL_SUPPORT "${HDF5_ALLOW_EXTERNAL_SUPPORT}" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) + +set (H5PL_GIT_URL "https://git@bitbucket.hdfgroup.org/scm/test/h5plugin.git" CACHE STRING "Use plugins from HDF repository" FORCE) +set (H5PL_GIT_BRANCH "master" CACHE STRING "" FORCE) + +set (H5PL_TGZ_NAME "${PLUGIN_TGZ_NAME}" CACHE STRING "Use plugins from compressed file" FORCE) + +set (PL_PACKAGE_NAME "${PLUGIN_PACKAGE_NAME}" CACHE STRING "Name of plugins package" FORCE) +set (H5PL_CPACK_ENABLE OFF CACHE BOOL "Enable the CPACK include and components" FORCE) diff --git a/config/cmake/HDF5PluginMacros.cmake b/config/cmake/HDF5PluginMacros.cmake index 46d3979..3c0e12c 100644 --- a/config/cmake/HDF5PluginMacros.cmake +++ b/config/cmake/HDF5PluginMacros.cmake @@ -3,114 +3,72 @@ #------------------------------------------------------------------------------- macro (EXTERNAL_PLUGIN_LIBRARY compress_type) if (${compress_type} MATCHES "GIT") - EXTERNALPROJECT_ADD (PLUGIN + FetchContent_Declare (PLUGIN GIT_REPOSITORY ${PLUGIN_URL} GIT_TAG ${PLUGIN_BRANCH} - LIST_SEPARATOR | - INSTALL_COMMAND "" - CMAKE_ARGS - -DUSE_SHARED_LIBS:BOOL=ON - -DBUILD_SHARED_LIBS:BOOL=ON - -DH5PL_ALLOW_EXTERNAL_SUPPORT:STRING=${HDF5_ALLOW_EXTERNAL_SUPPORT} - -DBUILD_TESTING:STRING=OFF - -DBUILD_EXAMPLES:STRING=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DDISABLE_PLUGIN_ENCODER:BOOL=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - # the hdf5 settings - -DHDF5_PACKAGE_NAME:STRING=hdf5 - -DHDF5_HDF5_HEADER:STRING=h5pubconf.h - -DHDF5_LINK_LIBS:STRING=$ - -DHDF5_INCLUDE_DIR:PATH=${HDF5_SRC_DIR}|${HDF5_SRC_BINARY_DIR} - -DPL_PACKAGE_NAME:STRING=${PLUGIN_PACKAGE_NAME} - -DH5PL_CPACK_ENABLE:BOOL=ON - -DHDF5_DIR:STRING=${CMAKE_CURRENT_BINARY_DIR} - -DTGZPATH:PATH=${TGZPATH} - # the filters - -DBSHUF_TGZ_NAME:STRING=${BSHUF_TGZ_NAME} - -DBSHUF_PACKAGE_NAME:STRING=${BSHUF_PACKAGE_NAME} - -DBLOSC_TGZ_NAME:STRING=${BLOSC_TGZ_NAME} - -DBLOSC_PACKAGE_NAME:STRING=${BLOSC_PACKAGE_NAME} - -DZLIB_TGZ_NAME:STRING=${ZLIB_TGZ_NAME} - -DZLIB_PACKAGE_NAME:STRING=${ZLIB_PACKAGE_NAME} - -DBZ2_TGZ_NAME:STRING=${BZ2_TGZ_NAME} - -DBZ2_PACKAGE_NAME:STRING=${BZ2_PACKAGE_NAME} - #-DFPZIP_TGZ_NAME:STRING=${FPZIP_TGZ_NAME} - #-DFPZIP_PACKAGE_NAME:STRING=${FPZIP_PACKAGE_NAME} - -DJPEG_TGZ_NAME:STRING=${JPEG_TGZ_NAME} - -DJPEG_PACKAGE_NAME:STRING=${JPEG_PACKAGE_NAME} - -DLZ4_TGZ_NAME:STRING=${LZ4_TGZ_NAME} - -DLZ4_PACKAGE_NAME:STRING=${LZ4_PACKAGE_NAME} - -DLZF_TGZ_NAME:STRING=${LZF_TGZ_NAME} - -DLZF_PACKAGE_NAME:STRING=${LZF_PACKAGE_NAME} - -DSZF_TGZ_NAME:STRING=${SZF_TGZ_NAME} - -DSZF_PACKAGE_NAME:STRING=${SZF_PACKAGE_NAME} - -DZFP_TGZ_NAME:STRING=${ZFP_TGZ_NAME} - -DZFP_PACKAGE_NAME:STRING=${ZFP_PACKAGE_NAME} ) elseif (${compress_type} MATCHES "TGZ") - EXTERNALPROJECT_ADD (PLUGIN + FetchContent_Declare (PLUGIN URL ${PLUGIN_URL} - URL_MD5 "" - LIST_SEPARATOR | - INSTALL_COMMAND "" - CMAKE_ARGS - -DUSE_SHARED_LIBS:BOOL=ON - -DBUILD_SHARED_LIBS:BOOL=ON - -DH5PL_ALLOW_EXTERNAL_SUPPORT:STRING=${HDF5_ALLOW_EXTERNAL_SUPPORT} - -DBUILD_TESTING:STRING=OFF - -DBUILD_EXAMPLES:STRING=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DDISABLE_PLUGIN_ENCODER:BOOL=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - # the hdf5 settings - -DHDF5_PACKAGE_NAME:STRING=hdf5 - -DHDF5_HDF5_HEADER:STRING=h5pubconf.h - -DHDF5_LINK_LIBS:STRING=$ - -DHDF5_INCLUDE_DIR:PATH=${HDF5_SRC_DIR}|${HDF5_SRC_BINARY_DIR} - -DPL_PACKAGE_NAME:STRING=${PLUGIN_PACKAGE_NAME} - -DH5PL_CPACK_ENABLE:BOOL=ON - -DHDF5_DIR:STRING=${CMAKE_CURRENT_BINARY_DIR} - -DTGZPATH:PATH=${TGZPATH} - # the filters - -DBSHUF_TGZ_NAME:STRING=${BSHUF_TGZ_NAME} - -DBSHUF_PACKAGE_NAME:STRING=${BSHUF_PACKAGE_NAME} - -DBLOSC_TGZ_NAME:STRING=${BLOSC_TGZ_NAME} - -DBLOSC_PACKAGE_NAME:STRING=${BLOSC_PACKAGE_NAME} - -DZLIB_TGZ_NAME:STRING=${ZLIB_TGZ_NAME} - -DZLIB_PACKAGE_NAME:STRING=${ZLIB_PACKAGE_NAME} - -DBZ2_TGZ_NAME:STRING=${BZ2_TGZ_NAME} - -DBZ2_PACKAGE_NAME:STRING=${BZ2_PACKAGE_NAME} - #-DFPZIP_TGZ_NAME:STRING=${FPZIP_TGZ_NAME} - #-DFPZIP_PACKAGE_NAME:STRING=${FPZIP_PACKAGE_NAME} - -DJPEG_TGZ_NAME:STRING=${JPEG_TGZ_NAME} - -DJPEG_PACKAGE_NAME:STRING=${JPEG_PACKAGE_NAME} - -DLZ4_TGZ_NAME:STRING=${LZ4_TGZ_NAME} - -DLZ4_PACKAGE_NAME:STRING=${LZ4_PACKAGE_NAME} - -DLZF_TGZ_NAME:STRING=${LZF_TGZ_NAME} - -DLZF_PACKAGE_NAME:STRING=${LZF_PACKAGE_NAME} - -DSZF_TGZ_NAME:STRING=${SZF_TGZ_NAME} - -DSZF_PACKAGE_NAME:STRING=${SZF_PACKAGE_NAME} - -DZFP_TGZ_NAME:STRING=${ZFP_TGZ_NAME} - -DZFP_PACKAGE_NAME:STRING=${ZFP_PACKAGE_NAME} + URL_HASH "" ) endif () - externalproject_get_property (PLUGIN BINARY_DIR SOURCE_DIR) - set (PLUGIN_BINARY_DIR "${BINARY_DIR}") - -# include (${BINARY_DIR}/PLUGIN-targets.cmake) + FetchContent_GetProperties(PLUGIN) + message (STATUS "HDF5_INCLUDE_DIR=${HDF5_INCLUDE_DIR}") + if(NOT PLUGIN_POPULATED) + FetchContent_Populate(PLUGIN) + include (${HDF_RESOURCES_DIR}/HDF5PluginCache.cmake) + set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) + add_subdirectory(${plugin_SOURCE_DIR} ${plugin_BINARY_DIR}) + if (ENABLE_BLOSC) + add_dependencies (h5blosc ${HDF5_LIBSH_TARGET}) + add_dependencies (h5ex_d_blosc ${HDF5_LIBSH_TARGET}) + target_include_directories (h5ex_d_blosc PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}") + endif () + if (ENABLE_BSHUF) + add_dependencies (h5bshuf ${HDF5_LIBSH_TARGET}) + add_dependencies (h5ex_d_bshuf ${HDF5_LIBSH_TARGET}) + target_include_directories (h5ex_d_bshuf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}") + endif () + if (ENABLE_BZIP2) + add_dependencies (h5bz2 ${HDF5_LIBSH_TARGET}) + add_dependencies (h5ex_d_bzip2 ${HDF5_LIBSH_TARGET}) + target_include_directories (h5ex_d_bzip2 PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}") + endif () + if (ENABLE_JPEG) + add_dependencies (h5jpeg ${HDF5_LIBSH_TARGET}) + add_dependencies (h5ex_d_jpeg ${HDF5_LIBSH_TARGET}) + target_include_directories (h5ex_d_jpeg PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}") + endif () + if (ENABLE_LZ4) + add_dependencies (h5lz4 ${HDF5_LIBSH_TARGET}) + add_dependencies (h5ex_d_lz4 ${HDF5_LIBSH_TARGET}) + target_include_directories (h5ex_d_lz4 PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}") + endif () + if (ENABLE_LZF) + add_dependencies (h5lzf ${HDF5_LIBSH_TARGET}) + add_dependencies (h5ex_d_lzf ${HDF5_LIBSH_TARGET}) + target_include_directories (h5ex_d_lzf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}") + endif () + if (ENABLE_MAFISC) + add_dependencies (h5mafisc ${HDF5_LIBSH_TARGET}) + add_dependencies (h5ex_d_mafisc ${HDF5_LIBSH_TARGET}) + target_include_directories (h5ex_d_mafisc PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}") + endif () + if (ENABLE_SZF) + add_dependencies (h5szf ${HDF5_LIBSH_TARGET}) + add_dependencies (h5ex_d_szf ${HDF5_LIBSH_TARGET}) + target_include_directories (h5ex_d_szf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}") + endif () + if (ENABLE_ZFP) + add_dependencies (h5zfp ${HDF5_LIBSH_TARGET}) + add_dependencies (h5ex_d_zfp ${HDF5_LIBSH_TARGET}) + target_include_directories (h5ex_d_zfp PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR}") + endif () + endif() + message (STATUS "HDF5_INCLUDE_DIR=${HDF5_INCLUDE_DIR}") + set (PLUGIN_BINARY_DIR "${plugin_BINARY_DIR}") + set (PLUGIN_SOURCE_DIR "${plugin_SOURCE_DIR}") set (PLUGIN_LIBRARY "PLUGIN") set (PLUGIN_FOUND 1) endmacro () @@ -129,7 +87,7 @@ macro (FILTER_OPTION plname) elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") if (NOT TGZPATH) set (TGZPATH ${H5PL_SOURCE_DIR}) - endif () + endif () set (HDF_${plname}_URL ${TGZPATH}/${HDF_${plname}_TGZ_NAME}) endif () endif () diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 8ca8159..952b766 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -429,6 +429,19 @@ macro (HDF_DIR_PATHS package_prefix) endif () endif () + if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + if (CMAKE_HOST_UNIX) + set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" + CACHE PATH "Install path prefix, prepended onto install directories." FORCE) + else () + GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) + set (CMAKE_INSTALL_PREFIX + "${CMAKE_GENERIC_PROGRAM_FILES}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" + CACHE PATH "Install path prefix, prepended onto install directories." FORCE) + set (CMAKE_GENERIC_PROGRAM_FILES) + endif () + endif () + #----------------------------------------------------------------------------- # Setup pre-3.14 FetchContent #----------------------------------------------------------------------------- diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 20bec6f..ecf34fd 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -563,5 +563,3 @@ if (NOT WIN32 AND NOT MINGW) COMPONENT fortlibraries ) endif () - - diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 2c1a838..77382c2 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -133,4 +133,3 @@ if (NOT WIN32 AND NOT MINGW) COMPONENT hlcpplibraries ) endif () - diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index be0eba5..82b5555 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -318,3 +318,51 @@ if (HDF5_EXPORTED_TARGETS) INCLUDES DESTINATION include ) endif () + +#----------------------------------------------------------------------------- +# Create pkgconfig files +#----------------------------------------------------------------------------- +set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) +set (_PKG_CONFIG_EXEC_PREFIX \${prefix}) +set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib) +set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include) +set (_PKG_CONFIG_LIBNAME "${HDF5_HL_F90_LIB_CORENAME}") +set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") + +set (_PKG_CONFIG_LIBS_PRIVATE) + +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_F90_LIB_CORENAME}") +endif () +if (BUILD_SHARED_LIBS) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_F90_LIB_CORENAME}") +endif () + +set (_PKG_CONFIG_REQUIRES "${HDF5_F90_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_F90_LIB_CORENAME}") + +configure_file ( + ${HDF_RESOURCES_DIR}/libhdf5.pc.in + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + @ONLY +) +install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_HL_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig + COMPONENT hlfortlibraries +) + +if (NOT WIN32 AND NOT MINGW) + set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5hlfc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5hlfc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT hlfortlibraries + ) +endif () diff --git a/java/src/hdf/hdf5lib/HDFArray.java b/java/src/hdf/hdf5lib/HDFArray.java index 30f0fc8..63e17e8 100644 --- a/java/src/hdf/hdf5lib/HDFArray.java +++ b/java/src/hdf/hdf5lib/HDFArray.java @@ -16,6 +16,7 @@ package hdf.hdf5lib; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5JavaException; +import java.util.Arrays; /** * This is a class for handling multidimensional arrays for HDF. @@ -394,6 +395,7 @@ public class HDFArray { throw (ex); } _barray = bytes; /* hope that the bytes are correct.... */ + if (ArrayDescriptor.dims == 1) { /* special case */ /* 2 data copies here! */ @@ -496,8 +498,62 @@ public class HDFArray { Object oo = _theArray; int n = 0; /* the current byte */ + int m = 0; /* the current array index */ int index = 0; int i; + Object flattenedArray = null; + switch (ArrayDescriptor.NT) { + case 'J': + flattenedArray = (Object) HDFNativeData.byteToLong(_barray); + break; + case 'S': + flattenedArray = (Object) HDFNativeData.byteToShort(_barray); + break; + case 'I': + flattenedArray = (Object) HDFNativeData.byteToInt(_barray); + break; + case 'F': + flattenedArray = (Object) HDFNativeData.byteToFloat(_barray); + break; + case 'D': + flattenedArray = (Object) HDFNativeData.byteToDouble(_barray); + break; + case 'B': + flattenedArray = (Object) _barray; + break; + case 'L': + switch (ArrayDescriptor.className) { + case "java.lang.Byte": + flattenedArray = (Object) ByteToByteObj(_barray); + break; + case "java.lang.Short": + flattenedArray = (Object) ByteToShort(_barray); + break; + case "java.lang.Integer": + flattenedArray = (Object) ByteToInteger(_barray); + break; + case "java.lang.Long": + flattenedArray = (Object) ByteToLongObj(_barray); + break; + case "java.lang.Float": + flattenedArray = (Object) ByteToFloatObj(_barray); + break; + case "java.lang.Double": + flattenedArray = (Object) ByteToDoubleObj(_barray); + break; + default: + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unsupported Object type: " + + ArrayDescriptor.NT); + throw (ex); + } // end of switch statement for arrays of boxed objects + default: + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unknown or unsupported type: " + + ArrayDescriptor.NT); + throw (ex); + } // end of switch statement for arrays of primitives + while (n < ArrayDescriptor.totalSize) { oo = ArrayDescriptor.objs[0]; index = n / ArrayDescriptor.bytetoindex[0]; @@ -524,172 +580,58 @@ public class HDFArray { /* array-ify */ try { - if (ArrayDescriptor.NT == 'J') { - long[] arow = HDFNativeData.byteToLong(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - arow); - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.NT == 'I') { - int[] arow = HDFNativeData.byteToInt(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - arow); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.NT == 'S') { - short[] arow = HDFNativeData.byteToShort(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - arow); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.NT == 'B') { - System.arraycopy(_barray, n, - ArrayDescriptor.objs[ArrayDescriptor.dims - 1], 0, - ArrayDescriptor.dimlen[ArrayDescriptor.dims]); - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - } - else if (ArrayDescriptor.NT == 'F') { - float arow[] = HDFNativeData.byteToFloat(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - arow); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.NT == 'D') { - double[] arow = HDFNativeData.byteToDouble(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - arow); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.NT == 'L') { - if (ArrayDescriptor.className.equals("java.lang.Byte")) { - Byte I[] = ByteToByteObj(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - I); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.className - .equals("java.lang.Integer")) { - Integer I[] = ByteToInteger(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - I); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.className - .equals("java.lang.Short")) { - Short I[] = ByteToShort(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - I); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.className - .equals("java.lang.Float")) { - Float I[] = ByteToFloatObj(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - I); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.className - .equals("java.lang.Double")) { - Double I[] = ByteToDoubleObj(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - I); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else if (ArrayDescriptor.className.equals("java.lang.Long")) { - Long I[] = ByteToLongObj(n, - ArrayDescriptor.dimlen[ArrayDescriptor.dims], - _barray); - java.lang.reflect.Array - .set( - ArrayDescriptor.objs[ArrayDescriptor.dims - 2], - (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), - I); - - n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; - ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; - } - else { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: unsupported Object type: " - + ArrayDescriptor.NT); - throw (ex); - } - } - else { - HDF5JavaException ex = new HDF5JavaException( - "HDFArray: unknown or unsupported type: " - + ArrayDescriptor.NT); - throw (ex); - } + + Object arow = null; + int mm = m + ArrayDescriptor.dimlen[ArrayDescriptor.dims]; + switch (ArrayDescriptor.NT) { + case 'B': + arow = (Object) Arrays.copyOfRange((byte[]) flattenedArray, m, mm); + break; + case 'S': + arow = (Object) Arrays.copyOfRange((short[]) flattenedArray, m, mm); + break; + case 'I': + arow = (Object) Arrays.copyOfRange((int[]) flattenedArray, m, mm); + break; + case 'J': + arow = (Object) Arrays.copyOfRange((long[]) flattenedArray, m, mm); + break; + case 'F': + arow = (Object) Arrays.copyOfRange((float[]) flattenedArray, m, mm); + break; + case 'D': + arow = (Object) Arrays.copyOfRange((double[]) flattenedArray, m, mm); + break; + case 'L': + switch (ArrayDescriptor.className) { + case "java.lang.Byte": + arow = (Object) Arrays.copyOfRange((Byte[])flattenedArray, m, mm); + break; + case "java.lang.Short": + arow = (Object) Arrays.copyOfRange((Short[])flattenedArray, m, mm); + break; + case "java.lang.Integer": + arow = (Object) Arrays.copyOfRange((Integer[])flattenedArray, m, mm); + break; + case "java.lang.Long": + arow = (Object) Arrays.copyOfRange((Long[])flattenedArray, m, mm); + break; + case "java.lang.Float": + arow = (Object) Arrays.copyOfRange((Float[])flattenedArray, m, mm); + break; + case "java.lang.Double": + arow = (Object) Arrays.copyOfRange((Double[])flattenedArray, m, mm); + break; + } // end of switch statement for arrays of boxed numerics + } // end of switch statement for arrays of primitives + + java.lang.reflect.Array.set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + m = mm; } catch (OutOfMemoryError err) { HDF5JavaException ex = new HDF5JavaException( @@ -717,25 +659,15 @@ public class HDFArray { + (ArrayDescriptor.dimlen[i] - 1) + "?")); } } - if (ArrayDescriptor.NT != 'B') { - if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1]) { - throw new java.lang.InternalError(new String( - "HDFArray::arrayify Panic didn't complete all data: currentindex[" - + i + "] = " + ArrayDescriptor.currentindex[i] - + " (should be " + (ArrayDescriptor.dimlen[i]) - + "?")); - } - } - else { - if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != (ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1] - 1)) { - throw new java.lang.InternalError(new String( - "HDFArray::arrayify Panic didn't complete all data: currentindex[" - + i + "] = " + ArrayDescriptor.currentindex[i] - + " (should be " - + (ArrayDescriptor.dimlen[i] - 1) + "?")); - } + if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1]) { + throw new java.lang.InternalError(new String( + "HDFArray::arrayify Panic didn't complete all data: currentindex[" + + i + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + (ArrayDescriptor.dimlen[i]) + + "?")); } + return _theArray; } @@ -944,6 +876,7 @@ class ArrayDescriptor { static int[] currentindex = null; static int[] bytetoindex = null; static int totalSize = 0; + static int totalElements = 0; static Object[] objs = null; static char NT = ' '; /* must be B,S,I,L,F,D, else error */ static int NTsize = 0; @@ -1052,6 +985,7 @@ class ArrayDescriptor { dimlen[0] = 1; dimstart[0] = 0; currentindex[0] = 0; + int elements = 1; int i; for (i = 1; i <= dims; i++) { dimlen[i] = java.lang.reflect.Array.getLength((Object) o); @@ -1059,7 +993,9 @@ class ArrayDescriptor { objs[i] = o; dimstart[i] = 0; currentindex[i] = 0; + elements *= dimlen[i]; } + totalElements = elements; int j; int dd; @@ -1083,7 +1019,7 @@ class ArrayDescriptor { System.out.println("Class: " + theClass); System.out.println("NT: " + NT + " NTsize: " + NTsize); System.out.println("Array has " + dims + " dimensions (" + totalSize - + " bytes)"); + + " bytes, " + totalElements + " elements)"); int i; for (i = 0; i <= dims; i++) { Class tc = objs[i].getClass(); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 5ae034a..447f16e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,22 @@ New Features Configuration: ------------- + - CMake option to build the HDF filter plugins project as an external project + + The HDF filter plugins project is a collection of registered compression + filters that can be dynamically loaded when needed to access data stored + in a hdf5 file. This CMake-only option allows the plugins to be built and + distributed with the hdf5 library and tools. Like the options for szip and + zlib, either a tgz file or a git repository can be specified for the source. + + The option was refactored to use the CMake FetchContent process. This allows + more control over the filter targets, but required external project command + options to be moved to a CMake include file, HDF5PluginCache.cmake. Also + enabled the filter examples to be used as tests for operation of the + filter plugins. + + (ADB - 2020/12/10, OESS-98) + - FreeBSD Autotools configuration now defaults to 'cc' and 'c++' compilers On FreeBSD, the autotools defaulted to 'gcc' as the C compiler and did @@ -216,7 +232,7 @@ New Features NO YES Default to SHARED NO NO Default to SHARED The defaults can be overriden by setting the config option - HDF5_INSTALL_MOD_FORTRAN to one of NO, SHARED, or STATIC + HDF5_INSTALL_MOD_FORTRAN to one of NO, SHARED, or STATIC (ADB - 2020/07/09, HDFFV-11116) @@ -620,7 +636,6 @@ Support for new platforms, languages and compilers. Bug Fixes since HDF5-1.12.0 release ================================== - Library ------- - Creation of dataset with optional filter @@ -705,6 +720,17 @@ Bug Fixes since HDF5-1.12.0 release Java Library: ---------------- + - The H5FArray.java class, in which virtually the entire execution time + is spent using the HDFNativeData method that converts from an array + of bytes to an array of the destination Java type. + + 1. Convert the entire byte array into a 1-d array of the desired type, + rather than performing 1 conversion per row; + 2. Use the Java Arrays method copyOfRange to grab the section of the + array from (1) that is desired to be inserted into the destination array. + + (PGT,ADB - 2020/12/13, HDFFV-10865) + - Added ability to test java library with VOLs. Created new CMake script that combines the java and vol test scripts. @@ -830,11 +856,11 @@ Bug Fixes since HDF5-1.12.0 release ------- - Stopped java/test/junit.sh.in installing libs for testing under ${prefix} - Lib files needed are now copied to a subdirectory in the java/test - directory, and on Macs the loader path for libhdf5.xxxs.so is changed - in the temporary copy of libhdf5_java.dylib. + Lib files needed are now copied to a subdirectory in the java/test + directory, and on Macs the loader path for libhdf5.xxxs.so is changed + in the temporary copy of libhdf5_java.dylib. - (LRK, 2020/07/02, HDFFV-11063) + (LRK, 2020/07/02, HDFFV-11063) Supported Platforms @@ -859,12 +885,10 @@ Supported Platforms (emu) Sun Fortran 95 8.6 SunOS_sparc Sun C++ 5.12 SunOS_sparc - Windows 7 x64 Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake) - Visual Studio 2015 w/ MSMPI 10 (cmake) - Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake) Visual Studio 2017 w/ Intel Fortran 19 (cmake) Visual Studio 2019 w/ Intel Fortran 19 (cmake) + Visual Studio 2019 w/ MSMPI 10.1 (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 @@ -896,10 +920,6 @@ Platform C F90/ F90 C++ zlib SZIP parallel F2003 parallel Solaris2.11 32-bit n y/y n y y y Solaris2.11 64-bit n y/n n y y y -Windows 7 y y/y n y y y -Windows 7 x64 y y/y y y y y -Windows 7 Cygwin n y/n n y y y -Windows 7 x64 Cygwin n y/n n y y y Windows 10 y y/y n y y y Windows 10 x64 y y/y n y y y Mac OS X Mountain Lion 10.8.5 64-bit n y/y n y y y @@ -918,10 +938,6 @@ Platform Shared Shared Shared Thread- C libs F90 libs C++ libs safe Solaris2.11 32-bit y y y y Solaris2.11 64-bit y y y y -Windows 7 y y y y -Windows 7 x64 y y y y -Windows 7 Cygwin n n n y -Windows 7 x64 Cygwin n n n y Windows 10 y y y y Windows 10 x64 y y y y Mac OS X Mountain Lion 10.8.5 64-bit y n y y @@ -996,6 +1012,9 @@ Known Problems images, but since this is a collective operation, a deadlock is possible if one or more processes do not participate. + CPP ptable test fails on both VS2017 and VS2019 with Intel compiler, JIRA + issue: HDFFV-10628. This test will pass with VS2015 with Intel compiler. + Known problems in previous releases can be found in the HISTORY*.txt files in the HDF5 source. Please report any new problems found to help@hdfgroup.org. -- cgit v0.12