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..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} && \ @@ -84,11 +84,37 @@ RUN source /etc/profile.d/modules.sh && \ module load boost && \ module load xercesc && \ module load xsd && \ + install_hdf5.sh \ + --version=${HDF5} \ + --parallel=$(nproc) \ + --modules-dir=${MODULES_DIR} && \ + module test hdf5 && \ + 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 && \ + 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/* + +# 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} \ - --parallel=$(nproc) \ --modules-dir=${MODULES_DIR} && \ module test petsc_hdf5 && \ rm -rf ${MODULES_DIR}/src/* && \ @@ -99,7 +125,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 && \ install_sundials.sh \ --version=${SUNDIALS} \ --parallel=$(nproc) \ @@ -113,7 +140,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..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} && \ @@ -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..747eb13 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) @@ -75,27 +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 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} --parallel=4 ``` -Install PETSc + HDF5 +Install PETSc +```sh +./install_petsc.sh --version=3.19.6 --arch=linux-gnu-opt --modules-dir=${MODULES_DIR} --parallel=4 +``` + +Install VTK ```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_vtk.sh --version=9.3.1 --modules-dir=${MODULES_DIR} --parallel=4 ``` > [!TIP] @@ -110,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 @@ -120,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/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/example.sh b/scripts/custom/example.sh index 55aa1a9..fc22a38 100755 --- a/scripts/custom/example.sh +++ b/scripts/custom/example.sh @@ -18,41 +18,35 @@ 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_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=4 +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=4 +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=4 +module test vtk/9.3.1 # Cleanup cd - diff --git a/scripts/custom/install_boost.sh b/scripts/custom/install_boost.sh index 19a1bc2..5d5a62b 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]' @@ -7,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 26e955f..de74474 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]' @@ -7,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 new file mode 100755 index 0000000..6def052 --- /dev/null +++ b/scripts/custom/install_hdf5.sh @@ -0,0 +1,161 @@ +#!/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]' + 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 + +src_dir=$(pwd)/hdf5-${version} +mkdir -p ${src_dir} + +wget -nc ${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 ${src_dir} +mkdir -p build +cd build + +CC=mpicc cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${install_dir} \ + -DHDF5_BUILD_TOOLS=OFF \ + -DHDF5_ENABLE_PARALLEL=ON \ + -DHDF5_ENABLE_Z_LIB_SUPPORT=ON \ + -DHDF5_ENABLE_SZIP_SUPPORT=ON \ + -DHDF5_ENABLE_UNSUPPORTED=OFF .. && \ +make -j ${parallel} && \ +make install + +# Add modulefile +mkdir -p ${base_dir}/modulefiles/hdf5 +cd ${base_dir}/modulefiles/hdf5 +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..9c88c79 --- /dev/null +++ b/scripts/custom/install_petsc.sh @@ -0,0 +1,190 @@ +#!/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}]' + 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 + +# 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} + +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=${download_f2cblaslapack} \ + --download-hypre=1 \ + --download-metis=1 \ + --download-parmetis=1 \ + --with-cc=mpicc \ + --with-cxx=mpicxx \ + --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=${download_f2cblaslapack} \ + --download-hypre=1 \ + --download-metis=1 \ + --download-parmetis=1 \ + --with-cc=mpicc \ + --with-cxx=mpicxx \ + --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]/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 index 768c607..de88580 100755 --- a/scripts/custom/install_petsc_hdf5.sh +++ b/scripts/custom/install_petsc_hdf5.sh @@ -1,21 +1,23 @@ #!/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 [--parallel=value]' + echo ' --hdf5-version=version --modules-dir=path' exit 1 } script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/../common.sh +. ${script_dir}/common.sh # Parse arguments petsc_version= petsc_arch= hdf5_version= base_dir= -parallel= for option; do case $option in @@ -31,9 +33,6 @@ for option; do --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 @@ -53,124 +52,9 @@ if [[ ! (${petsc_arch} = 'linux-gnu' || ${petsc_arch} = 'linux-gnu-opt') ]]; the 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 +read -r petsc_version _ < <(split_version ${petsc_version}) -# 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 +read -r hdf5_version _ < <(split_version ${hdf5_version}) # Add modulefile mkdir -p ${base_dir}/modulefiles/petsc_hdf5/${petsc_version}_${hdf5_version} @@ -181,14 +65,8 @@ cat < ${petsc_arch} ## 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" + set paths "[getenv HDF5_ROOT] + [getenv PETSC_DIR]/[getenv PETSC_ARCH]" foreach path \$paths { if { ![file exists \$path] } { @@ -205,25 +83,8 @@ proc ModulesHelp { } { 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} +module load hdf5/${hdf5_version} +module load petsc/${petsc_version}/${petsc_arch} -conflict petsc -conflict hdf5 conflict petsc_hdf5 EOF 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 0e0b21d..8d421fd 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]' @@ -7,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 cc19ba0..d7894b9 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]' @@ -7,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 341e2ba..fa2fad9 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]' @@ -7,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 7285310..8ff9c0b 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' @@ -7,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/custom/setup_custom.sh b/scripts/custom/setup_custom.sh index b793417..c8206c1 100755 --- a/scripts/custom/setup_custom.sh +++ b/scripts/custom/setup_custom.sh @@ -1,10 +1,11 @@ #!/bin/sh + # Setup required libraries for building Chaste dependencies on Ubuntu 22.04 Jammy export DEBIAN_FRONTEND=noninteractive # Base dependencies -apt-get update && \ +apt-get update apt-get install -y --no-install-recommends \ apt-transport-https \ apt-utils \ @@ -34,7 +35,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 \ @@ -116,9 +119,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. 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 diff --git a/scripts/system/install_modulefiles.sh b/scripts/system/install_modulefiles.sh index b9a81fa..c44d0b5 100755 --- a/scripts/system/install_modulefiles.sh +++ b/scripts/system/install_modulefiles.sh @@ -59,12 +59,77 @@ module-whatis "This adds the environment variables for boost ${version}" conflict boost EOF +# 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/hdf5/${hdf5_version} +cd ${base_dir}/modulefiles/hdf5/${hdf5_version} + +cat < linux-gnu +#%Module1.0##################################################################### +### +## hdf5 ${hdf5_version} modulefile +## +proc ModulesTest { } { + set paths "/usr/bin/h5pcc + /usr/include/hdf5 + /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}" -# PETSc and HDF5 modulefile stub +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) -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/${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" + + 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} with PETSC_ARCH=${petsc_arch}\n" +} + +module-whatis "This adds the environment variables for petsc ${petsc_version} with PETSC_ARCH=${petsc_arch}" + +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} @@ -74,12 +139,8 @@ cat < linux-gnu ## petsc_hdf5 ${petsc_version}_${hdf5_version}/${petsc_arch} 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/libpetsc.so - /usr/lib/libparmetis.so" + set paths "/usr/include/hdf5 + /usr/include/petsc" foreach path \$paths { if { ![file exists \$path] } { @@ -96,12 +157,9 @@ proc ModulesHelp { } { module-whatis "This adds the environment variables for petsc ${petsc_version} and hdf5 ${hdf5_version}, with PETSC_ARCH=${petsc_arch}" -conflict petsc -conflict hdf5 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) 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