diff --git a/.github/workflows/docker_build_tpls.yml b/.github/workflows/docker_build_tpls.yml index c69ecb5c..57864717 100644 --- a/.github/workflows/docker_build_tpls.yml +++ b/.github/workflows/docker_build_tpls.yml @@ -79,6 +79,13 @@ jobs: # SPEC: "~pygeosx~openmp cuda_arch=86 %gcc@10.1.0 ^cuda@12.4.0+allow-unsupported-compilers" # INSTALL_DIR_ROOT: /oak/stanford/groups/tchelepi/geos-sherlock/GPU # RUNS_ON: ubuntu-latest + - name: Ubuntu (24.04, amdclang 19 + ROCm 6.4.3) + DOCKER_REPOSITORY: geosx/ubuntu24.04-amdclang19.0.0-rocm6.4.3 + TPL_DOCKERFILE: docker/tpl-ubuntu-hip.Dockerfile + DOCKER_ROOT_IMAGE: rocm/dev-ubuntu-24.04:6.4.3 + RUNS_ON: streak2 + NPROC: 8 + DOCKER_RUN_ARGS: "--cpus=8 --memory=128g -v /etc/pki/tls/certs/ca-bundle.crt:/etc/pki/tls/certs/ca-bundle.crt:ro -v /etc/pki/tls/certs/ca-bundle.crt:/certs/ca-bundle.crt:ro" steps: - name: Checkout @@ -88,7 +95,7 @@ jobs: lfs: true - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - name: Print environment run: printenv @@ -99,8 +106,15 @@ jobs: # 1. Copy the host's CA bundle into the Docker build context cp /etc/pki/tls/certs/ca-bundle.crt ./ca-bundle.crt - # 2. Inject the COPY and update-ca-trust commands right before dnf runs - sed -i '/RUN dnf clean all/i COPY ca-bundle.crt /etc/pki/ca-trust/source/anchors/ca-bundle.crt\nRUN update-ca-trust extract' ${{ matrix.TPL_DOCKERFILE }} + # 2. Inject distro-specific trust-store setup into the Dockerfile. + if grep -q 'RUN dnf clean all' "${{ matrix.TPL_DOCKERFILE }}"; then + sed -i '/RUN dnf clean all/i COPY ca-bundle.crt /etc/pki/ca-trust/source/anchors/ca-bundle.crt\nRUN update-ca-trust extract' "${{ matrix.TPL_DOCKERFILE }}" + elif grep -q 'apt-get update' "${{ matrix.TPL_DOCKERFILE }}"; then + perl -0pi -e 's/(RUN .*?apt-get update)/COPY ca-bundle.crt \/usr\/local\/share\/ca-certificates\/host-ca.crt\nRUN update-ca-certificates\n\n$1/s' "${{ matrix.TPL_DOCKERFILE }}" + else + echo "Could not find a CA-injection hook in ${{ matrix.TPL_DOCKERFILE }}" + exit 1 + fi - name: Run the docker build docker script env: diff --git a/docker/spack-rocm.yaml b/docker/spack-rocm.yaml new file mode 100644 index 00000000..1abd4e46 --- /dev/null +++ b/docker/spack-rocm.yaml @@ -0,0 +1,481 @@ +spack: + config: + install_tree: + root: $spack/.. + projections: + all: '{compiler.name}-{compiler.version}/{name}-{version}-{hash}' + misc_cache: $spack/../misc_cache + test_stage: $spack/../test_stage + build_stage: $spack/../build_stage + + # Regular TPLs do not need views + view: false + + # Include shared variants and versions + include: + - ../defaults.yaml + - ../versions.yaml + + toolchains: + clang-15: + - spec: '%c=llvm@15.0.7+clang~flang~lld~lldb' + when: '%c' + - spec: '%cxx=llvm@15.0.7+clang~flang~lld~lldb' + when: '%cxx' + - spec: '%fortran=gcc@11.4.0' + when: '%fortran' + - spec: '%openmpi@4.1.2 %llvm@15.0.7' + when: '%mpi' + clang-10: + - spec: '%c=llvm@10.0.0+clang~flang~lld~lldb openmp=project' + when: '%c' + - spec: '%cxx=llvm@10.0.0+clang~flang~lld~lldb openmp=project' + when: '%cxx' + - spec: '%fortran=gcc@9.4.0' + when: '%fortran' + - spec: '%openmpi@4.1.2 %llvm@10.0.0' + when: '%mpi' + gcc-9: + - spec: cxxflags='-pthread' + - spec: cflags='-pthread' + - spec: '%c=gcc@9.4.0' + when: '%c' + - spec: '%cxx=gcc@9.4.0' + when: '%cxx' + - spec: '%fortran=gcc@9.4.0' + when: '%fortran' + - spec: '%openmpi %gcc@9.4.0' + when: '%mpi' + gcc-10: + - spec: cxxflags='-pthread' + - spec: cflags='-pthread' + - spec: '%c=gcc@10.5.0' + when: '%c' + - spec: '%cxx=gcc@10.5.0' + when: '%cxx' + - spec: '%fortran=gcc@10.5.0' + when: '%fortran' + - spec: '%openmpi %gcc@10.5.0' + when: '%mpi' + gcc-11: + - spec: cxxflags='-pthread' + - spec: cflags='-pthread' + - spec: '%c=gcc@11.4.0' + when: '%c' + - spec: '%cxx=gcc@11.4.0' + when: '%cxx' + - spec: '%fortran=gcc@11.4.0' + when: '%fortran' + - spec: '%openmpi %gcc@11.4.0' + when: '%mpi' + gcc-12: + - spec: cxxflags='-pthread' + - spec: cflags='-pthread' + - spec: '%c=gcc@12.3.0' + when: '%c' + - spec: '%cxx=gcc@12.3.0' + when: '%cxx' + - spec: '%fortran=gcc@12.3.0' + when: '%fortran' + - spec: '%openmpi %gcc@12.3.0' + when: '%mpi' + gcc-13: + - spec: cxxflags='-pthread' + - spec: cflags='-pthread' + - spec: '%c=gcc@13.3.0' + when: '%c' + - spec: '%cxx=gcc@13.3.0' + when: '%cxx' + - spec: '%fortran=gcc@13.3.0' + when: '%fortran' + - spec: '%openmpi@4.1.2 %gcc@13.3.0' + when: '%mpi' + amdclang-19: + - spec: '%c=llvm-amdgpu@6.4.3' + when: '%c' + - spec: '%cxx=llvm-amdgpu@6.4.3' + when: '%cxx' + - spec: '%fortran=gcc@13.3.0' + when: '%fortran' + - spec: '%openmpi@4.1.2 %llvm-amdgpu@6.4.3' + when: '%mpi' + + packages: + all: + target: [x86_64] + providers: + mpi: [openmpi] + blas: [netlib-lapack] + lapack: [netlib-lapack] + c: [llvm, gcc] + cxx: [llvm, gcc] + fortran: [gcc] + + mpi: + require: + - openmpi@4.1.2 + + llvm: + externals: + - spec: llvm@10.0.0+clang~flang~lld~lldb openmp=project + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang + cxx: /usr/bin/clang++ + - spec: llvm@15.0.7+clang~flang~lld~lldb + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang-15 + cxx: /usr/bin/clang++-15 + llvm-amdgpu: + buildable: false + externals: + - spec: llvm-amdgpu@6.4.3 + prefix: /opt/rocm-6.4.3/lib/llvm + extra_attributes: + compilers: + c: /usr/local/bin/amdclang-gcc13 + cxx: /usr/local/bin/amdclang++-gcc13 + environment: + set: + BISON: bison + FLEX: flex + CC: /usr/local/bin/amdclang-gcc13 + CXX: /usr/local/bin/amdclang++-gcc13 + FC: /usr/bin/gfortran-13 + F77: /usr/bin/gfortran-13 + MPICC: /usr/bin/mpicc + MPICXX: /usr/bin/mpicxx + MPIEXEC: /usr/bin/mpirun + OMPI_CC: /usr/local/bin/amdclang-gcc13 + OMPI_CXX: /usr/local/bin/amdclang++-gcc13 + HIPCXX: /usr/local/bin/amdclang++-gcc13 + CMAKE_HIP_COMPILER: /usr/local/bin/amdclang++-gcc13 + gcc: + externals: + - spec: gcc@9.4.0 languages:='c,c++,fortran' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/gcc-9 + cxx: /usr/bin/g++-9 + fortran: /usr/bin/gfortran-9 + - spec: gcc@10.5.0 languages:='c,c++,fortran' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/gcc-10 + cxx: /usr/bin/g++-10 + fortran: /usr/bin/gfortran-10 + - spec: gcc@11.4.0 languages:='c,c++,fortran' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/gcc-11 + cxx: /usr/bin/g++-11 + fortran: /usr/bin/gfortran-11 + - spec: gcc@12.3.0 languages:='c,c++,fortran' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/gcc-12 + cxx: /usr/bin/g++-12 + fortran: /usr/bin/gfortran-12 + - spec: gcc@13.3.0 languages:='c,c++,fortran' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/gcc-13 + cxx: /usr/bin/g++-13 + fortran: /usr/bin/gfortran-13 + cuda: + buildable: False + externals: + - spec: cuda@11.8.0 +allow-unsupported-compilers + prefix: /usr/local/cuda + hip: + buildable: false + externals: + - spec: hip@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + rocprim: + buildable: false + externals: + - spec: rocprim@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + rocsparse: + buildable: false + externals: + - spec: rocsparse@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + roctracer: + buildable: false + externals: + - spec: roctracer@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + rocblas: + buildable: false + externals: + - spec: rocblas@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + rocrand: + buildable: false + externals: + - spec: rocrand@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + rocsolver: + buildable: false + externals: + - spec: rocsolver@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + rocthrust: + buildable: false + externals: + - spec: rocthrust@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + hipblas: + buildable: false + externals: + - spec: hipblas@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + hipsparse: + buildable: false + externals: + - spec: hipsparse@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + hipfft: + buildable: false + externals: + - spec: hipfft@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + hipsolver: + buildable: false + externals: + - spec: hipsolver@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + hiprand: + buildable: false + externals: + - spec: hiprand@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + rocm-device-libs: + buildable: false + externals: + - spec: rocm-device-libs@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + hsa-rocr-dev: + buildable: false + externals: + - spec: hsa-rocr-dev@6.4.3 + prefix: /opt/rocm-6.4.3 + require: + - when: "%llvm-amdgpu@6.4.3" + spec: "@6.4.3" + + autoconf: + version: [2.71] + buildable: false + externals: + - spec: autoconf@2.71 + prefix: /usr + automake: + version: [1.16.5] + buildable: false + externals: + - spec: automake@1.16.5 + prefix: /usr + cmake: + version: [3.28.3] + buildable: false + externals: + - spec: cmake@3.28.3 + prefix: /usr/local + findutils: + version: [4.7.0] + buildable: false + externals: + - spec: findutils@4.7.0 + prefix: /usr + m4: + buildable: false + externals: + - spec: m4@1.4.18 + prefix: /usr + mpfr: + buildable: false + externals: + - spec: mpfr@6.0.2 + prefix: /usr + netlib-lapack: + buildable: false + externals: + - spec: netlib-lapack@3.10.0 + prefix: /usr + netlib-blas: + buildable: false + externals: + - spec: netlib-blas@3.10.0 + prefix: /usr + openmpi: + buildable: false + externals: + - spec: openmpi@4.1.2 %llvm@10.0.0 + prefix: /usr/lib/x86_64-linux-gnu/openmpi + modules: [mpi] + - spec: openmpi@4.1.2 %llvm@15.0.7 + prefix: /usr/lib/x86_64-linux-gnu/openmpi + modules: [mpi] + - spec: openmpi@4.1.2 %llvm-amdgpu@6.4.3 + prefix: /usr/lib/x86_64-linux-gnu/openmpi + - spec: openmpi@4.1.2 %gcc@9.4.0 + prefix: /usr/lib/x86_64-linux-gnu/openmpi + - spec: openmpi@4.1.2 %gcc@10.5.0 + prefix: /usr/lib/x86_64-linux-gnu/openmpi + - spec: openmpi@4.1.2 %gcc@11.4.0 + prefix: /usr/lib/x86_64-linux-gnu/openmpi + - spec: openmpi@4.1.2 %gcc@12.3.0 + prefix: /usr/lib/x86_64-linux-gnu/openmpi + - spec: openmpi@4.1.2 %gcc@13.3.0 + prefix: /usr/lib/x86_64-linux-gnu/openmpi + perl: + buildable: false + externals: + - spec: perl@5.34.0 + prefix: /usr + pkg-config: + buildable: false + externals: + - spec: pkg-config@0.29.2 + prefix: /usr + py-sphinx: + buildable: false + externals: + - spec: py-sphinx@4.3.2 + prefix: /usr + python: + buildable: false + externals: + - spec: python@3.10.12 + prefix: /usr + readline: + buildable: false + externals: + - spec: readline@8.0 + prefix: /usr + tar: + buildable: false + externals: + - spec: tar@1.34 + prefix: /usr + unzip: + buildable: false + externals: + - spec: unzip@6.0 + prefix: /usr + xz: + buildable: false + externals: + - spec: xz@5.2.5 + prefix: /usr + zlib: + buildable: false + externals: + - spec: zlib@1.2.11 + prefix: /usr + z3: + buildable: false + externals: + - spec: z3@4.8.12 + prefix: /usr + gettext: + buildable: false + externals: + - spec: gettext@0.21 + prefix: /usr + bison: + buildable: false + externals: + - spec: bison@3.8.2 + prefix: /usr + # Rely on spack to build a newer flex for scotch + # flex: + # buildable: false + # externals: + # - spec: flex@2.6.4 + # prefix: /usr + bzip2: + buildable: false + externals: + - spec: bzip2@1.0.8 + prefix: /usr + help2man: + buildable: false + externals: + - spec: help2man@1.49.3 + prefix: /usr + libtool: + buildable: false + externals: + - spec: libtool@2.4.7 + prefix: /usr + gmp: + buildable: false + externals: + - spec: gmp@6.3.0 + prefix: /usr + pugixml: + buildable: true + gmake: + buildable: false + externals: + - spec: gmake@4.4.1 + prefix: /usr + ninja: + buildable: false + externals: + - spec: ninja@1.11.1 + prefix: /usr diff --git a/docker/spack.yaml b/docker/spack.yaml index d59364f2..77a134a6 100644 --- a/docker/spack.yaml +++ b/docker/spack.yaml @@ -6,8 +6,7 @@ spack: all: '{compiler.name}-{compiler.version}/{name}-{version}-{hash}' misc_cache: $spack/../misc_cache test_stage: $spack/../test_stage - build_stage:: - - $spack/../build_stage + build_stage: $spack/../build_stage # Regular TPLs do not need views view: false @@ -19,22 +18,22 @@ spack: toolchains: clang-15: - - spec: '%[virtuals=c]llvm@15.0.7+clang~flang~lld~lldb' + - spec: '%c=llvm@15.0.7+clang~flang~lld~lldb' when: '%c' - - spec: '%[virtuals=cxx]llvm@15.0.7+clang~flang~lld~lldb' + - spec: '%cxx=llvm@15.0.7+clang~flang~lld~lldb' when: '%cxx' - - spec: '%[virtuals=fortran]gcc@11.4.0' + - spec: '%fortran=gcc@11.4.0' when: '%fortran' - - spec: '%openmpi' + - spec: '%openmpi@4.1.2 %llvm@15.0.7' when: '%mpi' clang-10: - - spec: '%[virtuals=c]llvm@10.0.0+clang~flang~lld~lldb openmp=project' + - spec: '%c=llvm@10.0.0+clang~flang~lld~lldb openmp=project' when: '%c' - - spec: '%[virtuals=cxx]llvm@10.0.0+clang~flang~lld~lldb openmp=project' + - spec: '%cxx=llvm@10.0.0+clang~flang~lld~lldb openmp=project' when: '%cxx' - - spec: '%[virtuals=fortran]gcc@9.4.0' + - spec: '%fortran=gcc@9.4.0' when: '%fortran' - - spec: '%openmpi' + - spec: '%openmpi@4.1.2 %llvm@10.0.0' when: '%mpi' gcc-9: - spec: cxxflags='-pthread' @@ -80,22 +79,35 @@ spack: when: '%fortran' - spec: '%openmpi %gcc@12.3.0' when: '%mpi' + gcc-13: + - spec: cxxflags='-pthread' + - spec: cflags='-pthread' + - spec: '%c=gcc@13.3.0' + when: '%c' + - spec: '%cxx=gcc@13.3.0' + when: '%cxx' + - spec: '%fortran=gcc@13.3.0' + when: '%fortran' + - spec: '%openmpi@4.1.2 %gcc@13.3.0' + when: '%mpi' packages: all: target: [x86_64] + providers: + mpi: [openmpi] + blas: [netlib-lapack] + lapack: [netlib-lapack] + c: [llvm, gcc] + cxx: [llvm, gcc] + fortran: [gcc] + # Require mpi: require: - openmpi@4.1.2 - blas: - require: - - "netlib-lapack" - lapack: - require: - - "netlib-lapack" - + # Compiler packages llvm: externals: - spec: llvm@10.0.0+clang~flang~lld~lldb openmp=project @@ -110,7 +122,6 @@ spack: compilers: c: /usr/bin/clang-15 cxx: /usr/bin/clang++-15 - gcc: externals: - spec: gcc@9.4.0 languages:='c,c++,fortran' @@ -141,7 +152,21 @@ spack: c: /usr/bin/gcc-12 cxx: /usr/bin/g++-12 fortran: /usr/bin/gfortran-12 + - spec: gcc@13.3.0 languages:='c,c++,fortran' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/gcc-13 + cxx: /usr/bin/g++-13 + fortran: /usr/bin/gfortran-13 + # CUDA packages + cuda: + buildable: False + externals: + - spec: cuda@11.8.0 +allow-unsupported-compilers + prefix: /usr/local/cuda + # System packages autoconf: version: [2.71] buildable: false @@ -160,11 +185,6 @@ spack: externals: - spec: cmake@3.28.3 prefix: /usr/local - cuda: - buildable: False - externals: - - spec: cuda@11.8.0 +allow-unsupported-compilers - prefix: /usr/local/cuda findutils: version: [4.7.0] buildable: false @@ -181,7 +201,6 @@ spack: externals: - spec: mpfr@6.0.2 prefix: /usr - netlib-lapack: buildable: false externals: @@ -195,22 +214,22 @@ spack: openmpi: buildable: false externals: - # Ubuntu 22.04 (apt) provides OpenMPI 4.1.2. We treat it as external for all toolchains - # to prevent Spack from building OpenMPI (which may otherwise drift to v5). - - spec: openmpi@4.1.2 %clang@15.0.7 - prefix: /usr + - spec: openmpi@4.1.2 %llvm@10.0.0 + prefix: /usr/lib/x86_64-linux-gnu/openmpi modules: [mpi] - - spec: openmpi@4.1.2 %clang@10.0.0 - prefix: /usr + - spec: openmpi@4.1.2 %llvm@15.0.7 + prefix: /usr/lib/x86_64-linux-gnu/openmpi modules: [mpi] - spec: openmpi@4.1.2 %gcc@9.4.0 - prefix: /usr + prefix: /usr/lib/x86_64-linux-gnu/openmpi - spec: openmpi@4.1.2 %gcc@10.5.0 - prefix: /usr + prefix: /usr/lib/x86_64-linux-gnu/openmpi - spec: openmpi@4.1.2 %gcc@11.4.0 - prefix: /usr + prefix: /usr/lib/x86_64-linux-gnu/openmpi - spec: openmpi@4.1.2 %gcc@12.3.0 - prefix: /usr + prefix: /usr/lib/x86_64-linux-gnu/openmpi + - spec: openmpi@4.1.2 %gcc@13.3.0 + prefix: /usr/lib/x86_64-linux-gnu/openmpi perl: buildable: false externals: @@ -256,3 +275,56 @@ spack: externals: - spec: zlib@1.2.11 prefix: /usr + z3: + buildable: false + externals: + - spec: z3@4.8.12 + prefix: /usr + gettext: + buildable: false + externals: + - spec: gettext@0.21 + prefix: /usr + bison: + buildable: false + externals: + - spec: bison@3.8.2 + prefix: /usr + # Rely on spack to build a newer flex for scotch + # flex: + # buildable: false + # externals: + # - spec: flex@2.6.4 + # prefix: /usr + bzip2: + buildable: false + externals: + - spec: bzip2@1.0.8 + prefix: /usr + help2man: + buildable: false + externals: + - spec: help2man@1.49.3 + prefix: /usr + libtool: + buildable: false + externals: + - spec: libtool@2.4.7 + prefix: /usr + gmp: + buildable: false + externals: + - spec: gmp@6.3.0 + prefix: /usr + pugixml: + buildable: true + gmake: + buildable: false + externals: + - spec: gmake@4.4.1 + prefix: /usr + ninja: + buildable: false + externals: + - spec: ninja@1.11.1 + prefix: /usr diff --git a/docker/tpl-centos-gcc-cuda.Dockerfile b/docker/tpl-centos-gcc-cuda.Dockerfile index dbea5b7b..fe16f984 100644 --- a/docker/tpl-centos-gcc-cuda.Dockerfile +++ b/docker/tpl-centos-gcc-cuda.Dockerfile @@ -1,5 +1,5 @@ # NOTE: see docker/tpl-ubuntu-gcc.Dockerfile for detailed comments -ARG TMP_DIR=/tmp +ARG TMP_DIR=/tmp ARG SRC_DIR=$TMP_DIR/thirdPartyLibs ARG BLD_DIR=$TMP_DIR/build @@ -11,12 +11,12 @@ ENV GEOSX_TPL_DIR=$INSTALL_DIR RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo && \ sed -i s/^#.*baseurl=http/baseurl=https/g /etc/yum.repos.d/*.repo && \ - sed -i s/^mirrorlist=http/#mirrorlist=https/g /etc/yum.repos.d/*.repo + sed -i s/^mirrorlist=http/#mirrorlist=https/g /etc/yum.repos.d/*.repo # Using gcc 8.3.1 provided by the Software Collections (SCL). RUN yum install -y \ centos-release-scl - + # Modify the SCLo repository configuration RUN sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-SCLo-scl.repo && \ sed -i 's|^baseurl=http://mirror.centos.org/centos/\$releasever/sclo/\$basearch/rh|baseurl=http://vault.centos.org/7.9.2009/sclo/x86_64/rh|g' /etc/yum.repos.d/CentOS-SCLo-scl.repo && \ @@ -25,7 +25,7 @@ RUN sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-SCLo-scl.repo # Install necessary tools and update the system RUN yum -y update && \ - yum -y install yum-utils + yum -y install yum-utils RUN yum install -y \ devtoolset-8-gcc \ @@ -48,6 +48,10 @@ RUN yum -y install \ # xz \ unzip \ bzip2 \ + flex \ + bison \ + gettext \ + help2man \ gnupg \ && pip3 install virtualenv @@ -65,6 +69,8 @@ ARG BLD_DIR RUN yum install -y \ tbb-devel \ make \ + autopoint \ + autotools-dev \ bc \ file \ patch \ diff --git a/docker/tpl-rockylinux-clang-cuda-12.Dockerfile b/docker/tpl-rockylinux-clang-cuda-12.Dockerfile index 85b0007f..bec7c84c 100644 --- a/docker/tpl-rockylinux-clang-cuda-12.Dockerfile +++ b/docker/tpl-rockylinux-clang-cuda-12.Dockerfile @@ -28,7 +28,11 @@ RUN dnf clean all && \ unzip \ mpfr-devel \ bzip2 \ + flex \ + bison \ + gettext \ gnupg \ + libtool \ xz \ python3-virtualenv diff --git a/docker/tpl-rockylinux-gcc-cuda-12.Dockerfile b/docker/tpl-rockylinux-gcc-cuda-12.Dockerfile index de0b95a9..13227a47 100644 --- a/docker/tpl-rockylinux-gcc-cuda-12.Dockerfile +++ b/docker/tpl-rockylinux-gcc-cuda-12.Dockerfile @@ -26,7 +26,11 @@ RUN dnf clean all && \ unzip \ mpfr-devel \ bzip2 \ + flex \ + bison \ + gettext \ gnupg \ + libtool \ xz \ python3-virtualenv diff --git a/docker/tpl-ubuntu-clang-cuda.Dockerfile b/docker/tpl-ubuntu-clang-cuda.Dockerfile index 1663462b..812f1557 100644 --- a/docker/tpl-ubuntu-clang-cuda.Dockerfile +++ b/docker/tpl-ubuntu-clang-cuda.Dockerfile @@ -34,6 +34,11 @@ RUN ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && \ libmpfr-dev \ lbzip2 \ bzip2 \ + flex \ + bison \ + gettext \ + help2man \ + libtool \ gnupg \ virtualenv @@ -52,10 +57,25 @@ RUN apt-get install -y --no-install-recommends \ libtbb-dev \ bc \ file \ + autopoint \ + autotools-dev \ + automake \ patch \ ca-certificates \ git +# OpenMPI hack for Ubuntu +RUN ln -s /usr/bin /usr/lib/x86_64-linux-gnu/openmpi + +# MPI environment variables +ENV CC=/usr/bin/clang \ + CXX=/usr/bin/clang++ \ + MPICC=/usr/bin/mpicc \ + MPICXX=/usr/bin/mpicxx \ + MPIEXEC=/usr/bin/mpirun \ + OMPI_CC=/usr/bin/clang \ + OMPI_CXX=/usr/bin/clang++ + # Run uberenv # Have to create install directory first for uberenv # -k flag is to ignore SSL errors diff --git a/docker/tpl-ubuntu-clang.Dockerfile b/docker/tpl-ubuntu-clang.Dockerfile index 4e0058ad..574353ea 100644 --- a/docker/tpl-ubuntu-clang.Dockerfile +++ b/docker/tpl-ubuntu-clang.Dockerfile @@ -39,6 +39,14 @@ RUN DEBIAN_FRONTEND=noninteractive TZ=America/Los_Angeles \ libmpfr-dev \ lbzip2 \ bzip2 \ + flex \ + bison \ + gettext \ + help2man \ + libtool \ + autopoint \ + autotools-dev \ + automake \ gnupg \ virtualenv @@ -69,16 +77,17 @@ RUN apt-get install -y --no-install-recommends \ ca-certificates \ git -# Add MPI environment path info -ENV CC=/usr/bin/gcc-$GCC_MAJOR_VERSION \ - CXX=/usr/bin/g++-$GCC_MAJOR_VERSION \ +# OpenMPI hack for Ubuntu +RUN ln -s /usr/bin /usr/lib/x86_64-linux-gnu/openmpi + +# MPI environment variables +ENV CC=/usr/bin/clang-$CLANG_MAJOR_VERSION \ + CXX=/usr/bin/clang++-$CLANG_MAJOR_VERSION \ MPICC=/usr/bin/mpicc \ MPICXX=/usr/bin/mpicxx \ - MPIEXEC=/usr/bin/mpirun -# The multi-line definition of arguments does not seem happy -# when a variable uses the value of another variable previously defined on the same line. -ENV OMPI_CC=$CC \ - OMPI_CXX=$CXX + MPIEXEC=/usr/bin/mpirun \ + OMPI_CC=/usr/bin/clang-$CLANG_MAJOR_VERSION \ + OMPI_CXX=/usr/bin/clang++-$CLANG_MAJOR_VERSION # Run uberenv # Have to create install directory first for uberenv diff --git a/docker/tpl-ubuntu-gcc.Dockerfile b/docker/tpl-ubuntu-gcc.Dockerfile index 2f74d46c..68fbd86e 100644 --- a/docker/tpl-ubuntu-gcc.Dockerfile +++ b/docker/tpl-ubuntu-gcc.Dockerfile @@ -64,6 +64,11 @@ RUN DEBIAN_FRONTEND=noninteractive TZ=America/Los_Angeles \ libmpfr-dev \ lbzip2 \ bzip2 \ + gettext \ + bison \ + flex \ + help2man \ + libtool \ gnupg \ virtualenv @@ -73,15 +78,17 @@ RUN python3 -m pip install --upgrade pip && \ RUN --mount=src=.,dst=$SRC_DIR $SRC_DIR/docker/install-cmake.sh +# OpenMPI hack for Ubuntu +RUN ln -s /usr/bin /usr/lib/x86_64-linux-gnu/openmpi + +# MPI environment variables ENV CC=/usr/bin/gcc-$GCC_MAJOR_VERSION \ CXX=/usr/bin/g++-$GCC_MAJOR_VERSION \ MPICC=/usr/bin/mpicc \ MPICXX=/usr/bin/mpicxx \ - MPIEXEC=/usr/bin/mpirun -# The multi-line definition of arguments does not seem happy -# when a variable uses the value of another variable previously defined on the same line. -ENV OMPI_CC=$CC \ - OMPI_CXX=$CXX + MPIEXEC=/usr/bin/mpirun \ + OMPI_CC=/usr/bin/gcc-$GCC_MAJOR_VERSION \ + OMPI_CXX=/usr/bin/g++-$GCC_MAJOR_VERSION # This stage is dedicated to TPLs uniquely. # A multi-stage build patern will allow to extract what we need for the GEOSX build. @@ -96,6 +103,9 @@ ARG GCC_MAJOR_VERSION RUN apt-get install -y --no-install-recommends \ libtbb-dev \ make \ + autopoint \ + autotools-dev \ + automake \ bc \ file \ # GEOS patches some tpl. Remove when it's not the case anymore. diff --git a/docker/tpl-ubuntu-hip.Dockerfile b/docker/tpl-ubuntu-hip.Dockerfile new file mode 100644 index 00000000..5ab3edde --- /dev/null +++ b/docker/tpl-ubuntu-hip.Dockerfile @@ -0,0 +1,178 @@ +# NOTE: see docker/tpl-ubuntu-gcc.Dockerfile for detailed comments +ARG TMP_DIR=/tmp +ARG SRC_DIR=$TMP_DIR/thirdPartyLibs +ARG BLD_DIR=$TMP_DIR/build + +# Base image is set by workflow via DOCKER_ROOT_IMAGE +ARG DOCKER_ROOT_IMAGE=rocm/dev-ubuntu-24.04:6.4.3 + +FROM ${DOCKER_ROOT_IMAGE} AS tpl_toolchain_intersect_geosx_toolchain +ARG SRC_DIR + +ARG INSTALL_DIR +ENV GEOSX_TPL_DIR=$INSTALL_DIR + +# Parameters +ARG AMDGPU_TARGET=gfx942 +ARG ROCM_VERSION=6.4.3 + +# Allow changing the number of cores used for building code via spack +ARG SPACK_BUILD_JOBS=4 +ENV SPACK_BUILD_JOBS=${SPACK_BUILD_JOBS} + +RUN ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && \ + apt-get update + +# Install system packages +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + wget \ + gnupg \ + ca-certificates \ + gcc-13 \ + g++-13 \ + gfortran-13 \ + libtbb12 \ + libtbbmalloc2 \ + libblas-dev \ + liblapack-dev \ + libz3-dev \ + zlib1g-dev \ + openmpi-bin \ + libopenmpi-dev \ + python3 \ + python3-dev \ + python3-pip \ + python3-sphinx \ + doxygen \ + pkg-config \ + xz-utils \ + gettext \ + bison \ + flex \ + bzip2 \ + help2man \ + libtool \ + libgmp-dev \ + unzip \ + libmpfr-dev \ + lbzip2 \ + bzip2 \ + gnupg \ + virtualenv \ + libpugixml-dev \ + roctracer-dev \ + rocsparse-dev \ + rocsolver-dev \ + rocblas-dev \ + hipblas-dev \ + hipsparse-dev \ + hipfft-dev \ + hipsolver-dev \ + hiprand-dev \ + rocprim-dev \ + rocrand-dev \ + rocthrust-dev \ + git && \ + rm -rf /var/lib/apt/lists/* + +# Install clingo for Spack (use pip without upgrading pip to avoid Debian conflict) +RUN python3 -m pip install clingo --break-system-packages + +# Install CMake +RUN --mount=src=.,dst=$SRC_DIR $SRC_DIR/docker/install-cmake.sh + +# OpenMPI hack for Ubuntu and provide amdclang wrappers with the GCC 13 system toolchain. +# clang++ inside the ROCm LLVM bin is also wrapped so that spack's cached_cmake.py, +# which hardcodes CMAKE_HIP_COMPILER to that path, gets the correct --gcc-toolchain. +RUN ln -s /usr/bin /usr/lib/x86_64-linux-gnu/openmpi && \ + printf '%s\n' '#!/bin/sh' "exec /opt/rocm-${ROCM_VERSION}/lib/llvm/bin/amdclang --gcc-toolchain=/usr \"\$@\"" > /usr/local/bin/amdclang-gcc13 && \ + chmod +x /usr/local/bin/amdclang-gcc13 && \ + printf '%s\n' '#!/bin/sh' "exec /opt/rocm-${ROCM_VERSION}/lib/llvm/bin/amdclang++ --gcc-toolchain=/usr \"\$@\"" > /usr/local/bin/amdclang++-gcc13 && \ + chmod +x /usr/local/bin/amdclang++-gcc13 && \ + rm -f /opt/rocm-${ROCM_VERSION}/lib/llvm/bin/clang++ && \ + printf '%s\n' '#!/bin/sh' "exec /opt/rocm-${ROCM_VERSION}/lib/llvm/bin/amdclang++ --gcc-toolchain=/usr \"\$@\"" > /opt/rocm-${ROCM_VERSION}/lib/llvm/bin/clang++ && \ + chmod +x /opt/rocm-${ROCM_VERSION}/lib/llvm/bin/clang++ && \ + ln -s /opt/rocm-${ROCM_VERSION}/lib/llvm/bin/clang /usr/bin/clang && \ + ln -s /opt/rocm-${ROCM_VERSION}/lib/llvm/bin/clang++ /usr/bin/clang++ + +# Installing TPLs +FROM tpl_toolchain_intersect_geosx_toolchain AS tpl_toolchain +ARG SRC_DIR +ARG BLD_DIR + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + libtbb-dev \ + make \ + autopoint \ + autotools-dev \ + automake \ + ninja-build \ + bc \ + file \ + patch \ + ca-certificates \ + git && \ + rm -rf /var/lib/apt/lists/* + +# Run uberenv +# Have to create install directory first for uberenv +# -k flag is to ignore SSL errors +# --spack-debug to debug build +RUN --mount=src=.,dst=$SRC_DIR,readwrite cd ${SRC_DIR} && \ + mkdir -p ${GEOSX_TPL_DIR} && \ + ./scripts/uberenv/uberenv.py \ + --spec "+rocm~uncrustify~openmp~pygeosx~trilinos~petsc amdgpu_target=${AMDGPU_TARGET} %amdclang-19 ^caliper~papi~gotcha~sampler~libunwind~libdw" \ + --spack-env-file=${SRC_DIR}/docker/spack-rocm.yaml \ + --project-json=.uberenv_config.json \ + --prefix ${GEOSX_TPL_DIR} \ + -k && \ +# Remove host-config generated for LvArray + rm lvarray* && \ +# Rename and copy spack-generated host-config to root directory + cp *.cmake /spack-generated.cmake && \ +# Remove extraneous spack files + cd ${GEOSX_TPL_DIR} && \ + rm -rf bin/ build_stage/ misc_cache/ spack/ spack_env/ .spack-db/ + +# Extract only TPLs from previous stage +FROM tpl_toolchain_intersect_geosx_toolchain AS geosx_toolchain +ARG SRC_DIR + +COPY --from=tpl_toolchain $GEOSX_TPL_DIR $GEOSX_TPL_DIR + +# Extract the generated host-config +COPY --from=tpl_toolchain /spack-generated.cmake / + +RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + apt-get install -y --no-install-recommends \ + openssh-client \ + ca-certificates \ + curl \ + python3 \ + texlive \ + texlive-latex-extra \ + graphviz \ + libxml2-utils \ + git \ + ghostscript \ + ninja-build \ + python3-dev \ + python3-sphinx \ + python3-mpi4py \ + python3-scipy \ + python3-virtualenv \ + python3-matplotlib \ + python3-venv \ + python3-pytest && \ + rm -rf /var/lib/apt/lists/* + +RUN --mount=src=.,dst=$SRC_DIR $SRC_DIR/docker/install-sccache.sh +ENV SCCACHE=/opt/sccache/bin/sccache + +# Helpful environment defaults for HIP +ENV ROCM_PATH=/opt/rocm-${ROCM_VERSION} +ENV HIP_PATH=${ROCM_PATH}/hip +ENV PATH=${ROCM_PATH}/bin:${ROCM_PATH}/llvm/bin:${PATH} +ENV LD_LIBRARY_PATH=${ROCM_PATH}/lib:${ROCM_PATH}/lib64:${ROCM_PATH}/llvm/lib +ENV CMAKE_HIP_ARCHITECTURES=${AMDGPU_TARGET} diff --git a/scripts/spack_configs/pangea-4/spack.yaml b/scripts/spack_configs/pangea-4/spack.yaml index 7070bb4d..47511c0c 100644 --- a/scripts/spack_configs/pangea-4/spack.yaml +++ b/scripts/spack_configs/pangea-4/spack.yaml @@ -68,7 +68,6 @@ spack: require: "@26.1" grpc: require: "@1.65.5-full-clone" - #### # external compiler gcc: diff --git a/scripts/spack_configs/versions.yaml b/scripts/spack_configs/versions.yaml index 293a75ba..26fc5811 100644 --- a/scripts/spack_configs/versions.yaml +++ b/scripts/spack_configs/versions.yaml @@ -14,9 +14,9 @@ # This file lists the package versions for geos's dependencies # packages: - # master - 01/23/26 + # master - 02/23/26 hypre: - require: "@git.8b0093306228fef1b92384d9face7fbe5a63b460=master" + require: "@git.7e403d172640473c07e8391f6a9fb69cd824d48a=master" # master - 04/12/20 uncrustify: diff --git a/scripts/spack_packages/packages/chai/package.py b/scripts/spack_packages/packages/chai/package.py index 16b68a56..bdc3f94b 100644 --- a/scripts/spack_packages/packages/chai/package.py +++ b/scripts/spack_packages/packages/chai/package.py @@ -1,3 +1,7 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + import os from spack.package import * @@ -6,4 +10,12 @@ class Chai(BuiltinChai): # Bypass llnl_link_helpers failure depends_on("fortran") + depends_on("c", type="build") + depends_on("cxx", type="build") + # From radiuss-packages (PR #143) + depends_on("blt@0.7.1:", type="build", when="@2025.09.0:") + depends_on("blt@0.7.0:", type="build", when="@2025.03.0:") + depends_on("umpire@2025.09.0:", when="@2025.09.0:") + depends_on("umpire@2025.03.0:", when="@2025.03.0:") + depends_on("umpire@2024.07.0", when="@2024.07.0") diff --git a/scripts/spack_packages/packages/geosx/package.py b/scripts/spack_packages/packages/geosx/package.py index 91b7b6f0..4704eda8 100644 --- a/scripts/spack_packages/packages/geosx/package.py +++ b/scripts/spack_packages/packages/geosx/package.py @@ -9,21 +9,25 @@ import socket import os +import llnl.util.tty as tty + from os import environ as env from os.path import join as pjoin -from spack_repo.builtin.build_systems.cached_cmake import cmake_cache_path - from spack_repo.builtin.build_systems.cmake import CMakePackage from spack_repo.builtin.build_systems.cuda import CudaPackage +from spack_repo.builtin.build_systems.cached_cmake import ( + cmake_cache_option, + cmake_cache_path, + cmake_cache_string, +) # Tested specs are located at scripts/spack_configs/<$SYS_TYPE>/spack.yaml (e.g. %clang@10.0.1) - # WARNING: +petsc variant is yet to be tested. def cmake_cache_entry(name, value, comment=""): - """Generate a string for a cmake cache variable""" + """Generate a string for a cmake cache variable.""" return 'set(%s "%s" CACHE PATH "%s")\n\n' % (name, value, comment) @@ -36,19 +40,6 @@ def cmake_cache_list(name, value, comment=""): return 'set(%s %s CACHE STRING "%s")\n\n' % (name, join_str.join(value), comment) -def cmake_cache_string(name, string, comment=""): - """Generate a string for a cmake cache variable""" - - return 'set(%s "%s" CACHE STRING "%s")\n\n' % (name, string, comment) - - -def cmake_cache_option(name, boolean_value, comment=""): - """Generate a string for a cmake configuration option""" - - value = "ON" if boolean_value else "OFF" - return 'set(%s %s CACHE BOOL "%s")\n\n' % (name, value, comment) - - class Geosx(CMakePackage, CudaPackage, ROCmPackage): """GEOSX simulation framework.""" @@ -159,8 +150,8 @@ class Geosx(CMakePackage, CudaPackage, ROCmPackage): # # Math # - depends_on("parmetis@4.0.3+int64~shared cflags='-fPIC' cxxflags='-fPIC'") - depends_on("metis +int64~shared cflags='-fPIC' cxxflags='-fPIC'") + depends_on("parmetis@4.0.3+int64+shared cflags='-fPIC' cxxflags='-fPIC'") + depends_on("metis +int64+shared cflags='-fPIC' cxxflags='-fPIC'") depends_on("superlu-dist@9.2.1 +int64 fflags='-fPIC'") depends_on("superlu-dist@9.2.1 +int64 fflags='-fPIC -ef'", when="%cce") @@ -185,6 +176,8 @@ class Geosx(CMakePackage, CudaPackage, ROCmPackage): depends_on("hypre +cuda+superlu-dist+mixedint+mpi+umpire+unified-memory", when='+cuda') depends_on("hypre +rocm+superlu-dist+mixedint+mpi+umpire+unified-memory", when='+rocm') depends_on("hypre ~openmp", when="~openmp") + depends_on("hypre +openmp", when="+openmp") + depends_on("hypre +caliper", when="+caliper") depends_on("hypre +pic", when="~shared") depends_on("hypre +shared", when="+shared") @@ -251,22 +244,22 @@ def _get_sys_type(self, spec): return sys_type def _get_host_config_path(self, spec, lvarray=False): - var = '' - - if '+cuda' in spec: - var = '-'.join([var, 'cuda']) - var += "@" + str(spec['cuda'].version) - elif '+rocm' in spec: - var = '-'.join([var, 'rocm']) - var += "@" + str(spec['hip'].version) - + gpu_backend = "" + if "+cuda" in spec: + gpu_backend = f"cuda@{spec['cuda'].version}" + elif "+rocm" in spec: + gpu_backend = f"rocm@{spec['hip'].version}" hostname = socket.gethostname().rstrip('1234567890') if lvarray: hostname = "lvarray-" + hostname - host_config_path = "%s-%s-%s@%s%s.cmake" % (hostname, self._get_sys_type(spec), (str(spec.compiler.name)), str(spec.compiler.version),var) + host_config_path = "%s-%s-%s@%s%s.cmake" % (hostname, + self._get_sys_type(spec), + str(spec.compiler.name), + str(spec.compiler.version), + gpu_backend) dest_dir = self.stage.source_path host_config_path = os.path.abspath(pjoin(dest_dir, host_config_path)) @@ -328,15 +321,15 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write("#{0}\n".format("-" * 80)) cfg.write("# Compilers\n") cfg.write("#{0}\n\n".format("-" * 80)) - cfg.write(cmake_cache_entry("CMAKE_C_COMPILER", c_compiler)) + cfg.write(cmake_cache_path("CMAKE_C_COMPILER", c_compiler)) cflags = ' '.join(spec.compiler_flags['cflags']) if cflags: - cfg.write(cmake_cache_entry("CMAKE_C_FLAGS", cflags)) + cfg.write(cmake_cache_string("CMAKE_C_FLAGS", cflags)) - cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) + cfg.write(cmake_cache_path("CMAKE_CXX_COMPILER", cpp_compiler)) cxxflags = ' '.join(spec.compiler_flags['cxxflags']) if cxxflags: - cfg.write(cmake_cache_entry("CMAKE_CXX_FLAGS", cxxflags)) + cfg.write(cmake_cache_string("CMAKE_CXX_FLAGS", cxxflags)) release_flags = "-O3 -DNDEBUG" if "clang" in self.compiler.cxx: @@ -348,7 +341,7 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG", debug_flags)) if "%clang arch=linux-rhel7-ppc64le" in spec: - cfg.write(cmake_cache_entry("CMAKE_EXE_LINKER_FLAGS", "-Wl,--no-toc-optimize")) + cfg.write(cmake_cache_string("CMAKE_EXE_LINKER_FLAGS", "-Wl,--no-toc-optimize")) cfg.write("#{0}\n".format("-" * 80)) cfg.write("# CMake Standard\n") @@ -361,8 +354,8 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write("#{0}\n\n".format("-" * 80)) cfg.write(cmake_cache_option('ENABLE_MPI', True)) - cfg.write(cmake_cache_entry('MPI_C_COMPILER', spec['mpi'].mpicc)) - cfg.write(cmake_cache_entry('MPI_CXX_COMPILER', spec['mpi'].mpicxx)) + cfg.write(cmake_cache_path('MPI_C_COMPILER', spec['mpi'].mpicc)) + cfg.write(cmake_cache_path('MPI_CXX_COMPILER', spec['mpi'].mpicxx)) hostname = socket.gethostname().rstrip('1234567890') @@ -370,14 +363,14 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): and hostname != 'p3dev': cfg.write(cmake_cache_option('ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC', True)) if hostname in ('lassen', 'rzansel'): - cfg.write(cmake_cache_entry('MPIEXEC', 'lrun')) - cfg.write(cmake_cache_entry('MPIEXEC_NUMPROC_FLAG', '-n')) + cfg.write(cmake_cache_string('MPIEXEC', 'lrun')) + cfg.write(cmake_cache_string('MPIEXEC_NUMPROC_FLAG', '-n')) else: - cfg.write(cmake_cache_entry('MPIEXEC', 'jsrun')) + cfg.write(cmake_cache_string('MPIEXEC', 'jsrun')) cfg.write(cmake_cache_list('MPIEXEC_NUMPROC_FLAG', ['-g1', '--bind', 'rs', '-n'])) elif sys_type in ('toss_4_x86_64_ib_cray'): - cfg.write(cmake_cache_entry('MPIEXEC', 'srun')) - cfg.write(cmake_cache_entry('MPIEXEC_NUMPROC_FLAG', '-n')) + cfg.write(cmake_cache_string('MPIEXEC', 'srun')) + cfg.write(cmake_cache_string('MPIEXEC_NUMPROC_FLAG', '-n')) else: # Taken from cached_cmake class: # https://github.com/spack/spack/blob/develop/lib/spack/spack/build_systems/cached_cmake.py#L180-234 @@ -441,9 +434,9 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_string('CMAKE_CUDA_STANDARD', spec.variants['cxxstd'].value)) cudatoolkitdir = spec['cuda'].prefix - cfg.write(cmake_cache_entry('CUDA_TOOLKIT_ROOT_DIR', cudatoolkitdir)) + cfg.write(cmake_cache_path('CUDA_TOOLKIT_ROOT_DIR', cudatoolkitdir)) cudacompiler = '${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc' - cfg.write(cmake_cache_entry('CMAKE_CUDA_COMPILER', cudacompiler)) + cfg.write(cmake_cache_path('CMAKE_CUDA_COMPILER', cudacompiler)) cmake_cuda_flags = ('-restrict --expt-extended-lambda -Werror ' 'cross-execution-space-call,reorder,' @@ -473,7 +466,7 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cuda_stack_size = int(spec.variants['cuda_stack_size'].value) if 0 < cuda_stack_size: cfg.write(cmake_cache_option('ENABLE_CUDA_STACK_SIZE', True, "Adjust the CUDA stack size limit")) - cfg.write(cmake_cache_entry('CUDA_STACK_SIZE', cuda_stack_size, "CUDA stack size in KB")) + cfg.write(cmake_cache_string('CUDA_STACK_SIZE', cuda_stack_size, "CUDA stack size in KB")) else: cfg.write(cmake_cache_option('ENABLE_CUDA', False)) @@ -484,13 +477,13 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): if '+rocm' in spec: cfg.write(cmake_cache_option('ENABLE_HIP', True)) cfg.write(cmake_cache_string('CMAKE_HIP_STANDARD', spec.variants['cxxstd'].value)) - cfg.write(cmake_cache_entry('CMAKE_HIP_COMPILER', spec['hip'].prefix.bin.hipcc)) + cfg.write(cmake_cache_path('CMAKE_HIP_COMPILER', spec['hip'].prefix.bin.hipcc)) if not spec.satisfies('amdgpu_target=none'): cmake_hip_archs = ";".join(spec.variants["amdgpu_target"].value) cfg.write(cmake_cache_string('CMAKE_HIP_ARCHITECTURES', cmake_hip_archs)) - cfg.write(cmake_cache_entry('ROCM_PATH', spec['hip'].prefix)) + cfg.write(cmake_cache_path('ROCM_PATH', spec['hip'].prefix)) else: cfg.write(cmake_cache_option('ENABLE_HIP', False)) @@ -499,14 +492,14 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('#{0}\n\n'.format('-' * 80)) cfg.write(cmake_cache_option('ENABLE_CHAI', True)) - cfg.write(cmake_cache_entry('CHAI_DIR', spec['chai'].prefix)) + cfg.write(cmake_cache_path('CHAI_DIR', spec['chai'].prefix)) - cfg.write(cmake_cache_entry('RAJA_DIR', spec['raja'].prefix)) + cfg.write(cmake_cache_path('RAJA_DIR', spec['raja'].prefix)) cfg.write(cmake_cache_option('ENABLE_UMPIRE', True)) - cfg.write(cmake_cache_entry('UMPIRE_DIR', spec['umpire'].prefix)) + cfg.write(cmake_cache_path('UMPIRE_DIR', spec['umpire'].prefix)) - cfg.write(cmake_cache_entry('CAMP_DIR', spec['camp'].prefix)) + cfg.write(cmake_cache_path('CAMP_DIR', spec['camp'].prefix)) # yapf: disable io_tpls = ( @@ -526,8 +519,8 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): if '+caliper' in spec: cfg.write(cmake_cache_option('ENABLE_CALIPER', True)) - cfg.write(cmake_cache_entry('CALIPER_DIR', spec['caliper'].prefix)) - cfg.write(cmake_cache_entry('ADIAK_DIR', spec['adiak'].prefix)) + cfg.write(cmake_cache_path('CALIPER_DIR', spec['caliper'].prefix)) + cfg.write(cmake_cache_path('ADIAK_DIR', spec['adiak'].prefix)) for tpl, cmake_name, enable in io_tpls: if enable: @@ -544,7 +537,7 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): raise KeyError("No zlib provider (zlib/zlib-ng/zlib-api) found in {0}".format(spec)) else: dep_spec = spec[tpl] - cfg.write(cmake_cache_entry('{}_DIR'.format(cmake_name), dep_spec.prefix)) + cfg.write(cmake_cache_path('{}_DIR'.format(cmake_name), dep_spec.prefix)) else: cfg.write(cmake_cache_option('ENABLE_{}'.format(cmake_name), False)) @@ -554,15 +547,15 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): if spec["blas"].name == "intel-oneapi-mkl": cfg.write(cmake_cache_option('ENABLE_MKL', True)) - cfg.write(cmake_cache_entry('MKL_INCLUDE_DIRS', spec['intel-oneapi-mkl'].prefix.include)) + cfg.write(cmake_cache_path('MKL_INCLUDE_DIRS', spec['intel-oneapi-mkl'].prefix.include)) cfg.write(cmake_cache_list('MKL_LIBRARIES', spec['intel-oneapi-mkl'].libs)) elif spec["blas"].name == "mkl": cfg.write(cmake_cache_option('ENABLE_MKL', True)) - cfg.write(cmake_cache_entry('MKL_INCLUDE_DIRS', spec['intel-mkl'].prefix.include)) + cfg.write(cmake_cache_path('MKL_INCLUDE_DIRS', spec['intel-mkl'].prefix.include)) cfg.write(cmake_cache_list('MKL_LIBRARIES', spec['intel-mkl'].libs)) elif spec["blas"].name == "essl": cfg.write(cmake_cache_option('ENABLE_ESSL', True)) - cfg.write(cmake_cache_entry('ESSL_INCLUDE_DIRS', spec['essl'].prefix.include)) + cfg.write(cmake_cache_path('ESSL_INCLUDE_DIRS', spec['essl'].prefix.include)) cfg.write(cmake_cache_list('ESSL_LIBRARIES', spec['blas'].libs)) cfg.write(cmake_cache_option('FORTRAN_MANGLE_NO_UNDERSCORE', True)) @@ -588,7 +581,7 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('#{0}\n\n'.format('-' * 80)) for tpl, cmake_name, enable in math_tpls: if enable: - cfg.write(cmake_cache_entry('{}_DIR'.format(cmake_name), spec[tpl].prefix)) + cfg.write(cmake_cache_path('{}_DIR'.format(cmake_name), spec[tpl].prefix)) if tpl == 'hypre' and '+cuda' in spec: cfg.write(cmake_cache_string('ENABLE_HYPRE_DEVICE', "CUDA")) @@ -611,8 +604,8 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('# Python\n') cfg.write('#{0}\n\n'.format('-' * 80)) - cfg.write(cmake_cache_entry('Python3_ROOT_DIR', os.path.join(spec['python'].prefix))) - cfg.write(cmake_cache_entry('Python3_EXECUTABLE', os.path.join(spec['python'].prefix.bin, 'python3'))) + cfg.write(cmake_cache_path('Python3_ROOT_DIR', os.path.join(spec['python'].prefix))) + cfg.write(cmake_cache_path('Python3_EXECUTABLE', os.path.join(spec['python'].prefix.bin, 'python3'))) if '+pygeosx' in spec: cfg.write(cmake_cache_option('ENABLE_PYGEOSX', True)) @@ -624,10 +617,10 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('#{0}\n\n'.format('-' * 80)) if '+docs' in spec: sphinx_bin_dir = spec['py-sphinx'].prefix.bin - cfg.write(cmake_cache_entry('SPHINX_EXECUTABLE', os.path.join(sphinx_bin_dir, 'sphinx-build'))) + cfg.write(cmake_cache_path('SPHINX_EXECUTABLE', os.path.join(sphinx_bin_dir, 'sphinx-build'))) doxygen_bin_dir = spec['doxygen'].prefix.bin - cfg.write(cmake_cache_entry('DOXYGEN_EXECUTABLE', os.path.join(doxygen_bin_dir, 'doxygen'))) + cfg.write(cmake_cache_path('DOXYGEN_EXECUTABLE', os.path.join(doxygen_bin_dir, 'doxygen'))) else: cfg.write(cmake_cache_option('ENABLE_DOCS', False)) cfg.write(cmake_cache_option('ENABLE_DOXYGEN', False)) @@ -640,14 +633,14 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_option('ENABLE_UNCRUSTIFY', '+uncrustify' in spec)) if '+uncrustify' in spec: cfg.write( - cmake_cache_entry('UNCRUSTIFY_EXECUTABLE', os.path.join(spec['uncrustify'].prefix.bin, 'uncrustify'))) + cmake_cache_path('UNCRUSTIFY_EXECUTABLE', os.path.join(spec['uncrustify'].prefix.bin, 'uncrustify'))) if '+addr2line' in spec: cfg.write('#{0}\n'.format('-' * 80)) cfg.write('# addr2line\n') cfg.write('#{0}\n\n'.format('-' * 80)) cfg.write(cmake_cache_option('ENABLE_ADDR2LINE', True)) - cfg.write(cmake_cache_entry('ADDR2LINE_EXEC ', '/usr/bin/addr2line')) + cfg.write(cmake_cache_path('ADDR2LINE_EXEC ', '/usr/bin/addr2line')) cfg.write('#{0}\n'.format('-' * 80)) cfg.write('# Other\n') @@ -655,7 +648,7 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): if '+mathpresso' in spec: cfg.write(cmake_cache_option('ENABLE_MATHPRESSO', True)) - cfg.write(cmake_cache_entry('MATHPRESSO_DIR', spec['mathpresso'].prefix)) + cfg.write(cmake_cache_path('MATHPRESSO_DIR', spec['mathpresso'].prefix)) cfg.write(cmake_cache_option('ENABLE_XML_UPDATES', True)) else: cfg.write(cmake_cache_option('ENABLE_MATHPRESSO', False)) @@ -741,15 +734,15 @@ def lvarray_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write("#{0}\n".format("-" * 80)) cfg.write("# Compilers\n") cfg.write("#{0}\n\n".format("-" * 80)) - cfg.write(cmake_cache_entry("CMAKE_C_COMPILER", c_compiler)) + cfg.write(cmake_cache_path("CMAKE_C_COMPILER", c_compiler)) cflags = ' '.join(spec.compiler_flags['cflags']) if cflags: - cfg.write(cmake_cache_entry("CMAKE_C_FLAGS", cflags)) + cfg.write(cmake_cache_string("CMAKE_C_FLAGS", cflags)) - cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) + cfg.write(cmake_cache_path("CMAKE_CXX_COMPILER", cpp_compiler)) cxxflags = ' '.join(spec.compiler_flags['cxxflags']) if cxxflags: - cfg.write(cmake_cache_entry("CMAKE_CXX_FLAGS", cxxflags)) + cfg.write(cmake_cache_string("CMAKE_CXX_FLAGS", cxxflags)) release_flags = "-O3 -DNDEBUG" cfg.write(cmake_cache_string("CMAKE_CXX_FLAGS_RELEASE", release_flags)) @@ -759,7 +752,7 @@ def lvarray_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG", debug_flags)) if "%clang arch=linux-rhel7-ppc64le" in spec: - cfg.write(cmake_cache_entry("CMAKE_EXE_LINKER_FLAGS", "-Wl,--no-toc-optimize")) + cfg.write(cmake_cache_string("CMAKE_EXE_LINKER_FLAGS", "-Wl,--no-toc-optimize")) cfg.write('#{0}\n'.format('-' * 80)) cfg.write('# Cuda\n') @@ -769,9 +762,9 @@ def lvarray_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_string('CMAKE_CUDA_STANDARD', spec.variants['cxxstd'].value)) cudatoolkitdir = spec['cuda'].prefix - cfg.write(cmake_cache_entry('CUDA_TOOLKIT_ROOT_DIR', cudatoolkitdir)) + cfg.write(cmake_cache_path('CUDA_TOOLKIT_ROOT_DIR', cudatoolkitdir)) cudacompiler = '${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc' - cfg.write(cmake_cache_entry('CMAKE_CUDA_COMPILER', cudacompiler)) + cfg.write(cmake_cache_path('CMAKE_CUDA_COMPILER', cudacompiler)) cmake_cuda_flags = ('-restrict --expt-extended-lambda -Werror ' 'cross-execution-space-call,reorder,' @@ -802,14 +795,14 @@ def lvarray_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('#{0}\n\n'.format('-' * 80)) cfg.write(cmake_cache_option('ENABLE_CHAI', True)) - cfg.write(cmake_cache_entry('CHAI_DIR', spec['chai'].prefix)) + cfg.write(cmake_cache_path('CHAI_DIR', spec['chai'].prefix)) - cfg.write(cmake_cache_entry('RAJA_DIR', spec['raja'].prefix)) + cfg.write(cmake_cache_path('RAJA_DIR', spec['raja'].prefix)) cfg.write(cmake_cache_option('ENABLE_UMPIRE', True)) - cfg.write(cmake_cache_entry('UMPIRE_DIR', spec['umpire'].prefix)) + cfg.write(cmake_cache_path('UMPIRE_DIR', spec['umpire'].prefix)) - cfg.write(cmake_cache_entry('CAMP_DIR', spec['camp'].prefix)) + cfg.write(cmake_cache_path('CAMP_DIR', spec['camp'].prefix)) cfg.write('#{0}\n'.format('-' * 80)) cfg.write('# IO TPLs\n') @@ -817,18 +810,18 @@ def lvarray_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): if '+caliper' in spec: cfg.write(cmake_cache_option('ENABLE_CALIPER', True)) - cfg.write(cmake_cache_entry('CALIPER_DIR', spec['caliper'].prefix)) - cfg.write(cmake_cache_entry('adiak_DIR', spec['adiak'].prefix + '/lib/cmake/adiak')) + cfg.write(cmake_cache_path('CALIPER_DIR', spec['caliper'].prefix)) + cfg.write(cmake_cache_path('adiak_DIR', spec['adiak'].prefix + '/lib/cmake/adiak')) cfg.write('#{0}\n'.format('-' * 80)) cfg.write('# Documentation\n') cfg.write('#{0}\n\n'.format('-' * 80)) if '+docs' in spec: sphinx_bin_dir = spec['py-sphinx'].prefix.bin - cfg.write(cmake_cache_entry('SPHINX_EXECUTABLE', os.path.join(sphinx_bin_dir, 'sphinx-build'))) + cfg.write(cmake_cache_path('SPHINX_EXECUTABLE', os.path.join(sphinx_bin_dir, 'sphinx-build'))) doxygen_bin_dir = spec['doxygen'].prefix.bin - cfg.write(cmake_cache_entry('DOXYGEN_EXECUTABLE', os.path.join(doxygen_bin_dir, 'doxygen'))) + cfg.write(cmake_cache_path('DOXYGEN_EXECUTABLE', os.path.join(doxygen_bin_dir, 'doxygen'))) else: cfg.write(cmake_cache_option('ENABLE_DOXYGEN', False)) cfg.write(cmake_cache_option('ENABLE_SPHINX', False))