From 9cbd70f1dee2862fec56eff9541316dbe2758828 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Thu, 12 Jun 2025 17:42:11 +0100 Subject: [PATCH 01/12] #84 Separate PETSc and HDF5 scripts --- scripts/custom/install_hdf5.sh | 152 +++++++++++++++++ scripts/custom/install_petsc.sh | 175 ++++++++++++++++++++ scripts/custom/install_petsc_hdf5.sh | 229 -------------------------- scripts/custom/setup_custom.sh | 28 ++-- scripts/system/install_modulefiles.sh | 53 ++++-- 5 files changed, 382 insertions(+), 255 deletions(-) create mode 100755 scripts/custom/install_hdf5.sh create mode 100755 scripts/custom/install_petsc.sh delete mode 100755 scripts/custom/install_petsc_hdf5.sh diff --git a/scripts/custom/install_hdf5.sh b/scripts/custom/install_hdf5.sh new file mode 100755 index 0000000..fc23f34 --- /dev/null +++ b/scripts/custom/install_hdf5.sh @@ -0,0 +1,152 @@ +#!/bin/bash -eu + +usage() +{ + echo 'Usage: '"$(basename $0)"' --version=version --modules-dir=path [--parallel=value]' + exit 1 +} + +script_dir="$(cd "$(dirname "$0")"; pwd)" +. ${script_dir}/../common.sh + +# Parse arguments +version= +base_dir= +parallel= + +for option; do + case $option in + --version=*) + version=$(expr "x$option" : "x--version=\(.*\)") + ;; + --modules-dir=*) + base_dir=$(expr "x$option" : "x--modules-dir=\(.*\)") + ;; + --parallel=*) + parallel=$(expr "x$option" : "x--parallel=\(.*\)") + ;; + *) + echo "Unknown option: $option" 1>&2 + exit 1 + ;; + esac +done + +if [ -z "${version}" ]; then usage; fi +if [ -z "${base_dir}" ]; then usage; fi + +parallel="${parallel:-$(nproc)}" + +read -r version major minor _ < <(split_version ${version}) +ver_si_on=${version//\./_} # Converts 1.14.0 to 1_14_0 + +# Unsupported versions: https://chaste.github.io/docs/installguides/dependency-versions/ +if version_lt "${version}" '1.10.4'; then # HDF5 < 1.10.4 + echo "$(basename $0): HDF5 versions < 1.10.4 not supported" + exit 1 +fi + +if version_eq "${major}.${minor}" '1.11'; then # HDF5 == 1.11.x + echo "$(basename $0): HDF5 1.11.x not supported" + exit 1 +fi + +if version_eq "${major}.${minor}" '1.13'; then # HDF5 == 1.13.x + echo "$(basename $0): HDF5 1.13.x not supported" + exit 1 +fi + +# Download and extract source +mkdir -p ${base_dir}/src/hdf5 +cd ${base_dir}/src/hdf5 + +URL_HDF5= +if (version_ge "${version}" '1.10.0' && version_lt "${version}" '1.10.12') || # HDF5 >=1.10.0, <1.10.12 + (version_ge "${version}" '1.12.0' && version_lt "${version}" '1.12.2') # HDF5 >=1.12.0, <1.12.2 +then + URL_HDF5=https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${major}.${minor}/hdf5-${version}/src/hdf5-${version}.tar.gz + +elif (version_ge "${version}" '1.12.2' && version_lt "${version}" '1.12.4') || # HDF5 >=1.12.2, <1.12.4 + (version_ge "${version}" '1.14.0' && version_lt "${version}" '1.14.4') # HDF5 >=1.14.0, <1.14.4 +then + URL_HDF5=https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-${ver_si_on}.tar.gz + +else + # HDF5 >=1.10.12, <1.11 + # HDF5 >=1.12.4, <1.13 + # HDF5 >=1.14.4, <1.15 + # + catch-all + URL_HDF5=https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-${version}.tar.gz +fi + +wget -nc ${URL_HDF5} +tar -xzf $(basename ${URL_HDF5}) + +# Build and install +install_dir=${base_dir}/opt/hdf5/${version} +mkdir -p ${install_dir} + +cd hdf5-${version} # TODO: check if this is the correct path for all versions +mkdir -p build +cd build + +# TODO: check cmake for HDF5 with MPI support +cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${install_dir} \ + -DHDF5_BUILD_HL_LIB=ON \ + -DHDF5_BUILD_TOOLS=OFF \ + -DHDF5_ENABLE_PARALLEL=ON \ + -DHDF5_ENABLE_Z_LIB_SUPPORT=ON \ + -DHDF5_ENABLE_SZIP_SUPPORT=OFF \ + -DHDF5_ENABLE_THREADSAFE=ON \ + -DHDF5_ENABLE_UNSUPPORTED=OFF .. && \ +make -j ${parallel} && \ +make install + +# Add modulefile +mkdir -p ${base_dir}/modulefiles/hdf5/${version} +cd ${base_dir}/modulefiles/hdf5/${version} +cat < ${version} +#%Module1.0##################################################################### +### +## hdf5 ${version} modulefile +## +proc ModulesTest { } { + set paths "[getenv HDF5_ROOT] + [getenv HDF5_ROOT]/bin/h5pcc + [getenv HDF5_ROOT]/include + [getenv HDF5_ROOT]/lib + [getenv HDF5_ROOT]/lib/libhdf5.so" + + foreach path \$paths { + if { ![file exists \$path] } { + puts stderr "ERROR: Does not exist: \$path" + return 0 + } + } + return 1 +} + +proc ModulesHelp { } { + puts stderr "\tThis adds the environment variables for hdf5 ${version}\n" +} + +module-whatis "This adds the environment variables for hdf5 ${version}" + +setenv HDF5_ROOT ${install_dir} + +prepend-path PATH ${install_dir}/bin + +prepend-path LIBRARY_PATH ${install_dir}/lib +prepend-path LD_LIBRARY_PATH ${install_dir}/lib +prepend-path LD_RUN_PATH ${install_dir}/lib + +prepend-path INCLUDE ${install_dir}/include +prepend-path C_INCLUDE_PATH ${install_dir}/include +prepend-path CPLUS_INCLUDE_PATH ${install_dir}/include + +prepend-path CMAKE_PREFIX_PATH ${install_dir} + +conflict hdf5 +EOF diff --git a/scripts/custom/install_petsc.sh b/scripts/custom/install_petsc.sh new file mode 100755 index 0000000..449e9fa --- /dev/null +++ b/scripts/custom/install_petsc.sh @@ -0,0 +1,175 @@ +#!/bin/bash -eu + +usage() +{ + echo 'Usage: '"$(basename $0)"' --version=version --arch=[{linux-gnu|linux-gnu-opt}]' + echo ' --modules-dir=path [--parallel=value]' + exit 1 +} + +script_dir="$(cd "$(dirname "$0")"; pwd)" +. ${script_dir}/../common.sh + +# Parse arguments +version= +arch= +base_dir= +parallel= + +for option; do + case $option in + --version=*) + version=$(expr "x$option" : "x--version=\(.*\)") + ;; + --arch=*) + arch=$(expr "x$option" : "x--arch=\(.*\)") + ;; + --modules-dir=*) + base_dir=$(expr "x$option" : "x--modules-dir=\(.*\)") + ;; + --parallel=*) + parallel=$(expr "x$option" : "x--parallel=\(.*\)") + ;; + *) + echo "Unknown option: $option" 1>&2 + exit 1 + ;; + esac +done + +if [ -z "${version}" ]; then usage; fi +if [ -z "${base_dir}" ]; then usage; fi + +if [ -z "${arch}" ]; then + arch=linux-gnu +fi + +if [[ ! (${arch} = 'linux-gnu' || ${arch} = 'linux-gnu-opt') ]]; then + usage +fi + +parallel="${parallel:-$(nproc)}" + +read -r version major minor _ < <(split_version ${version}) + +# Unsupported versions: https://chaste.github.io/docs/installguides/dependency-versions/ +if version_lt "${version}" '3.12'; then # PETSc < 3.12.x + echo "$(basename $0): PETSc versions < 3.12 not supported" + exit 1 +fi + +# Download and extract source +mkdir -p ${base_dir}/src/petsc +cd ${base_dir}/src/petsc + +# Download and extract PETSc +URL_PETSC=https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${version}.tar.gz +wget -nc ${URL_PETSC} + +install_dir=${base_dir}/opt/petsc/${version} +mkdir -p ${install_dir} + +tar -xzf $(basename ${URL_PETSC}) -C ${install_dir} --strip-components=1 + +# Fix for isAlive() removal from Python 3.9+ +# https://bugs.python.org/issue37804 +if [[ (${major} -eq 3) && ((${minor} -eq 12) || (${minor} -eq 13)) ]]; then # PETSc 3.12.x & 3.13.x + cd ${install_dir} + sed -i.bak 's/thread.isAlive()/thread.is_alive()/g' config/BuildSystem/script.py +fi + +# Build and install +cd ${install_dir} +export PETSC_DIR=$(pwd) + +case ${arch} in + + linux-gnu) + export PETSC_ARCH=linux-gnu + python3 ./configure \ + --COPTFLAGS=-Og \ + --CXXOPTFLAGS=-Og \ + --download-f2cblaslapack=1 \ + --download-hypre=1 \ + --download-metis=1 \ + --download-parmetis=1 \ + --with-cc=gcc \ + --with-cxx=g++ \ + --with-debugging=1 \ + --with-fc=0 \ + --with-shared-libraries \ + --with-ssl=false \ + --with-x=false && \ + make -j ${parallel} all + ;; + + linux-gnu-opt) + export PETSC_ARCH=linux-gnu-opt + python3 ./configure \ + --download-f2cblaslapack=1 \ + --download-hypre=1 \ + --download-metis=1 \ + --download-parmetis=1 \ + --with-cc=gcc \ + --with-cxx=g++ \ + --with-fc=0 \ + --with-shared-libraries \ + --with-ssl=false \ + --with-x=false && \ + make -j ${parallel} all + ;; + *) + ;; +esac + +# Add modulefile +mkdir -p ${base_dir}/modulefiles/petsc/${version} +cd ${base_dir}/modulefiles/petsc/${version} +cat < ${arch} +#%Module1.0##################################################################### +### +## petsc ${version}/${arch} modulefile +## +proc ModulesTest { } { + set paths "[getenv PETSC_DIR] + [getenv PETSC_DIR]/[getenv PETSC_ARCH] + [getenv PETSC_DIR]/[getenv PETSC_ARCH]/bin + [getenv PETSC_DIR]/[getenv PETSC_ARCH]/bin/h5pcc + [getenv PETSC_DIR]/[getenv PETSC_ARCH]/include + [getenv PETSC_DIR]/[getenv PETSC_ARCH]/lib + [getenv PETSC_DIR]/[getenv PETSC_ARCH]/lib/libpetsc.so" + + foreach path \$paths { + if { ![file exists \$path] } { + puts stderr "ERROR: Does not exist: \$path" + return 0 + } + } + return 1 +} + +proc ModulesHelp { } { + puts stderr "\tThis adds the environment variables for petsc ${version}, with PETSC_ARCH=${arch}\n" +} + +module-whatis "This adds the environment variables for petsc ${version}, with PETSC_ARCH=${arch}" + +setenv PETSC_DIR ${install_dir} +setenv PETSC_ARCH ${arch} + +prepend-path PATH ${install_dir}/${arch}/bin + +prepend-path LIBRARY_PATH ${install_dir}/${arch}/lib +prepend-path LD_LIBRARY_PATH ${install_dir}/${arch}/lib +prepend-path LD_RUN_PATH ${install_dir}/${arch}/lib + +prepend-path INCLUDE ${install_dir}/${arch}/include +prepend-path C_INCLUDE_PATH ${install_dir}/${arch}/include +prepend-path CPLUS_INCLUDE_PATH ${install_dir}/${arch}/include + +prepend-path CMAKE_PREFIX_PATH ${install_dir}/${arch} + +setenv PARMETIS_ROOT ${install_dir}/${arch} + +conflict petsc +EOF diff --git a/scripts/custom/install_petsc_hdf5.sh b/scripts/custom/install_petsc_hdf5.sh deleted file mode 100755 index 768c607..0000000 --- a/scripts/custom/install_petsc_hdf5.sh +++ /dev/null @@ -1,229 +0,0 @@ -#!/bin/bash -eu - -usage() -{ - echo 'Usage: '"$(basename $0)"' --petsc-version=version --petsc-arch=[{linux-gnu|linux-gnu-opt}]' - echo ' --hdf5-version=version --modules-dir=path [--parallel=value]' - exit 1 -} - -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh - -# Parse arguments -petsc_version= -petsc_arch= -hdf5_version= -base_dir= -parallel= - -for option; do - case $option in - --petsc-version=*) - petsc_version=$(expr "x$option" : "x--petsc-version=\(.*\)") - ;; - --petsc-arch=*) - petsc_arch=$(expr "x$option" : "x--petsc-arch=\(.*\)") - ;; - --hdf5-version=*) - hdf5_version=$(expr "x$option" : "x--hdf5-version=\(.*\)") - ;; - --modules-dir=*) - base_dir=$(expr "x$option" : "x--modules-dir=\(.*\)") - ;; - --parallel=*) - parallel=$(expr "x$option" : "x--parallel=\(.*\)") - ;; - *) - echo "Unknown option: $option" 1>&2 - exit 1 - ;; - esac -done - -if [ -z "${petsc_version}" ]; then usage; fi -if [ -z "${hdf5_version}" ]; then usage; fi -if [ -z "${base_dir}" ]; then usage; fi - -if [ -z "${petsc_arch}" ]; then - petsc_arch=linux-gnu -fi - -if [[ ! (${petsc_arch} = 'linux-gnu' || ${petsc_arch} = 'linux-gnu-opt') ]]; then - usage -fi - -parallel="${parallel:-$(nproc)}" - -read -r petsc_version petsc_major petsc_minor _ < <(split_version ${petsc_version}) - -read -r hdf5_version hdf5_major hdf5_minor _ < <(split_version ${hdf5_version}) -hdf5_ver_si_on=${hdf5_version//\./_} # Converts 1.14.0 to 1_14_0 - -# Unsupported versions: https://chaste.github.io/docs/installguides/dependency-versions/ -if version_lt "${petsc_version}" '3.12'; then # PETSc < 3.12.x - echo "$(basename $0): PETSc versions < 3.12 not supported" - exit 1 -fi - -if version_lt "${hdf5_version}" '1.10.4'; then # HDF5 < 1.10.4 - echo "$(basename $0): HDF5 versions < 1.10.4 not supported" - exit 1 -fi - -if version_eq "${hdf5_major}.${hdf5_minor}" '1.11'; then # HDF5 == 1.11.x - echo "$(basename $0): HDF5 1.11.x not supported" - exit 1 -fi - -if version_eq "${hdf5_major}.${hdf5_minor}" '1.13'; then # HDF5 == 1.13.x - echo "$(basename $0): HDF5 1.13.x not supported" - exit 1 -fi - -# Retrieve packages to fix "url is not a tarball" errors -mkdir -p ${base_dir}/src/petsc_hdf5 -cd ${base_dir}/src/petsc_hdf5 - -download_hdf5=1 -URL_HDF5= -if (version_ge "${hdf5_version}" '1.10.0' && version_lt "${hdf5_version}" '1.10.12') || # HDF5 >=1.10.0, <1.10.12 - (version_ge "${hdf5_version}" '1.12.0' && version_lt "${hdf5_version}" '1.12.2') # HDF5 >=1.12.0, <1.12.2 -then - URL_HDF5=https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${hdf5_major}.${hdf5_minor}/hdf5-${hdf5_version}/src/hdf5-${hdf5_version}.tar.gz - -elif (version_ge "${hdf5_version}" '1.12.2' && version_lt "${hdf5_version}" '1.12.4') || # HDF5 >=1.12.2, <1.12.4 - (version_ge "${hdf5_version}" '1.14.0' && version_lt "${hdf5_version}" '1.14.4') # HDF5 >=1.14.0, <1.14.4 -then - URL_HDF5=https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-${hdf5_ver_si_on}.tar.gz - -else - # HDF5 >=1.10.12, <1.11 - # HDF5 >=1.12.4, <1.13 - # HDF5 >=1.14.4, <1.15 - # + catch-all - URL_HDF5=https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-${hdf5_version}.tar.gz -fi - -wget -nc ${URL_HDF5} -download_hdf5=$(pwd)/$(basename ${URL_HDF5}) - -# Download and extract PETSc -URL_PETSC=https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${petsc_version}.tar.gz -wget -nc ${URL_PETSC} - -install_dir=${base_dir}/opt/petsc_hdf5/${petsc_version}_${hdf5_version} -mkdir -p ${install_dir} - -tar -xzf $(basename ${URL_PETSC}) -C ${install_dir} --strip-components=1 - -# Fix for isAlive() removal from Python 3.9+ -# https://bugs.python.org/issue37804 -if [[ (${petsc_major} -eq 3) && ((${petsc_minor} -eq 12) || (${petsc_minor} -eq 13)) ]]; then # PETSc 3.12.x & 3.13.x - cd ${install_dir} - sed -i.bak 's/thread.isAlive()/thread.is_alive()/g' config/BuildSystem/script.py -fi - -# Build and install -cd ${install_dir} -export PETSC_DIR=$(pwd) - -case ${petsc_arch} in - - linux-gnu) - export PETSC_ARCH=linux-gnu - python3 ./configure \ - --COPTFLAGS=-Og \ - --CXXOPTFLAGS=-Og \ - --download-f2cblaslapack=1 \ - --download-hdf5=${download_hdf5} \ - --download-hypre=1 \ - --download-metis=1 \ - --download-mpich=1 \ - --download-parmetis=1 \ - --with-cc=gcc \ - --with-cxx=g++ \ - --with-debugging=1 \ - --with-fc=0 \ - --with-shared-libraries \ - --with-ssl=false \ - --with-x=false && \ - make -j ${parallel} all - ;; - - linux-gnu-opt) - export PETSC_ARCH=linux-gnu-opt - python3 ./configure \ - --download-f2cblaslapack=1 \ - --download-hdf5=${download_hdf5} \ - --download-hypre=1 \ - --download-metis=1 \ - --download-mpich=1 \ - --download-parmetis=1 \ - --with-cc=gcc \ - --with-cxx=g++ \ - --with-fc=0 \ - --with-shared-libraries \ - --with-ssl=false \ - --with-x=false && \ - make -j ${parallel} all - ;; - *) - ;; -esac - -# Add modulefile -mkdir -p ${base_dir}/modulefiles/petsc_hdf5/${petsc_version}_${hdf5_version} -cd ${base_dir}/modulefiles/petsc_hdf5/${petsc_version}_${hdf5_version} -cat < ${petsc_arch} -#%Module1.0##################################################################### -### -## petsc_hdf5 ${petsc_version}_${hdf5_version}/${petsc_arch} modulefile -## -proc ModulesTest { } { - set paths "[getenv PETSC_DIR] - [getenv PETSC_DIR]/[getenv PETSC_ARCH] - [getenv PETSC_DIR]/[getenv PETSC_ARCH]/bin - [getenv PETSC_DIR]/[getenv PETSC_ARCH]/bin/h5pcc - [getenv PETSC_DIR]/[getenv PETSC_ARCH]/include - [getenv PETSC_DIR]/[getenv PETSC_ARCH]/lib - [getenv PETSC_DIR]/[getenv PETSC_ARCH]/lib/libhdf5.so - [getenv PETSC_DIR]/[getenv PETSC_ARCH]/lib/libpetsc.so" - - foreach path \$paths { - if { ![file exists \$path] } { - puts stderr "ERROR: Does not exist: \$path" - return 0 - } - } - return 1 -} - -proc ModulesHelp { } { - puts stderr "\tThis adds the environment variables for petsc ${petsc_version} and hdf5 ${hdf5_version}, with PETSC_ARCH=${petsc_arch}\n" -} - -module-whatis "This adds the environment variables for petsc ${petsc_version} and hdf5 ${hdf5_version}, with PETSC_ARCH=${petsc_arch}" - -setenv PETSC_DIR ${install_dir} -setenv PETSC_ARCH ${petsc_arch} - -prepend-path PATH ${install_dir}/${petsc_arch}/bin - -prepend-path LIBRARY_PATH ${install_dir}/${petsc_arch}/lib -prepend-path LD_LIBRARY_PATH ${install_dir}/${petsc_arch}/lib -prepend-path LD_RUN_PATH ${install_dir}/${petsc_arch}/lib - -prepend-path INCLUDE ${install_dir}/${petsc_arch}/include -prepend-path C_INCLUDE_PATH ${install_dir}/${petsc_arch}/include -prepend-path CPLUS_INCLUDE_PATH ${install_dir}/${petsc_arch}/include - -prepend-path CMAKE_PREFIX_PATH ${install_dir}/${petsc_arch} - -setenv HDF5_ROOT ${install_dir}/${petsc_arch} -setenv PARMETIS_ROOT ${install_dir}/${petsc_arch} - -conflict petsc -conflict hdf5 -conflict petsc_hdf5 -EOF diff --git a/scripts/custom/setup_custom.sh b/scripts/custom/setup_custom.sh index b793417..8857a7e 100755 --- a/scripts/custom/setup_custom.sh +++ b/scripts/custom/setup_custom.sh @@ -4,18 +4,18 @@ export DEBIAN_FRONTEND=noninteractive # Base dependencies -apt-get update && \ -apt-get install -y --no-install-recommends \ - apt-transport-https \ - apt-utils \ - ca-certificates \ - curl \ - environment-modules \ - gnupg \ - jq \ - openssl \ - rsync \ - wget +apt-get update && + apt-get install -y --no-install-recommends \ + apt-transport-https \ + apt-utils \ + ca-certificates \ + curl \ + environment-modules \ + gnupg \ + jq \ + openssl \ + rsync \ + wget # Build/dev dependencies apt-get install -y --no-install-recommends \ @@ -34,7 +34,9 @@ apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \ libfftw3-3 \ libfftw3-bin \ - libfftw3-dev + libfftw3-dev \ + mpi-default-bin \ + mpi-default-dev # VTK dependencies apt-get install -y --no-install-recommends \ diff --git a/scripts/system/install_modulefiles.sh b/scripts/system/install_modulefiles.sh index b9a81fa..1b0bd92 100755 --- a/scripts/system/install_modulefiles.sh +++ b/scripts/system/install_modulefiles.sh @@ -59,25 +59,54 @@ module-whatis "This adds the environment variables for boost ${version}" conflict boost EOF - -# PETSc and HDF5 modulefile stub -petsc_arch=linux-gnu -petsc_version=$(dpkg -s libpetsc-real-dev | grep 'Version:' | cut -d' ' -f2 | cut -d. -f1,2,3 | cut -d+ -f1) +# HDF5 modulefile stub hdf5_version=$(dpkg -s libhdf5-openmpi-dev | grep 'Version:' | cut -d' ' -f2 | cut -d. -f1,2,3 | cut -d+ -f1) -mkdir -p ${base_dir}/modulefiles/petsc_hdf5/${petsc_version}_${hdf5_version} -cd ${base_dir}/modulefiles/petsc_hdf5/${petsc_version}_${hdf5_version} +mkdir -p ${base_dir}/modulefiles/hdf5/${hdf5_version} +cd ${base_dir}/modulefiles/hdf5/${hdf5_version} cat < linux-gnu #%Module1.0##################################################################### ### -## petsc_hdf5 ${petsc_version}_${hdf5_version}/${petsc_arch} modulefile +## hdf5 ${hdf5_version} modulefile ## proc ModulesTest { } { set paths "/usr/bin/h5pcc /usr/include/hdf5 - /usr/lib/x86_64-linux-gnu/hdf5 - /usr/include/petsc + /usr/lib/x86_64-linux-gnu/hdf5" + + foreach path \$paths { + if { ![file exists \$path] } { + puts stderr "ERROR: Does not exist: \$path" + return 0 + } + } + return 1 +} + +proc ModulesHelp { } { + puts stderr "\tThis adds the environment variables for hdf5 ${hdf5_version}\n" +} + +module-whatis "This adds the environment variables for hdf5 ${hdf5_version}" + +conflict hdf5 +EOF + +# PETSc modulefile stub +petsc_arch=linux-gnu +petsc_version=$(dpkg -s libpetsc-real-dev | grep 'Version:' | cut -d' ' -f2 | cut -d. -f1,2,3 | cut -d+ -f1) + +mkdir -p ${base_dir}/modulefiles/petsc/${petsc_version} +cd ${base_dir}/modulefiles/petsc/${petsc_version} + +cat < linux-gnu +#%Module1.0##################################################################### +### +## petsc ${petsc_version}/${petsc_arch} modulefile +## +proc ModulesTest { } { + set paths "/usr/include/petsc /usr/lib/x86_64-linux-gnu/libpetsc.so /usr/lib/libparmetis.so" @@ -91,14 +120,12 @@ proc ModulesTest { } { } proc ModulesHelp { } { - puts stderr "\tThis adds the environment variables for petsc ${petsc_version} and hdf5 ${hdf5_version}, with PETSC_ARCH=${petsc_arch}\n" + puts stderr "\tThis adds the environment variables for petsc ${petsc_version} with PETSC_ARCH=${petsc_arch}\n" } -module-whatis "This adds the environment variables for petsc ${petsc_version} and hdf5 ${hdf5_version}, with PETSC_ARCH=${petsc_arch}" +module-whatis "This adds the environment variables for petsc ${petsc_version} with PETSC_ARCH=${petsc_arch}" conflict petsc -conflict hdf5 -conflict petsc_hdf5 EOF From 050da4d9acc854d192473fdd55596de118bb4003 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 12:09:51 +0100 Subject: [PATCH 02/12] #84 Separate PETSc and HDF5 github actions --- .github/workflows/build-all.yml | 34 +++++++++---- .github/workflows/build-hdf5.yml | 51 +++++++++++++++++++ .../{build-petsc_hdf5.yml => build-petsc.yml} | 22 +++----- .github/workflows/portability-tests.yml | 2 +- Dockerfile.custom | 29 ++++++++--- Dockerfile.system | 3 +- README.md | 3 +- scripts/custom/setup_custom.sh | 27 +++++----- 8 files changed, 122 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/build-hdf5.yml rename .github/workflows/{build-petsc_hdf5.yml => build-petsc.yml} (63%) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 3912676..01e87f1 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -128,20 +128,33 @@ jobs: module test xsd/${{ env.XSD_VER }} - - name: Build PETSc + HDF5 + - name: Build HDF5 run: | module use ${{ env.MODULES_DIR }}/modulefiles module load boost/${{ env.BOOST_VER }} module load xercesc/${{ env.XERCESC_VER }} module load xsd/${{ env.XSD_VER }} - ./install_petsc_hdf5.sh \ - --petsc-version=${{ env.PETSC_VER }} \ - --petsc-arch=${{ env.PETSC_ARCH }} \ - --hdf5-version=${{ env.HDF5_VER }} \ + ./install_hdf5.sh \ + --version=${{ env.HDF5_VER }} \ --modules-dir=${{ env.MODULES_DIR }} - module test petsc_hdf5/${{ env.PETSC_VER }}_${{ env.HDF5_VER }}/${{ env.PETSC_ARCH }} + module test hdf5/${{ env.HDF5_VER }} + + - name: Build PETSc + run: | + module use ${{ env.MODULES_DIR }}/modulefiles + module load boost/${{ env.BOOST_VER }} + module load xercesc/${{ env.XERCESC_VER }} + module load xsd/${{ env.XSD_VER }} + module load hdf5/${{ env.HDF5_VER }} + + ./install_petsc.sh \ + --version=${{ env.PETSC_VER }} \ + --arch=${{ env.PETSC_ARCH }} \ + --modules-dir=${{ env.MODULES_DIR }} + + module test petsc/${{ env.PETSC_VER }}/${{ env.PETSC_ARCH }} - name: Build SUNDIALS run: | @@ -149,7 +162,8 @@ jobs: module load boost/${{ env.BOOST_VER }} module load xercesc/${{ env.XERCESC_VER }} module load xsd/${{ env.XSD_VER }} - module load petsc_hdf5/${{ env.PETSC_VER }}_${{ env.HDF5_VER }}/${{ env.PETSC_ARCH }} + module load hdf5/${{ env.HDF5_VER }} + module load petsc/${{ env.PETSC_VER }}/${{ env.PETSC_ARCH }} ./install_sundials.sh \ --version=${{ env.SUNDIALS_VER }} \ @@ -163,7 +177,8 @@ jobs: module load boost/${{ env.BOOST_VER }} module load xercesc/${{ env.XERCESC_VER }} module load xsd/${{ env.XSD_VER }} - module load petsc_hdf5/${{ env.PETSC_VER }}_${{ env.HDF5_VER }}/${{ env.PETSC_ARCH }} + module load hdf5/${{ env.HDF5_VER }} + module load petsc/${{ env.PETSC_VER }}/${{ env.PETSC_ARCH }} module load sundials/${{ env.SUNDIALS_VER }} ./install_vtk.sh \ @@ -183,7 +198,8 @@ jobs: module load boost/${{ env.BOOST_VER }} module load xercesc/${{ env.XERCESC_VER }} module load xsd/${{ env.XSD_VER }} - module load petsc_hdf5/${{ env.PETSC_VER }}_${{ env.HDF5_VER }}/${{ env.PETSC_ARCH }} + module load hdf5/${{ env.HDF5_VER }} + module load petsc/${{ env.PETSC_VER }}/${{ env.PETSC_ARCH }} module load sundials/${{ env.SUNDIALS_VER }} module load vtk/${{ env.VTK_VER }} diff --git a/.github/workflows/build-hdf5.yml b/.github/workflows/build-hdf5.yml new file mode 100644 index 0000000..751dd49 --- /dev/null +++ b/.github/workflows/build-hdf5.yml @@ -0,0 +1,51 @@ +name: Build HDF5 + +on: + workflow_dispatch: + inputs: + hdf5_ver: + description: "HDF5 version" + required: true + type: string + default: "1.10.10" + +defaults: + run: + shell: bash --login -e -o pipefail {0} # login for environment modules + working-directory: ./scripts/custom + +jobs: + setup: + name: Build HDF5 ${{github.event.inputs.hdf5_ver }} + + runs-on: ubuntu-22.04 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set env + run: | + echo "MODULES_DIR=$HOME/modules" >> $GITHUB_ENV + echo "HDF5_VER=${{ github.event.inputs.hdf5_ver }}" >> $GITHUB_ENV + + - name: Setup OS + run: | + sudo ./setup_custom.sh + + - name: List environment modules + run: | + module avail + + - name: Run build script + run: | + ./install_hdf5.sh \ + --version=${{ env.HDF5_VER }} \ + --modules-dir=${{ env.MODULES_DIR }} + + - name: Test + run: | + module use ${{ env.MODULES_DIR }}/modulefiles + module avail + module load hdf5/${{ env.HDF5_VER }} + module test hdf5/${{ env.HDF5_VER }} diff --git a/.github/workflows/build-petsc_hdf5.yml b/.github/workflows/build-petsc.yml similarity index 63% rename from .github/workflows/build-petsc_hdf5.yml rename to .github/workflows/build-petsc.yml index ed741ec..4e4da78 100644 --- a/.github/workflows/build-petsc_hdf5.yml +++ b/.github/workflows/build-petsc.yml @@ -1,4 +1,4 @@ -name: Build PETSc + HDF5 +name: Build PETSc on: workflow_dispatch: @@ -18,12 +18,6 @@ on: - "linux-gnu-opt" default: "linux-gnu" - hdf5_ver: - description: "HDF5 version" - required: true - type: string - default: "1.10.10" - defaults: run: shell: bash --login -e -o pipefail {0} # login for environment modules @@ -31,7 +25,7 @@ defaults: jobs: setup: - name: Build PETSc ${{ github.event.inputs.petsc_ver }} + HDF5 ${{github.event.inputs.hdf5_ver }} + name: Build PETSc ${{ github.event.inputs.petsc_ver }}/${{github.event.inputs.petsc_arch }} runs-on: ubuntu-22.04 @@ -44,7 +38,6 @@ jobs: echo "MODULES_DIR=$HOME/modules" >> $GITHUB_ENV echo "PETSC_VER=${{ github.event.inputs.petsc_ver }}" >> $GITHUB_ENV echo "PETSC_ARCH=${{ github.event.inputs.petsc_arch }}" >> $GITHUB_ENV - echo "HDF5_VER=${{ github.event.inputs.hdf5_ver }}" >> $GITHUB_ENV - name: Setup OS run: | @@ -56,15 +49,14 @@ jobs: - name: Run build script run: | - ./install_petsc_hdf5.sh \ - --petsc-version=${{ env.PETSC_VER }} \ - --petsc-arch=${{ env.PETSC_ARCH }} \ - --hdf5-version=${{ env.HDF5_VER }} \ + ./install_petsc.sh \ + --version=${{ env.PETSC_VER }} \ + --arch=${{ env.PETSC_ARCH }} \ --modules-dir=${{ env.MODULES_DIR }} - name: Test run: | module use ${{ env.MODULES_DIR }}/modulefiles module avail - module load petsc_hdf5/${{ env.PETSC_VER }}_${{ env.HDF5_VER }}/${{ env.PETSC_ARCH }} - module test petsc_hdf5/${{ env.PETSC_VER }}_${{ env.HDF5_VER }}/${{ env.PETSC_ARCH }} + module load petsc/${{ env.PETSC_VER }}/${{ env.PETSC_ARCH }} + module test petsc/${{ env.PETSC_VER }}/${{ env.PETSC_ARCH }} diff --git a/.github/workflows/portability-tests.yml b/.github/workflows/portability-tests.yml index c7c5086..8654438 100644 --- a/.github/workflows/portability-tests.yml +++ b/.github/workflows/portability-tests.yml @@ -43,7 +43,7 @@ jobs: source /etc/profile.d/modules.sh module use /home/runner/modules/modulefiles module avail - module load boost petsc_hdf5 sundials vtk xercesc xsd + module load boost hdf5 petsc sundials vtk xercesc xsd module list EOF working-directory: build diff --git a/Dockerfile.custom b/Dockerfile.custom index 1d8d6d1..3ebc2d0 100755 --- a/Dockerfile.custom +++ b/Dockerfile.custom @@ -84,13 +84,11 @@ RUN source /etc/profile.d/modules.sh && \ module load boost && \ module load xercesc && \ module load xsd && \ - install_petsc_hdf5.sh \ - --petsc-version=${PETSC} \ - --petsc-arch=linux-gnu \ - --hdf5-version=${HDF5} \ + install_hdf5.sh \ + --version=${HDF5} \ --parallel=$(nproc) \ --modules-dir=${MODULES_DIR} && \ - module test petsc_hdf5 && \ + module test hdf5 && \ rm -rf ${MODULES_DIR}/src/* && \ rm -rf /tmp/* @@ -99,7 +97,23 @@ RUN source /etc/profile.d/modules.sh && \ module load boost && \ module load xercesc && \ module load xsd && \ - module load petsc_hdf5 && \ + module load hdf5 && \ + install_petsc.sh \ + --version=${PETSC} \ + --arch=linux-gnu \ + --parallel=$(nproc) \ + --modules-dir=${MODULES_DIR} && \ + module test petsc && \ + rm -rf ${MODULES_DIR}/src/* && \ + rm -rf /tmp/* + +RUN source /etc/profile.d/modules.sh && \ + module use ${MODULES_DIR}/modulefiles && \ + module load boost && \ + module load xercesc && \ + module load xsd && \ + module load hdf5 && \ + module load petsc && \ install_sundials.sh \ --version=${SUNDIALS} \ --parallel=$(nproc) \ @@ -113,7 +127,8 @@ RUN source /etc/profile.d/modules.sh && \ module load boost && \ module load xercesc && \ module load xsd && \ - module load petsc_hdf5 && \ + module load hdf5 && \ + module load petsc && \ module load sundials && \ install_vtk.sh \ --version=${VTK} \ diff --git a/Dockerfile.system b/Dockerfile.system index f19cd55..0c28129 100755 --- a/Dockerfile.system +++ b/Dockerfile.system @@ -47,7 +47,8 @@ RUN source /etc/profile.d/modules.sh && \ module test boost && \ module test xsd && \ module test xercesc && \ - module test petsc_hdf5 && \ + module test hdf5 && \ + module test petsc && \ module test sundials && \ module test vtk diff --git a/README.md b/README.md index 9433f63..56c95e0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ ![boost](https://github.com/Chaste/dependency-modules/actions/workflows/build-boost.yml/badge.svg) -![petsc_hdf5](https://github.com/Chaste/dependency-modules/actions/workflows/build-petsc_hdf5.yml/badge.svg) +![hdf5](https://github.com/Chaste/dependency-modules/actions/workflows/build-hdf5.yml/badge.svg) +![petsc](https://github.com/Chaste/dependency-modules/actions/workflows/build-petsc.yml/badge.svg) ![sundials](https://github.com/Chaste/dependency-modules/actions/workflows/build-sundials.yml/badge.svg) ![vtk](https://github.com/Chaste/dependency-modules/actions/workflows/build-vtk.yml/badge.svg) ![xercesc](https://github.com/Chaste/dependency-modules/actions/workflows/build-xercesc.yml/badge.svg) diff --git a/scripts/custom/setup_custom.sh b/scripts/custom/setup_custom.sh index 8857a7e..5491ee8 100755 --- a/scripts/custom/setup_custom.sh +++ b/scripts/custom/setup_custom.sh @@ -4,18 +4,18 @@ export DEBIAN_FRONTEND=noninteractive # Base dependencies -apt-get update && - apt-get install -y --no-install-recommends \ - apt-transport-https \ - apt-utils \ - ca-certificates \ - curl \ - environment-modules \ - gnupg \ - jq \ - openssl \ - rsync \ - wget +apt-get update +apt-get install -y --no-install-recommends \ + apt-transport-https \ + apt-utils \ + ca-certificates \ + curl \ + environment-modules \ + gnupg \ + jq \ + openssl \ + rsync \ + wget # Build/dev dependencies apt-get install -y --no-install-recommends \ @@ -118,9 +118,6 @@ apt-get install -y --no-install-recommends \ zlib1g \ zlib1g-dev -# mpi-default-bin mpi-default-dev: -# To be supplied by custom PETSc build for better compatibility. - # libexpat1-dev libexpat1: # To be supplied by custom VTK build due to version conflicts. From e8b505d9684e0b9b070a18eadeb9fd583dfd73b7 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 13:05:10 +0100 Subject: [PATCH 03/12] #84 Add petsc_hdf5 modulefile stubs for backward compatibility --- Dockerfile.custom | 13 ++++ scripts/custom/install_petsc_hdf5.sh | 90 +++++++++++++++++++++++++++ scripts/system/install_modulefiles.sh | 31 +++++++++ 3 files changed, 134 insertions(+) create mode 100755 scripts/custom/install_petsc_hdf5.sh diff --git a/Dockerfile.custom b/Dockerfile.custom index 3ebc2d0..65c84e5 100755 --- a/Dockerfile.custom +++ b/Dockerfile.custom @@ -107,6 +107,19 @@ RUN source /etc/profile.d/modules.sh && \ rm -rf ${MODULES_DIR}/src/* && \ rm -rf /tmp/* +# TODO: This RUN section is a temporary workaround for backwards compatibility. +# Remove once the combined PETSc/HDF5 module is no longer needed. +RUN source /etc/profile.d/modules.sh && \ + module use ${MODULES_DIR}/modulefiles && \ + install_petsc_hdf5.sh \ + --petsc-version=${PETSC} \ + --petsc-arch=linux-gnu \ + --hdf5-version=${HDF5} \ + --modules-dir=${MODULES_DIR} && \ + module test petsc_hdf5 && \ + rm -rf ${MODULES_DIR}/src/* && \ + rm -rf /tmp/* + RUN source /etc/profile.d/modules.sh && \ module use ${MODULES_DIR}/modulefiles && \ module load boost && \ diff --git a/scripts/custom/install_petsc_hdf5.sh b/scripts/custom/install_petsc_hdf5.sh new file mode 100755 index 0000000..4580d80 --- /dev/null +++ b/scripts/custom/install_petsc_hdf5.sh @@ -0,0 +1,90 @@ +#!/bin/bash -eu + +# TODO: This script adds a PETSc/HDF5 modulefile as a temporary workaround for backwards compatibility. +# Remove once the combined PETSc/HDF5 module is no longer needed. + +usage() +{ + echo 'Usage: '"$(basename $0)"' --petsc-version=version --petsc-arch=[{linux-gnu|linux-gnu-opt}]' + echo ' --hdf5-version=version --modules-dir=path' + exit 1 +} + +script_dir="$(cd "$(dirname "$0")"; pwd)" +. ${script_dir}/../common.sh + +# Parse arguments +petsc_version= +petsc_arch= +hdf5_version= +base_dir= + +for option; do + case $option in + --petsc-version=*) + petsc_version=$(expr "x$option" : "x--petsc-version=\(.*\)") + ;; + --petsc-arch=*) + petsc_arch=$(expr "x$option" : "x--petsc-arch=\(.*\)") + ;; + --hdf5-version=*) + hdf5_version=$(expr "x$option" : "x--hdf5-version=\(.*\)") + ;; + --modules-dir=*) + base_dir=$(expr "x$option" : "x--modules-dir=\(.*\)") + ;; + *) + echo "Unknown option: $option" 1>&2 + exit 1 + ;; + esac +done + +if [ -z "${petsc_version}" ]; then usage; fi +if [ -z "${hdf5_version}" ]; then usage; fi +if [ -z "${base_dir}" ]; then usage; fi + +if [ -z "${petsc_arch}" ]; then + petsc_arch=linux-gnu +fi + +if [[ ! (${petsc_arch} = 'linux-gnu' || ${petsc_arch} = 'linux-gnu-opt') ]]; then + usage +fi + +read -r petsc_version _ < <(split_version ${petsc_version}) + +read -r hdf5_version _ < <(split_version ${hdf5_version}) + +# Add modulefile +mkdir -p ${base_dir}/modulefiles/petsc_hdf5/${petsc_version}_${hdf5_version} +cd ${base_dir}/modulefiles/petsc_hdf5/${petsc_version}_${hdf5_version} +cat < ${petsc_arch} +#%Module1.0##################################################################### +### +## petsc_hdf5 ${petsc_version}_${hdf5_version}/${petsc_arch} modulefile +## +proc ModulesTest { } { + set paths "[getenv HDF5_ROOT] + [getenv PETSC_DIR]/[getenv PETSC_ARCH]" + + foreach path \$paths { + if { ![file exists \$path] } { + puts stderr "ERROR: Does not exist: \$path" + return 0 + } + } + return 1 +} + +proc ModulesHelp { } { + puts stderr "\tThis adds the environment variables for petsc ${petsc_version} and hdf5 ${hdf5_version}, with PETSC_ARCH=${petsc_arch}\n" +} + +module-whatis "This adds the environment variables for petsc ${petsc_version} and hdf5 ${hdf5_version}, with PETSC_ARCH=${petsc_arch}" + +module load hdf5/${hdf5_version} +module load petsc/${petsc_version}/${petsc_arch} + +conflict petsc_hdf5 +EOF diff --git a/scripts/system/install_modulefiles.sh b/scripts/system/install_modulefiles.sh index 1b0bd92..c44d0b5 100755 --- a/scripts/system/install_modulefiles.sh +++ b/scripts/system/install_modulefiles.sh @@ -128,6 +128,37 @@ module-whatis "This adds the environment variables for petsc ${petsc_version} wi conflict petsc EOF +# TODO: This adds PETSc/HDF5 modulefile stub as a temporary workaround for backwards compatibility. +# Remove once the combined PETSc/HDF5 module is no longer needed. +mkdir -p ${base_dir}/modulefiles/petsc_hdf5/${petsc_version}_${hdf5_version} +cd ${base_dir}/modulefiles/petsc_hdf5/${petsc_version}_${hdf5_version} + +cat < linux-gnu +#%Module1.0##################################################################### +### +## petsc_hdf5 ${petsc_version}_${hdf5_version}/${petsc_arch} modulefile +## +proc ModulesTest { } { + set paths "/usr/include/hdf5 + /usr/include/petsc" + + foreach path \$paths { + if { ![file exists \$path] } { + puts stderr "ERROR: Does not exist: \$path" + return 0 + } + } + return 1 +} + +proc ModulesHelp { } { + puts stderr "\tThis adds the environment variables for petsc ${petsc_version} and hdf5 ${hdf5_version}, with PETSC_ARCH=${petsc_arch}\n" +} + +module-whatis "This adds the environment variables for petsc ${petsc_version} and hdf5 ${hdf5_version}, with PETSC_ARCH=${petsc_arch}" + +conflict petsc_hdf5 +EOF # Sundials modulefile stub version=$(dpkg -s libsundials-dev | grep 'Version:' | cut -d' ' -f2 | cut -d. -f1,2,3 | cut -d+ -f1) From e47bcff7c9a1606d3aaf18b7219a02ae0398f7a9 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 13:05:43 +0100 Subject: [PATCH 04/12] #84 Add header docs to install scripts --- scripts/custom/install_boost.sh | 9 +++++++++ scripts/custom/install_cmake.sh | 9 +++++++++ scripts/custom/install_hdf5.sh | 9 +++++++++ scripts/custom/install_petsc.sh | 10 ++++++++++ scripts/custom/install_sundials.sh | 9 +++++++++ scripts/custom/install_vtk.sh | 9 +++++++++ scripts/custom/install_xercesc.sh | 9 +++++++++ scripts/custom/install_xsd.sh | 8 ++++++++ scripts/custom/setup_custom.sh | 1 + scripts/system/setup_system.sh | 1 + 10 files changed, 74 insertions(+) diff --git a/scripts/custom/install_boost.sh b/scripts/custom/install_boost.sh index 19a1bc2..7c373b6 100755 --- a/scripts/custom/install_boost.sh +++ b/scripts/custom/install_boost.sh @@ -1,5 +1,14 @@ #!/bin/bash -eu +# Installs Boost from source and creates a modulefile for it. +# Arguments: +# --version=version: The Boost version to install (e.g., 1.74.0). +# --modules-dir=path: The base directory for the installation and modulefile. +# --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). +# Example usage: +# ./install_boost.sh --version=1.74.0 --modules-dir=/path/to/modules --parallel=4 +# module load boost/1.74.0 + usage() { echo 'Usage: '"$(basename $0)"' --version=version --modules-dir=path [--parallel=value]' diff --git a/scripts/custom/install_cmake.sh b/scripts/custom/install_cmake.sh index 26e955f..1cddacd 100755 --- a/scripts/custom/install_cmake.sh +++ b/scripts/custom/install_cmake.sh @@ -1,5 +1,14 @@ #!/bin/bash -eu +# Installs CMake from source and creates a modulefile for it. +# Arguments: +# --version=version: The CMake version to install (e.g., 3.21.2). +# --modules-dir=path: The base directory for the installation and modulefile. +# --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). +# Example usage: +# ./install_cmake.sh --version=3.21.2 --modules-dir=/path/to/modules --parallel=4 +# module load cmake/3.21.2 + usage() { echo 'Usage: '"$(basename $0)"' --version=version --modules-dir=path [--parallel=value]' diff --git a/scripts/custom/install_hdf5.sh b/scripts/custom/install_hdf5.sh index fc23f34..a3d8f74 100755 --- a/scripts/custom/install_hdf5.sh +++ b/scripts/custom/install_hdf5.sh @@ -1,5 +1,14 @@ #!/bin/bash -eu +# Installs HDF5 from source and creates a modulefile for it. +# Arguments: +# --version=version: The HDF5 version to install (e.g., 1.12.0). +# --modules-dir=path: The base directory for the installation and modulefile. +# --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). +# Example usage: +# ./install_hdf5.sh --version=1.12.0 --modules-dir=/path/to/modules --parallel=4 +# module load hdf5/1.12.0 + usage() { echo 'Usage: '"$(basename $0)"' --version=version --modules-dir=path [--parallel=value]' diff --git a/scripts/custom/install_petsc.sh b/scripts/custom/install_petsc.sh index 449e9fa..95ef689 100755 --- a/scripts/custom/install_petsc.sh +++ b/scripts/custom/install_petsc.sh @@ -1,5 +1,15 @@ #!/bin/bash -eu +# Installs PETSc from source and adds a modulefile for it. +# Arguments: +# --version=version: The PETSc version to install (e.g., 3.15.0). +# --arch=[{linux-gnu|linux-gnu-opt}]: The build type (default: linux-gnu). +# --modules-dir=path: The base directory for the installation and modulefile. +# --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). +# Example usage: +# ./install_petsc.sh --version=3.15.0 --arch=linux-gnu --modules-dir=/path/to/modules --parallel=4 +# module load petsc/3.15.0/linux-gnu + usage() { echo 'Usage: '"$(basename $0)"' --version=version --arch=[{linux-gnu|linux-gnu-opt}]' diff --git a/scripts/custom/install_sundials.sh b/scripts/custom/install_sundials.sh index 0e0b21d..763502d 100755 --- a/scripts/custom/install_sundials.sh +++ b/scripts/custom/install_sundials.sh @@ -1,5 +1,14 @@ #!/bin/bash -eu +# Installs Sundials from source and creates a modulefile for it. +# Arguments: +# --version=version: The Sundials version to install (e.g., 5.7.0). +# --modules-dir=path: The base directory for the installation and modulefile. +# --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). +# Example usage: +# ./install_sundials.sh --version=5.7.0 --modules-dir=/path/to/modules --parallel=4 +# module load sundials/5.7.0 + usage() { echo 'Usage: '"$(basename $0)"' --version=version --modules-dir=path [--parallel=value]' diff --git a/scripts/custom/install_vtk.sh b/scripts/custom/install_vtk.sh index cc19ba0..9adf4c9 100755 --- a/scripts/custom/install_vtk.sh +++ b/scripts/custom/install_vtk.sh @@ -1,5 +1,14 @@ #!/bin/bash -eu +# Installs VTK from source and creates a modulefile for it. +# Arguments: +# --version=version: The VTK version to install (e.g., 9.3.0). +# --modules-dir=path: The base directory for the installation and modulefile. +# --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). +# Example usage: +# ./install_vtk.sh --version=9.3.0 --modules-dir=/path/to/modules --parallel=4 +# module load vtk/9.3.0 + usage() { echo 'Usage: '"$(basename $0)"' --version=version --modules-dir=path [--parallel=value]' diff --git a/scripts/custom/install_xercesc.sh b/scripts/custom/install_xercesc.sh index 341e2ba..3a5819b 100755 --- a/scripts/custom/install_xercesc.sh +++ b/scripts/custom/install_xercesc.sh @@ -1,5 +1,14 @@ #!/bin/bash -eu +# Installs Xerces-C++ from source and creates a modulefile for it. +# Arguments: +# --version=version: Version of Xerces-C++ to install (e.g., 3.2.3) +# --modules-dir=path: The base directory for the installation and modulefile. +# --parallel=value: Number of parallel jobs for building (default: number of CPU cores) +# Example usage: +# ./install_xercesc.sh --version=3.2.3 --modules-dir=/path/to/modules --parallel=4 +# module load xercesc/3.2.3 + usage() { echo 'Usage: '"$(basename $0)"' --version=version --modules-dir=path [--parallel=value]' diff --git a/scripts/custom/install_xsd.sh b/scripts/custom/install_xsd.sh index 7285310..efcc31a 100755 --- a/scripts/custom/install_xsd.sh +++ b/scripts/custom/install_xsd.sh @@ -1,5 +1,13 @@ #!/bin/bash -eu +# Installs XSD from source and creates a modulefile for it. +# Arguments: +# --version=version: Version of XSD to install (e.g., 4.0.0) +# --modules-dir=path: The base directory for the installation and modulefile. +# Example usage: +# ./install_xsd.sh --version=4.0.0 --modules-dir=/path/to/modules +# module load xsd/4.0.0 + usage() { echo 'Usage: '"$(basename $0)"' --version=version --modules-dir=path' diff --git a/scripts/custom/setup_custom.sh b/scripts/custom/setup_custom.sh index 5491ee8..c8206c1 100755 --- a/scripts/custom/setup_custom.sh +++ b/scripts/custom/setup_custom.sh @@ -1,4 +1,5 @@ #!/bin/sh + # Setup required libraries for building Chaste dependencies on Ubuntu 22.04 Jammy export DEBIAN_FRONTEND=noninteractive diff --git a/scripts/system/setup_system.sh b/scripts/system/setup_system.sh index 9f4def9..e70f491 100755 --- a/scripts/system/setup_system.sh +++ b/scripts/system/setup_system.sh @@ -1,4 +1,5 @@ #!/bin/sh + # Setup Chaste system dependency versions on Ubuntu export DEBIAN_FRONTEND=noninteractive From 42bda3dfbf4a5d5d115d2a58eefef5e973822c64 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 13:16:20 +0100 Subject: [PATCH 05/12] #84 Update README and example --- README.md | 21 ++++++++++++++------- scripts/custom/example.sh | 15 ++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 56c95e0..cf6bbeb 100644 --- a/README.md +++ b/README.md @@ -89,14 +89,19 @@ Install Boost ./install_boost.sh --version=1.83.0 --modules-dir=${MODULES_DIR} ``` -Install VTK +Install HDF5 ```sh -./install_vtk.sh --version=9.3.1 --modules-dir=${MODULES_DIR} +./install_hdf5.sh --version=1.10.10 --modules-dir=${MODULES_DIR} ``` -Install PETSc + HDF5 +Install PETSc ```sh -./install_petsc_hdf5.sh --petsc-version=3.19.6 --hdf5-version=1.10.10 --petsc-arch=linux-gnu-opt --modules-dir=${MODULES_DIR} +./install_petsc.sh --version=3.19.6 --arch=linux-gnu-opt --modules-dir=${MODULES_DIR} +``` + +Install VTK +```sh +./install_vtk.sh --version=9.3.1 --modules-dir=${MODULES_DIR} ``` > [!TIP] @@ -111,8 +116,9 @@ Use `module avail` to show available software modules ``` ---------------- /home//modules/modulefiles ---------------- boost/1.83.0 vtk/9.3.1 -petsc_hdf5/3.19.6_1.10.810/linux-gnu-opt xercesc/3.2.4 -sundials/6.4.0 xsd/4.0.0 +hdf5/1.10.10 xercesc/3.2.4 +petsc/3.19.6/linux-gnu-opt xsd/4.0.0 +sundials/6.4.0 ``` Use `module load` to activate software modules @@ -121,8 +127,9 @@ module load xsd/4.0.0 module load xercesc/3.2.4 module load sundials/6.4.0 module load boost/1.83.0 +module load hdf5/1.10.10 +module load petsc/3.19.6/linux-gnu-opt module load vtk/9.3.1 -module load petsc_hdf5/3.19.6_1.10.10/linux-gnu-opt ``` ### 5. Build Chaste diff --git a/scripts/custom/example.sh b/scripts/custom/example.sh index 55aa1a9..1b34e14 100755 --- a/scripts/custom/example.sh +++ b/scripts/custom/example.sh @@ -42,17 +42,14 @@ module test sundials/6.4.0 ./install_boost.sh --version=1.83.0 --modules-dir=${modules_dir} --parallel=${parallel} module test boost/1.83.0 -./install_vtk.sh --version=9.3.1 --modules-dir=${modules_dir} --parallel=${parallel} -module test vtk/9.3.1 +./install_hdf5.sh --version=1.10.10 --modules-dir=${modules_dir} --parallel=${parallel} +module test hdf5/1.10.10 -./install_petsc_hdf5.sh \ - --petsc-version=3.19.6 \ - --hdf5-version=1.10.10 \ - --petsc-arch=linux-gnu \ - --modules-dir=${modules_dir} \ - --parallel=${parallel} +./install_petsc.sh --version=3.19.6 --arch=linux-gnu --modules-dir=${modules_dir} --parallel=${parallel} +module test petsc/3.19.6/linux-gnu -module test petsc_hdf5/3.19.6_1.10.10/linux-gnu +./install_vtk.sh --version=9.3.1 --modules-dir=${modules_dir} --parallel=${parallel} +module test vtk/9.3.1 # Cleanup cd - From 5c1774854946fb735c4aa07fa64e70804398bcc5 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 13:53:49 +0000 Subject: [PATCH 06/12] #84 Fix petsc install --- scripts/custom/install_petsc.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/custom/install_petsc.sh b/scripts/custom/install_petsc.sh index 95ef689..a9535fb 100755 --- a/scripts/custom/install_petsc.sh +++ b/scripts/custom/install_petsc.sh @@ -103,8 +103,8 @@ case ${arch} in --download-hypre=1 \ --download-metis=1 \ --download-parmetis=1 \ - --with-cc=gcc \ - --with-cxx=g++ \ + --with-cc=mpicc \ + --with-cxx=mpicxx \ --with-debugging=1 \ --with-fc=0 \ --with-shared-libraries \ @@ -120,8 +120,8 @@ case ${arch} in --download-hypre=1 \ --download-metis=1 \ --download-parmetis=1 \ - --with-cc=gcc \ - --with-cxx=g++ \ + --with-cc=mpicc \ + --with-cxx=mpicxx \ --with-fc=0 \ --with-shared-libraries \ --with-ssl=false \ @@ -144,7 +144,6 @@ proc ModulesTest { } { set paths "[getenv PETSC_DIR] [getenv PETSC_DIR]/[getenv PETSC_ARCH] [getenv PETSC_DIR]/[getenv PETSC_ARCH]/bin - [getenv PETSC_DIR]/[getenv PETSC_ARCH]/bin/h5pcc [getenv PETSC_DIR]/[getenv PETSC_ARCH]/include [getenv PETSC_DIR]/[getenv PETSC_ARCH]/lib [getenv PETSC_DIR]/[getenv PETSC_ARCH]/lib/libpetsc.so" From 5604f702570399def9977f2d568f0875c27fe7c9 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 14:11:40 +0000 Subject: [PATCH 07/12] #84 Fix hdf5 install --- scripts/custom/install_hdf5.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/custom/install_hdf5.sh b/scripts/custom/install_hdf5.sh index a3d8f74..9ba7ee0 100755 --- a/scripts/custom/install_hdf5.sh +++ b/scripts/custom/install_hdf5.sh @@ -99,11 +99,9 @@ cd hdf5-${version} # TODO: check if this is the correct path for all versions mkdir -p build cd build -# TODO: check cmake for HDF5 with MPI support cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=${install_dir} \ - -DHDF5_BUILD_HL_LIB=ON \ -DHDF5_BUILD_TOOLS=OFF \ -DHDF5_ENABLE_PARALLEL=ON \ -DHDF5_ENABLE_Z_LIB_SUPPORT=ON \ From cd4b63245462e8e6999311944ac3fba564159f59 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 14:12:14 +0000 Subject: [PATCH 08/12] #84 Update readme and examples --- README.md | 12 ++++++------ scripts/custom/example.sh | 17 +++++++---------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index cf6bbeb..747eb13 100644 --- a/README.md +++ b/README.md @@ -76,32 +76,32 @@ Install XSD Install Xerces-C ```sh -./install_xercesc.sh --version=3.2.4 --modules-dir=${MODULES_DIR} +./install_xercesc.sh --version=3.2.4 --modules-dir=${MODULES_DIR} --parallel=4 ``` Install SUNDIALS ```sh -./install_sundials.sh --version=6.4.0 --modules-dir=${MODULES_DIR} +./install_sundials.sh --version=6.4.0 --modules-dir=${MODULES_DIR} --parallel=4 ``` Install Boost ```sh -./install_boost.sh --version=1.83.0 --modules-dir=${MODULES_DIR} +./install_boost.sh --version=1.83.0 --modules-dir=${MODULES_DIR} --parallel=4 ``` Install HDF5 ```sh -./install_hdf5.sh --version=1.10.10 --modules-dir=${MODULES_DIR} +./install_hdf5.sh --version=1.10.10 --modules-dir=${MODULES_DIR} --parallel=4 ``` Install PETSc ```sh -./install_petsc.sh --version=3.19.6 --arch=linux-gnu-opt --modules-dir=${MODULES_DIR} +./install_petsc.sh --version=3.19.6 --arch=linux-gnu-opt --modules-dir=${MODULES_DIR} --parallel=4 ``` Install VTK ```sh -./install_vtk.sh --version=9.3.1 --modules-dir=${MODULES_DIR} +./install_vtk.sh --version=9.3.1 --modules-dir=${MODULES_DIR} --parallel=4 ``` > [!TIP] diff --git a/scripts/custom/example.sh b/scripts/custom/example.sh index 1b34e14..fc22a38 100755 --- a/scripts/custom/example.sh +++ b/scripts/custom/example.sh @@ -18,37 +18,34 @@ module use ${modules_dir}/modulefiles # Add modulefiles directory to bash user profile configuration echo "module use ${modules_dir}/modulefiles" >> ${HOME}/.bashrc -# Set number of parallel processes -parallel=$(( $(nproc) < 8 ? $(nproc) : 8 )) - # Get install scripts git clone https://github.com/Chaste/dependency-modules.git /tmp/dependency-modules cd /tmp/dependency-modules/scripts # Install specific dependency versions -./install_cmake.sh --version=3.28.6 --modules-dir=${modules_dir} --parallel=${parallel} +./install_cmake.sh --version=3.28.6 --modules-dir=${modules_dir} --parallel=4 module test cmake/3.28.6 module load cmake/3.28.6 ./install_xsd.sh --version=4.0.0 --modules-dir=${modules_dir} module test xsd/4.0.0 -./install_xercesc.sh --version=3.2.4 --modules-dir=${modules_dir} --parallel=${parallel} +./install_xercesc.sh --version=3.2.4 --modules-dir=${modules_dir} --parallel=4 module test xercesc/3.2.4 -./install_sundials.sh --version=6.4.0 --modules-dir=${modules_dir} --parallel=${parallel} +./install_sundials.sh --version=6.4.0 --modules-dir=${modules_dir} --parallel=4 module test sundials/6.4.0 -./install_boost.sh --version=1.83.0 --modules-dir=${modules_dir} --parallel=${parallel} +./install_boost.sh --version=1.83.0 --modules-dir=${modules_dir} --parallel=4 module test boost/1.83.0 -./install_hdf5.sh --version=1.10.10 --modules-dir=${modules_dir} --parallel=${parallel} +./install_hdf5.sh --version=1.10.10 --modules-dir=${modules_dir} --parallel=4 module test hdf5/1.10.10 -./install_petsc.sh --version=3.19.6 --arch=linux-gnu --modules-dir=${modules_dir} --parallel=${parallel} +./install_petsc.sh --version=3.19.6 --arch=linux-gnu --modules-dir=${modules_dir} --parallel=4 module test petsc/3.19.6/linux-gnu -./install_vtk.sh --version=9.3.1 --modules-dir=${modules_dir} --parallel=${parallel} +./install_vtk.sh --version=9.3.1 --modules-dir=${modules_dir} --parallel=4 module test vtk/9.3.1 # Cleanup From a3869c31f1591ba69ccf5b341556256a8ab8fb1b Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 14:58:58 +0000 Subject: [PATCH 09/12] #84 Fix hdf5 source path --- scripts/custom/install_hdf5.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/custom/install_hdf5.sh b/scripts/custom/install_hdf5.sh index 9ba7ee0..36c57a6 100755 --- a/scripts/custom/install_hdf5.sh +++ b/scripts/custom/install_hdf5.sh @@ -88,14 +88,17 @@ else URL_HDF5=https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-${version}.tar.gz fi +src_dir=$(pwd)/hdf5-${version} +mkdir -p ${src_dir} + wget -nc ${URL_HDF5} -tar -xzf $(basename ${URL_HDF5}) +tar -xzf $(basename ${URL_HDF5}) -C ${src_dir} --strip-components=1 # Build and install install_dir=${base_dir}/opt/hdf5/${version} mkdir -p ${install_dir} -cd hdf5-${version} # TODO: check if this is the correct path for all versions +cd ${src_dir} mkdir -p build cd build @@ -105,8 +108,7 @@ cmake \ -DHDF5_BUILD_TOOLS=OFF \ -DHDF5_ENABLE_PARALLEL=ON \ -DHDF5_ENABLE_Z_LIB_SUPPORT=ON \ - -DHDF5_ENABLE_SZIP_SUPPORT=OFF \ - -DHDF5_ENABLE_THREADSAFE=ON \ + -DHDF5_ENABLE_SZIP_SUPPORT=ON \ -DHDF5_ENABLE_UNSUPPORTED=OFF .. && \ make -j ${parallel} && \ make install From 339ffd288e2d0f4272fdd2bc365983cf8d6a0f43 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 18:20:23 +0000 Subject: [PATCH 10/12] #84 Add symlinks for common.sh --- Dockerfile.custom | 2 +- Dockerfile.system | 2 +- scripts/custom/common.sh | 1 + scripts/custom/install_boost.sh | 2 +- scripts/custom/install_cmake.sh | 2 +- scripts/custom/install_hdf5.sh | 2 +- scripts/custom/install_petsc.sh | 2 +- scripts/custom/install_petsc_hdf5.sh | 2 +- scripts/custom/install_python.sh | 2 +- scripts/custom/install_sundials.sh | 2 +- scripts/custom/install_vtk.sh | 2 +- scripts/custom/install_xercesc.sh | 2 +- scripts/custom/install_xsd.sh | 2 +- scripts/system/common.sh | 1 + 14 files changed, 14 insertions(+), 12 deletions(-) create mode 120000 scripts/custom/common.sh create mode 120000 scripts/system/common.sh diff --git a/Dockerfile.custom b/Dockerfile.custom index 65c84e5..b69f812 100755 --- a/Dockerfile.custom +++ b/Dockerfile.custom @@ -28,7 +28,7 @@ ENV DEFAULT_USER="runner" \ MODULES_DIR="/home/runner/modules" # Copy scripts -COPY scripts/*.sh scripts/custom/ /usr/local/bin/ +COPY scripts/custom/ scripts/*.sh /usr/local/bin/ # Setup base dependencies and install actions runner RUN useradd -r -m -d ${DEFAULT_HOME} -s /bin/bash ${DEFAULT_USER} && \ diff --git a/Dockerfile.system b/Dockerfile.system index 0c28129..0f4582d 100755 --- a/Dockerfile.system +++ b/Dockerfile.system @@ -22,7 +22,7 @@ ENV DEFAULT_USER="runner" \ MODULES_DIR="/home/runner/modules" # Copy scripts -COPY scripts/*.sh scripts/system/ /usr/local/bin/ +COPY scripts/system/ scripts/*.sh /usr/local/bin/ # Setup Chaste dependencies and install actions runner RUN useradd -r -m -d ${DEFAULT_HOME} -s /bin/bash ${DEFAULT_USER} && \ diff --git a/scripts/custom/common.sh b/scripts/custom/common.sh new file mode 120000 index 0000000..f918132 --- /dev/null +++ b/scripts/custom/common.sh @@ -0,0 +1 @@ +../common.sh \ No newline at end of file diff --git a/scripts/custom/install_boost.sh b/scripts/custom/install_boost.sh index 7c373b6..5d5a62b 100755 --- a/scripts/custom/install_boost.sh +++ b/scripts/custom/install_boost.sh @@ -16,7 +16,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments version= diff --git a/scripts/custom/install_cmake.sh b/scripts/custom/install_cmake.sh index 1cddacd..de74474 100755 --- a/scripts/custom/install_cmake.sh +++ b/scripts/custom/install_cmake.sh @@ -16,7 +16,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments version= diff --git a/scripts/custom/install_hdf5.sh b/scripts/custom/install_hdf5.sh index 36c57a6..1f378c9 100755 --- a/scripts/custom/install_hdf5.sh +++ b/scripts/custom/install_hdf5.sh @@ -16,7 +16,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments version= diff --git a/scripts/custom/install_petsc.sh b/scripts/custom/install_petsc.sh index a9535fb..d491d92 100755 --- a/scripts/custom/install_petsc.sh +++ b/scripts/custom/install_petsc.sh @@ -18,7 +18,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments version= diff --git a/scripts/custom/install_petsc_hdf5.sh b/scripts/custom/install_petsc_hdf5.sh index 4580d80..de88580 100755 --- a/scripts/custom/install_petsc_hdf5.sh +++ b/scripts/custom/install_petsc_hdf5.sh @@ -11,7 +11,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments petsc_version= diff --git a/scripts/custom/install_python.sh b/scripts/custom/install_python.sh index c0a6f0c..a0e108e 100755 --- a/scripts/custom/install_python.sh +++ b/scripts/custom/install_python.sh @@ -7,7 +7,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments version= diff --git a/scripts/custom/install_sundials.sh b/scripts/custom/install_sundials.sh index 763502d..8d421fd 100755 --- a/scripts/custom/install_sundials.sh +++ b/scripts/custom/install_sundials.sh @@ -16,7 +16,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments version= diff --git a/scripts/custom/install_vtk.sh b/scripts/custom/install_vtk.sh index 9adf4c9..d7894b9 100755 --- a/scripts/custom/install_vtk.sh +++ b/scripts/custom/install_vtk.sh @@ -16,7 +16,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments version= diff --git a/scripts/custom/install_xercesc.sh b/scripts/custom/install_xercesc.sh index 3a5819b..fa2fad9 100755 --- a/scripts/custom/install_xercesc.sh +++ b/scripts/custom/install_xercesc.sh @@ -16,7 +16,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments version= diff --git a/scripts/custom/install_xsd.sh b/scripts/custom/install_xsd.sh index efcc31a..8ff9c0b 100755 --- a/scripts/custom/install_xsd.sh +++ b/scripts/custom/install_xsd.sh @@ -15,7 +15,7 @@ usage() } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments version= diff --git a/scripts/system/common.sh b/scripts/system/common.sh new file mode 120000 index 0000000..f918132 --- /dev/null +++ b/scripts/system/common.sh @@ -0,0 +1 @@ +../common.sh \ No newline at end of file From 5fc3aaf7ae8c0eb09f6bddf3ab11011b54044f1b Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Fri, 13 Jun 2025 19:05:36 +0000 Subject: [PATCH 11/12] #84 Help hdf5 find mpi --- scripts/custom/install_hdf5.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/custom/install_hdf5.sh b/scripts/custom/install_hdf5.sh index 1f378c9..6def052 100755 --- a/scripts/custom/install_hdf5.sh +++ b/scripts/custom/install_hdf5.sh @@ -102,7 +102,7 @@ cd ${src_dir} mkdir -p build cd build -cmake \ +CC=mpicc cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=${install_dir} \ -DHDF5_BUILD_TOOLS=OFF \ @@ -114,8 +114,8 @@ make -j ${parallel} && \ make install # Add modulefile -mkdir -p ${base_dir}/modulefiles/hdf5/${version} -cd ${base_dir}/modulefiles/hdf5/${version} +mkdir -p ${base_dir}/modulefiles/hdf5 +cd ${base_dir}/modulefiles/hdf5 cat < ${version} #%Module1.0##################################################################### ### From 9b826097a863f4448464910364cf309ad4a698dd Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 16 Jun 2025 09:25:20 +0000 Subject: [PATCH 12/12] #84 Help PETSc download blas --- scripts/custom/install_petsc.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/custom/install_petsc.sh b/scripts/custom/install_petsc.sh index d491d92..9c88c79 100755 --- a/scripts/custom/install_petsc.sh +++ b/scripts/custom/install_petsc.sh @@ -68,10 +68,16 @@ if version_lt "${version}" '3.12'; then # PETSc < 3.12.x exit 1 fi -# Download and extract source +# Get tarballs to prevent download errors mkdir -p ${base_dir}/src/petsc cd ${base_dir}/src/petsc +download_f2cblaslapack=1 +if (version_eq "${major}.${minor}" '3.17'); then # PETSc == 3.17.x + wget -nc https://www.mcs.anl.gov/petsc/mirror/externalpackages/f2cblaslapack-3.4.2.q4.tar.gz + download_f2cblaslapack=$(pwd)/f2cblaslapack-3.4.2.q4.tar.gz +fi + # Download and extract PETSc URL_PETSC=https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${version}.tar.gz wget -nc ${URL_PETSC} @@ -99,7 +105,7 @@ case ${arch} in python3 ./configure \ --COPTFLAGS=-Og \ --CXXOPTFLAGS=-Og \ - --download-f2cblaslapack=1 \ + --download-f2cblaslapack=${download_f2cblaslapack} \ --download-hypre=1 \ --download-metis=1 \ --download-parmetis=1 \ @@ -116,7 +122,7 @@ case ${arch} in linux-gnu-opt) export PETSC_ARCH=linux-gnu-opt python3 ./configure \ - --download-f2cblaslapack=1 \ + --download-f2cblaslapack=${download_f2cblaslapack} \ --download-hypre=1 \ --download-metis=1 \ --download-parmetis=1 \