Skip to content

Commit

Permalink
CI: Build without hdf5
Browse files Browse the repository at this point in the history
  • Loading branch information
gsjaardema committed Jun 1, 2023
1 parent 875867c commit 1ec8147
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 83 deletions.
14 changes: 11 additions & 3 deletions TPL/matio/runcmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ INSTALL_PATH=${INSTALL_PATH:-${ACCESS}}

rm -f config.cache

HDF5="${HDF5:-YES}"
if [ "$HDF5" == "YES" ]
then
DEFAULT_VERSION="7.3"
else
DEFAULT_VERSION="5"
fi

DEBUG="${DEBUG:-NO}"
if [ "$DEBUG" == "YES" ]
then
Expand Down Expand Up @@ -51,12 +59,12 @@ rm -f config.cache
cmake .. -DCMAKE_C_COMPILER:FILEPATH=${CC} \
-DBUILD_SHARED_LIBS:BOOL=${SHARED} \
-DMATIO_SHARED:BOOL=${SHARED} \
-DMATIO_DEFAULT_FILE_VERSION=7.3 \
-DMATIO_MAT73:BOOL=ON \
-DMATIO_DEFAULT_FILE_VERSION=${DEFAULT_VERSION} \
-DMATIO_MAT73:BOOL=${HDF5} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DMATIO_WITH_HDF5:BOOL=ON \
-DMATIO_WITH_HDF5:BOOL=${HDF5} \
-DMATIO_WITH_ZLIB:BOOL=ON \
-DHDF5_ROOT:PATH=${INSTALL_PATH} \
-DHDF5_DIR:PATH=${INSTALL_PATH} \
Expand Down
14 changes: 10 additions & 4 deletions TPL/netcdf/runcmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if [ "X$ACCESS" == "X" ] ; then
fi
INSTALL_PATH=${INSTALL_PATH:-${ACCESS}}

HDF5="${HDF5:-YES}"
DEBUG="${DEBUG:-NO}"
if [ "$DEBUG" == "YES" ]
then
Expand All @@ -28,6 +29,13 @@ else
EXTRA_DEPS="-DNC_EXTRA_DEPS=-ldl\;-lz"
fi

if [[ "$HDF5" == "ON" || "$HDF5" == "YES" ]]
then
HDF5_INFO="-DHDF5_ROOT:PATH=${INSTALL_PATH} -DHDF5_DIR:PATH=${INSTALL_PATH} -DENABLE_NETCDF4:BOOL=ON"
else
HDF5_INFO="-DENABLE_HDF5=OFF -DENABLE_NETCDF4:BOOL=OFF"
fi

NEEDS_ZLIB="${NEEDS_ZLIB:-NO}"
if [ "$NEEDS_ZLIB" == "YES" ]
then
Expand All @@ -54,7 +62,6 @@ cmake .. -DCMAKE_C_COMPILER:FILEPATH=${CC} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_NETCDF_4:BOOL=ON \
-DENABLE_PNETCDF:BOOL=${MPI} \
-DENABLE_CDF5=ON \
-DENABLE_MMAP:BOOL=ON \
Expand All @@ -63,9 +70,8 @@ cmake .. -DCMAKE_C_COMPILER:FILEPATH=${CC} \
${LOCAL_ZLIB} \
${LOCAL_SZIP} \
${EXTRA_DEPS} \
-DENABLE_CONVERSION_WARNINGS:BOOL=OFF \
-DHDF5_ROOT:PATH=${INSTALL_PATH} \
-DHDF5_DIR:PATH=${INSTALL_PATH}
${HDF5_INFO} \
-DENABLE_CONVERSION_WARNINGS:BOOL=OFF

echo ""
echo " MPI: ${MPI}"
Expand Down
11 changes: 10 additions & 1 deletion cmake/modules/FindMatio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,16 @@ else(Matio_LIBRARIES AND Matio_INCLUDE_DIRS)
# Need to find the Matio config script to check for HDF5
message(STATUS "Assuming that Matio requires HDF5")
if ( NOT TARGET hdf5)
add_package_dependency(Matio DEPENDS_ON HDF5)
assert_defined(Matio_INCLUDE_DIRS)
find_path(inc_path
NAMES "matio_pubconf.h"
HINTS ${Matio_INCLUDE_DIRS}
NO_DEFAULT_PATH)
file(STRINGS "${inc_path}/matio_pubconf.h" matio_default_version REGEX " MAT_FT_DEFAULT ")
string(REGEX MATCH "4|73" default_version "${matio_default_version}")
if (default_version EQUAL 73)
add_package_dependency(Matio DEPENDS_ON HDF5)
endif()
endif()

endif(Matio_LIBRARIES AND Matio_INCLUDE_DIRS )
Expand Down
164 changes: 89 additions & 75 deletions install-tpl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ BB=$(check_valid BB)
CRAY=${CRAY:-NO}
CRAY=$(check_valid CRAY)

# Which TPLS? (HDF5 and NetCDF always, PnetCDF if MPI=ON)
CGNS=${CGNS:-YES}
# Which TPLS? (NetCDF always, PnetCDF if MPI=ON)
HDF5=${HDF5:-YES}
HDF5=$(check_valid HDF5)
CGNS=${CGNS:-${HDF5}}
CGNS=$(check_valid CGNS)

MATIO=${MATIO:-YES}
Expand Down Expand Up @@ -186,6 +188,7 @@ if [ $# -gt 0 ]; then
echo " DEBUG = ${DEBUG}"
echo " USE_PROXY = ${USE_PROXY}"
echo ""
echo " HDF5 = ${HDF5}"
echo " H5VERSION = ${H5VERSION}"
echo " CGNS = ${CGNS}"
echo " MATIO = ${MATIO}"
Expand Down Expand Up @@ -391,80 +394,84 @@ then
fi

# =================== BUILD HDF5 ===============
if [ "$FORCE" == "YES" ] || ! [ -e $INSTALL_PATH/lib/libhdf5.${LD_EXT} ]
if [ "$HDF5" == "YES" ]
then
echo "${txtgrn}+++ HDF5${txtrst}"
hdf_suffix=""
if [ "${H5VERSION}" == "V18" ]; then
hdf_version="1.8.23"
hdf_base="1.8"
elif [ "${H5VERSION}" == "V110" ]; then
hdf_version="1.10.10"
hdf_base="1.10"
elif [ "${H5VERSION}" == "V112" ]; then
hdf_version="1.12.2"
hdf_base="1.12"
elif [ "${H5VERSION}" == "V113" ]; then
hdf_version="1.13.1"
hdf_base="1.13"
elif [ "${H5VERSION}" == "V114" ]; then
hdf_version="1.14.1"
hdf_base="1.14"
hdf_suffix="-2"
elif [ "${H5VERSION}" == "develop" ]; then
hdf_version="develop"
else
echo 1>&2 ${txtred}Invalid HDF5 version specified: ${H5VERSION}. Must be one of V18, V110, V112. exiting.${txtrst}
exit 1
fi

cd $ACCESS || exit
cd TPL/hdf5 || exit
if [ "$DOWNLOAD" == "YES" ]
then
echo "${txtgrn}+++ Downloading...${txtrst}"
rm -rf hdf5-${hdf_version}${hdf_suffix}
rm -f hdf5-${hdf_version}${hdf_suffix}.tar.bz2
if [ "${H5VERSION}" == "develop" ]; then
git clone https://github.com/HDFGroup/hdf5.git hdf5-develop
else
wget --no-check-certificate https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${hdf_base}/hdf5-${hdf_version}/src/hdf5-${hdf_version}${hdf_suffix}.tar.bz2
fi
if [ "${H5VERSION}" != "develop" ]
then
tar -jxf hdf5-${hdf_version}${hdf_suffix}.tar.bz2
rm -f hdf5-${hdf_version}${hdf_suffix}.tar.bz2
fi
fi

if [ "$BUILD" == "YES" ]
if [ "$FORCE" == "YES" ] || ! [ -e $INSTALL_PATH/lib/libhdf5.${LD_EXT} ]
then
echo "${txtgrn}+++ Configuring, Building, and Installing...${txtrst}"
cd hdf5-${hdf_version}${hdf_suffix} || exit
rm -rf build
mkdir build
cd build || exit
CRAY=${CRAY} H5VERSION=${H5VERSION} DEBUG=${DEBUG} SHARED=${SHARED} NEEDS_ZLIB=${NEEDS_ZLIB} NEEDS_SZIP=${NEEDS_SZIP} MPI=${MPI} bash -x ../../runcmake.sh
#CRAY=${CRAY} H5VERSION=${H5VERSION} DEBUG=${DEBUG} SHARED=${SHARED} NEEDS_ZLIB=${NEEDS_ZLIB} NEEDS_SZIP=${NEEDS_SZIP} MPI=${MPI} bash ../runconfigure.sh
if [[ $? != 0 ]]
then
echo 1>&2 ${txtred}couldn\'t configure hdf5. exiting.${txtrst}
exit 1
fi
make -j${JOBS} && ${SUDO} make "V=${VERBOSE}" install
if [[ $? != 0 ]]
then
echo 1>&2 ${txtred}couldn\'t build hdf5. exiting.${txtrst}
echo "${txtgrn}+++ HDF5${txtrst}"
hdf_suffix=""
if [ "${H5VERSION}" == "V18" ]; then
hdf_version="1.8.23"
hdf_base="1.8"
elif [ "${H5VERSION}" == "V110" ]; then
hdf_version="1.10.10"
hdf_base="1.10"
elif [ "${H5VERSION}" == "V112" ]; then
hdf_version="1.12.2"
hdf_base="1.12"
elif [ "${H5VERSION}" == "V113" ]; then
hdf_version="1.13.1"
hdf_base="1.13"
elif [ "${H5VERSION}" == "V114" ]; then
hdf_version="1.14.1"
hdf_base="1.14"
hdf_suffix="-2"
elif [ "${H5VERSION}" == "develop" ]; then
hdf_version="develop"
else
echo 1>&2 ${txtred}Invalid HDF5 version specified: ${H5VERSION}. Must be one of V18, V110, V112. exiting.${txtrst}
exit 1
fi
fi

cd $ACCESS || exit
cd TPL/hdf5 || exit
if [ "$DOWNLOAD" == "YES" ]
then
echo "${txtgrn}+++ Downloading...${txtrst}"
rm -rf hdf5-${hdf_version}${hdf_suffix}
rm -f hdf5-${hdf_version}${hdf_suffix}.tar.bz2
if [ "${H5VERSION}" == "develop" ]; then
git clone https://github.com/HDFGroup/hdf5.git hdf5-develop
else
wget --no-check-certificate https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${hdf_base}/hdf5-${hdf_version}/src/hdf5-${hdf_version}${hdf_suffix}.tar.bz2
fi
if [ "${H5VERSION}" != "develop" ]
then
tar -jxf hdf5-${hdf_version}${hdf_suffix}.tar.bz2
rm -f hdf5-${hdf_version}${hdf_suffix}.tar.bz2
fi
fi

if [ "$BUILD" == "YES" ]
then
echo "${txtgrn}+++ Configuring, Building, and Installing...${txtrst}"
cd hdf5-${hdf_version}${hdf_suffix} || exit
rm -rf build
mkdir build
cd build || exit
CRAY=${CRAY} H5VERSION=${H5VERSION} DEBUG=${DEBUG} SHARED=${SHARED} NEEDS_ZLIB=${NEEDS_ZLIB} NEEDS_SZIP=${NEEDS_SZIP} MPI=${MPI} bash -x ../../runcmake.sh
#CRAY=${CRAY} H5VERSION=${H5VERSION} DEBUG=${DEBUG} SHARED=${SHARED} NEEDS_ZLIB=${NEEDS_ZLIB} NEEDS_SZIP=${NEEDS_SZIP} MPI=${MPI} bash ../runconfigure.sh
if [[ $? != 0 ]]
then
echo 1>&2 ${txtred}couldn\'t configure hdf5. exiting.${txtrst}
exit 1
fi
make -j${JOBS} && ${SUDO} make "V=${VERBOSE}" install
if [[ $? != 0 ]]
then
echo 1>&2 ${txtred}couldn\'t build hdf5. exiting.${txtrst}
exit 1
fi
fi
# Create default plugin directory...
mkdir ${INSTALL_PATH}/lib/hdf5
mkdir ${INSTALL_PATH}/lib/hdf5/lib
mkdir ${INSTALL_PATH}/lib/hdf5/lib/plugin
else
echo "${txtylw}+++ HDF5 already installed. Skipping download and installation.${txtrst}"
fi
# Create default plugin directory...
mkdir ${INSTALL_PATH}/lib/hdf5
mkdir ${INSTALL_PATH}/lib/hdf5/lib
mkdir ${INSTALL_PATH}/lib/hdf5/lib/plugin
else
echo "${txtylw}+++ HDF5 already installed. Skipping download and installation.${txtrst}"
fi

# =================== INSTALL PnetCDF if parallel build ===============
if [ "$MPI" == "YES" ]
then
Expand Down Expand Up @@ -544,8 +551,11 @@ then
rm -rf build
mkdir build
cd build || exit
export HDF5_PLUGIN_PATH=${INSTALL_PATH}/lib/hdf5/lib/plugin
CRAY=${CRAY} SHARED=${SHARED} DEBUG=${DEBUG} NEEDS_ZLIB=${NEEDS_ZLIB} MPI=${MPI} bash -x ../../runcmake.sh
if [ "$HDF5" == "YES" ]
then
export HDF5_PLUGIN_PATH=${INSTALL_PATH}/lib/hdf5/lib/plugin
fi
CRAY=${CRAY} SHARED=${SHARED} DEBUG=${DEBUG} HDF5=${HDF5} NEEDS_ZLIB=${NEEDS_ZLIB} MPI=${MPI} bash -x ../../runcmake.sh
if [[ $? != 0 ]]
then
echo 1>&2 ${txtred}couldn\'t configure cmake for NetCDF. exiting.${txtrst}
Expand All @@ -563,7 +573,7 @@ else
echo "${txtylw}+++ NetCDF already installed. Skipping download and installation.${txtrst}"
fi
# =================== INSTALL CGNS ===============
if [ "$CGNS" == "YES" ]
if [ "$CGNS" == "YES" ] && [ "$HDF5" == "YES" ]
then
if [ "$FORCE" == "YES" ] || ! [ -e $INSTALL_PATH/lib/libcgns.${LD_EXT} ]
then
Expand Down Expand Up @@ -603,6 +613,10 @@ then
echo "${txtylw}+++ CGNS already installed. Skipping download and installation.${txtrst}"
fi
fi
if [ "$CGNS" == "YES" ] && [ "$HDF5" == "NO" ]
then
echo "${txtred}+++ CGNS requested, but HDF5 is not enabled. Cannot build CGNS without HDF5.${txtrst}"
fi

# =================== INSTALL METIS ===============
if [ "$METIS" == "YES" ]
Expand Down Expand Up @@ -713,7 +727,7 @@ then
rm -rf build
mkdir build
cd build || exit
CRAY=${CRAY} SHARED=${SHARED} DEBUG=${DEBUG} NEEDS_ZLIB=${NEEDS_ZLIB} bash -x ../../runcmake.sh
CRAY=${CRAY} SHARED=${SHARED} DEBUG=${DEBUG} NEEDS_ZLIB=${NEEDS_ZLIB} HDF5=${HDF5} bash -x ../../runcmake.sh
if [[ $? != 0 ]]
then
echo 1>&2 ${txtred}couldn\'t configure MatIO. exiting.${txtrst}
Expand Down

0 comments on commit 1ec8147

Please sign in to comment.