diff --git a/.github/workflows/docker_build_tpls.yml b/.github/workflows/docker_build_tpls.yml index b4181e62..72d7d46f 100644 --- a/.github/workflows/docker_build_tpls.yml +++ b/.github/workflows/docker_build_tpls.yml @@ -71,16 +71,22 @@ jobs: DOCKER_REPOSITORY: geosx/sherlock-gcc10.1.0-openmpi4.1.2-openblas0.3.10-zlib1.2.11 TPL_DOCKERFILE: docker/Stanford/Dockerfile DOCKER_ROOT_IMAGE: matteofrigo5/sherlock-gcc10.1.0-openmpi4.1.2-cuda12.4.0-openblas0.3.10-zlib1.2.11-cmake3.31.4-no-geosx:0.0.1 - SPEC: "%gcc@10.1.0~pygeosx~openmp" + SPEC: "~pygeosx~openmp %c,cxx,fortran=gcc@10.1.0" INSTALL_DIR_ROOT: /oak/stanford/groups/tchelepi/geos-sherlock/CPU RUNS_ON: ubuntu-latest - name: Sherlock GPU (centos 7.9.2009, gcc 10.1.0, open-mpi 4.1.2, cuda 12.4.0, openblas 0.3.10, zlib 1.2.11) DOCKER_REPOSITORY: geosx/sherlock-gcc10.1.0-openmpi4.1.2-cuda12.4.0-openblas0.3.10-zlib1.2.11 TPL_DOCKERFILE: docker/Stanford/Dockerfile DOCKER_ROOT_IMAGE: matteofrigo5/sherlock-gcc10.1.0-openmpi4.1.2-cuda12.4.0-openblas0.3.10-zlib1.2.11-cmake3.31.4-no-geosx:0.0.1 - SPEC: "%gcc@10.1.0~pygeosx~openmp cuda_arch=70 ^cuda@12.4.0+allow-unsupported-compilers" + SPEC: "~pygeosx~openmp cuda_arch=70 %c,cxx,fortran=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, gcc 13.3.0 + ROCm 6.4.3) + DOCKER_REPOSITORY: geosx/ubuntu24.04-gcc13.3.0-rocm6.4.3 + TPL_DOCKERFILE: docker/tpl-ubuntu-gcc-hip.Dockerfile + DOCKER_ROOT_IMAGE: rocm/dev-ubuntu-24.04:6.4.3 + DOCKER_COMPILER_BUILD_ARG: "--build-arg GCC_MAJOR_VERSION=13" + RUNS_ON: ubuntu-latest steps: - name: Checkout diff --git a/.uberenv_config.json b/.uberenv_config.json index a50db3f9..d7522d0f 100644 --- a/.uberenv_config.json +++ b/.uberenv_config.json @@ -4,7 +4,7 @@ "package_final_phase": "lvarray_hostconfig", "package_source_dir": "../..", "spack_url": "https://github.com/spack/spack", -"spack_commit": "2bfcc69fa870d3c6919be87593f22647981b648a", +"spack_commit": "734c5db2121b01c373eed6538e452f18887e9e44", "spack_configs_path": "scripts/spack_configs", "spack_packages_path": "scripts/spack_packages/packages" } diff --git a/docker/TotalEnergies/Pangea3.Dockerfile b/docker/TotalEnergies/Pangea3.Dockerfile index 61434384..3640040d 100644 --- a/docker/TotalEnergies/Pangea3.Dockerfile +++ b/docker/TotalEnergies/Pangea3.Dockerfile @@ -50,7 +50,7 @@ RUN --mount=src=.,dst=$SRC_DIR,readwrite cd ${SRC_DIR} && \ ln -s /usr/lib64/liblustreapi.so.1 /usr/lib64/liblustreapi.so && \ # Run uberenv ./scripts/uberenv/uberenv.py \ - --spec "%gcc@9.4.0+cuda~uncrustify~openmp~pygeosx cuda_arch=70 ^cuda@11.5.0+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ + --spec "+cuda~uncrustify~openmp~pygeosx cuda_arch=70 %c,cxx,fortran=gcc@9.4.0 ^cuda@11.5.0+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ --spack-env-file=${SRC_DIR}/docker/pangea-spack.yaml \ --project-json=.uberenv_config.json \ --prefix ${GEOSX_TPL_DIR} \ diff --git a/docker/centos-spack.yaml b/docker/centos-spack.yaml new file mode 100644 index 00000000..ad0d7ebe --- /dev/null +++ b/docker/centos-spack.yaml @@ -0,0 +1,152 @@ +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 + + packages: + all: + target: [x86_64] + providers: + blas: [netlib-lapack] + lapack: [netlib-lapack] + mpi: [openmpi] + + gcc: + version: [8.3.1] + buildable: false + externals: + - spec: gcc@8.3.1 languages:='c,c++,fortran' + prefix: /opt/rh/devtoolset-8/root/usr + extra_attributes: + compilers: + c: /opt/rh/devtoolset-8/root/usr/bin/gcc + cxx: /opt/rh/devtoolset-8/root/usr/bin/g++ + fortran: /opt/rh/devtoolset-8/root/usr/bin/gfortran + 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 + cuda: + buildable: False + externals: + - spec: cuda@11.8.0 +allow-unsupported-compilers + prefix: /usr/local/cuda + 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 + + # Spack may grab for mpi & we don't want to use them + mpi: + buildable: false + + 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: + externals: + - spec: openmpi@4.1.2%clang + prefix: /usr + - spec: openmpi@1.10.7%gcc@8 + prefix: /usr/lib64/openmpi + modules: [mpi] + - spec: openmpi@4.1.2%gcc@9 + prefix: /usr + - spec: openmpi@4.1.2%gcc@10 + prefix: /usr + - spec: openmpi@4.1.2%gcc@11 + prefix: /usr + - spec: openmpi@4.1.2%gcc@12 + prefix: /usr + 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 diff --git a/docker/pangea-spack.yaml b/docker/pangea-spack.yaml index a505347d..63c5629c 100644 --- a/docker/pangea-spack.yaml +++ b/docker/pangea-spack.yaml @@ -17,32 +17,27 @@ spack: - ../defaults.yaml - ../versions.yaml - compilers:: - - compiler: - spec: gcc@=9.4.0 - paths: - cc: /data_local/sw/spack/0.17.0/opt/spack/linux-rhel8-power9le/gcc-8.4.1/gcc-9.4.0-xe5cqnyajaqz75up3gflln5zlj2rue5v/bin/gcc - cxx: /data_local/sw/spack/0.17.0/opt/spack/linux-rhel8-power9le/gcc-8.4.1/gcc-9.4.0-xe5cqnyajaqz75up3gflln5zlj2rue5v/bin/g++ - f77: /data_local/sw/spack/0.17.0/opt/spack/linux-rhel8-power9le/gcc-8.4.1/gcc-9.4.0-xe5cqnyajaqz75up3gflln5zlj2rue5v/bin/gfortran - fc: /data_local/sw/spack/0.17.0/opt/spack/linux-rhel8-power9le/gcc-8.4.1/gcc-9.4.0-xe5cqnyajaqz75up3gflln5zlj2rue5v/bin/gfortran - flags: {} - operating_system: almalinux8 - target: ppc64le - modules: [] - environment: - prepend_path: - LD_LIBRARY_PATH: /data_local/sw/lsf/10.1/linux3.10-glibc2.17-ppc64le/lib - extra_rpaths: [] - packages: all: target: [x86_64] - compiler: [gcc] providers: blas: [openblas] lapack: [openblas] mpi: [openmpi] + gcc: + externals: + - spec: gcc@9.4.0 languages:='c,c++,fortran' + prefix: /data_local/sw/spack/0.17.0/opt/spack/linux-rhel8-power9le/gcc-8.4.1/gcc-9.4.0-xe5cqnyajaqz75up3gflln5zlj2rue5v + extra_attributes: + compilers: + c: /data_local/sw/spack/0.17.0/opt/spack/linux-rhel8-power9le/gcc-8.4.1/gcc-9.4.0-xe5cqnyajaqz75up3gflln5zlj2rue5v/bin/gcc + cxx: /data_local/sw/spack/0.17.0/opt/spack/linux-rhel8-power9le/gcc-8.4.1/gcc-9.4.0-xe5cqnyajaqz75up3gflln5zlj2rue5v/bin/g++ + fortran: /data_local/sw/spack/0.17.0/opt/spack/linux-rhel8-power9le/gcc-8.4.1/gcc-9.4.0-xe5cqnyajaqz75up3gflln5zlj2rue5v/bin/gfortran + environment: + prepend_path: + LD_LIBRARY_PATH: /data_local/sw/lsf/10.1/linux3.10-glibc2.17-ppc64le/lib + autoconf: externals: - spec: autoconf@2.69 diff --git a/docker/pecan-spack.yaml b/docker/pecan-spack.yaml index 822bd2a8..31a20221 100644 --- a/docker/pecan-spack.yaml +++ b/docker/pecan-spack.yaml @@ -37,7 +37,6 @@ spack: packages: all: target: [x86_64] - compiler: [gcc, clang] providers: blas: [intel-mkl] lapack: [intel-mkl] @@ -72,8 +71,8 @@ spack: buildable: False externals: # Pecan CPU/GPU - - spec: intel-mkl@2019.5.281%gcc@8.2.0 threads=openmp - prefix: /opt/intel/compilers_and_libraries_2019.5.281/linux/mkl/ + - spec: intel-mkl@2019.5.281 threads=openmp %gcc@8.2.0 + prefix: /opt/intel/compilers_and_libraries_2019.5.281/linux/mkl blas: buildable: false diff --git a/docker/rocky-spack.yaml b/docker/rocky-spack.yaml index 94025319..472d7528 100644 --- a/docker/rocky-spack.yaml +++ b/docker/rocky-spack.yaml @@ -17,45 +17,32 @@ spack: - ../defaults.yaml - ../versions.yaml - compilers:: - - compiler: - extra_rpaths: [] - flags: - cflags: -pthread - cxxflags: -pthread - modules: [] - operating_system: rocky8 - paths: - cc: /usr/bin/clang - cxx: /usr/bin/clang++ - f77: /usr/bin/gfortran - fc: /usr/bin/gfortran - spec: clang@17.0.6 - target: x86_64 - - compiler: - extra_rpaths: [] - flags: - cflags: -pthread - cxxflags: -pthread - modules: [] - operating_system: rocky8 - paths: - cc: /opt/rh/gcc-toolset-13/root/usr/bin/gcc - cxx: /opt/rh/gcc-toolset-13/root/usr/bin/g++ - f77: /opt/rh/gcc-toolset-13/root/usr/bin/gfortran - fc: /opt/rh/gcc-toolset-13/root/usr/bin/gfortran - spec: gcc@13.3.1 - target: x86_64 - packages: all: target: [x86_64] - compiler: [gcc, clang] providers: blas: [netlib-lapack] lapack: [netlib-lapack] mpi: [openmpi] + gcc: + externals: + - spec: gcc@13.3.1 languages:='c,c++,fortran' + prefix: /opt/rh/gcc-toolset-13/root/usr/ + extra_attributes: + compilers: + c: /opt/rh/gcc-toolset-13/root/usr/bin/gcc + cxx: /opt/rh/gcc-toolset-13/root/usr/bin/g++ + fortran: /opt/rh/gcc-toolset-13/root/usr/bin/gfortran + clang: + externals: + - spec: clang@17 languages:='c,c++' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang-17 + cxx: /usr/bin/clang++-17 + autoconf: version: [2.71] buildable: false @@ -77,9 +64,9 @@ spack: cuda: buildable: False externals: - - spec: cuda@12.9.1%gcc@13.3.1 +allow-unsupported-compilers + - spec: cuda@12.9.1 +allow-unsupported-compilers %gcc@13.3.1 prefix: /usr/local/cuda - - spec: cuda@12.9.1%clang@17.0.6 +allow-unsupported-compilers + - spec: cuda@12.9.1 +allow-unsupported-compilers %clang@17.0.6 prefix: /usr/local/cuda m4: buildable: false diff --git a/docker/spack-rocm.yaml b/docker/spack-rocm.yaml new file mode 100644 index 00000000..5c4358be --- /dev/null +++ b/docker/spack-rocm.yaml @@ -0,0 +1,290 @@ +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 + + view: false + + include: + - ../defaults.yaml + - ../versions.yaml + + compilers: + - compiler: + spec: gcc@13.3.0 + operating_system: ubuntu24.04 + target: x86_64 + paths: + cc: /usr/bin/gcc-13 + cxx: /usr/bin/g++-13 + f77: /usr/bin/gfortran-13 + fc: /usr/bin/gfortran-13 + flags: + cppflags: "-I/usr/include/c++/13" + modules: [] + extra_rpaths: + - /usr/lib/gcc/x86_64-linux-gnu/13 + - compiler: + spec: clang@19 + operating_system: ubuntu24.04 + target: x86_64 + paths: + cc: /opt/rocm-6.4.3/llvm/bin/clang + cxx: /opt/rocm-6.4.3/llvm/bin/clang++ + f77: /usr/bin/gfortran-13 + fc: /usr/bin/gfortran-13 + modules: [] + extra_rpaths: [] + + packages: + all: + target: [x86_64] + providers: + blas: [netlib-lapack] + lapack: [netlib-lapack] + mpi: [mpich] + + # ROCm + llvm-amdgpu: + buildable: false + externals: + - spec: llvm-amdgpu@6.4.3 + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/amdclang + cxx: /usr/bin/amdclang++ + hip: + buildable: false + externals: + - spec: hip@6.4.3 + prefix: /opt/rocm-6.4.3 + rocprim: + buildable: false + externals: + - spec: rocprim@6.4.3 + prefix: /opt/rocm-6.4.3 + rocsparse: + buildable: false + externals: + - spec: rocsparse@6.4.3 + prefix: /opt/rocm-6.4.3 + roctracer: + buildable: false + externals: + - spec: roctracer@6.4.3 + prefix: /opt/rocm-6.4.3 + rocblas: + buildable: false + externals: + - spec: rocblas@6.4.3 + prefix: /opt/rocm-6.4.3 + rocrand: + buildable: false + externals: + - spec: rocrand@6.4.3 + prefix: /opt/rocm-6.4.3 + rocsolver: + buildable: false + externals: + - spec: rocsolver@6.4.3 + prefix: /opt/rocm-6.4.3 + rocthrust: + buildable: false + externals: + - spec: rocthrust@6.4.3 + prefix: /opt/rocm-6.4.3 + hipblas: + buildable: false + externals: + - spec: hipblas@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + hipsparse: + buildable: false + externals: + - spec: hipsparse@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + hipfft: + buildable: false + externals: + - spec: hipfft@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + hipsolver: + buildable: false + externals: + - spec: hipsolver@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + hiprand: + buildable: false + externals: + - spec: hiprand@6.4.3 +rocm + prefix: /opt/rocm-6.4.3 + rocm-device-libs: + buildable: false + externals: + - spec: rocm-device-libs@6.4.3 + prefix: /opt/rocm-6.4.3 + hsa-rocr-dev: + buildable: false + externals: + - spec: hsa-rocr-dev@6.4.3 + prefix: /opt/rocm-6.4.3 + + # External packages + gcc: + version: [13.3.0] + buildable: false + externals: + - spec: gcc@13.3.0 languages:='c,c++,fortran' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/gcc + cxx: /usr/bin/g++ + fortran: /usr/bin/gfortran + gcc-runtime: + version: [13.3.0] + buildable: false + externals: + - spec: gcc-runtime@13.3.0 + prefix: /usr + mpich: + version: [4.2.0] + buildable: false + externals: + - spec: mpich@4.2.0%gcc + prefix: /opt/mpich-system + cmake: + version: [3.28.6] + buildable: false + externals: + - spec: cmake@3.28.6 + prefix: /usr/local + 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 + 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 + 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 + 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: false + externals: + - spec: pugixml@1.13.0 + prefix: /usr + gmake: + buildable: false + externals: + - spec: gmake@4.4.1 + prefix: /usr diff --git a/docker/stanford-spack.yaml b/docker/stanford-spack.yaml index f8b43a32..0c7d8432 100644 --- a/docker/stanford-spack.yaml +++ b/docker/stanford-spack.yaml @@ -18,32 +18,24 @@ spack: - ../defaults.yaml - ../versions.yaml - compilers:: - # Sherlock CPU/GPU Compiler (centos7 x86_64) - - compiler: - spec: gcc@10.1.0 - operating_system: centos7 - target: x86_64 - paths: - cc: /share/software/user/open/gcc/10.1.0/bin/gcc - cxx: /share/software/user/open/gcc/10.1.0/bin/g++ - f77: /share/software/user/open/gcc/10.1.0/bin/gfortran - fc: /share/software/user/open/gcc/10.1.0/bin/gfortran - flags: - cflags: -pthread - cxxflags: -pthread - modules: [] - extra_rpaths: [] - packages: all: target: [x86_64] - compiler: [gcc] providers: mpi: [openmpi] blas: [openblas] lapack: [openblas] + gcc: + externals: + - spec: gcc@10.5.0 languages:='c,c++,fortran' + prefix: /share/software/user/open/gcc/10.1.0 + extra_attributes: + compilers: + c: /share/software/user/open/gcc/10.1.0/bin/gcc + cxx: /share/software/user/open/gcc/10.1.0/bin/g++ + fortran: /share/software/user/open/gcc/10.1.0/bin/gfortran + autoconf: buildable: false externals: diff --git a/docker/tpl-centos-gcc-cuda.Dockerfile b/docker/tpl-centos-gcc-cuda.Dockerfile index f99c9f19..a81e36bf 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 \ @@ -49,6 +49,15 @@ RUN yum -y install \ unzip \ bzip2 \ gnupg \ + tbb-devel \ + make \ + bc \ + file \ + patch \ + ca-certificates \ + autoconf \ + automake \ + git \ && pip3 install virtualenv # Install clingo for Spack @@ -62,17 +71,6 @@ FROM tpl_toolchain_intersect_geosx_toolchain AS tpl_toolchain ARG SRC_DIR ARG BLD_DIR -RUN yum install -y \ - tbb-devel \ - make \ - bc \ - file \ - patch \ - ca-certificates \ - autoconf \ - automake \ - git - # Run uberenv # Have to create install directory first for uberenv # -k flag is to ignore SSL errors @@ -81,8 +79,8 @@ RUN --mount=src=.,dst=$SRC_DIR,readwrite cd ${SRC_DIR} && \ # Create symlink to openmpi include directory ln -s /usr/include/openmpi-x86_64 /usr/lib64/openmpi/include && \ ./scripts/uberenv/uberenv.py \ - --spec "%gcc@8+cuda~uncrustify~openmp~pygeosx cuda_arch=70 ^cuda@11.8.0+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ - --spack-env-file=${SRC_DIR}/docker/spack.yaml \ + --spec "+cuda~uncrustify~openmp~pygeosx cuda_arch=70 %c,cxx,fortran=gcc@8 ^cuda@11.8.0+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ + --spack-env-file=${SRC_DIR}/docker/centos-spack.yaml \ --project-json=.uberenv_config.json \ --prefix ${GEOSX_TPL_DIR} \ -k && \ diff --git a/docker/tpl-rockylinux-clang-cuda-12.Dockerfile b/docker/tpl-rockylinux-clang-cuda-12.Dockerfile index bffe8879..2ee4e676 100644 --- a/docker/tpl-rockylinux-clang-cuda-12.Dockerfile +++ b/docker/tpl-rockylinux-clang-cuda-12.Dockerfile @@ -13,7 +13,7 @@ ENV GEOSX_TPL_DIR=$INSTALL_DIR RUN dnf clean all && \ dnf -y update && \ dnf -y install \ - which \ + which \ clang-17.0.6 \ gcc-gfortran \ python3 \ @@ -70,7 +70,7 @@ RUN --mount=src=.,dst=$SRC_DIR,readwrite cd ${SRC_DIR} && \ ln -s /usr/lib64/libblas.so.3 /usr/lib64/libblas.so && \ ln -s /usr/lib64/liblapack.so.3 /usr/lib64/liblapack.so && \ ./scripts/uberenv/uberenv.py \ - --spec "%clang@17.0.6+cuda~uncrustify~openmp~pygeosx cuda_arch=70 ^cuda@12.9.1+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ + --spec "+cuda~uncrustify~openmp~pygeosx cuda_arch=70 %c,cxx=clang@17.0.6 ^cuda@12.9.1+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ --spack-env-file=${SRC_DIR}/docker/rocky-spack.yaml \ --project-json=.uberenv_config.json \ --prefix ${GEOSX_TPL_DIR} \ diff --git a/docker/tpl-rockylinux-gcc-cuda-12.Dockerfile b/docker/tpl-rockylinux-gcc-cuda-12.Dockerfile index faf56712..2ec1b39e 100644 --- a/docker/tpl-rockylinux-gcc-cuda-12.Dockerfile +++ b/docker/tpl-rockylinux-gcc-cuda-12.Dockerfile @@ -67,7 +67,7 @@ RUN --mount=src=.,dst=$SRC_DIR,readwrite cd ${SRC_DIR} && \ ln -s /usr/lib64/libblas.so.3 /usr/lib64/libblas.so && \ ln -s /usr/lib64/liblapack.so.3 /usr/lib64/liblapack.so && \ ./scripts/uberenv/uberenv.py \ - --spec "%gcc@13.3.1+cuda~uncrustify~openmp~pygeosx cuda_arch=70 ^cuda@12.9.1+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ + --spec "+cuda~uncrustify~openmp~pygeosx cuda_arch=70 %c,cxx,fortran=gcc@13.3.1 ^cuda@12.9.1+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ --spack-env-file=${SRC_DIR}/docker/rocky-spack.yaml \ --project-json=.uberenv_config.json \ --prefix ${GEOSX_TPL_DIR} \ diff --git a/docker/tpl-ubuntu-clang-cuda.Dockerfile b/docker/tpl-ubuntu-clang-cuda.Dockerfile index 0fe92b43..765f6d41 100644 --- a/docker/tpl-ubuntu-clang-cuda.Dockerfile +++ b/docker/tpl-ubuntu-clang-cuda.Dockerfile @@ -62,8 +62,8 @@ RUN apt-get install -y --no-install-recommends \ RUN --mount=src=.,dst=$SRC_DIR,readwrite cd ${SRC_DIR} && \ mkdir -p ${GEOSX_TPL_DIR} && \ ./scripts/uberenv/uberenv.py \ - --spec "%clang@10+cuda~uncrustify~openmp~pygeosx cuda_arch=70 ^cuda@11.8.0+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ - --spack-env-file=${SRC_DIR}/docker/spack.yaml \ + --spec "+cuda~uncrustify~openmp~pygeosx cuda_arch=70 %c,cxx,fortran=clang@10 ^cuda@11.8.0+allow-unsupported-compilers ^caliper~gotcha~sampler~libunwind~libdw~papi" \ + --spack-env-file=${SRC_DIR}/docker/ubuntu-spack.yaml \ --project-json=.uberenv_config.json \ --prefix ${GEOSX_TPL_DIR} \ -k && \ diff --git a/docker/tpl-ubuntu-clang.Dockerfile b/docker/tpl-ubuntu-clang.Dockerfile index 55094101..1e899af9 100644 --- a/docker/tpl-ubuntu-clang.Dockerfile +++ b/docker/tpl-ubuntu-clang.Dockerfile @@ -74,8 +74,8 @@ RUN apt-get install -y --no-install-recommends \ RUN --mount=src=.,dst=$SRC_DIR,readwrite cd ${SRC_DIR} && \ mkdir -p ${GEOSX_TPL_DIR} && \ ./scripts/uberenv/uberenv.py \ - --spec "%clang@${CLANG_MAJOR_VERSION} ~shared~openmp+docs ^caliper~gotcha~sampler~libunwind~libdw~papi" \ - --spack-env-file=${SRC_DIR}/docker/spack.yaml \ + --spec "~shared~openmp+docs %c,cxx=clang@${CLANG_MAJOR_VERSION} ^caliper~gotcha~sampler~libunwind~libdw~papi" \ + --spack-env-file=${SRC_DIR}/docker/ubuntu-spack.yaml \ --project-json=.uberenv_config.json \ --prefix ${GEOSX_TPL_DIR} \ -k && \ diff --git a/docker/tpl-ubuntu-gcc-hip.Dockerfile b/docker/tpl-ubuntu-gcc-hip.Dockerfile new file mode 100644 index 00000000..2190f50b --- /dev/null +++ b/docker/tpl-ubuntu-gcc-hip.Dockerfile @@ -0,0 +1,162 @@ +# 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 GCC_MAJOR_VERSION=13 +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 \ + libtbb12 \ + libtbbmalloc2 \ + libblas-dev \ + libz3-dev \ + zlib1g-dev \ + libmpich-dev \ + mpich \ + 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 \ + 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 + +# Hack for spack to see Ubuntu's mpich in a standard prefix layout +RUN mkdir -p /opt/mpich-system/bin /opt/mpich-system/include /opt/mpich-system/lib && \ + ln -s /usr/bin/mpicc /opt/mpich-system/bin/mpicc && \ + ln -s /usr/bin/mpicxx /opt/mpich-system/bin/mpicxx && \ + ln -s /usr/bin/mpif90 /opt/mpich-system/bin/mpif90 && \ + ln -s /usr/bin/mpifort /opt/mpich-system/bin/mpifort && \ + ln -s /usr/bin/mpirun /opt/mpich-system/bin/mpirun && \ + ln -s /usr/lib/x86_64-linux-gnu/mpich/include/* /opt/mpich-system/include/ && \ + ln -s /usr/lib/x86_64-linux-gnu/mpich/lib/* /opt/mpich-system/lib/ + +# 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 \ + 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~vtk amdgpu_target=${AMDGPU_TARGET} %c,cxx,fortran=gcc@13.3.0 ^mpich@4.2.0 ^caliper~papi" \ + --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} \ No newline at end of file diff --git a/docker/tpl-ubuntu-gcc.Dockerfile b/docker/tpl-ubuntu-gcc.Dockerfile index 736ca370..a0aa9952 100644 --- a/docker/tpl-ubuntu-gcc.Dockerfile +++ b/docker/tpl-ubuntu-gcc.Dockerfile @@ -5,8 +5,7 @@ ARG BLD_DIR=$TMP_DIR/build # Defining the building toolchain that are common to both GEOSX and its TPLs. # The docker base image could be any version of ubuntu/debian (as long as package names are unchanged). -ARG DOCKER_ROOT_IMAGE - +ARG DOCKER_ROOT_IMAGE=ubuntu:24.04 FROM $DOCKER_ROOT_IMAGE AS tpl_toolchain_intersect_geosx_toolchain ARG SRC_DIR @@ -25,7 +24,12 @@ ENV GEOSX_TPL_DIR=$INSTALL_DIR # The GCC_MAJOR_VERSION argument is here to parametrise (--build-arg) the build from the `docker build` command line. # Note that docker seems to forget about the ARGs after each FROM statement. # This is why we repeat it below. -ARG GCC_MAJOR_VERSION +ARG GCC_MAJOR_VERSION=12 +ENV GCC_MAJOR_VERSION=${GCC_MAJOR_VERSION} + +# Allow changing the number of cores used for building code via spack +ARG SPACK_BUILD_JOBS=4 +ENV SPACK_BUILD_JOBS=${SPACK_BUILD_JOBS} # Do not apt-get upgrade (ask the maintainer if you really think something should be upgraded) RUN apt-get update @@ -65,6 +69,16 @@ RUN DEBIAN_FRONTEND=noninteractive TZ=America/Los_Angeles \ lbzip2 \ bzip2 \ gnupg \ +# `ca-certificates` needed by `git` to download spack repo. + ca-certificates \ + git \ + libtbb-dev \ + make \ + bc \ + file \ + patch \ + bison \ + flex \ virtualenv # Install clingo for Spack @@ -91,19 +105,7 @@ ARG BLD_DIR # This is the version from the `docker build` command line. # It is repeated because docker forgets about the ARGs after FROM statements. -ARG GCC_MAJOR_VERSION - -RUN apt-get install -y --no-install-recommends \ - libtbb-dev \ - make \ - bc \ - file \ -# GEOS patches some tpl. Remove when it's not the case anymore. - patch \ -# `ca-certificates` needed by `git` to download spack repo. - ca-certificates \ - git - +# ARG GCC_MAJOR_VERSION # Run uberenv # Have to create install directory first for uberenv @@ -111,8 +113,9 @@ RUN apt-get install -y --no-install-recommends \ RUN --mount=src=.,dst=$SRC_DIR,readwrite cd ${SRC_DIR} && \ mkdir -p ${GEOSX_TPL_DIR} && \ ./scripts/uberenv/uberenv.py \ - --spec "%gcc@${GCC_MAJOR_VERSION} ~pygeosx +docs" \ - --spack-env-file=${SRC_DIR}/docker/spack.yaml \ + --spec "~pygeosx +docs %c,cxx,fortran=gcc@${GCC_MAJOR_VERSION}" \ + --spack-debug \ + --spack-env-file=${SRC_DIR}/docker/ubuntu-spack.yaml \ --project-json=${SRC_DIR}/.uberenv_config.json \ --prefix ${GEOSX_TPL_DIR} \ -k && \ diff --git a/docker/spack.yaml b/docker/ubuntu-spack.yaml similarity index 56% rename from docker/spack.yaml rename to docker/ubuntu-spack.yaml index 463e8ead..f431eb87 100644 --- a/docker/spack.yaml +++ b/docker/ubuntu-spack.yaml @@ -17,112 +17,66 @@ spack: - ../defaults.yaml - ../versions.yaml - - compilers:: - - compiler: - extra_rpaths: [] - flags: {} - modules: [] - operating_system: ubuntu22.04 - paths: - cc: /usr/bin/clang-15 - cxx: /usr/bin/clang++-15 - f77: /usr/bin/gfortran-11 - fc: /usr/bin/gfortran-11 - spec: clang@15 - target: x86_64 - - compiler: - extra_rpaths: [] - flags: {} - modules: [] - operating_system: ubuntu20.04 - paths: - cc: /usr/bin/clang - cxx: /usr/bin/clang++ - f77: /usr/bin/gfortran - fc: /usr/bin/gfortran - spec: clang@10 - target: x86_64 - - compiler: - extra_rpaths: [] - flags: - cflags: -pthread - cxxflags: -pthread - modules: [] - operating_system: ubuntu22.04 - paths: - cc: /usr/bin/gcc-12 - cxx: /usr/bin/g++-12 - f77: /usr/bin/gfortran-12 - fc: /usr/bin/gfortran-12 - spec: gcc@12 - target: x86_64 - - compiler: - extra_rpaths: [] - flags: - cflags: -pthread - cxxflags: -pthread - modules: [] - operating_system: ubuntu22.04 - paths: - cc: /usr/bin/gcc-11 - cxx: /usr/bin/g++-11 - f77: /usr/bin/gfortran-11 - fc: /usr/bin/gfortran-11 - spec: gcc@11 - target: x86_64 - - compiler: - extra_rpaths: [] - flags: - cflags: -pthread - cxxflags: -pthread - modules: [] - operating_system: ubuntu20.04 - paths: - cc: /usr/bin/gcc-10 - cxx: /usr/bin/g++-10 - f77: /usr/bin/gfortran-10 - fc: /usr/bin/gfortran-10 - spec: gcc@10 - target: x86_64 - - compiler: - extra_rpaths: [] - flags: - cflags: -pthread - cxxflags: -pthread - modules: [] - operating_system: ubuntu20.04 - paths: - cc: /usr/bin/gcc-9 - cxx: /usr/bin/g++-9 - f77: /usr/bin/gfortran-9 - fc: /usr/bin/gfortran-9 - spec: gcc@9 - target: x86_64 - - compiler: - extra_rpaths: [] - flags: - cflags: -pthread - cxxflags: -pthread - modules: [] - operating_system: centos7 - paths: - cc: /opt/rh/devtoolset-8/root/usr/bin/gcc - cxx: /opt/rh/devtoolset-8/root/usr/bin/g++ - f77: /opt/rh/devtoolset-8/root/usr/bin/gfortran - fc: /opt/rh/devtoolset-8/root/usr/bin/gfortran - spec: gcc@8 - target: x86_64 - packages: all: target: [x86_64] - compiler: [gcc, clang] providers: blas: [netlib-lapack] lapack: [netlib-lapack] mpi: [openmpi] + 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 + clang: + externals: + - spec: clang@10.0.0 languages:='c,c++' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang-10 + cxx: /usr/bin/clang++-10 + - spec: clang@15.0.7 languages:='c,c++' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang-15 + cxx: /usr/bin/clang++-15 + autoconf: version: [2.71] buildable: false @@ -192,6 +146,11 @@ spack: prefix: /usr - spec: openmpi@4.1.2%gcc@12 prefix: /usr + hwloc: + buildable: false + externals: + - spec: hwloc@2.7.0 + prefix: /usr perl: buildable: false externals: @@ -237,3 +196,18 @@ spack: externals: - spec: zlib@1.2.11 prefix: /usr + doxygen: + buildable: false + externals: + - spec: doxygen@1.9.1 + prefix: /usr + bison: + buildable: false + externals: + - spec: bison@3.8.2 + prefix: /usr + flex: + buildable: false + externals: + - spec: flex@2.6.4 + prefix: /usr diff --git a/scripts/spack_configs/versions.yaml b/scripts/spack_configs/versions.yaml index 37052ab1..56cd666c 100644 --- a/scripts/spack_configs/versions.yaml +++ b/scripts/spack_configs/versions.yaml @@ -11,40 +11,40 @@ #------------------------------------------------------------------------------------------------------------ # -# This file lists the package versions for geos's dependencies +# This file lists the package versions for geos' dependencies # packages: - # v0.6.2 + # v0.7.1 - 09/04/25 blt: - require: "@git.9ff77344f0b2a6ee345e452bddd6bfd46cbbfa35=develop" + require: "@git.e783e30f2823ee1a208f7f90741b41c1f5a08063=develop" - # master - 06/27/25 + # master - 08/22/25 hypre: - require: "@git.907a2d07b64fe47bdde4540c54665c83ced83a2c" + require: "@git.4dd96d0e83088890879612c58364f6c10756ed90" - # v2025.0.3.0 + # v2025.09.1 chai: - require: "@git.4b9060b18b9bec1167026cfb3132bd540c4bd56b=develop" + require: "@git.51e66b8a5a6caac41aa329c8643180b8e2b33e5f=develop" - # v2025.0.3.0 + # v2025.09.0 umpire: - require: "@git.1ed0669c57f041baa1f1070693991c3a7a43e7ee=develop" + require: "@git.6b0ea9edbbbc741c8a429768d946549cd3bd7d33=develop" - # v2025.0.3.0 + # 2025.09.0 raja: - require: "@git.1d70abf171474d331f1409908bdf1b1c3fe19222=develop" + require: "@git.ca756788dbdd43fec2a3840389126ae94a905d5f=develop" - # v2025.0.3.0 + # v2025.09.2 camp: - require: "@git.ee0a3069a7ae72da8bcea63c06260fad34901d43=main" + require: "@git.4070ce93a802849d61037310a87c50cc24c9e498=main" - # v2.12.0 + # v2.13.1 - 07/15/25 caliper: - require: "@git.287b7f3ad2d12f520aad04268d44f353cd05403c" + require: "@git.837eee499940d6927d0d18e063c9160f5e431cfe=master" - # v0.9.2 + # v0.9.5 - 09/10/25 conduit: - require: "@git.ad86e316ad56a75c099d30ca5ce75cff275b5924=develop" + require: "@git.8543892a582737eb5941b1e90df068a75543df92=develop" # master - 04/12/20 uncrustify: diff --git a/scripts/spack_packages/packages/camp/package.py b/scripts/spack_packages/packages/camp/package.py new file mode 100644 index 00000000..b9fc471c --- /dev/null +++ b/scripts/spack_packages/packages/camp/package.py @@ -0,0 +1,158 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +# GEOSX_EDIT_START +# Victor: This is adapted from the radius-spack-configs GitHub repo. +# We're using this since the new 2025.09 packages suite has not been upstreamed to spack yet. +# See PR: https://github.com/LLNL/radiuss-spack-configs/pull/143 +# +# TODO: Delete this file after the new 2025.09 suite becomes available on spack_packages +# +# GEOSX_EDIT_END +# yapf: disable + +from spack_repo.builtin.build_systems.cached_cmake import cmake_cache_string +from spack_repo.builtin.build_systems.cmake import CMakePackage +from spack_repo.builtin.build_systems.cuda import CudaPackage +from spack_repo.builtin.build_systems.rocm import ROCmPackage + +from spack.package import * + + +class Camp(CMakePackage, CudaPackage, ROCmPackage): + """ + Compiler agnostic metaprogramming library providing concepts, + type operations and tuples for C++ and cuda + """ + + homepage = "https://github.com/LLNL/camp" + git = "https://github.com/LLNL/camp.git" + url = "https://github.com/LLNL/camp/archive/v0.1.0.tar.gz" + + maintainers("adrienbernede", "kab163", "trws") + + license("BSD-3-Clause") + + version("main", branch="main", submodules=False) + version( + "2025.09.2", + tag="v2025.09.2", + commit="4070ce93a802849d61037310a87c50cc24c9e498", + submodules=False, + ) + version( + "2025.09.0", + tag="v2025.09.0", + commit="b642f29b9d0eee9113bea2791958c29243063e5c", + submodules=False, + ) + version( + "2025.03.0", + tag="v2025.03.0", + commit="ee0a3069a7ae72da8bcea63c06260fad34901d43", + submodules=False, + ) + version( + "2024.07.0", + tag="v2024.07.0", + commit="0f07de4240c42e0b38a8d872a20440cb4b33d9f5", + submodules=False, + ) + version( + "2024.02.1", + tag="v2024.02.1", + commit="79c320fa09db987923b56884afdc9f82f4b70fc4", + submodules=False, + ) + version( + "2024.02.0", + tag="v2024.02.0", + commit="03c80a6c6ab4f97e76a52639563daec71435a277", + submodules=False, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="ac34c25b722a06b138bc045d38bfa5e8fa3ec9c5", + submodules=False, + ) + version("2022.10.1", sha256="2d12f1a46f5a6d01880fc075cfbd332e2cf296816a7c1aa12d4ee5644d386f02") + version("2022.10.0", sha256="3561c3ef00bbcb61fe3183c53d49b110e54910f47e7fc689ad9ccce57e55d6b8") + version("2022.03.2", sha256="bc4aaeacfe8f2912e28f7a36fc731ab9e481bee15f2c6daf0cb208eed3f201eb") + version("2022.03.0", sha256="e9090d5ee191ea3a8e36b47a8fe78f3ac95d51804f1d986d931e85b8f8dad721") + version("0.3.0", sha256="129431a049ca5825443038ad5a37a86ba6d09b2618d5fe65d35f83136575afdb") + version("0.2.3", sha256="58a0f3bd5eadb588d7dc83f3d050aff8c8db639fc89e8d6553f9ce34fc2421a7") + version("0.2.2", sha256="194d38b57e50e3494482a7f94940b27f37a2bee8291f2574d64db342b981d819") + version("0.1.0", sha256="fd4f0f2a60b82a12a1d9f943f8893dc6fe770db493f8fae5ef6f7d0c439bebcc") + + depends_on("c", type="build") + depends_on("cxx", type="build") + + # TODO: figure out gtest dependency and then set this default True. + variant("tests", default=False, description="Build tests") + variant("openmp", default=False, description="Build with OpenMP support") + variant("omptarget", default=False, description="Build with OpenMP Target support") + variant("sycl", default=False, description="Build with Sycl support") + + with when("+cuda"): + depends_on("cub", when="^cuda@:10") + + depends_on("blt", type="build") + 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("blt@0.6.2:", type="build", when="@2024.02.1:") + depends_on("blt@0.6.1", type="build", when="@2024.02.0") + depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0:2023.06.0") + + #patch("libstdc++-13-missing-header.patch", when="@:2022.10") + #patch("camp-rocm6.patch", when="@0.2.3 +rocm ^hip@6:") + + conflicts("^blt@:0.3.6", when="+rocm") + + conflicts("+omptarget +rocm") + conflicts("+sycl +omptarget") + conflicts("+sycl +rocm") + conflicts( + "+sycl", + when="@:2024.02.99", + msg="Support for SYCL was introduced in RAJA after 2024.02 release, " + "please use a newer release.", + ) + + def cmake_args(self): + spec = self.spec + + options = [] + + options.append("-DBLT_SOURCE_DIR={0}".format(spec["blt"].prefix)) + + options.append(self.define_from_variant("ENABLE_CUDA", "cuda")) + if spec.satisfies("+cuda"): + options.append("-DCUDA_TOOLKIT_ROOT_DIR={0}".format(spec["cuda"].prefix)) + + if not spec.satisfies("cuda_arch=none"): + cuda_arch = spec.variants["cuda_arch"].value + options.append("-DCMAKE_CUDA_ARCHITECTURES={0}".format(cuda_arch[0])) + options.append("-DCUDA_ARCH=sm_{0}".format(cuda_arch[0])) + flag = "-arch sm_{0}".format(cuda_arch[0]) + options.append("-DCMAKE_CUDA_FLAGS:STRING={0}".format(flag)) + + options.append(self.define_from_variant("ENABLE_HIP", "rocm")) + if spec.satisfies("+rocm"): + options.append("-DHIP_ROOT_DIR={0}".format(spec["hip"].prefix)) + + archs = ";".join(self.spec.variants["amdgpu_target"].value) + options.append("-DCMAKE_HIP_ARCHITECTURES={0}".format(archs)) + options.append("-DGPU_TARGETS={0}".format(archs)) + options.append("-DAMDGPU_TARGETS={0}".format(archs)) + + if spec.satisfies("+omptarget"): + options.append(cmake_cache_string("RAJA_DATA_ALIGN", 64)) + + options.append(self.define_from_variant("ENABLE_TESTS", "tests")) + options.append(self.define_from_variant("ENABLE_OPENMP", "openmp")) + options.append(self.define_from_variant("CAMP_ENABLE_TARGET_OPENMP", "omptarget")) + options.append(self.define_from_variant("ENABLE_SYCL", "sycl")) + + return options diff --git a/scripts/spack_packages/packages/camp/radiuss-package.py b/scripts/spack_packages/packages/camp/radiuss-package.py new file mode 100644 index 00000000..195e3ec2 --- /dev/null +++ b/scripts/spack_packages/packages/camp/radiuss-package.py @@ -0,0 +1,220 @@ +# Copyright 2013-2025 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import glob +import re + +from os.path import dirname + +from spack.package import * +from spack.util.executable import which_string + + +def spec_uses_toolchain(spec): + gcc_toolchain_regex = re.compile(".*gcc-toolchain.*") + using_toolchain = list(filter(gcc_toolchain_regex.match, spec.compiler_flags["cxxflags"])) + return using_toolchain + +def spec_uses_gccname(spec): + gcc_name_regex = re.compile(".*gcc-name.*") + using_gcc_name = list(filter(gcc_name_regex.match, spec.compiler_flags["cxxflags"])) + return using_gcc_name + +def hip_for_radiuss_projects(options, spec, compiler): + # adrienbernede-22-11: + # Specific to Umpire, attempt port to RAJA and CHAI + rocm_root = dirname(spec["llvm-amdgpu"].prefix) + hip_link_flags = "" + if spec_uses_toolchain(spec): + gcc_prefix = spec_uses_toolchain(spec)[0] + options.append(cmake_cache_string("HIP_CLANG_FLAGS", "--gcc-toolchain={0}".format(gcc_prefix))) + options.append(cmake_cache_string("CMAKE_EXE_LINKER_FLAGS", hip_link_flags + " -Wl,-rpath={0}/lib64".format(gcc_prefix))) + else: + options.append(cmake_cache_string("CMAKE_EXE_LINKER_FLAGS", "-Wl,-rpath={0}/llvm/lib/".format(rocm_root))) + +def cuda_for_radiuss_projects(options, spec): + # Here is what is typically needed for radiuss projects when building with cuda + + # CUDA_FLAGS + cuda_flags = [] + + if not spec.satisfies("cuda_arch=none"): + cuda_archs = ";".join(spec.variants["cuda_arch"].value) + options.append(cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", cuda_archs)) + + if spec_uses_toolchain(spec): + cuda_flags.append("-Xcompiler {}".format(spec_uses_toolchain(spec)[0])) + + if spec.satisfies("target=ppc64le %gcc@8.1:"): + cuda_flags.append("-Xcompiler -mno-float128") + + options.append(cmake_cache_string("CMAKE_CUDA_FLAGS", " ".join(cuda_flags))) + +def mpi_for_radiuss_projects(options, spec, env): + + if spec["mpi"].name == "spectrum-mpi" and spec.satisfies("^blt"): + options.append(cmake_cache_string("BLT_MPI_COMMAND_APPEND", "mpibind")) + + sys_type = spec.architecture + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + # Replace /usr/bin/srun path with srun flux wrapper path on TOSS 4 + # TODO: Remove this logic by adding `using_flux` case in + # spack/lib/spack/spack/build_systems/cached_cmake.py:196 and remove hard-coded + # path to srun in same file. + if "toss_4" in sys_type: + srun_wrapper = which_string("srun") + mpi_exec_index = [ + index for index, entry in enumerate(options) if "MPIEXEC_EXECUTABLE" in entry + ] + if len(mpi_exec_index) > 0: + del options[mpi_exec_index[0]] + mpi_exec_flag_index = [ + index for index, entry in enumerate(options) if "MPIEXEC_NUMPROC_FLAG" in entry + ] + if len(mpi_exec_flag_index) > 0: + del options[mpi_exec_flag_index[0]] + options.append(cmake_cache_path("MPIEXEC_EXECUTABLE", srun_wrapper)) + options.append(cmake_cache_string("MPIEXEC_NUMPROC_FLAG", "-n")) + + +class Camp(CMakePackage, CudaPackage, ROCmPackage): + """ + Compiler agnostic metaprogramming library providing concepts, + type operations and tuples for C++ and cuda + """ + + homepage = "https://github.com/LLNL/camp" + git = "https://github.com/LLNL/camp.git" + url = "https://github.com/LLNL/camp/archive/v0.1.0.tar.gz" + + maintainers("adrienbernede", "kab163", "trws") + + license("BSD-3-Clause") + + version("main", branch="main", submodules=False) + version( + "2025.09.2", + tag="v2025.09.2", + commit="4070ce93a802849d61037310a87c50cc24c9e498", + submodules=False, + ) + version( + "2025.09.0", + tag="v2025.09.0", + commit="b642f29b9d0eee9113bea2791958c29243063e5c", + submodules=False, + ) + version( + "2025.03.0", + tag="v2025.03.0", + commit="ee0a3069a7ae72da8bcea63c06260fad34901d43", + submodules=False, + ) + version( + "2024.07.0", + tag="v2024.07.0", + commit="0f07de4240c42e0b38a8d872a20440cb4b33d9f5", + submodules=False, + ) + version( + "2024.02.1", + tag="v2024.02.1", + commit="79c320fa09db987923b56884afdc9f82f4b70fc4", + submodules=False, + ) + version( + "2024.02.0", + tag="v2024.02.0", + commit="03c80a6c6ab4f97e76a52639563daec71435a277", + submodules=False, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="ac34c25b722a06b138bc045d38bfa5e8fa3ec9c5", + submodules=False, + ) + version("2022.10.1", sha256="2d12f1a46f5a6d01880fc075cfbd332e2cf296816a7c1aa12d4ee5644d386f02") + version("2022.10.0", sha256="3561c3ef00bbcb61fe3183c53d49b110e54910f47e7fc689ad9ccce57e55d6b8") + version("2022.03.2", sha256="bc4aaeacfe8f2912e28f7a36fc731ab9e481bee15f2c6daf0cb208eed3f201eb") + version("2022.03.0", sha256="e9090d5ee191ea3a8e36b47a8fe78f3ac95d51804f1d986d931e85b8f8dad721") + version("0.3.0", sha256="129431a049ca5825443038ad5a37a86ba6d09b2618d5fe65d35f83136575afdb") + version("0.2.3", sha256="58a0f3bd5eadb588d7dc83f3d050aff8c8db639fc89e8d6553f9ce34fc2421a7") + version("0.2.2", sha256="194d38b57e50e3494482a7f94940b27f37a2bee8291f2574d64db342b981d819") + version("0.1.0", sha256="fd4f0f2a60b82a12a1d9f943f8893dc6fe770db493f8fae5ef6f7d0c439bebcc") + + depends_on("c", type="build") + depends_on("cxx", type="build") + + # TODO: figure out gtest dependency and then set this default True. + variant("tests", default=False, description="Build tests") + variant("openmp", default=False, description="Build with OpenMP support") + variant("omptarget", default=False, description="Build with OpenMP Target support") + variant("sycl", default=False, description="Build with Sycl support") + + with when("+cuda"): + depends_on("cub", when="^cuda@:10") + + depends_on("blt", type="build") + 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("blt@0.6.2:", type="build", when="@2024.02.1:") + depends_on("blt@0.6.1", type="build", when="@2024.02.0") + depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0:2023.06.0") + + patch("libstdc++-13-missing-header.patch", when="@:2022.10") + + patch("camp-rocm6.patch", when="@0.2.3 +rocm ^hip@6:") + + conflicts("^blt@:0.3.6", when="+rocm") + + conflicts("+omptarget +rocm") + conflicts("+sycl +omptarget") + conflicts("+sycl +rocm") + conflicts( + "+sycl", + when="@:2024.02.99", + msg="Support for SYCL was introduced in RAJA after 2024.02 release, " + "please use a newer release.", + ) + + def cmake_args(self): + spec = self.spec + + options = [] + + options.append("-DBLT_SOURCE_DIR={0}".format(spec["blt"].prefix)) + + options.append(self.define_from_variant("ENABLE_CUDA", "cuda")) + if spec.satisfies("+cuda"): + options.append("-DCUDA_TOOLKIT_ROOT_DIR={0}".format(spec["cuda"].prefix)) + + if not spec.satisfies("cuda_arch=none"): + cuda_arch = spec.variants["cuda_arch"].value + options.append("-DCMAKE_CUDA_ARCHITECTURES={0}".format(cuda_arch[0])) + options.append("-DCUDA_ARCH=sm_{0}".format(cuda_arch[0])) + flag = "-arch sm_{0}".format(cuda_arch[0]) + options.append("-DCMAKE_CUDA_FLAGS:STRING={0}".format(flag)) + + options.append(self.define_from_variant("ENABLE_HIP", "rocm")) + if spec.satisfies("+rocm"): + rocm_root = dirname(spec["llvm-amdgpu"].prefix) + options.append("-DROCM_PATH={0}".format(rocm_root)) + + archs = ";".join(self.spec.variants["amdgpu_target"].value) + options.append("-DCMAKE_HIP_ARCHITECTURES={0}".format(archs)) + options.append("-DGPU_TARGETS={0}".format(archs)) + options.append("-DAMDGPU_TARGETS={0}".format(archs)) + + if spec.satisfies("+omptarget"): + options.append(cmake_cache_string("RAJA_DATA_ALIGN", 64)) + + options.append(self.define_from_variant("ENABLE_TESTS", "tests")) + options.append(self.define_from_variant("ENABLE_OPENMP", "openmp")) + options.append(self.define_from_variant("CAMP_ENABLE_TARGET_OPENMP", "omptarget")) + options.append(self.define_from_variant("ENABLE_SYCL", "sycl")) + + return options diff --git a/scripts/spack_packages/packages/chai/package.py b/scripts/spack_packages/packages/chai/package.py new file mode 100644 index 00000000..e25c0314 --- /dev/null +++ b/scripts/spack_packages/packages/chai/package.py @@ -0,0 +1,352 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +# GEOSX_EDIT_START +# Victor: This is adapted from the radius-spack-configs GitHub repo. +# We're using this since the new 2025.09 packages suite has not been upstreamed to spack yet. +# See PR: https://github.com/LLNL/radiuss-spack-configs/pull/143 +# +# TODO: Delete this file after the new 2025.09 suite becomes available on spack_packages +# +# GEOSX_EDIT_END +# yapf: disable + +import socket + +from spack_repo.builtin.build_systems.cached_cmake import ( + CachedCMakePackage, + cmake_cache_option, + cmake_cache_path, + cmake_cache_string, +) +from spack_repo.builtin.build_systems.cuda import CudaPackage +from spack_repo.builtin.build_systems.rocm import ROCmPackage +from spack_repo.builtin.packages.blt.package import llnl_link_helpers + +from spack.package import * + + +class Chai(CachedCMakePackage, CudaPackage, ROCmPackage): + """ + Copy-hiding array interface for data migration between memory spaces + """ + + homepage = "https://github.com/LLNL/CHAI" + git = "https://github.com/LLNL/CHAI.git" + tags = ["ecp", "e4s", "radiuss"] + + maintainers("adayton1", "adrienbernede", "davidbeckingsale", "kab163") + + license("BSD-3-Clause") + + version("develop", branch="develop", submodules=False) + version( + "2025.09.0", + tag="v2025.09.0", + commit="352ae302535d9dc5ba50b77bf508c89fc7500d30", + submodules=False, + ) + version( + "2025.03.0", + tag="v2025.03.0", + commit="79f6414a00a89070054ac97baed47d21d10c83a4", + submodules=False, + ) + version( + "2024.07.0", + tag="v2024.07.0", + commit="df7741f1dbbdc5fff5f7d626151fdf1904e62b19", + submodules=False, + ) + version( + "2024.02.2", + tag="v2024.02.2", + commit="5ba0944d862513f600432c34b009824875df27e5", + submodules=False, + ) + version( + "2024.02.1", + tag="v2024.02.1", + commit="7597134729bd3a38b45b67b4dfbf7f199d8106f3", + submodules=False, + ) + version( + "2024.02.0", + tag="v2024.02.0", + commit="31773a2f0d30f3f64c82939f60fc4da32cf33261", + submodules=False, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="6fe3470ad020303530af2f3dbbfe18826bd3319b", + submodules=False, + ) + version( + "2022.10.0", + tag="v2022.10.0", + commit="9510efd33b06e4443b15447eebb7dad761822654", + submodules=False, + ) + version( + "2022.03.0", + tag="v2022.03.0", + commit="f0b809de1ac194376866b3ac0f5933d4146ec09e", + submodules=False, + ) + version( + "2.4.0", tag="v2.4.0", commit="77d22da28187245a2c5454cf471c0c352bd98ad7", submodules=True + ) + version( + "2.3.0", tag="v2.3.0", commit="42f3fbcc0b966227b40b4467dc919a4c24f07196", submodules=True + ) + version( + "2.2.2", tag="v2.2.2", commit="56e75fc0f805b2746f3992af0c00c474513e3b24", submodules=True + ) + version( + "2.2.1", tag="v2.2.1", commit="c912f583828ea5963850816e3e232cc45608ccf7", submodules=True + ) + version( + "2.2.0", tag="v2.2.0", commit="18536c61a4817db6b3b3025f35e2dd3ae532330c", submodules=True + ) + version( + "2.1.1", tag="v2.1.1", commit="496911e00d15c350560860f7964cd5fb5ab7f515", submodules=True + ) + version( + "2.1.0", tag="v2.1.0", commit="fff02768068a64970b34760a1041585319edee87", submodules=True + ) + version( + "2.0.0", tag="v2.0.0", commit="63139cf45443b1266950826b165e042c7679b557", submodules=True + ) + version( + "1.2.0", tag="v1.2.0", commit="7bb5bc12e4508db45910d8e2b98444687da7ebf6", submodules=True + ) + version( + "1.1.0", tag="v1.1.0", commit="907d5f40d653a73955387067799913397807adf3", submodules=True + ) + version("1.0", tag="v1.0", commit="501a098ad879dc8deb4a74fcfe8c08c283a10627", submodules=True) + + depends_on("c", type="build") + depends_on("cxx", type="build") + + # Patching Umpire for dual BLT targets import changed MPI target name in Umpire link interface + # We propagate the patch here. + #patch("change_mpi_target_name_umpire_patch.patch", when="@2022.10.0:2023.06.0") + + variant("enable_pick", default=False, when="@:2024", description="Enable pick method") + variant( + "separable_compilation", + default=True, + description="Build with CUDA_SEPARABLE_COMPILATION flag on ", + ) + variant("shared", default=True, description="Build Shared Libs") + variant("mpi", default=False, description="Enable MPI support") + variant("raja", default=False, description="Build plugin for RAJA") + variant("examples", default=True, description="Build examples.") + variant("openmp", default=False, description="Build using OpenMP") + # TODO: figure out gtest dependency and then set this default True + # and remove the +tests conflict below. + variant( + "tests", + default="none", + values=("none", "basic", "benchmarks"), + multi=False, + description="Tests to run", + ) + + depends_on("cmake", type="build") + depends_on("cmake@3.23:", type="build", when="@2024.07.0:") + depends_on("cmake@3.14:", type="build", when="@2022.03.0:2024.2") + depends_on("cmake@3.9:", type="build", when="+cuda") + depends_on("cmake@3.8:", type="build") + + depends_on("blt", type="build") + 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("blt@0.6.2:", type="build", when="@2024.02.1:") + depends_on("blt@0.6.1", type="build", when="@2024.02.0") + depends_on("blt@0.5.3", type="build", when="@2023.06.0") + depends_on("blt@0.5.2:0.5.3", type="build", when="@2022.10.0") + depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0") + depends_on("blt@0.4.1:0.5.3", type="build", when="@2.4.0") + depends_on("blt@0.4.0:0.5.3", type="build", when="@2.3.0") + depends_on("blt@0.3.6:0.5.3", type="build", when="@:2.2.2") + conflicts("^blt@:0.3.6", when="+rocm") + + depends_on("umpire") + 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") + depends_on("umpire@2024.02.1", when="@2024.02.1") + depends_on("umpire@2024.02.0", when="@2024.02.0") + depends_on("umpire@2023.06.0", when="@2023.06.0") + depends_on("umpire@2022.10.0:2023.06.0", when="@2022.10.0") + depends_on("umpire@2022.03.0:2023.06.0", when="@2022.03.0") + depends_on("umpire@6.0.0", when="@2.4.0") + depends_on("umpire@4.1.2", when="@2.2.0:2.3.0") + + depends_on("umpire+mpi", when="+mpi") + + with when("+cuda"): + depends_on("umpire+cuda") + for sm_ in CudaPackage.cuda_arch_values: + depends_on("umpire+cuda cuda_arch={0}".format(sm_), when="cuda_arch={0}".format(sm_)) + with when("@2024.02.0:"): + depends_on("umpire~fmt_header_only") + + with when("+rocm"): + depends_on("umpire+rocm") + for arch in ROCmPackage.amdgpu_targets: + depends_on( + "umpire+rocm amdgpu_target={0}".format(arch), when="amdgpu_target={0}".format(arch) + ) + + with when("+raja"): + depends_on("raja~openmp", when="~openmp") + depends_on("raja+openmp", when="+openmp") + depends_on("raja@2025.09.0:", when="@2025.09.0:") + depends_on("raja@2025.03.2:", when="@2025.03.1:") + depends_on("raja@2025.03.0:", when="@2025.03.0:") + depends_on("raja@2024.07.0", when="@2024.07.0") + depends_on("raja@2024.02.2", when="@2024.02.2") + depends_on("raja@2024.02.1", when="@2024.02.1") + depends_on("raja@2024.02.0", when="@2024.02.0") + depends_on("raja@2023.06.0", when="@2023.06.0") + depends_on("raja@2022.10.0:2023.06.0", when="@2022.10.0") + depends_on("raja@2022.03.0:2023.06.0", when="@2022.03.0") + depends_on("raja@0.14.0", when="@2.4.0") + depends_on("raja@0.13.0", when="@2.3.0") + depends_on("raja@0.12.0", when="@2.2.0:2.2.2") + + with when("+cuda"): + depends_on("raja+cuda") + for sm_ in CudaPackage.cuda_arch_values: + depends_on("raja+cuda cuda_arch={0}".format(sm_), when="cuda_arch={0}".format(sm_)) + with when("+rocm"): + depends_on("raja+rocm") + for arch in ROCmPackage.amdgpu_targets: + depends_on( + "raja+rocm amdgpu_target={0}".format(arch), + when="amdgpu_target={0}".format(arch), + ) + + depends_on("mpi", when="+mpi") + + def _get_sys_type(self, spec): + sys_type = spec.architecture + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type + + @property + def cache_name(self): + hostname = socket.gethostname() + if "SYS_TYPE" in env: + hostname = hostname.rstrip("1234567890") + return "{0}-{1}-{2}@{3}-{4}.cmake".format( + hostname, + self._get_sys_type(self.spec), + self.spec.compiler.name, + self.spec.compiler.version, + self.spec.dag_hash(8), + ) + + def initconfig_compiler_entries(self): + spec = self.spec + compiler = self.compiler + # Default entries are already defined in CachedCMakePackage, inherit them: + entries = super().initconfig_compiler_entries() + + if spec.satisfies("+rocm ^blt@:0.6"): + entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) + + llnl_link_helpers(entries, spec, compiler) + + return entries + + def initconfig_hardware_entries(self): + spec = self.spec + entries = super().initconfig_hardware_entries() + + entries.append("#------------------{0}".format("-" * 30)) + entries.append("# Package custom hardware settings") + entries.append("#------------------{0}\n".format("-" * 30)) + + if spec.satisfies("+cuda"): + entries.append(cmake_cache_option("ENABLE_CUDA", True)) + if spec.satisfies("+separable_compilation"): + entries.append(cmake_cache_option("CMAKE_CUDA_SEPARABLE_COMPILATION", True)) + entries.append(cmake_cache_option("CUDA_SEPARABLE_COMPILATION", True)) + else: + entries.append(cmake_cache_option("ENABLE_CUDA", False)) + + if spec.satisfies("+rocm"): + entries.append(cmake_cache_option("ENABLE_HIP", True)) + else: + entries.append(cmake_cache_option("ENABLE_HIP", False)) + + return entries + + def initconfig_mpi_entries(self): + spec = self.spec + + entries = super(Chai, self).initconfig_mpi_entries() + entries.append(cmake_cache_option("ENABLE_MPI", spec.satisfies("+mpi"))) + + return entries + + def initconfig_package_entries(self): + spec = self.spec + entries = [] + + option_prefix = "CHAI_" if spec.satisfies("@2022.03.0:") else "" + + # TPL locations + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# TPLs") + entries.append("#------------------{0}\n".format("-" * 60)) + + # - BLT + entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) + + # - RAJA + if spec.satisfies("+raja"): + entries.append(cmake_cache_option("{}ENABLE_RAJA_PLUGIN".format(option_prefix), True)) + entries.append(cmake_cache_path("RAJA_DIR", spec["raja"].prefix)) + else: + entries.append(cmake_cache_option("{}ENABLE_RAJA_PLUGIN".format(option_prefix), False)) + + # - Umpire + entries.append(cmake_cache_path("umpire_DIR", spec["umpire"].prefix)) + + # Build options + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# Build Options") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_string("CMAKE_BUILD_TYPE", spec.variants["build_type"].value)) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", spec.satisfies("+shared"))) + + # Generic options that have a prefixed equivalent in CHAI CMake + entries.append(cmake_cache_option("ENABLE_OPENMP", spec.satisfies("+openmp"))) + entries.append(cmake_cache_option("ENABLE_EXAMPLES", spec.satisfies("+examples"))) + entries.append(cmake_cache_option("ENABLE_DOCS", False)) + if spec.satisfies("tests=benchmarks"): + # BLT requires ENABLE_TESTS=True to enable benchmarks + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", True)) + entries.append(cmake_cache_option("ENABLE_TESTS", True)) + else: + entries.append(cmake_cache_option("ENABLE_TESTS", not spec.satisfies("tests=none"))) + + # Prefixed options that used to be name without one + entries.append( + cmake_cache_option( + "{}ENABLE_PICK".format(option_prefix), spec.satisfies("+enable_pick") + ) + ) + + return entries + + def cmake_args(self): + return [] diff --git a/scripts/spack_packages/packages/chai/radiuss-package.py b/scripts/spack_packages/packages/chai/radiuss-package.py new file mode 100644 index 00000000..3860dd4d --- /dev/null +++ b/scripts/spack_packages/packages/chai/radiuss-package.py @@ -0,0 +1,340 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import socket + +from spack.package import * + +from .camp import hip_for_radiuss_projects +from .camp import cuda_for_radiuss_projects +from .camp import mpi_for_radiuss_projects +from .blt import llnl_link_helpers + + +class Chai(CachedCMakePackage, CudaPackage, ROCmPackage): + """ + Copy-hiding array interface for data migration between memory spaces + """ + + homepage = "https://github.com/LLNL/CHAI" + git = "https://github.com/LLNL/CHAI.git" + tags = ["ecp", "e4s", "radiuss"] + + maintainers("adayton1", "adrienbernede", "davidbeckingsale", "kab163") + + license("BSD-3-Clause") + + version("develop", branch="develop", submodules=False) + version( + "2025.09.0", + tag="v2025.09.0", + commit="352ae302535d9dc5ba50b77bf508c89fc7500d30", + submodules=False, + ) + version( + "2025.03.0", + tag="v2025.03.0", + commit="79f6414a00a89070054ac97baed47d21d10c83a4", + submodules=False, + ) + version( + "2024.07.0", + tag="v2024.07.0", + commit="df7741f1dbbdc5fff5f7d626151fdf1904e62b19", + submodules=False, + ) + version( + "2024.02.2", + tag="v2024.02.2", + commit="5ba0944d862513f600432c34b009824875df27e5", + submodules=False, + ) + version( + "2024.02.1", + tag="v2024.02.1", + commit="7597134729bd3a38b45b67b4dfbf7f199d8106f3", + submodules=False, + ) + version( + "2024.02.0", + tag="v2024.02.0", + commit="31773a2f0d30f3f64c82939f60fc4da32cf33261", + submodules=False, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="6fe3470ad020303530af2f3dbbfe18826bd3319b", + submodules=False, + ) + version( + "2022.10.0", + tag="v2022.10.0", + commit="9510efd33b06e4443b15447eebb7dad761822654", + submodules=False, + ) + version( + "2022.03.0", + tag="v2022.03.0", + commit="f0b809de1ac194376866b3ac0f5933d4146ec09e", + submodules=False, + ) + version( + "2.4.0", tag="v2.4.0", commit="77d22da28187245a2c5454cf471c0c352bd98ad7", submodules=True + ) + version( + "2.3.0", tag="v2.3.0", commit="42f3fbcc0b966227b40b4467dc919a4c24f07196", submodules=True + ) + version( + "2.2.2", tag="v2.2.2", commit="56e75fc0f805b2746f3992af0c00c474513e3b24", submodules=True + ) + version( + "2.2.1", tag="v2.2.1", commit="c912f583828ea5963850816e3e232cc45608ccf7", submodules=True + ) + version( + "2.2.0", tag="v2.2.0", commit="18536c61a4817db6b3b3025f35e2dd3ae532330c", submodules=True + ) + version( + "2.1.1", tag="v2.1.1", commit="496911e00d15c350560860f7964cd5fb5ab7f515", submodules=True + ) + version( + "2.1.0", tag="v2.1.0", commit="fff02768068a64970b34760a1041585319edee87", submodules=True + ) + version( + "2.0.0", tag="v2.0.0", commit="63139cf45443b1266950826b165e042c7679b557", submodules=True + ) + version( + "1.2.0", tag="v1.2.0", commit="7bb5bc12e4508db45910d8e2b98444687da7ebf6", submodules=True + ) + version( + "1.1.0", tag="v1.1.0", commit="907d5f40d653a73955387067799913397807adf3", submodules=True + ) + version("1.0", tag="v1.0", commit="501a098ad879dc8deb4a74fcfe8c08c283a10627", submodules=True) + + depends_on("c", type="build") + depends_on("cxx", type="build") + + # Patching Umpire for dual BLT targets import changed MPI target name in Umpire link interface + # We propagate the patch here. + patch("change_mpi_target_name_umpire_patch.patch", when="@2022.10.0:2023.06.0") + + variant("enable_pick", default=False, when="@:2024", description="Enable pick method") + variant( + "separable_compilation", + default=True, + description="Build with CUDA_SEPARABLE_COMPILATION flag on ", + ) + variant("shared", default=True, description="Build Shared Libs") + variant("mpi", default=False, description="Enable MPI support") + variant("raja", default=False, description="Build plugin for RAJA") + variant("examples", default=True, description="Build examples.") + variant("openmp", default=False, description="Build using OpenMP") + # TODO: figure out gtest dependency and then set this default True + # and remove the +tests conflict below. + variant( + "tests", + default="none", + values=("none", "basic", "benchmarks"), + multi=False, + description="Tests to run", + ) + + depends_on("cmake", type="build") + depends_on("cmake@3.23:", type="build", when="@2024.07.0:") + depends_on("cmake@3.14:", type="build", when="@2022.03.0:2024.2") + depends_on("cmake@3.9:", type="build", when="+cuda") + depends_on("cmake@3.8:", type="build") + + depends_on("blt", type="build") + 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("blt@0.6.2:", type="build", when="@2024.02.1:") + depends_on("blt@0.6.1", type="build", when="@2024.02.0") + depends_on("blt@0.5.3", type="build", when="@2023.06.0") + depends_on("blt@0.5.2:0.5.3", type="build", when="@2022.10.0") + depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0") + depends_on("blt@0.4.1:0.5.3", type="build", when="@2.4.0") + depends_on("blt@0.4.0:0.5.3", type="build", when="@2.3.0") + depends_on("blt@0.3.6:0.5.3", type="build", when="@:2.2.2") + conflicts("^blt@:0.3.6", when="+rocm") + + depends_on("umpire") + 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") + depends_on("umpire@2024.02.1", when="@2024.02.1") + depends_on("umpire@2024.02.0", when="@2024.02.0") + depends_on("umpire@2023.06.0", when="@2023.06.0") + depends_on("umpire@2022.10.0:2023.06.0", when="@2022.10.0") + depends_on("umpire@2022.03.0:2023.06.0", when="@2022.03.0") + depends_on("umpire@6.0.0", when="@2.4.0") + depends_on("umpire@4.1.2", when="@2.2.0:2.3.0") + + depends_on("umpire+mpi", when="+mpi") + + with when("+cuda"): + depends_on("umpire+cuda") + for sm_ in CudaPackage.cuda_arch_values: + depends_on("umpire+cuda cuda_arch={0}".format(sm_), when="cuda_arch={0}".format(sm_)) + with when("@2024.02.0:"): + depends_on("umpire~fmt_header_only") + + with when("+rocm"): + depends_on("umpire+rocm") + for arch in ROCmPackage.amdgpu_targets: + depends_on( + "umpire+rocm amdgpu_target={0}".format(arch), when="amdgpu_target={0}".format(arch) + ) + + with when("+raja"): + depends_on("raja~openmp", when="~openmp") + depends_on("raja+openmp", when="+openmp") + depends_on("raja@2025.09.0:", when="@2025.09.0:") + depends_on("raja@2025.03.2:", when="@2025.03.1:") + depends_on("raja@2025.03.0:", when="@2025.03.0:") + depends_on("raja@2024.07.0", when="@2024.07.0") + depends_on("raja@2024.02.2", when="@2024.02.2") + depends_on("raja@2024.02.1", when="@2024.02.1") + depends_on("raja@2024.02.0", when="@2024.02.0") + depends_on("raja@2023.06.0", when="@2023.06.0") + depends_on("raja@2022.10.0:2023.06.0", when="@2022.10.0") + depends_on("raja@2022.03.0:2023.06.0", when="@2022.03.0") + depends_on("raja@0.14.0", when="@2.4.0") + depends_on("raja@0.13.0", when="@2.3.0") + depends_on("raja@0.12.0", when="@2.2.0:2.2.2") + + with when("+cuda"): + depends_on("raja+cuda") + for sm_ in CudaPackage.cuda_arch_values: + depends_on("raja+cuda cuda_arch={0}".format(sm_), when="cuda_arch={0}".format(sm_)) + with when("+rocm"): + depends_on("raja+rocm") + for arch in ROCmPackage.amdgpu_targets: + depends_on( + "raja+rocm amdgpu_target={0}".format(arch), + when="amdgpu_target={0}".format(arch), + ) + + depends_on("mpi", when="+mpi") + + def _get_sys_type(self, spec): + sys_type = spec.architecture + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type + + @property + def cache_name(self): + hostname = socket.gethostname() + if "SYS_TYPE" in env: + hostname = hostname.rstrip("1234567890") + return "{0}-{1}-{2}@{3}-{4}.cmake".format( + hostname, + self._get_sys_type(self.spec), + self.spec.compiler.name, + self.spec.compiler.version, + self.spec.dag_hash(8), + ) + + def initconfig_compiler_entries(self): + spec = self.spec + compiler = self.compiler + # Default entries are already defined in CachedCMakePackage, inherit them: + entries = super().initconfig_compiler_entries() + + llnl_link_helpers(entries, spec, compiler) + + return entries + + def initconfig_hardware_entries(self): + spec = self.spec + compiler = self.compiler + entries = super().initconfig_hardware_entries() + + entries.append("#------------------{0}".format("-" * 30)) + entries.append("# Package custom hardware settings") + entries.append("#------------------{0}\n".format("-" * 30)) + + if spec.satisfies("+cuda"): + entries.append(cmake_cache_option("ENABLE_CUDA", True)) + if spec.satisfies("+separable_compilation"): + entries.append(cmake_cache_option("CMAKE_CUDA_SEPARABLE_COMPILATION", True)) + entries.append(cmake_cache_option("CUDA_SEPARABLE_COMPILATION", True)) + cuda_for_radiuss_projects(entries, spec) + else: + entries.append(cmake_cache_option("ENABLE_CUDA", False)) + + if spec.satisfies("+rocm"): + entries.append(cmake_cache_option("ENABLE_HIP", True)) + hip_for_radiuss_projects(entries, spec, compiler) + else: + entries.append(cmake_cache_option("ENABLE_HIP", False)) + + return entries + + def initconfig_mpi_entries(self): + spec = self.spec + + entries = super(Chai, self).initconfig_mpi_entries() + entries.append(cmake_cache_option("ENABLE_MPI", spec.satisfies("+mpi"))) + if spec.satisfies("+mpi"): + mpi_for_radiuss_projects(entries, spec, env) + + return entries + + def initconfig_package_entries(self): + spec = self.spec + entries = [] + + option_prefix = "CHAI_" if spec.satisfies("@2022.03.0:") else "" + + # TPL locations + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# TPLs") + entries.append("#------------------{0}\n".format("-" * 60)) + + # - BLT + entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) + + # - RAJA + if spec.satisfies("+raja"): + entries.append(cmake_cache_option("{}ENABLE_RAJA_PLUGIN".format(option_prefix), True)) + entries.append(cmake_cache_path("RAJA_DIR", spec["raja"].prefix)) + else: + entries.append(cmake_cache_option("{}ENABLE_RAJA_PLUGIN".format(option_prefix), False)) + + # - Umpire + entries.append(cmake_cache_path("umpire_DIR", spec["umpire"].prefix)) + + # Build options + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# Build Options") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_string("CMAKE_BUILD_TYPE", spec.variants["build_type"].value)) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", spec.satisfies("+shared"))) + + # Generic options that have a prefixed equivalent in CHAI CMake + entries.append(cmake_cache_option("ENABLE_OPENMP", spec.satisfies("+openmp"))) + entries.append(cmake_cache_option("ENABLE_EXAMPLES", spec.satisfies("+examples"))) + entries.append(cmake_cache_option("ENABLE_DOCS", False)) + if spec.satisfies("tests=benchmarks"): + # BLT requires ENABLE_TESTS=True to enable benchmarks + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", True)) + entries.append(cmake_cache_option("ENABLE_TESTS", True)) + else: + entries.append(cmake_cache_option("ENABLE_TESTS", not spec.satisfies("tests=none"))) + + # Prefixed options that used to be name without one + entries.append( + cmake_cache_option( + "{}ENABLE_PICK".format(option_prefix), spec.satisfies("+enable_pick") + ) + ) + + return entries + + def cmake_args(self): + return [] diff --git a/scripts/spack_packages/packages/geosx/package.py b/scripts/spack_packages/packages/geosx/package.py index 1e40d064..fe44e776 100644 --- a/scripts/spack_packages/packages/geosx/package.py +++ b/scripts/spack_packages/packages/geosx/package.py @@ -3,28 +3,24 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +from spack.package import * +from spack_repo.builtin.build_systems.cached_cmake import ( + CachedCMakePackage, + cmake_cache_option, + cmake_cache_path, + cmake_cache_string, +) import warnings import socket import os -import llnl.util.tty as tty - from os import environ as env from os.path import join as pjoin # 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""" - - return 'set(%s "%s" CACHE PATH "%s")\n\n' % (name, value, comment) - - def cmake_cache_list(name, value, comment=""): """Generate a list for a cmake cache variable""" @@ -32,21 +28,7 @@ def cmake_cache_list(name, value, comment=""): join_str = '\n' + ' ' * indent 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): +class Geosx(CachedCMakePackage, CudaPackage, ROCmPackage): """GEOSX simulation framework.""" homepage = "https://github.com/GEOS-DEV/GEOS" @@ -72,6 +54,7 @@ class Geosx(CMakePackage, CudaPackage, ROCmPackage): values=('trilinos', 'hypre', 'petsc'), multi=False) variant('pygeosx', default=True, description='Enable pygeosx.') + variant('cxxstd', default='17', description='CXX standard.') # SPHINX_END_VARIANTS @@ -84,13 +67,16 @@ class Geosx(CMakePackage, CudaPackage, ROCmPackage): description='Add support for addr2line.') variant('mathpresso', default=True, description='Build mathpresso.') - variant('cuda_stack_size', default=0, description="Defines the adjusted cuda stack \ + variant('cuda_stack_size', default='0', description="Defines the adjusted cuda stack \ size limit if required. Zero or negative keep default behavior") # SPHINX_BEGIN_DEPENDS - depends_on('cmake@3.24:', type='build') + depends_on("c", type="build") + depends_on("cxx", type="build") + #depends_on("fortran", type="build") + depends_on('cmake@3.24:', type='build') depends_on('blt') # @@ -103,19 +89,19 @@ class Geosx(CMakePackage, CudaPackage, ROCmPackage): # # Performance portability # - depends_on('raja ~examples~exercises~shared') + depends_on("raja ~examples~exercises~shared") depends_on("raja~openmp", when="~openmp") depends_on("raja+openmp", when="+openmp") - depends_on('umpire +c~examples+fortran~device_alloc~shared') + depends_on("umpire +c~examples+fortran~device_alloc~shared") depends_on("umpire~openmp", when="~openmp") depends_on("umpire+openmp", when="+openmp") - depends_on('chai +raja~examples~shared') + depends_on("chai +raja~examples~shared") depends_on("chai~openmp", when="~openmp") depends_on("chai+openmp", when="+openmp") - depends_on('camp') + depends_on("camp") # # GPUs @@ -149,7 +135,8 @@ class Geosx(CMakePackage, CudaPackage, ROCmPackage): depends_on('pugixml@1.13 ~shared') - depends_on('fmt@10.0.0 cxxstd=14') + #depends_on('fmt@10.0.0 cxxstd=14') + depends_on("fmt@11") depends_on('vtk@9.4.2', when='+vtk') # @@ -199,7 +186,7 @@ class Geosx(CMakePackage, CudaPackage, ROCmPackage): # # Documentation # - depends_on('doxygen@1.8.20', when='+docs', type='build') + depends_on('doxygen@1.8.20:', when='+docs', type='build') depends_on('py-sphinx@1.6.3:', when='+docs', type='build') # @@ -220,6 +207,12 @@ class Geosx(CMakePackage, CudaPackage, ROCmPackage): phases = ['geos_hostconfig', 'lvarray_hostconfig'] #phases = ['hostconfig', 'cmake', 'build', 'install'] + # This method is called to finalize dependencies + def dependencies(self): + super().dependencies() + # Add a conditional dependency on fmt with the cxxstd variant + self.depends_on(f"fmt@11 cxxstd=c++{self.spec.variants['cxxstd'].value}") + @run_after('build') @on_package_attributes(run_tests=True) def check(self): @@ -244,21 +237,21 @@ 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.cmake" % (hostname, self._get_sys_type(spec), (str(spec.compiler)).replace('=',''), var) + host_config_path = "%s-%s-%s-%s%s.cmake" % (hostname, + self._get_sys_type(spec), + self.spec.compiler.name, + self.spec.compiler.version, + gpu_backend) dest_dir = self.stage.source_path host_config_path = os.path.abspath(pjoin(dest_dir, host_config_path)) @@ -320,15 +313,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: @@ -340,36 +333,32 @@ 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") cfg.write("#{0}\n\n".format("-" * 80)) - cfg.write(cmake_cache_string("BLT_CXX_STD", "c++17")) + cfg.write(cmake_cache_string("BLT_CXX_STD", f"c++{spec.variants['cxxstd'].value}")) cfg.write("#{0}\n".format("-" * 80)) cfg.write("# MPI\n") 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_string('MPI_CXX_COMPILER', spec['mpi'].mpicxx)) hostname = socket.gethostname().rstrip('1234567890') if sys_type in ('linux-rhel7-ppc64le', 'linux-rhel8-ppc64le', 'blueos_3_ppc64le_ib_p9') \ 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')) - else: - cfg.write(cmake_cache_entry('MPIEXEC', 'jsrun')) - cfg.write(cmake_cache_list('MPIEXEC_NUMPROC_FLAG', ['-g1', '--bind', 'rs', '-n'])) + 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 @@ -430,12 +419,12 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('#{0}\n\n'.format('-' * 80)) if '+cuda' in spec: cfg.write(cmake_cache_option('ENABLE_CUDA', True)) - cfg.write(cmake_cache_entry('CMAKE_CUDA_STANDARD', 17)) + 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,' @@ -465,7 +454,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)) @@ -475,14 +464,14 @@ def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('#{0}\n\n'.format('-' * 80)) if '+rocm' in spec: cfg.write(cmake_cache_option('ENABLE_HIP', True)) - cfg.write(cmake_cache_string('CMAKE_HIP_STANDARD', 17)) - cfg.write(cmake_cache_entry('CMAKE_HIP_COMPILER', spec['hip'].prefix.bin.hipcc)) + cfg.write(cmake_cache_string('CMAKE_HIP_STANDARD', spec.variants['cxxstd'].value)) + 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)) @@ -491,14 +480,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 = ( @@ -518,12 +507,12 @@ 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: - cfg.write(cmake_cache_entry('{}_DIR'.format(cmake_name), spec[tpl].prefix)) + cfg.write(cmake_cache_path('{}_DIR'.format(cmake_name), spec[tpl].prefix)) else: cfg.write(cmake_cache_option('ENABLE_{}'.format(cmake_name), False)) @@ -533,15 +522,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)) @@ -567,7 +556,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")) @@ -590,8 +579,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)) @@ -603,10 +592,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)) @@ -619,14 +608,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') @@ -634,7 +623,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)) @@ -709,15 +698,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)) @@ -727,19 +716,19 @@ 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') cfg.write('#{0}\n\n'.format('-' * 80)) if '+cuda' in spec: cfg.write(cmake_cache_option('ENABLE_CUDA', True)) - cfg.write(cmake_cache_entry('CMAKE_CUDA_STANDARD', 17)) + cfg.write(cmake_cache_string('CMAKE_CUDA_STANDARD', self.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,' @@ -770,14 +759,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') @@ -785,18 +774,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)) diff --git a/scripts/spack_packages/packages/hdf5/package.py b/scripts/spack_packages/packages/hdf5/package.py deleted file mode 100644 index 061251f5..00000000 --- a/scripts/spack_packages/packages/hdf5/package.py +++ /dev/null @@ -1,747 +0,0 @@ -# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -# GEOS_EDIT_START -# Older hdf5 spack recipe that works on lassen -# (latest spack release fails with MPI related configuration failure) -# GEOS_EDIT_END - -import os -import shutil - -import llnl.util.tty as tty - -from spack.package import * - - -class Hdf5(CMakePackage): - """HDF5 is a data model, library, and file format for storing and managing - data. It supports an unlimited variety of datatypes, and is designed for - flexible and efficient I/O and for high volume and complex data. - """ - - homepage = "https://portal.hdfgroup.org" - url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.8/src/hdf5-1.10.8.tar.gz" - list_url = "https://support.hdfgroup.org/ftp/HDF5/releases" - list_depth = 3 - git = "https://github.com/HDFGroup/hdf5.git" - maintainers = [ - "lrknox", - "brtnfld", - "byrnHDF", - "ChristopherHogan", - "epourmal", - "gheber", - "hyoklee", - "lkurz", - "soumagne", - ] - - tags = ["e4s"] - - test_requires_compiler = True - - # The 'develop' version is renamed so that we could uninstall (or patch) it - # without affecting other develop version. - version("develop-1.13", branch="develop") - version("develop-1.12", branch="hdf5_1_12") - version("develop-1.10", branch="hdf5_1_10") - version("develop-1.8", branch="hdf5_1_8") - - # Odd versions are considered experimental releases - version("1.13.2", sha256="01643fa5b37dba7be7c4db6bbf3c5d07adf5c1fa17dbfaaa632a279b1b2f06da") - - # Even versions are maintenance versions - version( - "1.12.2", - sha256="2a89af03d56ce7502dcae18232c241281ad1773561ec00c0f0e8ee2463910f14", - preferred=True, - ) - version( - "1.12.1", - sha256="79c66ff67e666665369396e9c90b32e238e501f345afd2234186bfb8331081ca", - preferred=True, - ) - version( - "1.12.0", - sha256="a62dcb276658cb78e6795dd29bf926ed7a9bc4edf6e77025cd2c689a8f97c17a", - preferred=True, - ) - version( - "1.10.9", - sha256="f5b77f59b705a755a5a223372d0222c7bc408fe8db6fa8d9d7ecf8bce291b8dd", - preferred=True, - ) - version( - "1.10.8", - sha256="d341b80d380dd763753a0ebe22915e11e87aac4e44a084a850646ff934d19c80", - preferred=True, - ) - version( - "1.10.7", - sha256="7a1a0a54371275ce2dfc5cd093775bb025c365846512961e7e5ceaecb437ef15", - preferred=True, - ) - version( - "1.10.6", - sha256="5f9a3ee85db4ea1d3b1fa9159352aebc2af72732fc2f58c96a3f0768dba0e9aa", - preferred=True, - ) - version( - "1.10.5", - sha256="6d4ce8bf902a97b050f6f491f4268634e252a63dadd6656a1a9be5b7b7726fa8", - preferred=True, - ) - version( - "1.10.4", - sha256="8f60dc4dd6ab5fcd23c750d1dc5bca3d0453bdce5c8cdaf0a4a61a9d1122adb2", - preferred=True, - ) - version( - "1.10.3", - sha256="b600d7c914cfa80ae127cd1a1539981213fee9994ac22ebec9e3845e951d9b39", - preferred=True, - ) - version( - "1.10.2", - sha256="bfec1be8c366965a99812cf02ddc97e4b708c1754fccba5414d4adccdc073866", - preferred=True, - ) - version( - "1.10.1", - sha256="048a9d149fb99aaa1680a712963f5a78e9c43b588d0e79d55e06760ec377c172", - preferred=True, - ) - version( - "1.10.0-patch1", - sha256="6e78cfe32a10e6e0629393cdfddf6cfa536571efdaf85f08e35326e1b4e9eff0", - preferred=True, - ) - version( - "1.10.0", - sha256="81f6201aba5c30dced5dcd62f5d5477a2790fd5850e02ac514ca8bf3e2bb375a", - preferred=True, - ) - version( - "1.8.22", - sha256="8406d96d9355ef8961d2739fb8fd5474ad4cdf52f3cfac657733defd9709bfaa", - preferred=True, - ) - version( - "1.8.21", - sha256="87d8c82eba5cf766d97cd06c054f4639c1049c4adeaa3a79f77f8bd374f80f37", - preferred=True, - ) - version( - "1.8.19", - sha256="a4335849f19fae88c264fd0df046bc321a78c536b2548fc508627a790564dc38", - preferred=True, - ) - version( - "1.8.18", - sha256="cdb195ad8d9e6782acf24b2488061289f615628c2ccda8457b0a0c3fb7a8a063", - preferred=True, - ) - version( - "1.8.17", - sha256="d9cda297ee76ade9881c4208987939250d397bae6252d0ccb66fa7d24d67e263", - preferred=True, - ) - version( - "1.8.16", - sha256="ed17178abd9928a7237f30370189ba767b9e39e0db45917c2ac4665eb9cb4771", - preferred=True, - ) - version( - "1.8.15", - sha256="4e963216b7d32469596bc1321a8c3f6e0c278dcbbdb7be6414c63c081b34c275", - preferred=True, - ) - version( - "1.8.14", - sha256="1dbefeeef7f591897c632b2b090db96bb8d35ad035beaa36bc39cb2bc67e0639", - preferred=True, - ) - version( - "1.8.13", - sha256="82f6b38eec103b4fccfbf14892786e0c27a8135d3252d8601cf5bf20066d38c1", - preferred=True, - ) - version( - "1.8.12", - sha256="b5cccea850096962b5fd9e96f22c4f47d2379224bb41130d9bc038bb6c37dfcb", - preferred=True, - ) - version( - "1.8.10", - sha256="4813b79c5fb8701a625b9924b8203bc7154a77f9b826ad4e034144b4056a160a", - preferred=True, - ) - - variant("shared", default=True, description="Builds a shared version of the library") - - variant("hl", default=False, description="Enable the high-level library") - variant("cxx", default=False, description="Enable C++ support") - variant("fortran", default=False, description="Enable Fortran support") - variant("java", when="@1.10:", default=False, description="Enable Java support") - variant("threadsafe", default=False, description="Enable thread-safe capabilities") - variant("tools", default=True, description="Enable building tools") - variant("mpi", default=True, description="Enable MPI support") - variant("szip", default=False, description="Enable szip support") - # Build HDF5 with API compatibility. - variant( - "api", - default="default", - description="Choose api compatibility for earlier version", - values=("default", "v114", "v112", "v110", "v18", "v16"), - multi=False, - ) - - depends_on("cmake@3.12:", type="build") - - depends_on("mpi", when="+mpi") - depends_on("java", type=("build", "run"), when="+java") - depends_on("szip", when="+szip") - depends_on("zlib@1.1.2:") - - # The compiler wrappers (h5cc, h5fc, etc.) run 'pkg-config'. - depends_on("pkgconfig", type="run") - - conflicts("api=v114", when="@1.6:1.12", msg="v114 is not compatible with this release") - conflicts("api=v112", when="@1.6:1.10", msg="v112 is not compatible with this release") - conflicts("api=v110", when="@1.6:1.8", msg="v110 is not compatible with this release") - conflicts("api=v18", when="@1.6.0:1.6", msg="v18 is not compatible with this release") - - # The Java wrappers cannot be built without shared libs. - conflicts("+java", when="~shared") - # Fortran fails built with shared for old HDF5 versions - conflicts("+fortran", when="+shared@:1.8.15") - # See https://github.com/spack/spack/issues/31085 - conflicts("+fortran+mpi", when="@1.8.22") - - # GEOS_EDIT_START - # Commenting out unused patches - - # There are several officially unsupported combinations of the features: - # 1. Thread safety is not guaranteed via high-level C-API but in some cases - # it works. - # conflicts('+threadsafe+hl') - - # 2. Thread safety is not guaranteed via Fortran (CXX) API, but it's - # possible for a dependency tree to contain a package that uses Fortran - # (CXX) API in a single thread and another one that uses low-level C-API - # in multiple threads. To allow for such scenarios, we don't specify the - # following conflicts. - # conflicts('+threadsafe+cxx') - # conflicts('+threadsafe+fortran') - - # 3. Parallel features are not supported via CXX API, but for the reasons - # described in #2 we allow for such combination. - # conflicts('+mpi+cxx') - - # There are known build failures with intel@18.0.1. This issue is - # discussed and patch is provided at - # https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/747951. - #patch("h5f90global-mult-obj-same-equivalence-same-common-block.patch", when="@1.10.1%intel@18") - - # Turn line comments into block comments to conform with pre-C99 language - # standards. Versions of hdf5 after 1.8.10 don't require this patch, - # either because they conform to pre-C99 or neglect to ask for pre-C99 - # language standards from their compiler. The hdf5 build system adds - # the -ansi cflag (run 'man gcc' for info on -ansi) for some versions - # of some compilers (see hdf5-1.8.10/config/gnu-flags). The hdf5 build - # system does not provide an option to disable -ansi, but since the - # pre-C99 code is restricted to just five lines of line comments in - # three src files, this patch accomplishes the simple task of patching the - # three src files and leaves the hdf5 build system alone. - #patch("pre-c99-comments.patch", when="@1.8.10") - - # There are build errors with GCC 8, see - # https://forum.hdfgroup.org/t/1-10-2-h5detect-compile-error-gcc-8-1-0-on-centos-7-2-solved/4441 - # patch( - # "https://salsa.debian.org/debian-gis-team/hdf5/raw/bf94804af5f80f662cad80a5527535b3c6537df6/debian/patches/gcc-8.patch", - # sha256="57cee5ff1992b4098eda079815c36fc2da9b10e00a9056df054f2384c4fc7523", - # when="@1.10.2%gcc@8:", - # ) - - # Disable MPI C++ interface when C++ is disabled, otherwise downstream - # libraries fail to link; see https://github.com/spack/spack/issues/12586 - # patch( - # "h5public-skip-mpicxx.patch", - # when="@1.8.10:1.8.21,1.10.0:1.10.5+mpi~cxx", - # sha256="b61e2f058964ad85be6ee5ecea10080bf79e73f83ff88d1fa4b602d00209da9c", - # ) - - # Fixes BOZ literal constant error when compiled with GCC 10. - # The issue is described here: https://github.com/spack/spack/issues/18625 - # patch( - # "hdf5_1.8_gcc10.patch", - # when="@:1.8.21", - # sha256="0e20187cda3980a4fdff410da92358b63de7ebef2df1d7a425371af78e50f666", - # ) - - # patch("fortran-kinds.patch", when="@1.10.7") - - # This patch may only be needed with GCC11.2 on macOS, but it's valid for - # any of the head HDF5 versions as of 12/2021. Since it's impossible to - # tell what Fortran version is part of a mixed apple-clang toolchain on - # macOS (which is the norm), and this might be an issue for other compilers - # as well, we just apply it to all platforms. - # See https://github.com/HDFGroup/hdf5/issues/1157 - # patch("fortran-kinds-2.patch", when="@1.10.8,1.12.1") - - # The argument 'buf_size' of the C function 'h5fget_file_image_c' is - # declared as intent(in) though it is modified by the invocation. As a - # result, aggressive compilers such as Fujitsu's may do a wrong - # optimization to cause an error. - # GEOS_EDIT_END - - def patch(self): - filter_file( - "INTEGER(SIZE_T), INTENT(IN) :: buf_size", - "INTEGER(SIZE_T), INTENT(OUT) :: buf_size", - "fortran/src/H5Fff.F90", - string=True, - ignore_absent=True, - ) - filter_file( - "INTEGER(SIZE_T), INTENT(IN) :: buf_size", - "INTEGER(SIZE_T), INTENT(OUT) :: buf_size", - "fortran/src/H5Fff_F03.f90", - string=True, - ignore_absent=True, - ) - if self.run_tests: - # hdf5 has ~2200 CPU-intensive tests, some of them have races: - # Often, these loop endless(at least on one Xeon and one EPYC). - # testphdf5 fails indeterministic. This fixes finishing the tests - filter_file( - "REMOVE_ITEM H5P_TESTS", - "REMOVE_ITEM H5P_TESTS t_bigio t_shapesame testphdf5", - "testpar/CMakeTests.cmake", - ) - - # The parallel compiler wrappers (i.e. h5pcc, h5pfc, etc.) reference MPI - # compiler wrappers and do not need to be changed. - filter_compiler_wrappers( - "h5cc", "h5hlcc", "h5fc", "h5hlfc", "h5c++", "h5hlc++", relative_root="bin" - ) - - def url_for_version(self, version): - url = ( - "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-{0}/hdf5-{1}/src/hdf5-{1}.tar.gz" - ) - return url.format(version.up_to(2), version) - - def flag_handler(self, name, flags): - spec = self.spec - cmake_flags = [] - - if name == "cflags": - if spec.compiler.name in ["gcc", "clang", "apple-clang", "oneapi"]: - # Quiet warnings/errors about implicit declaration of functions - # in C99: - cmake_flags.append("-Wno-error=implicit-function-declaration") - # Note that this flag will cause an error if building %nvhpc. - if spec.satisfies("@:1.8.12~shared"): - # More recent versions set CMAKE_POSITION_INDEPENDENT_CODE to - # True and build with PIC flags. - cmake_flags.append(self.compiler.cc_pic_flag) - elif name == "cxxflags": - if spec.satisfies("@:1.8.12+cxx~shared"): - cmake_flags.append(self.compiler.cxx_pic_flag) - elif name == "fflags": - if spec.satisfies("%cce+fortran"): - # Cray compiler generates module files with uppercase names by - # default, which is not handled by the CMake scripts. The - # following flag forces the compiler to produce module files - # with lowercase names. - cmake_flags.append("-ef") - if spec.satisfies("@:1.8.12+fortran~shared"): - cmake_flags.append(self.compiler.fc_pic_flag) - elif name == "ldlibs": - if "+fortran %fj" in spec: - cmake_flags.extend(["-lfj90i", "-lfj90f", "-lfjsrcinfo", "-lelf"]) - - return flags, None, (cmake_flags or None) - - @property - def libs(self): - """HDF5 can be queried for the following parameters: - - - "hl": high-level interface - - "cxx": C++ APIs - - "fortran": Fortran APIs - - "java": Java APIs - - :return: list of matching libraries - """ - query_parameters = self.spec.last_query.extra_parameters - - shared = "+shared" in self.spec - - # This map contains a translation from query_parameters - # to the libraries needed - query2libraries = { - tuple(): ["libhdf5"], - ("cxx", "fortran", "hl", "java"): [ - # When installed with Autotools, the basename of the real - # library file implementing the High-level Fortran interface is - # 'libhdf5hl_fortran'. Starting versions 1.8.22, 1.10.5 and - # 1.12.0, the Autotools installation also produces a symbolic - # link 'libhdf5_hl_fortran.' to - # 'libhdf5hl_fortran.'. Note that in the case of the - # dynamic library, the latter is a symlink to the real sonamed - # file 'libhdf5_fortran.so.'. This means that all - # dynamically linked executables/libraries of the dependent - # packages need 'libhdf5_fortran.so.' with the same - # DT_SONAME entry. However, the CMake installation (at least - # starting version 1.8.10) does not produce it. Instead, the - # basename of the library file is 'libhdf5_hl_fortran'. Which - # means that switching to CMake requires rebuilding of all - # dependant packages that use the High-level Fortran interface. - # Therefore, we do not try to preserve backward compatibility - # with Autotools installations by creating symlinks. The only - # packages that could benefit from it would be those that - # hardcode the library name in their building systems. Such - # packages should simply be patched. - "libhdf5_hl_fortran", - "libhdf5_hl_f90cstub", - "libhdf5_hl_cpp", - "libhdf5_hl", - "libhdf5_fortran", - "libhdf5_f90cstub", - "libhdf5_java", - "libhdf5", - ], - ("cxx", "hl"): [ - "libhdf5_hl_cpp", - "libhdf5_hl", - "libhdf5", - ], - ("fortran", "hl"): [ - "libhdf5_hl_fortran", - "libhdf5_hl_f90cstub", - "libhdf5_hl", - "libhdf5_fortran", - "libhdf5_f90cstub", - "libhdf5", - ], - ("hl",): [ - "libhdf5_hl", - "libhdf5", - ], - ("cxx", "fortran"): [ - "libhdf5_fortran", - "libhdf5_f90cstub", - "libhdf5_cpp", - "libhdf5", - ], - ("cxx",): [ - "libhdf5_cpp", - "libhdf5", - ], - ("fortran",): [ - "libhdf5_fortran", - "libhdf5_f90cstub", - "libhdf5", - ], - ("java",): [ - "libhdf5_java", - "libhdf5", - ], - } - - # Turn the query into the appropriate key - key = tuple(sorted(query_parameters)) - libraries = query2libraries[key] - - return find_libraries(libraries, root=self.prefix, shared=shared, recursive=True) - - @when("@:1.8.21,1.10.0:1.10.5+szip") - def setup_build_environment(self, env): - env.set("SZIP_INSTALL", self.spec["szip"].prefix) - - @run_before("cmake") - def fortran_check(self): - if "+fortran" in self.spec and not self.compiler.fc: - msg = "cannot build a Fortran variant without a Fortran compiler" - raise RuntimeError(msg) - - def cmake_args(self): - spec = self.spec - - if spec.satisfies("@:1.8.15+shared"): - tty.warn("hdf5@:1.8.15+shared does not produce static libraries") - - args = [ - # Always enable this option. This does not actually enable any - # features: it only *allows* the user to specify certain - # combinations of other arguments. - self.define("ALLOW_UNSUPPORTED", True), - # Speed-up the building by skipping the examples: - self.define("HDF5_BUILD_EXAMPLES", False), - self.define( - "BUILD_TESTING", - self.run_tests or - # Version 1.8.22 fails to build the tools when shared libraries - # are enabled but the tests are disabled. - spec.satisfies("@1.8.22+shared+tools"), - ), - self.define("HDF5_ENABLE_Z_LIB_SUPPORT", True), - self.define_from_variant("HDF5_ENABLE_SZIP_SUPPORT", "szip"), - self.define_from_variant("HDF5_ENABLE_SZIP_ENCODING", "szip"), - self.define_from_variant("BUILD_SHARED_LIBS", "shared"), - self.define("ONLY_SHARED_LIBS", False), - self.define_from_variant("HDF5_ENABLE_PARALLEL", "mpi"), - self.define_from_variant("HDF5_ENABLE_THREADSAFE", "threadsafe"), - self.define_from_variant("HDF5_BUILD_HL_LIB", "hl"), - self.define_from_variant("HDF5_BUILD_CPP_LIB", "cxx"), - self.define_from_variant("HDF5_BUILD_FORTRAN", "fortran"), - self.define_from_variant("HDF5_BUILD_JAVA", "java"), - self.define_from_variant("HDF5_BUILD_TOOLS", "tools"), - ] - - api = spec.variants["api"].value - if api != "default": - args.append(self.define("DEFAULT_API_VERSION", api)) - - if "+mpi" in spec: - args.append(self.define("CMAKE_C_COMPILER", spec["mpi"].mpicc)) - - if "+cxx" in self.spec: - args.append(self.define("CMAKE_CXX_COMPILER", spec["mpi"].mpicxx)) - - if "+fortran" in self.spec: - args.append(self.define("CMAKE_Fortran_COMPILER", spec["mpi"].mpifc)) - - # work-around for https://github.com/HDFGroup/hdf5/issues/1320 - if spec.satisfies("@1.10.8,1.13.0"): - args.append(self.define("HDF5_INSTALL_CMAKE_DIR", "share/cmake/hdf5")) - - return args - - @run_after("install") - def ensure_parallel_compiler_wrappers(self): - # When installed with Autotools and starting at least version 1.8.10, - # the package produces C compiler wrapper called either 'h5cc' (when MPI - # support is disabled) or 'h5pcc' (when MPI support is enabled). The - # CMake installation produces the wrapper called 'h5cc' (regardless of - # whether MPI support is enabled) only starting versions 1.8.21, 1.10.2 - # and 1.12.0. The current develop versions also produce 'h5pcc' when MPI - # support is enabled and the file is identical to 'h5cc'. Here, we make - # sure that 'h5pcc' is available when MPI support is enabled (only for - # versions that generate 'h5cc'). - if self.spec.satisfies("@1.8.21:1.8.22,1.10.2:1.10.7,1.12.0+mpi"): - with working_dir(self.prefix.bin): - # No try/except here, fix the condition above instead: - symlink("h5cc", "h5pcc") - - # The same as for 'h5pcc'. However, the CMake installation produces the - # Fortran compiler wrapper called 'h5fc' only starting versions 1.8.22, - # 1.10.6 and 1.12.0. The current develop versions do not produce 'h5pfc' - # at all. Here, we make sure that 'h5pfc' is available when Fortran and - # MPI support are enabled (only for versions that generate 'h5fc'). - if self.spec.satisfies( - "@1.8.22:1.8," "1.10.6:1.10," "1.12.0:1.12," "develop:" "+fortran+mpi" - ): - with working_dir(self.prefix.bin): - # No try/except here, fix the condition above instead: - symlink("h5fc", "h5pfc") - - @run_after("install") - def fix_package_config(self): - # We need to fix the pkg-config files, which are also used by the - # compiler wrappers. The files are created starting versions 1.8.21, - # 1.10.2 and 1.12.0. However, they are broken (except for the version - # 1.8.22): the files are named -.pc but reference - # packages. This was fixed in the develop versions at some point: the - # files started referencing - packages but got broken - # again: the files got names .pc but references had not been - # updated accordingly. Another issue, which we address here, is that - # some Linux distributions install pkg-config files named hdf5.pc and we - # want to override them. Therefore, the following solution makes sure - # that each -.pc file is symlinked by .pc and all - # references to - packages in the original files are - # replaced with references to packages. - pc_files = find(self.prefix.lib.pkgconfig, "hdf5*.pc", recursive=False) - - if not pc_files: - # This also tells us that the pkgconfig directory does not exist. - return - - # Replace versioned references in all pkg-config files: - filter_file( - r"(Requires(?:\.private)?:.*)(hdf5[^\s,]*)(?:-[^\s,]*)(.*)", - r"\1\2\3", - *pc_files, - backup=False - ) - - # Create non-versioned symlinks to the versioned pkg-config files: - with working_dir(self.prefix.lib.pkgconfig): - for f in pc_files: - src_filename = os.path.basename(f) - version_sep_idx = src_filename.find("-") - if version_sep_idx > -1: - tgt_filename = src_filename[:version_sep_idx] + ".pc" - if not os.path.exists(tgt_filename): - symlink(src_filename, tgt_filename) - - @run_after("install") - @on_package_attributes(run_tests=True) - def check_install(self): - self._check_install() - - def _check_install(self): - # Build and run a small program to test the installed HDF5 library - spec = self.spec - print("Checking HDF5 installation...") - checkdir = "spack-check" - with working_dir(checkdir, create=True): - # Because the release number in a develop branch is not fixed, - # only the major and minor version numbers are compared. - # Otherwise all 3 numbers are checked. - if "develop" in str(spec.version.up_to(3)): - source = r""" -#include -#include -#include -int main(int argc, char **argv) { - unsigned majnum, minnum, relnum; - herr_t herr = H5get_libversion(&majnum, &minnum, &relnum); - assert(!herr); - printf("HDF5 version %d.%d %u.%u\n", H5_VERS_MAJOR, H5_VERS_MINOR, - majnum, minnum); - return 0; -} -""" - else: - source = r""" -#include -#include -#include -int main(int argc, char **argv) { - unsigned majnum, minnum, relnum; - herr_t herr = H5get_libversion(&majnum, &minnum, &relnum); - assert(!herr); - printf("HDF5 version %d.%d.%d %u.%u.%u\n", H5_VERS_MAJOR, H5_VERS_MINOR, - H5_VERS_RELEASE, majnum, minnum, relnum); - return 0; -} -""" - expected = """\ -HDF5 version {version} {version} -""".format( - version=str(spec.version.up_to(3)) - ) - if "develop" in expected: - # Remove 'develop-' from the version in spack for checking - # version against the version in the HDF5 code. - expected = """\ -HDF5 version {version} {version} -""".format( - version=str(spec.version.up_to(3)).partition("-")[2] - ) - with open("check.c", "w") as f: - f.write(source) - if "+mpi" in spec: - cc = Executable(spec["mpi"].mpicc) - else: - cc = Executable(self.compiler.cc) - cc(*(["-c", "check.c"] + spec["hdf5"].headers.cpp_flags.split())) - cc(*(["-o", "check", "check.o"] + spec["hdf5"].libs.ld_flags.split())) - try: - check = Executable("./check") - output = check(output=str) - except ProcessError: - output = "" - success = output == expected - if not success: - print("Produced output does not match expected output.") - print("Expected output:") - print("-" * 80) - print(expected) - print("-" * 80) - print("Produced output:") - print("-" * 80) - print(output) - print("-" * 80) - raise RuntimeError("HDF5 install check failed") - shutil.rmtree(checkdir) - - def _test_check_versions(self): - """Perform version checks on selected installed package binaries.""" - spec_vers_str = "Version {0}".format(self.spec.version) - if "develop" in spec_vers_str: - # Remove 'develop-' from the version in spack for checking - # version against the version in the HDF5 code. - spec_vers_str = spec_vers_str.partition("-")[2] - - exes = [ - "h5copy", - "h5diff", - "h5dump", - "h5format_convert", - "h5ls", - "h5mkgrp", - "h5repack", - "h5stat", - "h5unjam", - ] - use_short_opt = ["h52gif", "h5repart", "h5unjam"] - for exe in exes: - reason = "test: ensuring version of {0} is {1}".format(exe, spec_vers_str) - option = "-V" if exe in use_short_opt else "--version" - self.run_test( - exe, option, spec_vers_str, installed=True, purpose=reason, skip_missing=True - ) - - def _test_example(self): - """This test performs copy, dump, and diff on an example hdf5 file.""" - test_data_dir = self.test_suite.current_test_data_dir - - filename = "spack.h5" - h5_file = test_data_dir.join(filename) - - reason = "test: ensuring h5dump produces expected output" - expected = get_escaped_text_output(test_data_dir.join("dump.out")) - self.run_test( - "h5dump", - filename, - expected, - installed=True, - purpose=reason, - skip_missing=True, - work_dir=test_data_dir, - ) - - reason = "test: ensuring h5copy runs" - options = ["-i", h5_file, "-s", "Spack", "-o", "test.h5", "-d", "Spack"] - self.run_test( - "h5copy", options, [], installed=True, purpose=reason, skip_missing=True, work_dir="." - ) - - reason = "test: ensuring h5diff shows no differences between orig and" " copy" - self.run_test( - "h5diff", - [h5_file, "test.h5"], - [], - installed=True, - purpose=reason, - skip_missing=True, - work_dir=".", - ) - - def test(self): - """Perform smoke tests on the installed package.""" - # Simple version check tests on known binaries - self._test_check_versions() - - # Run sequence of commands on an hdf5 file - self._test_example() - - # Run existing install check - self._check_install() \ No newline at end of file diff --git a/scripts/spack_packages/packages/pygeosx/package.py b/scripts/spack_packages/packages/pygeosx/package.py index aaa1ddc4..84a3e866 100644 --- a/scripts/spack_packages/packages/pygeosx/package.py +++ b/scripts/spack_packages/packages/pygeosx/package.py @@ -3,7 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +from spack.package import * class Pygeosx(BundlePackage): """This is a set of libraries necessary for the pygeosx ATS environment. diff --git a/scripts/spack_packages/packages/raja/package.py b/scripts/spack_packages/packages/raja/package.py new file mode 100644 index 00000000..71186d84 --- /dev/null +++ b/scripts/spack_packages/packages/raja/package.py @@ -0,0 +1,585 @@ +# Copyright 2013-2025 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +# GEOSX_EDIT_START +# Victor: This is adapted from the radius-spack-configs GitHub repo. +# We're using this since the new 2025.09 packages suite has not been upstreamed to spack yet. +# See PR: https://github.com/LLNL/radiuss-spack-configs/pull/143 +# +# TODO: Delete this file after the new 2025.09 suite becomes available on spack_packages +# +# GEOSX_EDIT_END +# yapf: disable + +import socket + +from spack_repo.builtin.build_systems.cached_cmake import ( + CachedCMakePackage, + cmake_cache_option, + cmake_cache_path, + cmake_cache_string, +) +from spack_repo.builtin.build_systems.cuda import CudaPackage +from spack_repo.builtin.build_systems.rocm import ROCmPackage +from spack_repo.builtin.packages.blt.package import llnl_link_helpers + +from spack.package import * + + +# Starting with 2022.03.0, the only submodule we want to fetch is tpl/desul +# since there is no package for it. Other RAJA submodules are defined as +# dependencies. +def submodules(package): + submodules = [] + submodules.append("tpl/desul") + return submodules + + +class Raja(CachedCMakePackage, CudaPackage, ROCmPackage): + """RAJA Parallel Framework.""" + + homepage = "https://github.com/LLNL/RAJA" + git = "https://github.com/LLNL/RAJA.git" + tags = ["radiuss", "e4s"] + + maintainers("adrienbernede", "davidbeckingsale", "kab163") + + license("BSD-3-Clause") + + version("develop", branch="develop", submodules=submodules) + version("main", branch="main", submodules=submodules) + version( + "2025.09.0", + tag="v2025.09.0", + commit="ca756788dbdd43fec2a3840389126ae94a905d5f", + submodules=submodules, + ) + version( + "2025.03.2", + tag="v2025.03.2", + commit="6e36a94380adbe88fed11a3213fc08461428ece0", + submodules=submodules, + ) + version( + "2025.03.0", + tag="v2025.03.0", + commit="1d70abf171474d331f1409908bdf1b1c3fe19222", + submodules=submodules, + ) + version( + "2024.07.0", + tag="v2024.07.0", + commit="4d7fcba55ebc7cb972b7cc9f6778b48e43792ea1", + submodules=submodules, + ) + version( + "2024.02.2", + tag="v2024.02.2", + commit="593f756b14ac57ded33ee61d8d2292d4beb840e6", + submodules=submodules, + ) + version( + "2024.02.1", + tag="v2024.02.1", + commit="3ada0950b0774ec907d30a9eceaf6af7478b833b", + submodules=submodules, + ) + version( + "2024.02.0", + tag="v2024.02.0", + commit="82d1b926ada0fbb15a4a6e0adadc30c715cfda7b", + submodules=submodules, + ) + version( + "2023.06.1", + tag="v2023.06.1", + commit="9b5f61edf3aa1e6fdbc9a4b30828c81504639963", + submodules=submodules, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="e330b2560747d5417cd7bd265fab3fb91d32ecbd", + submodules=submodules, + ) + version( + "2022.10.5", + tag="v2022.10.5", + commit="3774f51339459bbbdb77055aa23f82919b6335b6", + submodules=submodules, + ) + version( + "2022.10.4", + tag="v2022.10.4", + commit="c2a6b1740759ae3ae7c85b35e20dbffbe235355d", + submodules=submodules, + ) + version( + "2022.03.0", + tag="v2022.03.0", + commit="4351fe6a50bd579511a625b017c9e054885e7fd2", + submodules=submodules, + ) + version( + "0.14.0", + tag="v0.14.0", + commit="357933a42842dd91de5c1034204d937fce0a2a44", + submodules="True", + ) + version( + "0.13.0", + tag="v0.13.0", + commit="3047fa720132d19ee143b1fcdacaa72971f5988c", + submodules="True", + ) + version( + "0.12.1", + tag="v0.12.1", + commit="9cb6370bb2868e35ebba23cdce927f5f7f9da530", + submodules="True", + ) + version( + "0.12.0", + tag="v0.12.0", + commit="32d92e38da41cc8d4db25ec79b9884a73a0cb3a1", + submodules="True", + ) + version( + "0.11.0", + tag="v0.11.0", + commit="0502b9b69c4cb60aa0afbdf699b555c76cb18f22", + submodules="True", + ) + version( + "0.10.1", + tag="v0.10.1", + commit="be91e040130678b1350dbda56cc352433db758bd", + submodules="True", + ) + version( + "0.10.0", + tag="v0.10.0", + commit="53cb89cf788d28bc4ed2b4e6f75483fdd26024aa", + submodules="True", + ) + version( + "0.9.0", tag="v0.9.0", commit="df7ca1fa892b6ac4147c614d2d739d5022f63fc7", submodules="True" + ) + version( + "0.8.0", tag="v0.8.0", commit="8d19a8c2cbac611de6f92ad8852b9f3454b27e63", submodules="True" + ) + version( + "0.7.0", tag="v0.7.0", commit="caa33b371b586dfae3d8569caee91c5eddfd7b31", submodules="True" + ) + version( + "0.6.0", tag="v0.6.0", commit="cc7a97e8b4e52c3de820c9dfacd358822a147871", submodules="True" + ) + version( + "0.5.3", tag="v0.5.3", commit="1ca35c0ed2a43a3fa9c6cd70c5d25f16d88ecd8c", submodules="True" + ) + version( + "0.5.2", tag="v0.5.2", commit="4d5c3d5d7f311838855f7010810610349e729f64", submodules="True" + ) + version( + "0.5.1", tag="v0.5.1", commit="bf340abe5199d7e051520913c9a7a5de336b5820", submodules="True" + ) + version( + "0.5.0", tag="v0.5.0", commit="9b539d84fdad049f65caeba836f41031f5baf4cc", submodules="True" + ) + version( + "0.4.1", tag="v0.4.1", commit="3618cfe95d6a442fa50fbe7bfbcf654cf9f800b9", submodules="True" + ) + version( + "0.4.0", tag="v0.4.0", commit="31b2a48192542c2da426885baa5af0ed57606b78", submodules="True" + ) + + depends_on("cxx", type="build") # generated + + # export targets when building pre-2.4.0 release with BLT 0.4.0+ + patch( + "https://github.com/LLNL/RAJA/commit/eca1124ee4af380d6613adc6012c307d1fd4176b.patch?full_index=1", + sha256="12bb78c00b6683ad3e7fd4e3f87f9776bae074b722431b79696bc862816735ef", + when="@:0.13.0 ^blt@0.4:", + ) + + # Backward compatibility is stopped from ROCm 6.0 + # Future relase will have the change from PR https://github.com/LLNL/RAJA/pull/1568 + patch( + "https://github.com/LLNL/RAJA/commit/406eb8dee05a41eb32c421c375688a4863b60642.patch?full_index=1", + sha256="d9ce5ef038555cbccb330a9016b7be77e56ae0660583cba955dab9d0297a4b07", + when="^hip@6.0", + ) + + # Fix compilation issue reported by Intel from their new compiler version + patch( + "https://github.com/LLNL/RAJA/pull/1668.patch?full_index=1", + sha256="c0548fc5220f24082fb2592d5b4e8b7c8c783b87906d5f0950d53953d25161f6", + when="@2024.02.1:2024.02.99 %oneapi@2025:", + ) + + variant("openmp", default=False, description="Build OpenMP backend") + variant("shared", default=False, description="Build shared libs") + variant("desul", default=False, description="Build desul atomics backend") + variant("vectorization", default=True, description="Build SIMD/SIMT intrinsics support") + variant( + "omptask", default=False, description="Build OpenMP task variants of internal algorithms" + ) + variant("omptarget", default=False, description="Build OpenMP on target device support") + variant("sycl", default=False, description="Build sycl backend") + variant("gpu-profiling", default=False, description="Enable GPU profiling") + + variant("plugins", default=False, description="Enable runtime plugins") + variant("examples", default=True, description="Build examples.") + variant("exercises", default=True, description="Build exercises.") + # TODO: figure out gtest dependency and then set this default True + # and remove the +tests conflict below. + variant("tests", default=False, description="Build tests") + + # we don't use variants to express the failing test, we only add a variant to + # define whether we want to run all the tests (including those known to fail) + # or only the passing ones. + variant( + "run-all-tests", + default=False, + description="Run all the tests, including those known to fail.", + ) + + variant( + "lowopttest", + default=False, + description="For developers, lowers optimization level to pass tests with some compilers", + ) + + depends_on("cxx", type="build") # generated + + depends_on("blt", type="build") + 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("blt@0.6.2:", type="build", when="@2024.02.1:") + depends_on("blt@0.6.1", type="build", when="@2024.02.0") + depends_on("blt@0.5.3", type="build", when="@2023.06.0:2023.06.1") + depends_on("blt@0.5.2:0.5.3", type="build", when="@2022.10.5") + depends_on("blt@0.5.0:0.5.3", type="build", when="@0.14.1:2022.10.4") + depends_on("blt@0.4.1", type="build", when="@0.14.0") + depends_on("blt@0.4.0:0.4.1", type="build", when="@0.13.0") + depends_on("blt@0.3.6:0.4.1", type="build", when="@:0.12.0") + conflicts("^blt@:0.3.6", when="+rocm") + + depends_on("camp") + depends_on("camp+openmp", when="+openmp") + depends_on("camp+omptarget", when="+omptarget") + depends_on("camp+sycl", when="+sycl") + depends_on("camp@main", when="@develop") + depends_on("camp@2025.09.2:", when="@2025.09.0:") + depends_on("camp@2025.03.0:", when="@2025.03.0:") + depends_on("camp@2024.07.0:", when="@2024.07.0:") + depends_on("camp@2024.02.1:", when="@2024.02.1:") + depends_on("camp@2024.02.0", when="@2024.02.0") + depends_on("camp@2023.06.0", when="@2023.06.0:2023.06.1") + depends_on("camp@2022.10.1:2023.06.0", when="@2022.10.3:2022.10.5") + depends_on("camp@2022.10.0:2023.06.0", when="@2022.10.0:2022.10.2") + depends_on("camp@2022.03.2", when="@2022.03.0:2022.03.1") + depends_on("camp@0.2.2:0.2.3", when="@0.14.0") + depends_on("camp@0.1.0", when="@0.10.0:0.13.0") + + depends_on("cmake@3.23:", when="@2024.07.0:", type="build") + depends_on("cmake@3.23:", when="@2022.10.0:2024.02.2+rocm", type="build") + depends_on("cmake@3.20:", when="@2022.10.0:2024.02.2", type="build") + depends_on("cmake@3.20:", when="@:2022.03+rocm", type="build") + depends_on("cmake@3.14:", when="@:2022.03", type="build") + + depends_on("llvm-openmp", when="+openmp %apple-clang") + + depends_on("rocprim", when="+rocm") + with when("+rocm @0.12.0:"): + depends_on("camp+rocm") + for arch in ROCmPackage.amdgpu_targets: + depends_on( + "camp+rocm amdgpu_target={0}".format(arch), when="amdgpu_target={0}".format(arch) + ) + conflicts("+openmp", when="@:2022.03") + + with when("+cuda @0.12.0:"): + depends_on("camp+cuda") + for sm_ in CudaPackage.cuda_arch_values: + depends_on("camp +cuda cuda_arch={0}".format(sm_), when="cuda_arch={0}".format(sm_)) + + conflicts("+gpu-profiling", when="~cuda~rocm", msg="GPU profiling requires CUDA or ROCm") + conflicts("+gpu-profiling +cuda", when="@:2022.02.99") + conflicts("+gpu-profiling +rocm", when="@:2022.02.99") + + conflicts("+omptarget +rocm") + conflicts("+sycl +omptarget") + conflicts("+sycl +rocm") + conflicts( + "+sycl", + when="@:2024.02.99", + msg="Support for SYCL was introduced in RAJA after 2024.02 release, " + "please use a newer release.", + ) + + def _get_sys_type(self, spec): + sys_type = spec.architecture + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type + + @property + def libs(self): + shared = "+shared" in self.spec + return find_libraries("libRAJA", root=self.prefix, shared=shared, recursive=True) + + @property + def cache_name(self): + hostname = socket.gethostname() + if "SYS_TYPE" in env: + hostname = hostname.rstrip("1234567890") + return "{0}-{1}-{2}@{3}-{4}.cmake".format( + hostname, + self._get_sys_type(self.spec), + self.spec.compiler.name, + self.spec.compiler.version, + self.spec.dag_hash(8), + ) + + def initconfig_compiler_entries(self): + spec = self.spec + compiler = self.compiler + # Default entries are already defined in CachedCMakePackage, inherit them: + entries = super().initconfig_compiler_entries() + + if spec.satisfies("+rocm ^blt@:0.6"): + entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) + + llnl_link_helpers(entries, spec, compiler) + + return entries + + def initconfig_hardware_entries(self): + spec = self.spec + entries = super().initconfig_hardware_entries() + + entries.append("#------------------{0}".format("-" * 30)) + entries.append("# Package custom hardware settings") + entries.append("#------------------{0}\n".format("-" * 30)) + + entries.append(cmake_cache_option("ENABLE_OPENMP", spec.satisfies("+openmp"))) + entries.append(cmake_cache_option("ENABLE_CUDA", spec.satisfies("+cuda"))) + + if spec.satisfies("+rocm"): + entries.append(cmake_cache_option("ENABLE_HIP", True)) + hipcc_flags = [] + if self.spec.satisfies("@2025.09.0:"): + hipcc_flags.append("-std=c++17") + elif self.spec.satisfies("@0.14.0:2025.09.0"): + hipcc_flags.append("-std=c++14") + entries.append(cmake_cache_string("HIP_HIPCC_FLAGS", " ".join(hipcc_flags))) + else: + entries.append(cmake_cache_option("ENABLE_HIP", False)) + + return entries + + def initconfig_package_entries(self): + spec = self.spec + entries = [] + + option_prefix = "RAJA_" if spec.satisfies("@0.14.0:") else "" + + # TPL locations + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# TPLs") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) + if "camp" in self.spec: + entries.append(cmake_cache_path("camp_DIR", spec["camp"].prefix)) + + # Build options + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# Build Options") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_string("CMAKE_BUILD_TYPE", spec.variants["build_type"].value)) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", spec.satisfies("+shared"))) + + entries.append(cmake_cache_option("RAJA_ENABLE_DESUL_ATOMICS", spec.satisfies("+desul"))) + + entries.append( + cmake_cache_option("RAJA_ENABLE_VECTORIZATION", spec.satisfies("+vectorization")) + ) + + entries.append(cmake_cache_option("RAJA_ENABLE_OPENMP_TASK", spec.satisfies("+omptask"))) + + entries.append( + cmake_cache_option("RAJA_ENABLE_TARGET_OPENMP", spec.satisfies("+omptarget")) + ) + + entries.append(cmake_cache_option("RAJA_ENABLE_SYCL", spec.satisfies("+sycl"))) + entries.append( + cmake_cache_option("RAJA_ENABLE_NV_TOOLS_EXT", spec.satisfies("+gpu-profiling +cuda")) + ) + entries.append( + cmake_cache_option("RAJA_ENABLE_ROCTX", spec.satisfies("+gpu-profiling +rocm")) + ) + + if spec.satisfies("+lowopttest"): + entries.append(cmake_cache_string("CMAKE_CXX_FLAGS_RELEASE", "-O1")) + + # C++17 + if (spec.satisfies("@2025.09.0:") or + (spec.satisfies("@2024.07.0:") and spec.satisfies("+sycl"))): + entries.append(cmake_cache_string("BLT_CXX_STD", "c++17")) + # C++14 + elif spec.satisfies("@0.14.0:2025.09.0"): + entries.append(cmake_cache_string("BLT_CXX_STD", "c++14")) + + if spec.satisfies("+desul"): + if spec.satisfies("+cuda"): + entries.append(cmake_cache_string("CMAKE_CUDA_STANDARD", "14")) + + entries.append( + cmake_cache_option("RAJA_ENABLE_RUNTIME_PLUGINS", spec.satisfies("+plugins")) + ) + + if spec.satisfies("+omptarget"): + entries.append( + cmake_cache_string( + "BLT_OPENMP_COMPILE_FLAGS", "-fopenmp;-fopenmp-targets=nvptx64-nvidia-cuda" + ) + ) + entries.append( + cmake_cache_string( + "BLT_OPENMP_LINK_FLAGS", "-fopenmp;-fopenmp-targets=nvptx64-nvidia-cuda" + ) + ) + + entries.append( + cmake_cache_option( + "{}ENABLE_EXAMPLES".format(option_prefix), spec.satisfies("+examples") + ) + ) + if spec.satisfies("@0.14.0:"): + entries.append( + cmake_cache_option( + "{}ENABLE_EXERCISES".format(option_prefix), spec.satisfies("+exercises") + ) + ) + else: + entries.append(cmake_cache_option("ENABLE_EXERCISES", spec.satisfies("+exercises"))) + + # TODO: Treat the workaround when building tests with spack wrapper + # For now, removing it to test CI, which builds tests outside of wrapper. + # Work around spack adding -march=ppc64le to SPACK_TARGET_ARGS which + # is used by the spack compiler wrapper. This can go away when BLT + # removes -Werror from GTest flags + # + # if self.spec.satisfies("%clang target=ppc64le:") + # or (not self.run_tests and not spec.satisfies("+tests")): + if not self.run_tests and not spec.satisfies("+tests"): + entries.append(cmake_cache_option("ENABLE_TESTS", False)) + else: + entries.append(cmake_cache_option("ENABLE_TESTS", True)) + if not spec.satisfies("+run-all-tests"): + if spec.satisfies("%clang@12.0.0:13.9.999"): + entries.append( + cmake_cache_string( + "CTEST_CUSTOM_TESTS_IGNORE", + "test-algorithm-sort-OpenMP.exe;test-algorithm-stable-sort-OpenMP.exe", + ) + ) + excluded_tests = [ + "test-algorithm-sort-Cuda.exe", + "test-algorithm-stable-sort-Cuda.exe", + "test-algorithm-sort-OpenMP.exe", + "test-algorithm-stable-sort-OpenMP.exe", + ] + if spec.satisfies("+cuda %clang@12.0.0:13.9.999"): + entries.append( + cmake_cache_string("CTEST_CUSTOM_TESTS_IGNORE", ";".join(excluded_tests)) + ) + if spec.satisfies("+cuda %xl@16.1.1.12"): + entries.append( + cmake_cache_string( + "CTEST_CUSTOM_TESTS_IGNORE", + "test-algorithm-sort-Cuda.exe;test-algorithm-stable-sort-Cuda.exe", + ) + ) + + entries.append(cmake_cache_option("RAJA_HOST_CONFIG_LOADED", True)) + + return entries + + def cmake_args(self): + return [] + + @property + def build_relpath(self): + """Relative path to the cmake build subdirectory.""" + return join_path("..", self.build_dirname) + + @run_after("install") + def setup_build_tests(self): + """Copy the build test files after the package is installed to a + relative install test subdirectory for use during `spack test run`.""" + # Now copy the relative files + cache_extra_test_sources(self, self.build_relpath) + + # Ensure the path exists since relying on a relative path at the + # same level as the normal stage source path. + mkdirp(install_test_root(self)) + + @property + def _extra_tests_path(self): + # TODO: The tests should be converted to re-build and run examples + # TODO: using the installed libraries. + return join_path(install_test_root(self), self.build_relpath, "bin") + + def run_example(self, exe, expected): + """run and check outputs of the example""" + with working_dir(self._extra_tests_path): + example = which(exe) + if example is None: + raise SkipTest(f"{exe} was not built") + + out = example(output=str.split, error=str.split) + check_outputs(expected, out) + + def test_line_of_sight(self): + """check line of sight example""" + self.run_example( + "ex5_line-of-sight_solution", + [r"C-style sequential", r"RAJA sequential", r"result -- PASS"], + ) + + def test_stencil_offset_layout(self): + """check stencil offset layout""" + self.run_example( + "ex6_stencil-offset-layout_solution", [r"RAJA Views \(permuted\)", r"result -- PASS"] + ) + + def test_tiled_matrix(self): + """check tiled matrix transpose""" + self.run_example( + "ex8_tiled-matrix-transpose_solution", + [r"C-version", r"RAJA sequential", r"result -- PASS"], + ) + + def test_dynamic_tile(self): + """check kernel dynamic tile""" + self.run_example("kernel-dynamic-tile", [r"Running index", r"(24,24)"]) + + def test_plugin_example(self): + """check plugin example""" + self.run_example("plugin-example", [r"Launching host kernel for the 10 time"]) + + def test_matrix_multiply(self): + """check batched matrix multiple tutorial""" + self.run_example( + "tut_batched-matrix-multiply", [r"batched matrix multiplication", r"result -- PASS"] + ) + + def test_wave_equation(self): + """check wave equation""" + self.run_example("wave-eqn", [r"Max Error = 2", r"Evolved solution to time"]) diff --git a/scripts/spack_packages/packages/raja/radiuss-package.py b/scripts/spack_packages/packages/raja/radiuss-package.py new file mode 100644 index 00000000..e127d293 --- /dev/null +++ b/scripts/spack_packages/packages/raja/radiuss-package.py @@ -0,0 +1,556 @@ +# Copyright 2013-2025 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import socket + +from spack.package import * + +from .camp import hip_for_radiuss_projects +from .camp import cuda_for_radiuss_projects +from .blt import llnl_link_helpers + + +# Starting with 2022.03.0, the only submodule we want to fetch is tpl/desul +# since there is no package for it. Other RAJA submodules are defined as +# dependencies. +def submodules(package): + submodules = [] + submodules.append("tpl/desul") + return submodules + + +class Raja(CachedCMakePackage, CudaPackage, ROCmPackage): + """RAJA Parallel Framework.""" + + homepage = "https://github.com/LLNL/RAJA" + git = "https://github.com/LLNL/RAJA.git" + tags = ["radiuss", "e4s"] + + maintainers("adrienbernede", "davidbeckingsale", "kab163") + + license("BSD-3-Clause") + + version("develop", branch="develop", submodules=submodules) + version("main", branch="main", submodules=submodules) + version( + "2025.09.0", + tag="v2025.09.0", + commit="ca756788dbdd43fec2a3840389126ae94a905d5f", + submodules=submodules, + ) + version( + "2025.03.2", + tag="v2025.03.2", + commit="6e36a94380adbe88fed11a3213fc08461428ece0", + submodules=submodules, + ) + version( + "2025.03.0", + tag="v2025.03.0", + commit="1d70abf171474d331f1409908bdf1b1c3fe19222", + submodules=submodules, + ) + version( + "2024.07.0", + tag="v2024.07.0", + commit="4d7fcba55ebc7cb972b7cc9f6778b48e43792ea1", + submodules=submodules, + ) + version( + "2024.02.2", + tag="v2024.02.2", + commit="593f756b14ac57ded33ee61d8d2292d4beb840e6", + submodules=submodules, + ) + version( + "2024.02.1", + tag="v2024.02.1", + commit="3ada0950b0774ec907d30a9eceaf6af7478b833b", + submodules=submodules, + ) + version( + "2024.02.0", + tag="v2024.02.0", + commit="82d1b926ada0fbb15a4a6e0adadc30c715cfda7b", + submodules=submodules, + ) + version( + "2023.06.1", + tag="v2023.06.1", + commit="9b5f61edf3aa1e6fdbc9a4b30828c81504639963", + submodules=submodules, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="e330b2560747d5417cd7bd265fab3fb91d32ecbd", + submodules=submodules, + ) + version( + "2022.10.5", + tag="v2022.10.5", + commit="3774f51339459bbbdb77055aa23f82919b6335b6", + submodules=submodules, + ) + version( + "2022.10.4", + tag="v2022.10.4", + commit="c2a6b1740759ae3ae7c85b35e20dbffbe235355d", + submodules=submodules, + ) + version( + "2022.03.0", + tag="v2022.03.0", + commit="4351fe6a50bd579511a625b017c9e054885e7fd2", + submodules=submodules, + ) + version( + "0.14.0", + tag="v0.14.0", + commit="357933a42842dd91de5c1034204d937fce0a2a44", + submodules="True", + ) + version( + "0.13.0", + tag="v0.13.0", + commit="3047fa720132d19ee143b1fcdacaa72971f5988c", + submodules="True", + ) + version( + "0.12.1", + tag="v0.12.1", + commit="9cb6370bb2868e35ebba23cdce927f5f7f9da530", + submodules="True", + ) + version( + "0.12.0", + tag="v0.12.0", + commit="32d92e38da41cc8d4db25ec79b9884a73a0cb3a1", + submodules="True", + ) + version( + "0.11.0", + tag="v0.11.0", + commit="0502b9b69c4cb60aa0afbdf699b555c76cb18f22", + submodules="True", + ) + version( + "0.10.1", + tag="v0.10.1", + commit="be91e040130678b1350dbda56cc352433db758bd", + submodules="True", + ) + version( + "0.10.0", + tag="v0.10.0", + commit="53cb89cf788d28bc4ed2b4e6f75483fdd26024aa", + submodules="True", + ) + version( + "0.9.0", tag="v0.9.0", commit="df7ca1fa892b6ac4147c614d2d739d5022f63fc7", submodules="True" + ) + version( + "0.8.0", tag="v0.8.0", commit="8d19a8c2cbac611de6f92ad8852b9f3454b27e63", submodules="True" + ) + version( + "0.7.0", tag="v0.7.0", commit="caa33b371b586dfae3d8569caee91c5eddfd7b31", submodules="True" + ) + version( + "0.6.0", tag="v0.6.0", commit="cc7a97e8b4e52c3de820c9dfacd358822a147871", submodules="True" + ) + version( + "0.5.3", tag="v0.5.3", commit="1ca35c0ed2a43a3fa9c6cd70c5d25f16d88ecd8c", submodules="True" + ) + version( + "0.5.2", tag="v0.5.2", commit="4d5c3d5d7f311838855f7010810610349e729f64", submodules="True" + ) + version( + "0.5.1", tag="v0.5.1", commit="bf340abe5199d7e051520913c9a7a5de336b5820", submodules="True" + ) + version( + "0.5.0", tag="v0.5.0", commit="9b539d84fdad049f65caeba836f41031f5baf4cc", submodules="True" + ) + version( + "0.4.1", tag="v0.4.1", commit="3618cfe95d6a442fa50fbe7bfbcf654cf9f800b9", submodules="True" + ) + version( + "0.4.0", tag="v0.4.0", commit="31b2a48192542c2da426885baa5af0ed57606b78", submodules="True" + ) + + depends_on("cxx", type="build") # generated + + # export targets when building pre-2.4.0 release with BLT 0.4.0+ + patch( + "https://github.com/LLNL/RAJA/commit/eca1124ee4af380d6613adc6012c307d1fd4176b.patch?full_index=1", + sha256="12bb78c00b6683ad3e7fd4e3f87f9776bae074b722431b79696bc862816735ef", + when="@:0.13.0 ^blt@0.4:", + ) + + # Backward compatibility is stopped from ROCm 6.0 + # Future relase will have the change from PR https://github.com/LLNL/RAJA/pull/1568 + patch( + "https://github.com/LLNL/RAJA/commit/406eb8dee05a41eb32c421c375688a4863b60642.patch?full_index=1", + sha256="d9ce5ef038555cbccb330a9016b7be77e56ae0660583cba955dab9d0297a4b07", + when="^hip@6.0", + ) + + # Fix compilation issue reported by Intel from their new compiler version + patch( + "https://github.com/LLNL/RAJA/pull/1668.patch?full_index=1", + sha256="c0548fc5220f24082fb2592d5b4e8b7c8c783b87906d5f0950d53953d25161f6", + when="@2024.02.1:2024.02.99 %oneapi@2025:", + ) + + variant("openmp", default=False, description="Build OpenMP backend") + variant("shared", default=False, description="Build shared libs") + variant("desul", default=False, description="Build desul atomics backend") + variant("vectorization", default=True, description="Build SIMD/SIMT intrinsics support") + variant( + "omptask", default=False, description="Build OpenMP task variants of internal algorithms" + ) + variant("omptarget", default=False, description="Build OpenMP on target device support") + variant("sycl", default=False, description="Build sycl backend") + + variant("plugins", default=False, description="Enable runtime plugins") + variant("examples", default=True, description="Build examples.") + variant("exercises", default=True, description="Build exercises.") + # TODO: figure out gtest dependency and then set this default True + # and remove the +tests conflict below. + variant("tests", default=False, description="Build tests") + + # we don't use variants to express the failing test, we only add a variant to + # define whether we want to run all the tests (including those known to fail) + # or only the passing ones. + variant( + "run-all-tests", + default=False, + description="Run all the tests, including those known to fail.", + ) + + variant("lowopttest", default=False, description="Intended for developers to use low optimization level for tests to pass with some compilers.") + + depends_on("blt", type="build") + 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("blt@0.6.2:", type="build", when="@2024.02.1:") + depends_on("blt@0.6.1", type="build", when="@2024.02.0") + depends_on("blt@0.5.3", type="build", when="@2023.06.0:2023.06.1") + depends_on("blt@0.5.2:0.5.3", type="build", when="@2022.10.5") + depends_on("blt@0.5.0:0.5.3", type="build", when="@0.14.1:2022.10.4") + depends_on("blt@0.4.1", type="build", when="@0.14.0") + depends_on("blt@0.4.0:0.4.1", type="build", when="@0.13.0") + depends_on("blt@0.3.6:0.4.1", type="build", when="@:0.12.0") + conflicts("^blt@:0.3.6", when="+rocm") + + depends_on("camp") + depends_on("camp+openmp", when="+openmp") + depends_on("camp+omptarget", when="+omptarget") + depends_on("camp+sycl", when="+sycl") + depends_on("camp@main", when="@develop") + depends_on("camp@2025.09.2:", when="@2025.09.0:") + depends_on("camp@2025.03.0:", when="@2025.03.0:") + depends_on("camp@2024.07.0:", when="@2024.07.0:") + depends_on("camp@2024.02.1:", when="@2024.02.1:") + depends_on("camp@2024.02.0", when="@2024.02.0") + depends_on("camp@2023.06.0", when="@2023.06.0:2023.06.1") + depends_on("camp@2022.10.1:2023.06.0", when="@2022.10.3:2022.10.5") + depends_on("camp@2022.10.0:2023.06.0", when="@2022.10.0:2022.10.2") + depends_on("camp@2022.03.2", when="@2022.03.0:2022.03.1") + depends_on("camp@0.2.2:0.2.3", when="@0.14.0") + depends_on("camp@0.1.0", when="@0.10.0:0.13.0") + + depends_on("cmake@3.23:", when="@2024.07.0:", type="build") + depends_on("cmake@3.23:", when="@2022.10.0:2024.02.2+rocm", type="build") + depends_on("cmake@3.20:", when="@2022.10.0:2024.02.2", type="build") + depends_on("cmake@3.20:", when="@:2022.03+rocm", type="build") + depends_on("cmake@3.14:", when="@:2022.03", type="build") + + depends_on("llvm-openmp", when="+openmp %apple-clang") + + depends_on("rocprim", when="+rocm") + with when("+rocm @0.12.0:"): + depends_on("camp+rocm") + for arch in ROCmPackage.amdgpu_targets: + depends_on( + "camp+rocm amdgpu_target={0}".format(arch), when="amdgpu_target={0}".format(arch) + ) + conflicts("+openmp", when="@:2022.03") + + with when("+cuda @0.12.0:"): + depends_on("camp+cuda") + for sm_ in CudaPackage.cuda_arch_values: + depends_on("camp +cuda cuda_arch={0}".format(sm_), when="cuda_arch={0}".format(sm_)) + + conflicts("+omptarget +rocm") + conflicts("+sycl +omptarget") + conflicts("+sycl +rocm") + conflicts( + "+sycl", + when="@:2024.02.99", + msg="Support for SYCL was introduced in RAJA after 2024.02 release, " + "please use a newer release.", + ) + + def _get_sys_type(self, spec): + sys_type = spec.architecture + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type + + @property + def libs(self): + shared = "+shared" in self.spec + return find_libraries("libRAJA", root=self.prefix, shared=shared, recursive=True) + + @property + def cache_name(self): + hostname = socket.gethostname() + if "SYS_TYPE" in env: + hostname = hostname.rstrip("1234567890") + return "{0}-{1}-{2}@{3}-{4}.cmake".format( + hostname, + self._get_sys_type(self.spec), + self.spec.compiler.name, + self.spec.compiler.version, + self.spec.dag_hash(8), + ) + + def initconfig_compiler_entries(self): + spec = self.spec + compiler = self.compiler + # Default entries are already defined in CachedCMakePackage, inherit them: + entries = super().initconfig_compiler_entries() + + llnl_link_helpers(entries, spec, compiler) + + return entries + + def initconfig_hardware_entries(self): + spec = self.spec + compiler = self.compiler + entries = super().initconfig_hardware_entries() + + entries.append("#------------------{0}".format("-" * 30)) + entries.append("# Package custom hardware settings") + entries.append("#------------------{0}\n".format("-" * 30)) + + entries.append(cmake_cache_option("ENABLE_OPENMP", spec.satisfies("+openmp"))) + + if spec.satisfies("+cuda"): + entries.append(cmake_cache_option("ENABLE_CUDA", True)) + cuda_for_radiuss_projects(entries, spec) + else: + entries.append(cmake_cache_option("ENABLE_CUDA", False)) + + if spec.satisfies("+rocm"): + entries.append(cmake_cache_option("ENABLE_HIP", True)) + hipcc_flags = [] + if self.spec.satisfies("@2025.09.0:"): + hipcc_flags.append("-std=c++17") + elif self.spec.satisfies("@0.14.0:2025.09.0"): + hipcc_flags.append("-std=c++14") + entries.append(cmake_cache_string("HIP_HIPCC_FLAGS", " ".join(hipcc_flags))) + hip_for_radiuss_projects(entries, spec, compiler) + else: + entries.append(cmake_cache_option("ENABLE_HIP", False)) + + return entries + + def initconfig_package_entries(self): + spec = self.spec + entries = [] + + option_prefix = "RAJA_" if spec.satisfies("@0.14.0:") else "" + + # TPL locations + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# TPLs") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) + if "camp" in self.spec: + entries.append(cmake_cache_path("camp_DIR", spec["camp"].prefix)) + + # Build options + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# Build Options") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_string("CMAKE_BUILD_TYPE", spec.variants["build_type"].value)) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", spec.satisfies("+shared"))) + + entries.append(cmake_cache_option("RAJA_ENABLE_DESUL_ATOMICS", spec.satisfies("+desul"))) + + entries.append( + cmake_cache_option("RAJA_ENABLE_VECTORIZATION", spec.satisfies("+vectorization")) + ) + + entries.append(cmake_cache_option("RAJA_ENABLE_OPENMP_TASK", spec.satisfies("+omptask"))) + + entries.append( + cmake_cache_option("RAJA_ENABLE_TARGET_OPENMP", spec.satisfies("+omptarget")) + ) + + entries.append(cmake_cache_option("RAJA_ENABLE_SYCL", spec.satisfies("+sycl"))) + + if spec.satisfies("+lowopttest"): + entries.append(cmake_cache_string("CMAKE_CXX_FLAGS_RELEASE", "-O1")) + + # C++17 + if (spec.satisfies("@2025.09.0:") or + (spec.satisfies("@2024.07.0:") and spec.satisfies("+sycl"))): + entries.append(cmake_cache_string("BLT_CXX_STD", "c++17")) + # C++14 + elif spec.satisfies("@0.14.0:2025.09.0"): + entries.append(cmake_cache_string("BLT_CXX_STD", "c++14")) + + if spec.satisfies("+desul"): + if spec.satisfies("+cuda"): + entries.append(cmake_cache_string("CMAKE_CUDA_STANDARD", "14")) + + entries.append( + cmake_cache_option("RAJA_ENABLE_RUNTIME_PLUGINS", spec.satisfies("+plugins")) + ) + + if spec.satisfies("+omptarget"): + entries.append( + cmake_cache_string( + "BLT_OPENMP_COMPILE_FLAGS", "-fopenmp;-fopenmp-targets=nvptx64-nvidia-cuda" + ) + ) + entries.append( + cmake_cache_string( + "BLT_OPENMP_LINK_FLAGS", "-fopenmp;-fopenmp-targets=nvptx64-nvidia-cuda" + ) + ) + + entries.append( + cmake_cache_option( + "{}ENABLE_EXAMPLES".format(option_prefix), spec.satisfies("+examples") + ) + ) + if spec.satisfies("@0.14.0:"): + entries.append( + cmake_cache_option( + "{}ENABLE_EXERCISES".format(option_prefix), spec.satisfies("+exercises") + ) + ) + else: + entries.append(cmake_cache_option("ENABLE_EXERCISES", spec.satisfies("+exercises"))) + + # TODO: Treat the workaround when building tests with spack wrapper + # For now, removing it to test CI, which builds tests outside of wrapper. + # Work around spack adding -march=ppc64le to SPACK_TARGET_ARGS which + # is used by the spack compiler wrapper. This can go away when BLT + # removes -Werror from GTest flags + # + # if self.spec.satisfies("%clang target=ppc64le:") + # or (not self.run_tests and not spec.satisfies("+tests")): + if not self.run_tests and not spec.satisfies("+tests"): + entries.append(cmake_cache_option("ENABLE_TESTS", False)) + else: + entries.append(cmake_cache_option("ENABLE_TESTS", True)) + if not spec.satisfies("+run-all-tests"): + if spec.satisfies("%clang@12.0.0:13.9.999"): + entries.append( + cmake_cache_string( + "CTEST_CUSTOM_TESTS_IGNORE", + "test-algorithm-sort-OpenMP.exe;test-algorithm-stable-sort-OpenMP.exe", + ) + ) + excluded_tests = [ + "test-algorithm-sort-Cuda.exe", + "test-algorithm-stable-sort-Cuda.exe", + "test-algorithm-sort-OpenMP.exe", + "test-algorithm-stable-sort-OpenMP.exe", + ] + if spec.satisfies("+cuda %clang@12.0.0:13.9.999"): + entries.append( + cmake_cache_string("CTEST_CUSTOM_TESTS_IGNORE", ";".join(excluded_tests)) + ) + if spec.satisfies("+cuda %xl@16.1.1.12"): + entries.append( + cmake_cache_string( + "CTEST_CUSTOM_TESTS_IGNORE", + "test-algorithm-sort-Cuda.exe;test-algorithm-stable-sort-Cuda.exe", + ) + ) + + entries.append(cmake_cache_option("RAJA_HOST_CONFIG_LOADED", True)) + + return entries + + def cmake_args(self): + return [] + + @property + def build_relpath(self): + """Relative path to the cmake build subdirectory.""" + return join_path("..", self.build_dirname) + + @run_after("install") + def setup_build_tests(self): + """Copy the build test files after the package is installed to a + relative install test subdirectory for use during `spack test run`.""" + # Now copy the relative files + cache_extra_test_sources(self, self.build_relpath) + + # Ensure the path exists since relying on a relative path at the + # same level as the normal stage source path. + mkdirp(install_test_root(self)) + + @property + def _extra_tests_path(self): + # TODO: The tests should be converted to re-build and run examples + # TODO: using the installed libraries. + return join_path(install_test_root(self), self.build_relpath, "bin") + + def run_example(self, exe, expected): + """run and check outputs of the example""" + with working_dir(self._extra_tests_path): + example = which(exe) + if example is None: + raise SkipTest(f"{exe} was not built") + + out = example(output=str.split, error=str.split) + check_outputs(expected, out) + + def test_line_of_sight(self): + """check line of sight example""" + self.run_example( + "ex5_line-of-sight_solution", + [r"C-style sequential", r"RAJA sequential", r"result -- PASS"], + ) + + def test_stencil_offset_layout(self): + """check stencil offset layout""" + self.run_example( + "ex6_stencil-offset-layout_solution", [r"RAJA Views \(permuted\)", r"result -- PASS"] + ) + + def test_tiled_matrix(self): + """check tiled matrix transpose""" + self.run_example( + "ex8_tiled-matrix-transpose_solution", + [r"C-version", r"RAJA sequential", r"result -- PASS"], + ) + + def test_dynamic_tile(self): + """check kernel dynamic tile""" + self.run_example("kernel-dynamic-tile", [r"Running index", r"(24,24)"]) + + def test_plugin_example(self): + """check plugin example""" + self.run_example("plugin-example", [r"Launching host kernel for the 10 time"]) + + def test_matrix_multiply(self): + """check batched matrix multiple tutorial""" + self.run_example( + "tut_batched-matrix-multiply", [r"batched matrix multiplication", r"result -- PASS"] + ) + + def test_wave_equation(self): + """check wave equation""" + self.run_example("wave-eqn", [r"Max Error = 2", r"Evolved solution to time"]) diff --git a/scripts/spack_packages/packages/scotch/package.py b/scripts/spack_packages/packages/scotch/package.py index c79025a8..ace6057a 100644 --- a/scripts/spack_packages/packages/scotch/package.py +++ b/scripts/spack_packages/packages/scotch/package.py @@ -2,9 +2,9 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack.build_systems import cmake, makefile -from spack.build_systems.cmake import CMakePackage -from spack.build_systems.makefile import MakefilePackage +from spack_repo.builtin.build_systems import cmake, makefile +from spack_repo.builtin.build_systems.cmake import CMakePackage +from spack_repo.builtin.build_systems.makefile import MakefilePackage from spack.package import * diff --git a/scripts/spack_packages/packages/trilinos/cray_secas.patch b/scripts/spack_packages/packages/trilinos/cray_secas.patch deleted file mode 100644 index 14eb4ad3..00000000 --- a/scripts/spack_packages/packages/trilinos/cray_secas.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f29f61e8ebcb8c887c271bc4a764192976910ca3 Mon Sep 17 00:00:00 2001 -From: Howard Pritchard -Date: Mon, 17 Aug 2020 16:05:47 -0600 -Subject: [PATCH] secas: patch FortranSettings for Cray fortran - -compiler. This problem showed up in spack based builds of LANL LAP project dependencies -on one of our cray systems using CCE. - -Signed-off-by: Howard Pritchard - -diff --git a/packages/seacas/cmake/FortranSettings.cmake b/packages/seacas/cmake/FortranSettings.cmake -index c3447d57..7a73ce5f 100644 ---- a/packages/seacas/cmake/FortranSettings.cmake -+++ b/packages/seacas/cmake/FortranSettings.cmake -@@ -8,6 +8,8 @@ IF ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") - SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -fdefault-real-8 -fdefault-integer-8 -fno-range-check") - ELSEIF ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "XL") - SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -WF,-D__XLF__ -qintsize=8 -qrealsize=8 -qfixed") -+ELSEIF ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Cray") -+ SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -sdefault64") - ELSE() - SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -i8") - ENDIF() --- -2.18.4 - diff --git a/scripts/spack_packages/packages/trilinos/fix_clang_errors_12_18_1.patch b/scripts/spack_packages/packages/trilinos/fix_clang_errors_12_18_1.patch deleted file mode 100644 index 6da3f431..00000000 --- a/scripts/spack_packages/packages/trilinos/fix_clang_errors_12_18_1.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 01b88601a85691da73042089778db6db5bf6cf01 Mon Sep 17 00:00:00 2001 -From: Jean-Paul Pelteret -Date: Sat, 1 Feb 2020 05:48:48 +0100 -Subject: [PATCH] Fix Clang 8.0.0 compiler errors 12.18.1 - ---- - packages/belos/tpetra/src/solvers/Belos_Tpetra_Krylov.hpp | 2 +- - packages/muelu/src/Interface/MueLu_ParameterListUtils.cpp | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/packages/belos/tpetra/src/solvers/Belos_Tpetra_Krylov.hpp b/packages/belos/tpetra/src/solvers/Belos_Tpetra_Krylov.hpp -index d4f72bc..302dfc2 100644 ---- a/packages/belos/tpetra/src/solvers/Belos_Tpetra_Krylov.hpp -+++ b/packages/belos/tpetra/src/solvers/Belos_Tpetra_Krylov.hpp -@@ -126,7 +126,7 @@ public: - virtual void - getDefaultParameters (Teuchos::ParameterList& params) const - { -- const SolverInput input; -+ const SolverInput input{}; - const int verbosity = 0; - const std::string implResScal = input.needToScale ? - "Norm of Preconditioned Initial Residual" : "None"; // ??? -diff --git a/packages/muelu/src/Interface/MueLu_ParameterListUtils.cpp b/packages/muelu/src/Interface/MueLu_ParameterListUtils.cpp -index 051a2df..a703aff 100644 ---- a/packages/muelu/src/Interface/MueLu_ParameterListUtils.cpp -+++ b/packages/muelu/src/Interface/MueLu_ParameterListUtils.cpp -@@ -143,7 +143,7 @@ namespace MueLu { - - // Usage: GetMLSubList(paramList, "smoother", 2); - const Teuchos::ParameterList & GetMLSubList(const Teuchos::ParameterList & paramList, const std::string & type, int levelID) { -- static const Teuchos::ParameterList emptyParamList; -+ static const Teuchos::ParameterList emptyParamList{}; - - char levelChar[11]; - sprintf(levelChar, "(level %d)", levelID); --- -2.10.1 (Apple Git-78) - diff --git a/scripts/spack_packages/packages/trilinos/package.py b/scripts/spack_packages/packages/trilinos/package.py deleted file mode 100644 index 20600933..00000000 --- a/scripts/spack_packages/packages/trilinos/package.py +++ /dev/null @@ -1,907 +0,0 @@ -# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -# GEOSX_EDIT_START -# This is an older, modified version of the spack recipe (Commit date: 3/8/22, Spack PR: #29256): -# https://github.com/spack/spack/blob/b2a02861bbbe8c989d24b8c7fbd202e31abc6bd0/var/spack/repos/builtin/packages/trilinos/package.py -# GEOSX_EDIT_END -# yapf: disable - -import os -import sys - -from spack import * -from spack.build_environment import dso_suffix -from spack.error import NoHeadersError -from spack.operating_systems.mac_os import macos_version -from spack.pkg.builtin.kokkos import Kokkos - -# Trilinos is complicated to build, as an inspiration a couple of links to -# other repositories which build it: -# https://github.com/hpcugent/easybuild-easyblocks/blob/master/easybuild/easyblocks/t/trilinos.py#L111 -# https://github.com/koecher/candi/blob/master/deal.II-toolchain/packages/trilinos.package -# https://gitlab.com/configurations/cluster-config/blob/master/trilinos.sh -# https://github.com/Homebrew/homebrew-science/blob/master/trilinos.rb and some -# relevant documentation/examples: -# https://github.com/trilinos/Trilinos/issues/175 - - -class Trilinos(CMakePackage, CudaPackage, ROCmPackage): - """The Trilinos Project is an effort to develop algorithms and enabling - technologies within an object-oriented software framework for the solution - of large-scale, complex multi-physics engineering and scientific problems. - A unique design feature of Trilinos is its focus on packages. - """ - homepage = "https://trilinos.org/" - url = "https://github.com/trilinos/Trilinos/archive/trilinos-release-12-12-1.tar.gz" - git = "https://github.com/trilinos/Trilinos.git" - - maintainers = ['keitat', 'sethrj', 'kuberry'] - - tags = ['e4s'] - - # ###################### Versions ########################## - - version('master', branch='master') - version('develop', branch='develop') - # GEOS Added - version("16.1.0", sha256="e9651c88f581049457036cfc01b527a9d3903c257338eeeab942befd7452f23a") - version("16.0.0", sha256="46bfc40419ed2aa2db38c144fb8e61d4aa8170eaa654a88d833ba6b92903f309") - - version("13.4.1", sha256="5465cbff3de7ef4ac7d40eeff9d99342c00d9d20eee0a5f64f0a523093f5f1b3") - version("13.4.0", sha256="39550006e059043b7e2177f10467ae2f77fe639901aee91cbc1e359516ff8d3e") - version('13.2.0', commit='4a5f7906a6420ee2f9450367e9cc95b28c00d744') # tag trilinos-release-13-2-0 - version('13.0.1', commit='4796b92fb0644ba8c531dd9953e7a4878b05c62d', preferred=True) # tag trilinos-release-13-0-1 - version('13.0.0', commit='9fec35276d846a667bc668ff4cbdfd8be0dfea08') # tag trilinos-release-13-0-0 - version('12.18.1', commit='55a75997332636a28afc9db1aee4ae46fe8d93e7') # tag trilinos-release-12-8-1 - version('12.14.1', sha256='52a4406cca2241f5eea8e166c2950471dd9478ad6741cbb2a7fc8225814616f0') - version('12.12.1', sha256='5474c5329c6309224a7e1726cf6f0d855025b2042959e4e2be2748bd6bb49e18') - version('12.10.1', sha256='ab81d917196ffbc21c4927d42df079dd94c83c1a08bda43fef2dd34d0c1a5512') - version('12.8.1', sha256='d20fe60e31e3ba1ef36edecd88226240a518f50a4d6edcc195b88ee9dda5b4a1') - version('12.6.4', sha256='1c7104ba60ee8cc4ec0458a1c4f6a26130616bae7580a7b15f2771a955818b73') - version('12.6.3', sha256='4d28298bb4074eef522db6cd1626f1a934e3d80f292caf669b8846c0a458fe81') - version('12.6.2', sha256='8be7e3e1166cc05aea7f856cc8033182e8114aeb8f87184cb38873bfb2061779') - version('12.6.1', sha256='4b38ede471bed0036dcb81a116fba8194f7bf1a9330da4e29c3eb507d2db18db') - version('12.4.2', sha256='fd2c12e87a7cedc058bcb8357107ffa2474997aa7b17b8e37225a1f7c32e6f0e') - version('12.2.1', sha256='088f303e0dc00fb4072b895c6ecb4e2a3ad9a2687b9c62153de05832cf242098') - version('12.0.1', sha256='eee7c19ca108538fa1c77a6651b084e06f59d7c3307dae77144136639ab55980') - version('11.14.3', sha256='e37fa5f69103576c89300e14d43ba77ad75998a54731008b25890d39892e6e60') - version('11.14.2', sha256='f22b2b0df7b88e28b992e19044ba72b845292b93cbbb3a948488199647381119') - version('11.14.1', sha256='f10fc0a496bf49427eb6871c80816d6e26822a39177d850cc62cf1484e4eec07') - - # ###################### Variants ########################## - - # Build options - variant('complex', default=False, description='Enable complex numbers in Trilinos') - variant('cuda_rdc', default=False, description='Turn on RDC for CUDA build') - variant('rocm_rdc', default=False, description='Turn on RDC for ROCm build') - - # GEOS Adjusted - variant('cxxstd', default='17', values=['11', '14', '17'], multi=False) - # variant('cxxstd', default='14', values=['11', '14', '17'], multi=False) - - variant('debug', default=False, description='Enable runtime safety and debug checks') - variant('explicit_template_instantiation', default=True, description='Enable explicit template instantiation (ETI)') - variant('float', default=False, description='Enable single precision (float) numbers in Trilinos') - variant('fortran', default=True, description='Compile with Fortran support') - variant('gotype', default='long_long', - values=('int', 'long', 'long_long', 'all'), - multi=False, - description='global ordinal type for Tpetra') - variant('openmp', default=False, description='Enable OpenMP') - variant('python', default=False, description='Build PyTrilinos wrappers') - variant('shared', default=True, description='Enables the build of shared libraries') - variant('uvm', default=False, when='@13.2: +cuda', description='Turn on UVM for CUDA build') - variant('wrapper', default=False, description='Use nvcc-wrapper for CUDA build') - - # TPLs (alphabet order) - variant('adios2', default=False, description='Enable ADIOS2') - variant('boost', default=False, description='Compile with Boost') - variant('hdf5', default=False, description='Compile with HDF5') - variant('hypre', default=False, description='Compile with Hypre preconditioner') - variant('mpi', default=True, description='Compile with MPI parallelism') - variant('mumps', default=False, description='Compile with support for MUMPS solvers') - variant('suite-sparse', default=False, description='Compile with SuiteSparse solvers') - variant('superlu-dist', default=False, description='Compile with SuperluDist solvers') - variant('superlu', default=False, description='Compile with SuperLU solvers') - variant('strumpack', default=False, description='Compile with STRUMPACK solvers') - variant('x11', default=False, description='Compile with X11 when +exodus') - - # Package options (alphabet order) - variant('amesos', default=True, description='Compile with Amesos') - variant('amesos2', default=True, description='Compile with Amesos2') - variant('anasazi', default=True, description='Compile with Anasazi') - variant('aztec', default=True, description='Compile with Aztec') - variant('belos', default=True, description='Compile with Belos') - variant('chaco', default=False, description='Compile with Chaco from SEACAS') - variant('epetra', default=True, description='Compile with Epetra') - variant('epetraext', default=True, description='Compile with EpetraExt') - variant('exodus', default=False, description='Compile with Exodus from SEACAS') - variant('ifpack', default=True, description='Compile with Ifpack') - variant('ifpack2', default=True, description='Compile with Ifpack2') - variant('intrepid', default=False, description='Enable Intrepid') - variant('intrepid2', default=False, description='Enable Intrepid2') - variant('isorropia', default=False, description='Compile with Isorropia') - variant('gtest', default=False, description='Build vendored Googletest') - variant('kokkos', default=True, description='Compile with Kokkos') - variant('ml', default=True, description='Compile with ML') - variant('minitensor', default=False, description='Compile with MiniTensor') - variant('muelu', default=True, description='Compile with Muelu') - variant('nox', default=False, description='Compile with NOX') - variant('panzer', default=False, description='Compile with Panzer') - variant('piro', default=False, description='Compile with Piro') - variant('phalanx', default=False, description='Compile with Phalanx') - variant('rol', default=False, description='Compile with ROL') - variant('rythmos', default=False, description='Compile with Rythmos') - variant('sacado', default=True, description='Compile with Sacado') - variant('stk', default=False, description='Compile with STK') - variant('shards', default=False, description='Compile with Shards') - variant('shylu', default=False, description='Compile with ShyLU') - variant('stokhos', default=False, description='Compile with Stokhos') - variant('stratimikos', default=False, description='Compile with Stratimikos') - variant('teko', default=False, description='Compile with Teko') - variant('tempus', default=False, description='Compile with Tempus') - variant('thyra', default=False, description='Compile with Thyra') - variant('tpetra', default=True, description='Compile with Tpetra') - variant('trilinoscouplings', default=False, description='Compile with TrilinosCouplings') - variant('zoltan', default=False, description='Compile with Zoltan') - variant('zoltan2', default=False, description='Compile with Zoltan2') - - # Internal package options (alphabetical order) - variant('basker', default=False, description='Compile with the Basker solver in Amesos2') - variant('epetraextbtf', default=False, description='Compile with BTF in EpetraExt') - variant('epetraextexperimental', default=False, description='Compile with experimental in EpetraExt') - variant('epetraextgraphreorderings', default=False, description='Compile with graph reorderings in EpetraExt') - - # External package options - variant('dtk', default=False, description='Enable DataTransferKit (deprecated)') - variant('scorec', default=False, description='Enable SCOREC') - variant('mesquite', default=False, description='Enable Mesquite (deprecated)') - - resource(name='dtk', - git='https://github.com/ornl-cees/DataTransferKit.git', - commit='4fe4d9d56cfd4f8a61f392b81d8efd0e389ee764', # branch dtk-3.0 - placement='DataTransferKit', - when='+dtk @12.14.0:12.14') - resource(name='dtk', - git='https://github.com/ornl-cees/DataTransferKit.git', - commit='edfa050cd46e2274ab0a0b7558caca0079c2e4ca', # tag 3.1-rc1 - placement='DataTransferKit', - submodules=True, - when='+dtk @12.18.0:12.18') - resource(name='scorec', - git='https://github.com/SCOREC/core.git', - commit='73c16eae073b179e45ec625a5abe4915bc589af2', # tag v2.2.5 - placement='SCOREC', - when='+scorec') - resource(name='mesquite', - url='https://github.com/trilinos/mesquite/archive/trilinos-release-12-12-1.tar.gz', - sha256='e0d09b0939dbd461822477449dca611417316e8e8d8268fd795debb068edcbb5', - placement='packages/mesquite', - when='+mesquite @12.12.1:12.16') - resource(name='mesquite', - git='https://github.com/trilinos/mesquite.git', - commit='20a679679b5cdf15bf573d66c5dc2b016e8b9ca1', # branch trilinos-release-12-12-1 - placement='packages/mesquite', - when='+mesquite @12.18.1:12.18') - resource(name='mesquite', - git='https://github.com/trilinos/mesquite.git', - tag='develop', - placement='packages/mesquite', - when='+mesquite @master') - - # ###################### Conflicts ########################## - - # Epetra stack - with when('~epetra'): - conflicts('+amesos') - conflicts('+aztec') - conflicts('+epetraext') - conflicts('+ifpack') - conflicts('+isorropia') - conflicts('+ml', when='@13.2:') - with when('~epetraext'): - conflicts('+isorropia') - conflicts('+teko') - conflicts('+epetraextbtf') - conflicts('+epetraextexperimental') - conflicts('+epetraextgraphreorderings') - with when('+teko'): - conflicts('~stratimikos') - conflicts('@:12 gotype=long') - with when('+piro'): - conflicts('~stratimikos') - conflicts('~nox') - - # Tpetra stack - with when('~kokkos'): - conflicts('+cuda') - conflicts('+rocm') - conflicts('+tpetra') - conflicts('+intrepid2') - conflicts('+phalanx') - with when('~tpetra'): - conflicts('+amesos2') - conflicts('+dtk') - conflicts('+ifpack2') - conflicts('+muelu') - conflicts('+teko') - conflicts('+zoltan2') - - with when('~zoltan'): - conflicts('+isorropia') - conflicts('+scorec') - conflicts('+shylu') - conflicts('+zoltan2') - with when('~shards'): - conflicts('+intrepid') - conflicts('+intrepid2') - conflicts('+scorec') - conflicts('+stk') - with when('+scorec'): - conflicts('~mpi') - conflicts('~stk') - - # Panzer is not gen-2 library - with when('+panzer'): - conflicts('~intrepid2') - conflicts('~mpi') - conflicts('~phalanx') - conflicts('~sacado') - conflicts('~tpetra') - conflicts('~thyra') - conflicts('~zoltan') - conflicts('~nox') - conflicts('~rythmos') - conflicts('~piro') - conflicts('~stratimikos') - conflicts('~stk') - conflicts('~ml') - conflicts('~ifpack') - conflicts('~aztec') - - # Known requirements from tribits dependencies - conflicts('~thyra', when='+stratimikos') - conflicts('+aztec', when='~fortran') - conflicts('+basker', when='~amesos2') - conflicts('+ifpack2', when='~belos') - conflicts('+intrepid', when='~sacado') - conflicts('+minitensor', when='~boost') - conflicts('+phalanx', when='~sacado') - conflicts('+stokhos', when='~kokkos') - conflicts('+tempus', when='~nox') - - # Only allow DTK with Trilinos 12.14, 12.18 - conflicts('+dtk', when='~boost') - conflicts('+dtk', when='~intrepid2') - conflicts('+dtk', when='@:12.12,13:') - - # Installed FindTrilinos are broken in SEACAS if Fortran is disabled - # see https://github.com/trilinos/Trilinos/issues/3346 - conflicts('+exodus', when='@:13.0.1 ~fortran') - # Only allow Mesquite with Trilinos 12.12 and up, and master - conflicts('+mesquite', when='@:12.10,master') - # Strumpack is only available as of mid-2021 - conflicts('+strumpack', when='@:13.0') - # Can only use one type of SuperLU - conflicts('+superlu-dist', when='+superlu') - # For Trilinos v11 we need to force SuperLUDist=OFF, since only the - # deprecated SuperLUDist v3.3 together with an Amesos patch is working. - conflicts('+superlu-dist', when='@11.4.1:11.14.3') - # see https://github.com/trilinos/Trilinos/issues/3566 - conflicts('+superlu-dist', when='+float+amesos2+explicit_template_instantiation^superlu-dist@5.3.0:') - # Amesos, conflicting types of double and complex SLU_D - # see https://trilinos.org/pipermail/trilinos-users/2015-March/004731.html - # and https://trilinos.org/pipermail/trilinos-users/2015-March/004802.html - conflicts('+superlu-dist', when='+complex+amesos2') - # https://github.com/trilinos/Trilinos/issues/2994 - conflicts( - '+shared', when='+stk platform=darwin', - msg='Cannot build Trilinos with STK as a shared library on Darwin.' - ) - conflicts('+adios2', when='@:12.14.1') - conflicts('cxxstd=11', when='@13.2:') - conflicts('cxxstd=17', when='@:12') - conflicts('cxxstd=11', when='+wrapper ^cuda@6.5.14') - conflicts('cxxstd=14', when='+wrapper ^cuda@6.5.14:8.0.61') - conflicts('cxxstd=17', when='+wrapper ^cuda@6.5.14:10.2.89') - - # Multi-value gotype only applies to trilinos through 12.14 - conflicts('gotype=all', when='@12.15:') - - # CUDA without wrapper requires clang - for _compiler in spack.compilers.supported_compilers(): - if _compiler != 'clang': - conflicts('+cuda', when='~wrapper %' + _compiler, - msg='trilinos~wrapper+cuda can only be built with the ' - 'Clang compiler') - conflicts('+cuda_rdc', when='~cuda') - conflicts('+rocm_rdc', when='~rocm') - conflicts('+wrapper', when='~cuda') - conflicts('+wrapper', when='%clang') - - # Old trilinos fails with new CUDA (see #27180) - conflicts('@:13.0.1 +cuda', when='^cuda@11:') - # Build hangs with CUDA 11.6 (see #28439) - conflicts('+cuda +stokhos', when='^cuda@11.6:') - # Cuda UVM must be enabled prior to 13.2 - # See https://github.com/spack/spack/issues/28869 - conflicts('~uvm', when='@:13.1 +cuda') - - # stokhos fails on xl/xl_r - conflicts('+stokhos', when='%xl') - conflicts('+stokhos', when='%xl_r') - - # ###################### Dependencies ########################## - - depends_on('adios2', when='+adios2') - depends_on('blas') - depends_on('boost', when='+boost') - # Need to revisit the requirement of STK - depends_on('boost', when='+stk') - - # - depends_on('cgns', when='+exodus') - depends_on('hdf5+hl', when='+hdf5') - depends_on('hypre~internal-superlu~int64', when='+hypre') - depends_on('kokkos-nvcc-wrapper', when='+wrapper') - depends_on('lapack') - # depends_on('perl', type=('build',)) # TriBITS finds but doesn't use... - depends_on('libx11', when='+x11') - depends_on('matio', when='+exodus') - depends_on('metis', when='+zoltan') - depends_on('mpi', when='+mpi') - depends_on('netcdf-c', when="+exodus") - depends_on('parallel-netcdf', when='+exodus+mpi') - depends_on('parmetis', when='+mpi +zoltan') - depends_on('parmetis', when='+scorec') - depends_on('py-mpi4py', when='+mpi+python', type=('build', 'run')) - depends_on('py-numpy', when='+python', type=('build', 'run')) - depends_on('python', when='+python') - depends_on('python', when='@13.2: +ifpack +hypre', type='build') - depends_on('python', when='@13.2: +ifpack2 +hypre', type='build') - depends_on('scalapack', when='+mumps') - depends_on('scalapack', when='+strumpack+mpi') - depends_on('strumpack+shared', when='+strumpack') - depends_on('suite-sparse', when='+suite-sparse') - depends_on('superlu-dist', when='+superlu-dist') - depends_on('superlu@4.3 +pic', when='+superlu') - depends_on('swig', when='+python') - depends_on('zlib', when='+zoltan') - - # Trilinos' Tribits config system is limited which makes it very tricky to - # link Amesos with static MUMPS, see - # https://trilinos.org/docs/dev/packages/amesos2/doc/html/classAmesos2_1_1MUMPS.html - # One could work it out by getting linking flags from mpif90 --showme:link - # (or alike) and adding results to -DTrilinos_EXTRA_LINK_FLAGS together - # with Blas and Lapack and ScaLAPACK and Blacs and -lgfortran and it may - # work at the end. But let's avoid all this by simply using shared libs - depends_on('mumps@5.0:+shared', when='+mumps') - - for _flag in ('~mpi', '+mpi'): - depends_on('hdf5' + _flag, when='+hdf5' + _flag) - depends_on('mumps' + _flag, when='+mumps' + _flag) - for _flag in ('~openmp', '+openmp'): - depends_on('mumps' + _flag, when='+mumps' + _flag) - - # GEOSX_EDIT_START - # Do not force hwloc as dependency (MPI error on quartz) - #depends_on('hwloc', when='@13: +kokkos') - #depends_on('hwloc+cuda', when='@13: +kokkos+cuda') - # GEOSX_EDIT_END - depends_on('hypre@develop', when='@master: +hypre') - depends_on('netcdf-c+mpi+parallel-netcdf', when="+exodus+mpi@12.12.1:") - depends_on('superlu-dist@4.4:5.3', when='@12.6.2:12.12.1+superlu-dist') - depends_on('superlu-dist@5.4:6.2.0', when='@12.12.2:13.0.0+superlu-dist') - depends_on('superlu-dist@6.3.0:', when='@13.0.1:99 +superlu-dist') - depends_on('superlu-dist@:4.3', when='@11.14.1:12.6.1+superlu-dist') - depends_on('superlu-dist@develop', when='@master: +superlu-dist') - - # ###################### Patches ########################## - - # GEOSX_EDIT_START - # Comment out unused patches - - #patch('umfpack_from_suitesparse.patch', when='@11.14.1:12.8.1') - #for _compiler in ['xl', 'xl_r', 'clang']: - # patch('xlf_seacas.patch', when='@12.10.1:12.12.1 %' + _compiler) - # patch('xlf_tpetra.patch', when='@12.12.1 %' + _compiler) - patch('fix_clang_errors_12_18_1.patch', when='@12.18.1%clang') - #patch('cray_secas_12_12_1.patch', when='@12.12.1%cce') - patch('cray_secas.patch', when='@12.14.1:%cce') - - # workaround an NVCC bug with c++14 (https://github.com/trilinos/Trilinos/issues/6954) - # avoid calling deprecated functions with CUDA-11 - #patch('fix_cxx14_cuda11.patch', when='@13.0.0:13.0.1 cxxstd=14 ^cuda@11:') - # Allow building with +teko gotype=long - #patch('https://github.com/trilinos/Trilinos/commit/b17f20a0b91e0b9fc5b1b0af3c8a34e2a4874f3f.patch', - # sha256='dee6c55fe38eb7f6367e1896d6bc7483f6f9ab8fa252503050cc0c68c6340610', - # when='@13.0.0:13.0.1 +teko gotype=long') - # GEOSX_EDIT_END - - def flag_handler(self, name, flags): - is_cce = self.spec.satisfies('%cce') - - if name == 'cxxflags': - spec = self.spec - if '+mumps' in spec: - # see https://github.com/trilinos/Trilinos/blob/master/packages/amesos/README-MUMPS - flags.append('-DMUMPS_5_0') - if '+stk platform=darwin' in spec: - flags.append('-DSTK_NO_BOOST_STACKTRACE') - if '+stk%intel' in spec: - # Workaround for Intel compiler segfaults with STK and IPO - flags.append('-no-ipo') - if '+wrapper' in spec: - flags.append('--expt-extended-lambda') - elif name == 'ldflags' and is_cce: - flags.append('-fuse-ld=gold') - - # GEOSX_EDIT_START - # Property insert gcc-toolchain flag through environment - if name in ['cflags', 'cxxflags', 'cppflags']: - return (None, None, flags) - # GEOSX_EDIT_END - - if is_cce: - return (None, None, flags) - return (flags, None, None) - - def url_for_version(self, version): - url = "https://github.com/trilinos/Trilinos/archive/trilinos-release-{0}.tar.gz" - return url.format(version.dashed) - - def setup_dependent_run_environment(self, env, dependent_spec): - if '+cuda' in self.spec: - # currently Trilinos doesn't perform the memory fence so - # it relies on blocking CUDA kernel launch. This is needed - # in case the dependent app also run a CUDA backend via Trilinos - env.set('CUDA_LAUNCH_BLOCKING', '1') - - def setup_dependent_package(self, module, dependent_spec): - if '+wrapper' in self.spec: - self.spec.kokkos_cxx = self.spec["kokkos-nvcc-wrapper"].kokkos_cxx - else: - self.spec.kokkos_cxx = spack_cxx - - def setup_build_environment(self, env): - spec = self.spec - if '+cuda' in spec and '+wrapper' in spec: - if '+mpi' in spec: - env.set('OMPI_CXX', spec["kokkos-nvcc-wrapper"].kokkos_cxx) - env.set('MPICH_CXX', spec["kokkos-nvcc-wrapper"].kokkos_cxx) - env.set('MPICXX_CXX', spec["kokkos-nvcc-wrapper"].kokkos_cxx) - else: - env.set('CXX', spec["kokkos-nvcc-wrapper"].kokkos_cxx) - - if '+rocm' in spec: - if '+mpi' in spec: - env.set('OMPI_CXX', self.spec['hip'].hipcc) - env.set('MPICH_CXX', self.spec['hip'].hipcc) - env.set('MPICXX_CXX', self.spec['hip'].hipcc) - else: - env.set('CXX', self.spec['hip'].hipcc) - if '+stk' in spec: - # Using CXXFLAGS for hipcc which doesn't use flags in the spack wrappers - env.set('CXXFLAGS', '-DSTK_NO_BOOST_STACKTRACE') - - def cmake_args(self): - options = [] - - spec = self.spec - # GEOSX_EDIT_START - #define = CMakePackage.define - define = self.define - # GEOSX_EDIT_END - define_from_variant = self.define_from_variant - - def _make_definer(prefix): - def define_enable(suffix, value=None): - key = prefix + suffix - if value is None: - # Default to lower-case spec - value = suffix.lower() - elif isinstance(value, bool): - # Explicit true/false - return define(key, value) - return define_from_variant(key, value) - return define_enable - - # Return "Trilinos_ENABLE_XXX" for spec "+xxx" or boolean value - define_trilinos_enable = _make_definer("Trilinos_ENABLE_") - # Same but for TPLs - define_tpl_enable = _make_definer("TPL_ENABLE_") - - # #################### Base Settings ####################### - - options.extend([ - define('Trilinos_VERBOSE_CONFIGURE', False), - define_from_variant('BUILD_SHARED_LIBS', 'shared'), - define_trilinos_enable('ALL_OPTIONAL_PACKAGES', False), - define_trilinos_enable('ALL_PACKAGES', False), - define_trilinos_enable('CXX11', True), - define_trilinos_enable('DEBUG', 'debug'), - define_trilinos_enable('EXAMPLES', False), - define_trilinos_enable('SECONDARY_TESTED_CODE', True), - define_trilinos_enable('TESTS', False), - define_trilinos_enable('Fortran'), - define_trilinos_enable('OpenMP'), - define_trilinos_enable('EXPLICIT_INSTANTIATION', - 'explicit_template_instantiation') - ]) - - if spec.version >= Version('13'): - options.append(define_from_variant('CMAKE_CXX_STANDARD', 'cxxstd')) - else: - # Prior to version 13, Trilinos would erroneously inject - # '-std=c++11' regardless of CMAKE_CXX_STANDARD value - options.append(define( - 'Trilinos_CXX11_FLAGS', - self.compiler.cxx14_flag - if spec.variants['cxxstd'].value == '14' - else self.compiler.cxx11_flag - )) - - # ################## Trilinos Packages ##################### - - options.extend([ - define_trilinos_enable('Amesos'), - define_trilinos_enable('Amesos2'), - define_trilinos_enable('Anasazi'), - define_trilinos_enable('AztecOO', 'aztec'), - define_trilinos_enable('Belos'), - define_trilinos_enable('Epetra'), - define_trilinos_enable('EpetraExt'), - define_trilinos_enable('FEI', False), - define_trilinos_enable('Gtest'), - define_trilinos_enable('Ifpack'), - define_trilinos_enable('Ifpack2'), - define_trilinos_enable('Intrepid'), - define_trilinos_enable('Intrepid2'), - define_trilinos_enable('Isorropia'), - define_trilinos_enable('Kokkos'), - define_trilinos_enable('MiniTensor'), - define_trilinos_enable('Mesquite'), - define_trilinos_enable('ML'), - define_trilinos_enable('MueLu'), - define_trilinos_enable('NOX'), - define_trilinos_enable('Pamgen', False), - define_trilinos_enable('Panzer'), - define_trilinos_enable('Pike', False), - define_trilinos_enable('Piro'), - define_trilinos_enable('Phalanx'), - define_trilinos_enable('PyTrilinos', 'python'), - define_trilinos_enable('ROL'), - define_trilinos_enable('Rythmos'), - define_trilinos_enable('Sacado'), - define_trilinos_enable('SCOREC'), - define_trilinos_enable('Shards'), - define_trilinos_enable('ShyLU'), - define_trilinos_enable('STK'), - define_trilinos_enable('Stokhos'), - define_trilinos_enable('Stratimikos'), - define_trilinos_enable('Teko'), - define_trilinos_enable('Tempus'), - define_trilinos_enable('Thyra'), - define_trilinos_enable('Tpetra'), - define_trilinos_enable('TrilinosCouplings'), - define_trilinos_enable('Zoltan'), - define_trilinos_enable('Zoltan2'), - define_from_variant('EpetraExt_BUILD_BTF', 'epetraextbtf'), - define_from_variant('EpetraExt_BUILD_EXPERIMENTAL', - 'epetraextexperimental'), - define_from_variant('EpetraExt_BUILD_GRAPH_REORDERINGS', - 'epetraextgraphreorderings'), - define_from_variant('Amesos2_ENABLE_Basker', 'basker'), - define_from_variant('Amesos2_ENABLE_LAPACK', 'amesos2'), - ]) - - # GEOS Added - Disable deprecated warning failures - options.extend([ - define('Epetra_SHOW_DEPRECATED_WARNINGS', False), - define('EpetraExt_SHOW_DEPRECATED_WARNINGS', False), - define('ML_SHOW_DEPRECATED_WARNINGS', False), - define('AztecOO_SHOW_DEPRECATED_WARNINGS', False), - define('Ifpack_SHOW_DEPRECATED_WARNINGS', False), - ]) - - if '+dtk' in spec: - options.extend([ - define('Trilinos_EXTRA_REPOSITORIES', 'DataTransferKit'), - define_trilinos_enable('DataTransferKit', True), - ]) - - if '+exodus' in spec: - options.extend([ - define_trilinos_enable('SEACAS', True), - define_trilinos_enable('SEACASExodus', True), - define_trilinos_enable('SEACASIoss', True), - define_trilinos_enable('SEACASEpu', True), - define_trilinos_enable('SEACASExodiff', True), - define_trilinos_enable('SEACASNemspread', True), - define_trilinos_enable('SEACASNemslice', True), - ]) - else: - options.extend([ - define_trilinos_enable('SEACASExodus', False), - define_trilinos_enable('SEACASIoss', False), - ]) - - if '+chaco' in spec: - options.extend([ - define_trilinos_enable('SEACAS', True), - define_trilinos_enable('SEACASChaco', True), - ]) - else: - # don't disable SEACAS, could be needed elsewhere - options.extend([ - define_trilinos_enable('SEACASChaco', False), - define_trilinos_enable('SEACASNemslice', False) - ]) - - if '+stratimikos' in spec: - # Explicitly enable Thyra (ThyraCore is required). If you don't do - # this, then you get "NOT setting ${pkg}_ENABLE_Thyra=ON since - # Thyra is NOT enabled at this point!" leading to eventual build - # errors if using MueLu because `Xpetra_ENABLE_Thyra` is set to - # off. - - # Add thyra adapters based on package enables - options.extend( - define_trilinos_enable('Thyra' + pkg + 'Adapters', pkg.lower()) - for pkg in ['Epetra', 'EpetraExt', 'Tpetra']) - - # ######################### TPLs ############################# - - def define_tpl(trilinos_name, spack_name, have_dep): - options.append(define('TPL_ENABLE_' + trilinos_name, have_dep)) - if not have_dep: - return - depspec = spec[spack_name] - libs = depspec.libs - try: - options.extend([ - define(trilinos_name + '_INCLUDE_DIRS', - depspec.headers.directories), - ]) - except NoHeadersError: - # Handle case were depspec does not have headers - pass - - options.extend([ - define(trilinos_name + '_ROOT', depspec.prefix), - define(trilinos_name + '_LIBRARY_NAMES', libs.names), - define(trilinos_name + '_LIBRARY_DIRS', libs.directories), - ]) - - # Enable these TPLs explicitly from variant options. - # Format is (TPL name, variant name, Spack spec name) - tpl_variant_map = [ - ('ADIOS2', 'adios2', 'adios2'), - ('Boost', 'boost', 'boost'), - ('CUDA', 'cuda', 'cuda'), - ('HDF5', 'hdf5', 'hdf5'), - ('HYPRE', 'hypre', 'hypre'), - ('MUMPS', 'mumps', 'mumps'), - ('UMFPACK', 'suite-sparse', 'suite-sparse'), - ('SuperLU', 'superlu', 'superlu'), - ('SuperLUDist', 'superlu-dist', 'superlu-dist'), - ('X11', 'x11', 'libx11'), - ] - if spec.satisfies('@13.0.2:'): - tpl_variant_map.append(('STRUMPACK', 'strumpack', 'strumpack')) - - for tpl_name, var_name, spec_name in tpl_variant_map: - define_tpl(tpl_name, spec_name, spec.variants[var_name].value) - - # Enable these TPLs based on whether they're in our spec; prefer to - # require this way so that packages/features disable availability - tpl_dep_map = [ - ('BLAS', 'blas'), - ('CGNS', 'cgns'), - ('LAPACK', 'lapack'), - ('Matio', 'matio'), - ('METIS', 'metis'), - ('Netcdf', 'netcdf-c'), - ('SCALAPACK', 'scalapack'), - ('Zlib', 'zlib'), - ] - if spec.satisfies('@12.12.1:'): - tpl_dep_map.append(('Pnetcdf', 'parallel-netcdf')) - - # GEOSX_EDIT_START - #if spec.satisfies('@13:'): - # tpl_dep_map.append(('HWLOC', 'hwloc')) - # GEOSX_EDIT_END - - for tpl_name, dep_name in tpl_dep_map: - define_tpl(tpl_name, dep_name, dep_name in spec) - - # MPI settings - options.append(define_tpl_enable('MPI')) - if '+mpi' in spec: - # Force Trilinos to use the MPI wrappers instead of raw compilers - # to propagate library link flags for linkers that require fully - # resolved symbols in shared libs (such as macOS and some newer - # Ubuntu) - options.extend([ - define('CMAKE_C_COMPILER', spec['mpi'].mpicc), - define('CMAKE_CXX_COMPILER', spec['mpi'].mpicxx), - define('CMAKE_Fortran_COMPILER', spec['mpi'].mpifc), - define('MPI_BASE_DIR', spec['mpi'].prefix), - ]) - - # ParMETIS dependencies have to be transitive explicitly - have_parmetis = 'parmetis' in spec - options.append(define_tpl_enable('ParMETIS', have_parmetis)) - if have_parmetis: - options.extend([ - define('ParMETIS_LIBRARY_DIRS', [ - spec['parmetis'].prefix.lib, spec['metis'].prefix.lib - ]), - define('ParMETIS_LIBRARY_NAMES', ['parmetis', 'metis']), - define('TPL_ParMETIS_INCLUDE_DIRS', - spec['parmetis'].headers.directories + - spec['metis'].headers.directories), - ]) - - if spec.satisfies('^superlu-dist@4.0:'): - options.extend([ - define('HAVE_SUPERLUDIST_LUSTRUCTINIT_2ARG', True), - ]) - - if spec.satisfies('^parallel-netcdf'): - options.extend([ - define('TPL_Netcdf_Enables_Netcdf4', True), - define('TPL_Netcdf_PARALLEL', True), - define('PNetCDF_ROOT', spec['parallel-netcdf'].prefix), - ]) - - options.append(define_tpl_enable('Cholmod', False)) - - if spec.satisfies('platform=darwin'): - # Don't let TriBITS define `libdl` as an absolute path to - # the MacOSX{nn.n}.sdk since that breaks at every xcode update - options.append(define_tpl_enable('DLlib', False)) - - # ################# Explicit template instantiation ################# - - complex_s = spec.variants['complex'].value - float_s = spec.variants['float'].value - - options.extend([ - define('Teuchos_ENABLE_COMPLEX', complex_s), - define('Teuchos_ENABLE_FLOAT', float_s), - ]) - - if '+tpetra +explicit_template_instantiation' in spec: - options.append(define_from_variant('Tpetra_INST_OPENMP', 'openmp')) - options.extend([ - define('Tpetra_INST_DOUBLE', True), - define('Tpetra_INST_COMPLEX_DOUBLE', complex_s), - define('Tpetra_INST_COMPLEX_FLOAT', float_s and complex_s), - define('Tpetra_INST_FLOAT', float_s), - define('Tpetra_INST_SERIAL', True), - ]) - - gotype = spec.variants['gotype'].value - if gotype == 'all': - # default in older Trilinos versions to enable multiple GOs - options.extend([ - define('Tpetra_INST_INT_INT', True), - define('Tpetra_INST_INT_LONG', True), - define('Tpetra_INST_INT_LONG_LONG', True), - ]) - else: - options.extend([ - define('Tpetra_INST_INT_INT', gotype == 'int'), - define('Tpetra_INST_INT_LONG', gotype == 'long'), - define('Tpetra_INST_INT_LONG_LONG', gotype == 'long_long'), - ]) - - # ################# Kokkos ###################### - - if '+kokkos' in spec: - arch = Kokkos.get_microarch(spec.target) - if arch: - options.append(define("Kokkos_ARCH_" + arch.upper(), True)) - - define_kok_enable = _make_definer("Kokkos_ENABLE_") - options.extend([ - define_kok_enable('CUDA'), - define_kok_enable('OPENMP' if spec.version >= Version('13') - else 'OpenMP'), - ]) - if '+cuda' in spec: - use_uvm = '+uvm' in spec - options.extend([ - define_kok_enable('CUDA_UVM', use_uvm), - define_kok_enable('CUDA_LAMBDA', True), - define_kok_enable('CUDA_RELOCATABLE_DEVICE_CODE', 'cuda_rdc') - ]) - arch_map = Kokkos.spack_cuda_arch_map - options.extend( - define("Kokkos_ARCH_" + arch_map[arch].upper(), True) - for arch in spec.variants['cuda_arch'].value - ) - - if '+rocm' in spec: - options.extend([ - define_kok_enable('ROCM', False), - define_kok_enable('HIP', True), - define_kok_enable('HIP_RELOCATABLE_DEVICE_CODE', 'rocm_rdc') - ]) - if '+tpetra' in spec: - options.append(define('Tpetra_INST_HIP', True)) - amdgpu_arch_map = Kokkos.amdgpu_arch_map - for amd_target in spec.variants['amdgpu_target'].value: - try: - arch = amdgpu_arch_map[amd_target] - except KeyError: - pass - else: - options.append(define("Kokkos_ARCH_" + arch.upper(), True)) - - # ################# System-specific ###################### - - # Fortran lib (assumes clang is built with gfortran!) - if ('+fortran' in spec - and spec.compiler.name in ['gcc', 'clang', 'apple-clang']): - fc = Executable(spec['mpi'].mpifc) if ( - '+mpi' in spec) else Executable(spack_fc) - libgfortran = fc('--print-file-name', - 'libgfortran.' + dso_suffix, - output=str).strip() - # if libgfortran is equal to "libgfortran." then - # print-file-name failed, use static library instead - if libgfortran == 'libgfortran.' + dso_suffix: - libgfortran = fc('--print-file-name', - 'libgfortran.a', - output=str).strip() - # -L -lgfortran required for OSX - # https://github.com/spack/spack/pull/25823#issuecomment-917231118 - options.append( - define('Trilinos_EXTRA_LINK_FLAGS', - '-L%s/ -lgfortran' % os.path.dirname(libgfortran))) - - if sys.platform == 'darwin' and macos_version() >= Version('10.12'): - # use @rpath on Sierra due to limit of dynamic loader - options.append(define('CMAKE_MACOSX_RPATH', True)) - else: - options.append(define('CMAKE_INSTALL_NAME_DIR', self.prefix.lib)) - - return options - - @run_after('install') - def filter_python(self): - # When trilinos is built with Python, libpytrilinos is included - # through cmake configure files. Namely, Trilinos_LIBRARIES in - # TrilinosConfig.cmake contains pytrilinos. This leads to a - # run-time error: Symbol not found: _PyBool_Type and prevents - # Trilinos to be used in any C++ code, which links executable - # against the libraries listed in Trilinos_LIBRARIES. See - # https://github.com/trilinos/Trilinos/issues/569 and - # https://github.com/trilinos/Trilinos/issues/866 - # A workaround is to remove PyTrilinos from the COMPONENTS_LIST - # and to remove -lpytrilonos from Makefile.export.Trilinos - if '+python' in self.spec: - filter_file(r'(SET\(COMPONENTS_LIST.*)(PyTrilinos;)(.*)', - (r'\1\3'), - '%s/cmake/Trilinos/TrilinosConfig.cmake' % - self.prefix.lib) - filter_file(r'-lpytrilinos', '', - '%s/Makefile.export.Trilinos' % - self.prefix.include) - - def setup_run_environment(self, env): - if '+exodus' in self.spec: - env.prepend_path('PYTHONPATH', self.prefix.lib) - - if '+cuda' in self.spec: - # currently Trilinos doesn't perform the memory fence so - # it relies on blocking CUDA kernel launch. - env.set('CUDA_LAUNCH_BLOCKING', '1') - -# yapf: enable diff --git a/scripts/spack_packages/packages/umpire/package.py b/scripts/spack_packages/packages/umpire/package.py new file mode 100644 index 00000000..2c0756ad --- /dev/null +++ b/scripts/spack_packages/packages/umpire/package.py @@ -0,0 +1,583 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +# GEOSX_EDIT_START +# Victor: This is adapted from the radius-spack-configs GitHub repo. +# We're using this since the new 2025.09 packages suite has not been upstreamed to spack yet. +# See PR: https://github.com/LLNL/radiuss-spack-configs/pull/143 +# +# TODO: Delete this file after the new 2025.09 suite becomes available on spack_packages +# +# GEOSX_EDIT_END +# yapf: disable + +import os +import socket + +from spack_repo.builtin.build_systems.cached_cmake import ( + CachedCMakePackage, + cmake_cache_option, + cmake_cache_path, + cmake_cache_string, +) +from spack_repo.builtin.build_systems.cuda import CudaPackage +from spack_repo.builtin.build_systems.rocm import ROCmPackage +from spack_repo.builtin.packages.blt.package import llnl_link_helpers + +from spack.package import * + + +class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage): + """An application-focused API for memory management on NUMA & GPU + architectures""" + + homepage = "https://github.com/LLNL/Umpire" + git = "https://github.com/LLNL/Umpire.git" + tags = ["radiuss", "e4s"] + + maintainers("adrienbernede", "davidbeckingsale", "kab163") + + license("MIT") + + version("develop", branch="develop", submodules=False) + version( + "2025.09.0", + tag="v2025.09.0", + commit="6b0ea9edbbbc741c8a429768d946549cd3bd7d33", + submodules=False, + ) + version( + "2025.03.0", + tag="v2025.03.0", + commit="1ed0669c57f041baa1f1070693991c3a7a43e7ee", + submodules=False, + ) + version( + "2024.07.0", + tag="v2024.07.0", + commit="abd729f40064175e999a83d11d6b073dac4c01d2", + submodules=False, + ) + version( + "2024.02.1", + tag="v2024.02.1", + commit="3058d562fc707650e904f9321b1ee9bcebad3ae2", + submodules=False, + ) + version( + "2024.02.0", + tag="v2024.02.0", + commit="1db3fef913a70d8882ca510a4830c77c388873e0", + submodules=False, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="1e5ef604de88e81bb3b6fc4a5d914be833529da5", + submodules=False, + ) + version( + "2022.10.0", + tag="v2022.10.0", + commit="93b1441aaa258c1dcd211a552b75cff6461a2a8a", + submodules=False, + ) + version( + "2022.03.1", + tag="v2022.03.1", + commit="6bf231bdbbc797df70d60027ddb714ac2ef7c0a1", + submodules=False, + ) + version( + "2022.03.0", + tag="v2022.03.0", + commit="2db6224ae0c3f3e0bbd6722e95c1167b7f79be7b", + submodules=False, + ) + version( + "6.0.0", tag="v6.0.0", commit="5f886b4299496b7cb6f9d62dc1372ce6d3832fbc", submodules=True + ) + version( + "5.0.1", tag="v5.0.1", commit="5201a47a35e3844160dcbecd0916f8c96aa7dd07", submodules=True + ) + version( + "5.0.0", tag="v5.0.0", commit="2196615500057e068f2d93597b4f8da89d582afb", submodules=True + ) + version( + "4.1.2", tag="v4.1.2", commit="447f4640eff7b8f39d3c59404f3b03629b90c021", submodules=True + ) + version( + "4.1.1", tag="v4.1.1", commit="df1830b5ea04185f93fc229ed667da62d1d2d6e3", submodules=True + ) + version( + "4.1.0", tag="v4.1.0", commit="62f146d9c6b291cd79b29386dcb84b30f7b4212e", submodules=True + ) + version( + "4.0.1", tag="v4.0.1", commit="06d8692d084a88b15b0ef2794a1da779197da747", submodules=True + ) + version( + "4.0.0", tag="v4.0.0", commit="bdd598512516bdc4238502f180c8a7e145c6e68f", submodules=True + ) + version( + "3.0.0", tag="v3.0.0", commit="657676087574f61f9d90b996a3bdbf4e1cdfc92e", submodules=True + ) + version( + "2.1.0", tag="v2.1.0", commit="52e10c05cd40dfdfde186c1e63213695f5aeaf65", submodules=True + ) + version( + "2.0.0", tag="v2.0.0", commit="0dc8b4736357645b99632ee7c17a3dc6af771fbb", submodules=True + ) + version( + "1.1.0", tag="v1.1.0", commit="3db26e6a2626ee8c0cfa5c9769cfac6e33587122", submodules=True + ) + version( + "1.0.1", tag="v1.0.1", commit="a6741073431cab3a7a2434f9119a54d18e9978f4", submodules=True + ) + version( + "1.0.0", tag="v1.0.0", commit="82482fd7450ab378db110f06f7e0302112c22c05", submodules=True + ) + version( + "0.3.5", tag="v0.3.5", commit="a283977bb548cbaa0221bdb6c9832f7834f69e74", submodules=True + ) + version( + "0.3.4", tag="v0.3.4", commit="20a77408d8ae467af21d5802d14afe54f1253694", submodules=True + ) + version( + "0.3.3", tag="v0.3.3", commit="715a8bd003eb1d9db1e2ac7ff2c6251cfd445c27", submodules=True + ) + version( + "0.3.2", tag="v0.3.2", commit="06f37f2011fa4d9482f15e04fc206e2e7b7aa9e2", submodules=True + ) + version( + "0.3.1", tag="v0.3.1", commit="aef223065fdfe85d1e46bab95e3874821702891a", submodules=True + ) + version( + "0.3.0", tag="v0.3.0", commit="529004f9e88fbb49ee93a97465ff904be249039c", submodules=True + ) + version( + "0.2.4", tag="v0.2.4", commit="f774afae69b6f2e5c99ea8bf5660ccf68bd5436d", submodules=True + ) + version( + "0.2.3", tag="v0.2.3", commit="af158291f574701aabb6a2b16e6536aefaf4496e", submodules=True + ) + version( + "0.2.2", tag="v0.2.2", commit="68f4b86fd877c9ca00c9438c603e5dbc40d5f219", submodules=True + ) + version( + "0.2.1", tag="v0.2.1", commit="c22df368e2f52398351f49fbe2522bd1150ad171", submodules=True + ) + version( + "0.2.0", tag="v0.2.0", commit="7910b8d4dbfe83faacf65e864304ca916e34b86c", submodules=True + ) + version( + "0.1.4", tag="v0.1.4", commit="c2848289ba9d8c85346610d25af9531b82c50fc3", submodules=True + ) + version( + "0.1.3", tag="v0.1.3", commit="cc347edeb17f5f30f694aa47f395d17369a2e449", submodules=True + ) + + depends_on("c", type="build") # generated + depends_on("cxx", type="build") # generated + depends_on("fortran", type="build") # generated + + # Some projects importing both camp and umpire targets end up with conflicts in BLT targets + # import. This is not addressing the root cause, which will be addressed in BLT@5.4.0 and will + # require adapting umpire build system. + #patch("dual_blt_import_umpire_2022.10_2023.06.patch", when="@2022.10.0:2023.06.0") + #patch("export_includes.patch", when="@2022.10.0") + #patch("std-filesystem-pr784.patch", when="@2022.03.1 +rocm ^blt@0.5.2:") + #patch("camp_target_umpire_3.0.0.patch", when="@3.0.0") + #patch("cmake_version_check.patch", when="@4.1") + #patch("missing_header_for_numeric_limits.patch", when="@4.1:5.0.1") + + # export targets when building pre-6.0.0 release with BLT 0.4.0+ + patch( + "https://github.com/LLNL/Umpire/commit/5773ce9af88952c8d23f9bcdcb2e503ceda40763.patch?full_index=1", + sha256="f3b21335ce5cf9c0fecc852a94dfec90fb5703032ac97f9fee104af9408d8899", + when="@:5.0.1 ^blt@0.4:", + ) + + # https://github.com/LLNL/Umpire/pull/805 + patch( + "https://github.com/LLNL/Umpire/commit/47ff0aa1f7a01a917c3b7ac618e8a9e44a10fd25.patch?full_index=1", + sha256="802f074a05e1cb1f428e13d99c5fcb1435f86bd8f36a1ea2f7b6756e6625e0a0", + when="@2022.10.0", + ) + + # https://github.com/LLNL/Umpire/pull/816 + patch( + "https://github.com/LLNL/Umpire/commit/2292d1d6078f6d9523b7ad0886ffa053644569d5.patch?full_index=1", + sha256="170dbcadb9ae36c7e211119c17a812695f11f4fe1be290b750f7af4fb4896192", + when="@2022.10.0", + ) + + # https://github.com/LLNL/Umpire/pull/853 + patch( + "https://github.com/LLNL/Umpire/commit/4bd9b2ded81d3216b3f62e2aad62d0e34fe2c256.patch?full_index=1", + sha256="c9ddae1f4212cef72e1050b6ac482ce5b795dad4977d2462cff2e884b8d7aff5", + when="@2022.10:2023.06", + ) + + variant("fortran", default=False, description="Build C/Fortran API") + variant("c", default=True, description="Build C API") + variant("mpi", default=False, description="Enable MPI support") + variant("ipc_shmem", default=False, description="Enable POSIX shared memory") + variant("mpi3_shmem", default=False, description="Enable MPI3 shared memory") + variant( + "sqlite_experimental", + default=False, + description="Enable sqlite integration with umpire events (Experimental)", + ) + variant("numa", default=False, description="Enable NUMA support") + variant("shared", default=True, description="Enable Shared libs") + variant("openmp", default=False, description="Build with OpenMP support") + variant("omptarget", default=False, description="Build with OpenMP 4.5 support") + variant("deviceconst", default=False, description="Enables support for constant device memory") + variant("examples", default=False, description="Build Umpire Examples") + variant( + "tests", + default="none", + values=("none", "basic", "benchmarks"), + multi=False, + description="Tests to run", + ) + variant("tools", default=False, description="Enable tools") + variant("backtrace", default=False, description="Enable backtrace tools") + variant("dev_benchmarks", default=False, description="Enable developer benchmarks") + variant("device_alloc", default=False, description="Enable DeviceAllocator") + variant("werror", default=True, description="Enable warnings as errors") + variant("asan", default=False, description="Enable ASAN") + variant("sanitizer_tests", default=False, description="Enable address sanitizer tests") + variant("fmt_header_only", default=True, description="Link to header-only fmt target") + + depends_on("cmake@3.23:", when="@2024.07.0:", type="build") + depends_on("cmake@3.23:", when="@2022.10.0: +rocm", type="build") + depends_on("cmake@3.20:", when="@2022.10.0:2024.02.1", type="build") + depends_on("cmake@:3.20", when="@2022.03.0:2022.03 +rocm", type="build") + depends_on("cmake@3.14:", when="@2022.03.0:", type="build") + depends_on("cmake@3.9:", when="+cuda", type="build") + depends_on("cmake@3.8:", type="build") + + depends_on("blt", type="build") + 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("blt@0.6.2:", type="build", when="@2024.02.1:") + depends_on("blt@0.6.1", type="build", when="@2024.02.0") + depends_on("blt@0.5.3", type="build", when="@2023.06.0") + depends_on("blt@0.5.2:0.5.3", type="build", when="@2022.10.0") + depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0:2022.03.1") + depends_on("blt@0.4.1", type="build", when="@6.0.0") + depends_on("blt@0.4.0:0.4.1", type="build", when="@4.1.3:5.0.1") + depends_on("blt@0.3.6:0.4.1", type="build", when="@:4.1.2") + conflicts("^blt@:0.3.6", when="+rocm") + + depends_on("camp") + depends_on("camp@2025.09.2:", when="@2025.09.0:") + depends_on("camp@2025.03.0:", when="@2025.03.0:") + depends_on("camp+openmp", when="+openmp") + depends_on("camp~cuda", when="~cuda") + depends_on("camp~rocm", when="~rocm") + depends_on("camp@main", when="@develop") + depends_on("camp@2024.07.0:", when="@2024.07.0:") + depends_on("camp@2024.02.1", when="@2024.02.1") + depends_on("camp@2024.02.0", when="@2024.02.0") + depends_on("camp@2023.06.0", when="@2023.06.0") + depends_on("camp@2022.10.0:2023.06.0", when="@2022.10.0") + depends_on("camp@2022.03.2:2023.06.0", when="@2022.03.0:2022.03.1") + depends_on("camp@0.2.2:0.2.3", when="@6.0.0") + depends_on("camp@0.1.0", when="@5.0.0:5.0.1") + + depends_on("sqlite", when="+sqlite_experimental") + depends_on("mpi", when="+mpi") + + depends_on("fmt@9.1:11.0", when="@2024.02.0:") + # For some reason, we need c++ 17 explicitly only with intel + depends_on("fmt@9.1:11.0 cxxstd=17", when="@2024.02.0: %intel@19.1") + + with when("@5.0.0:"): + with when("+cuda"): + depends_on("camp+cuda") + for sm_ in CudaPackage.cuda_arch_values: + depends_on("camp+cuda cuda_arch={0}".format(sm_), when="cuda_arch={0}".format(sm_)) + + with when("+rocm"): + depends_on("camp+rocm") + for arch_ in ROCmPackage.amdgpu_targets: + depends_on( + "camp+rocm amdgpu_target={0}".format(arch_), + when="amdgpu_target={0}".format(arch_), + ) + + conflicts("+numa", when="@:0.3.2") + conflicts("~c", when="+fortran", msg="Fortran API requires C API") + + # device allocator must be used with more current umpire versions, rocm 5.4.0 and greater, + # and with either rocm or cuda enabled + conflicts("+device_alloc", when="@:2022.03.0") + conflicts("+device_alloc", when="^hip@:5.3.99") + conflicts("+device_alloc", when="~rocm~cuda") + + conflicts("+deviceconst", when="~rocm~cuda") + conflicts("~openmp", when="+omptarget", msg="OpenMP target requires OpenMP") + conflicts("+cuda", when="+rocm") + conflicts("+tools", when="+rocm") + conflicts( + "+rocm", when="+omptarget", msg="Cant support both rocm and openmp device backends at once" + ) + conflicts("+ipc_shmem", when="@:5.0.1") + conflicts("+mpi3_shmem", when="@:2024.07.0") + conflicts("+mpi3_shmem", when="~mpi") + conflicts("+ipc_shmem", when="+mpi3_shmem @:2025.03.0") + + conflicts("+sqlite_experimental", when="@:6.0.0") + conflicts("+sanitizer_tests", when="~asan") + + # device allocator exports device code, which requires static libs + # currently only available for cuda. + conflicts("+shared", when="+cuda") + + def _get_sys_type(self, spec): + sys_type = spec.architecture + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type + + @property + def cache_name(self): + hostname = socket.gethostname() + if "SYS_TYPE" in env: + hostname = hostname.rstrip("1234567890") + return "{0}-{1}-{2}@{3}-{4}.cmake".format( + hostname, + self._get_sys_type(self.spec), + self.spec.compiler.name, + self.spec.compiler.version, + self.spec.dag_hash(8), + ) + + def initconfig_compiler_entries(self): + spec = self.spec + compiler = self.compiler + # Default entries are already defined in CachedCMakePackage, inherit them: + entries = super().initconfig_compiler_entries() + + if spec.satisfies("+rocm ^blt@:0.6"): + entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) + + option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" + + if spec.satisfies("+fortran") and compiler.fc is not None: + entries.append(cmake_cache_option("ENABLE_FORTRAN", True)) + else: + entries.append(cmake_cache_option("ENABLE_FORTRAN", False)) + + entries.append( + cmake_cache_option("{}ENABLE_C".format(option_prefix), spec.satisfies("+c")) + ) + + llnl_link_helpers(entries, spec, compiler) + + return entries + + def initconfig_hardware_entries(self): + spec = self.spec + entries = super().initconfig_hardware_entries() + + entries.append("#------------------{0}".format("-" * 30)) + entries.append("# Package custom hardware settings") + entries.append("#------------------{0}\n".format("-" * 30)) + + option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" + + if spec.satisfies("+cuda"): + entries.append(cmake_cache_option("ENABLE_CUDA", True)) + # Umpire used to pick only the first architecture in the list. The shared logic in + # CachedCMakePackage keeps the list of architectures. + else: + entries.append(cmake_cache_option("ENABLE_CUDA", False)) + + if spec.satisfies("+rocm"): + entries.append(cmake_cache_option("ENABLE_HIP", True)) + else: + entries.append(cmake_cache_option("ENABLE_HIP", False)) + + entries.append( + cmake_cache_option( + "{}ENABLE_DEVICE_CONST".format(option_prefix), spec.satisfies("+deviceconst") + ) + ) + + entries.append( + cmake_cache_option( + "{}ENABLE_OPENMP_TARGET".format(option_prefix), spec.satisfies("+omptarget") + ) + ) + + if spec.satisfies("+omptarget") and spec.satisfies("%xl"): + entries.append(cmake_cache_string("OpenMP_CXX_FLAGS", "-qsmp;-qoffload")) + + return entries + + def initconfig_mpi_entries(self): + spec = self.spec + + entries = super().initconfig_mpi_entries() + entries.append(cmake_cache_option("ENABLE_MPI", spec.satisfies("+mpi"))) + entries.append( + cmake_cache_option("UMPIRE_ENABLE_MPI3_SHARED_MEMORY", spec.satisfies("+mpi3_shmem")) + ) + + return entries + + def initconfig_package_entries(self): + spec = self.spec + entries = [] + + option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" + + # TPL locations + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# TPLs") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) + if spec.satisfies("@5.0.0:"): + entries.append(cmake_cache_path("camp_DIR", spec["camp"].prefix)) + + if spec.satisfies("@2024.02.0:"): + entries.append(cmake_cache_path("fmt_DIR", spec["fmt"].prefix)) + + # Build options + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# Build Options") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_string("CMAKE_BUILD_TYPE", spec.variants["build_type"].value)) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", spec.satisfies("+shared"))) + entries.append(cmake_cache_option("ENABLE_WARNINGS_AS_ERRORS", spec.satisfies("+werror"))) + + # Generic options that have a prefixed equivalent in Umpire CMake + entries.append(cmake_cache_option("ENABLE_OPENMP", spec.satisfies("+openmp"))) + entries.append(cmake_cache_option("ENABLE_EXAMPLES", spec.satisfies("+examples"))) + entries.append(cmake_cache_option("ENABLE_DOCS", False)) + if spec.satisfies("tests=benchmarks") or spec.satisfies("+dev_benchmarks"): + # BLT requires ENABLE_TESTS=True to enable benchmarks + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", True)) + entries.append(cmake_cache_option("ENABLE_TESTS", True)) + else: + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", False)) + entries.append(cmake_cache_option("ENABLE_TESTS", not spec.satisfies("tests=none"))) + + # Prefixed options that used to be name without one + entries.append( + cmake_cache_option("{}ENABLE_NUMA".format(option_prefix), spec.satisfies("+numa")) + ) + entries.append( + cmake_cache_option( + "{}ENABLE_DEVELOPER_BENCHMARKS".format(option_prefix), + spec.satisfies("+dev_benchmarks"), + ) + ) + entries.append( + cmake_cache_option("{}ENABLE_TOOLS".format(option_prefix), spec.satisfies("+tools")) + ) + entries.append( + cmake_cache_option( + "{}ENABLE_BACKTRACE".format(option_prefix), spec.satisfies("+backtrace") + ) + ) + entries.append( + cmake_cache_option("{}ENABLE_ASAN".format(option_prefix), spec.satisfies("+asan")) + ) + entries.append( + cmake_cache_option( + "{}ENABLE_SANITIZER_TESTS".format(option_prefix), + spec.satisfies("+sanitizer_tests"), + ) + ) + + # Recent options, were never name without prefix + entries.append( + cmake_cache_option("UMPIRE_ENABLE_DEVICE_ALLOCATOR", spec.satisfies("+device_alloc")) + ) + entries.append( + cmake_cache_option( + "UMPIRE_ENABLE_SQLITE_EXPERIMENTAL", spec.satisfies("+sqlite_experimental") + ) + ) + if spec.satisfies("+sqlite_experimental"): + entries.append(cmake_cache_path("SQLite3_ROOT", spec["sqlite"].prefix)) + + # This option was renamed later than the others + if spec.satisfies("@2022.10.0:"): + entries.append( + cmake_cache_option("UMPIRE_ENABLE_IPC_SHARED_MEMORY", spec.satisfies("+ipc_shmem")) + ) + else: + entries.append( + cmake_cache_option("ENABLE_IPC_SHARED_MEMORY", spec.satisfies("+ipc_shmem")) + ) + + if spec.satisfies("~fmt_header_only"): + entries.append(cmake_cache_string("UMPIRE_FMT_TARGET", "fmt::fmt")) + + return entries + + def cmake_args(self): + return [] + + def setup_run_environment(self, env): + for library in ["lib", "lib64"]: + lib_path = join_path(self.prefix, library) + if os.path.exists(lib_path): + env.append_path("LD_LIBRARY_PATH", lib_path) + + def run_example(self, exe, expected): + """Perform stand-alone checks on the installed package.""" + + exe_run = which(join_path(self.prefix.bin, exe)) + if exe_run is None: + raise SkipTest(f"{exe} is not installed for version {self.version}") + out = exe_run(output=str.split, error=str.split) + check_outputs(expected, out) + + def test_malloc(self): + """Run Malloc""" + self.run_example("malloc", ["99 should be 99"]) + + def test_recipe_dynamic_pool_heuristic(self): + """Multiple use allocator test""" + self.run_example("recipe_dynamic_pool_heuristic", ["in the pool", "releas"]) + + def test_recipe_no_introspection(self): + """Test without introspection""" + self.run_example("recipe_no_introspection", ["has allocated", "used"]) + + def test_strategy_example(self): + """Memory allocation strategy test""" + self.run_example("strategy_example", ["Available allocators", "HOST"]) + + def test_tut_copy(self): + """Copy data test""" + self.run_example("tut_copy", ["Copied source data"]) + + def test_tut_introspection(self): + """Keep track of pointer allocation test""" + self.run_example("tut_introspection", ["Allocator used is HOST", "size of the allocation"]) + + def test_tut_memset(self): + """Set entire block of memory to one value test""" + self.run_example("tut_memset", ["Set data from HOST"]) + + def test_tut_move(self): + """Move memory test""" + self.run_example("tut_move", ["Moved source data", "HOST"]) + + def test_tut_reallocate(self): + """Reallocate memory test""" + self.run_example("tut_reallocate", ["Reallocated data"]) + + def test_vector_allocator(self): + """Allocate vector memory test""" + self.run_example("vector_allocator", [""]) diff --git a/scripts/spack_packages/packages/umpire/radiuss-package.py b/scripts/spack_packages/packages/umpire/radiuss-package.py new file mode 100644 index 00000000..2c53788c --- /dev/null +++ b/scripts/spack_packages/packages/umpire/radiuss-package.py @@ -0,0 +1,572 @@ +# Copyright 2013-2025 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import socket + +from spack.package import * + +from .camp import hip_for_radiuss_projects +from .camp import cuda_for_radiuss_projects +from .camp import mpi_for_radiuss_projects +from .blt import llnl_link_helpers + + +class Umpire(CachedCMakePackage, CudaPackage, ROCmPackage): + """An application-focused API for memory management on NUMA & GPU + architectures""" + + homepage = "https://github.com/LLNL/Umpire" + git = "https://github.com/LLNL/Umpire.git" + tags = ["radiuss", "e4s"] + + maintainers("adrienbernede", "davidbeckingsale", "kab163") + + license("MIT") + + version("develop", branch="develop", submodules=False) + version( + "2025.09.0", + tag="v2025.09.0", + commit="6b0ea9edbbbc741c8a429768d946549cd3bd7d33", + submodules=False, + ) + version( + "2025.03.0", + tag="v2025.03.0", + commit="1ed0669c57f041baa1f1070693991c3a7a43e7ee", + submodules=False, + ) + version( + "2024.07.0", + tag="v2024.07.0", + commit="abd729f40064175e999a83d11d6b073dac4c01d2", + submodules=False, + ) + version( + "2024.02.1", + tag="v2024.02.1", + commit="3058d562fc707650e904f9321b1ee9bcebad3ae2", + submodules=False, + ) + version( + "2024.02.0", + tag="v2024.02.0", + commit="1db3fef913a70d8882ca510a4830c77c388873e0", + submodules=False, + ) + version( + "2023.06.0", + tag="v2023.06.0", + commit="1e5ef604de88e81bb3b6fc4a5d914be833529da5", + submodules=False, + ) + version( + "2022.10.0", + tag="v2022.10.0", + commit="93b1441aaa258c1dcd211a552b75cff6461a2a8a", + submodules=False, + ) + version( + "2022.03.1", + tag="v2022.03.1", + commit="6bf231bdbbc797df70d60027ddb714ac2ef7c0a1", + submodules=False, + ) + version( + "2022.03.0", + tag="v2022.03.0", + commit="2db6224ae0c3f3e0bbd6722e95c1167b7f79be7b", + submodules=False, + ) + version( + "6.0.0", tag="v6.0.0", commit="5f886b4299496b7cb6f9d62dc1372ce6d3832fbc", submodules=True + ) + version( + "5.0.1", tag="v5.0.1", commit="5201a47a35e3844160dcbecd0916f8c96aa7dd07", submodules=True + ) + version( + "5.0.0", tag="v5.0.0", commit="2196615500057e068f2d93597b4f8da89d582afb", submodules=True + ) + version( + "4.1.2", tag="v4.1.2", commit="447f4640eff7b8f39d3c59404f3b03629b90c021", submodules=True + ) + version( + "4.1.1", tag="v4.1.1", commit="df1830b5ea04185f93fc229ed667da62d1d2d6e3", submodules=True + ) + version( + "4.1.0", tag="v4.1.0", commit="62f146d9c6b291cd79b29386dcb84b30f7b4212e", submodules=True + ) + version( + "4.0.1", tag="v4.0.1", commit="06d8692d084a88b15b0ef2794a1da779197da747", submodules=True + ) + version( + "4.0.0", tag="v4.0.0", commit="bdd598512516bdc4238502f180c8a7e145c6e68f", submodules=True + ) + version( + "3.0.0", tag="v3.0.0", commit="657676087574f61f9d90b996a3bdbf4e1cdfc92e", submodules=True + ) + version( + "2.1.0", tag="v2.1.0", commit="52e10c05cd40dfdfde186c1e63213695f5aeaf65", submodules=True + ) + version( + "2.0.0", tag="v2.0.0", commit="0dc8b4736357645b99632ee7c17a3dc6af771fbb", submodules=True + ) + version( + "1.1.0", tag="v1.1.0", commit="3db26e6a2626ee8c0cfa5c9769cfac6e33587122", submodules=True + ) + version( + "1.0.1", tag="v1.0.1", commit="a6741073431cab3a7a2434f9119a54d18e9978f4", submodules=True + ) + version( + "1.0.0", tag="v1.0.0", commit="82482fd7450ab378db110f06f7e0302112c22c05", submodules=True + ) + version( + "0.3.5", tag="v0.3.5", commit="a283977bb548cbaa0221bdb6c9832f7834f69e74", submodules=True + ) + version( + "0.3.4", tag="v0.3.4", commit="20a77408d8ae467af21d5802d14afe54f1253694", submodules=True + ) + version( + "0.3.3", tag="v0.3.3", commit="715a8bd003eb1d9db1e2ac7ff2c6251cfd445c27", submodules=True + ) + version( + "0.3.2", tag="v0.3.2", commit="06f37f2011fa4d9482f15e04fc206e2e7b7aa9e2", submodules=True + ) + version( + "0.3.1", tag="v0.3.1", commit="aef223065fdfe85d1e46bab95e3874821702891a", submodules=True + ) + version( + "0.3.0", tag="v0.3.0", commit="529004f9e88fbb49ee93a97465ff904be249039c", submodules=True + ) + version( + "0.2.4", tag="v0.2.4", commit="f774afae69b6f2e5c99ea8bf5660ccf68bd5436d", submodules=True + ) + version( + "0.2.3", tag="v0.2.3", commit="af158291f574701aabb6a2b16e6536aefaf4496e", submodules=True + ) + version( + "0.2.2", tag="v0.2.2", commit="68f4b86fd877c9ca00c9438c603e5dbc40d5f219", submodules=True + ) + version( + "0.2.1", tag="v0.2.1", commit="c22df368e2f52398351f49fbe2522bd1150ad171", submodules=True + ) + version( + "0.2.0", tag="v0.2.0", commit="7910b8d4dbfe83faacf65e864304ca916e34b86c", submodules=True + ) + version( + "0.1.4", tag="v0.1.4", commit="c2848289ba9d8c85346610d25af9531b82c50fc3", submodules=True + ) + version( + "0.1.3", tag="v0.1.3", commit="cc347edeb17f5f30f694aa47f395d17369a2e449", submodules=True + ) + + depends_on("c", type="build") # generated + depends_on("cxx", type="build") # generated + depends_on("fortran", type="build") # generated + + # Some projects importing both camp and umpire targets end up with conflicts in BLT targets + # import. This is not addressing the root cause, which will be addressed in BLT@5.4.0 and will + # require adapting umpire build system. + patch("dual_blt_import_umpire_2022.10_2023.06.patch", when="@2022.10.0:2023.06.0") + patch("export_includes.patch", when="@2022.10.0") + patch("std-filesystem-pr784.patch", when="@2022.03.1 +rocm ^blt@0.5.2:") + patch("camp_target_umpire_3.0.0.patch", when="@3.0.0") + patch("cmake_version_check.patch", when="@4.1") + patch("missing_header_for_numeric_limits.patch", when="@4.1:5.0.1") + + # export targets when building pre-6.0.0 release with BLT 0.4.0+ + patch( + "https://github.com/LLNL/Umpire/commit/5773ce9af88952c8d23f9bcdcb2e503ceda40763.patch?full_index=1", + sha256="f3b21335ce5cf9c0fecc852a94dfec90fb5703032ac97f9fee104af9408d8899", + when="@:5.0.1 ^blt@0.4:", + ) + + # https://github.com/LLNL/Umpire/pull/805 + patch( + "https://github.com/LLNL/Umpire/commit/47ff0aa1f7a01a917c3b7ac618e8a9e44a10fd25.patch?full_index=1", + sha256="802f074a05e1cb1f428e13d99c5fcb1435f86bd8f36a1ea2f7b6756e6625e0a0", + when="@2022.10.0", + ) + + # https://github.com/LLNL/Umpire/pull/816 + patch( + "https://github.com/LLNL/Umpire/commit/2292d1d6078f6d9523b7ad0886ffa053644569d5.patch?full_index=1", + sha256="170dbcadb9ae36c7e211119c17a812695f11f4fe1be290b750f7af4fb4896192", + when="@2022.10.0", + ) + + # https://github.com/LLNL/Umpire/pull/853 + patch( + "https://github.com/LLNL/Umpire/commit/4bd9b2ded81d3216b3f62e2aad62d0e34fe2c256.patch?full_index=1", + sha256="c9ddae1f4212cef72e1050b6ac482ce5b795dad4977d2462cff2e884b8d7aff5", + when="@2022.10:2023.06", + ) + + variant("fortran", default=False, description="Build C/Fortran API") + variant("c", default=True, description="Build C API") + variant("mpi", default=False, description="Enable MPI support") + variant("ipc_shmem", default=False, description="Enable POSIX shared memory") + variant("mpi3_shmem", default=False, description="Enable MPI3 shared memory") + variant( + "sqlite_experimental", + default=False, + description="Enable sqlite integration with umpire events (Experimental)", + ) + variant("numa", default=False, description="Enable NUMA support") + variant("shared", default=True, description="Enable Shared libs") + variant("openmp", default=False, description="Build with OpenMP support") + variant("omptarget", default=False, description="Build with OpenMP 4.5 support") + variant("deviceconst", default=False, description="Enables support for constant device memory") + variant("examples", default=False, description="Build Umpire Examples") + variant( + "tests", + default="none", + values=("none", "basic", "benchmarks"), + multi=False, + description="Tests to run", + ) + variant("tools", default=False, description="Enable tools") + variant("backtrace", default=False, description="Enable backtrace tools") + variant("dev_benchmarks", default=False, description="Enable developer benchmarks") + variant("device_alloc", default=False, description="Enable DeviceAllocator") + variant("werror", default=True, description="Enable warnings as errors") + variant("asan", default=False, description="Enable ASAN") + variant("sanitizer_tests", default=False, description="Enable address sanitizer tests") + variant("fmt_header_only", default=True, description="Link to header-only fmt target") + + depends_on("cmake@3.23:", when="@2024.07.0:", type="build") + depends_on("cmake@3.23:", when="@2022.10.0: +rocm", type="build") + depends_on("cmake@3.20:", when="@2022.10.0:2024.02.1", type="build") + depends_on("cmake@:3.20", when="@2022.03.0:2022.03 +rocm", type="build") + depends_on("cmake@3.14:", when="@2022.03.0:", type="build") + depends_on("cmake@3.9:", when="+cuda", type="build") + depends_on("cmake@3.8:", type="build") + + depends_on("blt", type="build") + 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("blt@0.6.2:", type="build", when="@2024.02.1:") + depends_on("blt@0.6.1", type="build", when="@2024.02.0") + depends_on("blt@0.5.3", type="build", when="@2023.06.0") + depends_on("blt@0.5.2:0.5.3", type="build", when="@2022.10.0") + depends_on("blt@0.5.0:0.5.3", type="build", when="@2022.03.0:2022.03.1") + depends_on("blt@0.4.1", type="build", when="@6.0.0") + depends_on("blt@0.4.0:0.4.1", type="build", when="@4.1.3:5.0.1") + depends_on("blt@0.3.6:0.4.1", type="build", when="@:4.1.2") + conflicts("^blt@:0.3.6", when="+rocm") + + depends_on("camp") + depends_on("camp@2025.09.2:", when="@2025.09.0:") + depends_on("camp@2025.03.0:", when="@2025.03.0:") + depends_on("camp+openmp", when="+openmp") + depends_on("camp~cuda", when="~cuda") + depends_on("camp~rocm", when="~rocm") + depends_on("camp@main", when="@develop") + depends_on("camp@2024.07.0:", when="@2024.07.0:") + depends_on("camp@2024.02.1", when="@2024.02.1") + depends_on("camp@2024.02.0", when="@2024.02.0") + depends_on("camp@2023.06.0", when="@2023.06.0") + depends_on("camp@2022.10.0:2023.06.0", when="@2022.10.0") + depends_on("camp@2022.03.2:2023.06.0", when="@2022.03.0:2022.03.1") + depends_on("camp@0.2.2:0.2.3", when="@6.0.0") + depends_on("camp@0.1.0", when="@5.0.0:5.0.1") + + depends_on("sqlite", when="+sqlite_experimental") + depends_on("mpi", when="+mpi") + + depends_on("fmt@9.1:11.0", when="@2024.02.0:") + # For some reason, we need c++ 17 explicitly only with intel + depends_on("fmt@9.1:11.0 cxxstd=17", when="@2024.02.0: %intel@19.1") + + with when("@5.0.0:"): + with when("+cuda"): + depends_on("camp+cuda") + for sm_ in CudaPackage.cuda_arch_values: + depends_on("camp+cuda cuda_arch={0}".format(sm_), when="cuda_arch={0}".format(sm_)) + + with when("+rocm"): + depends_on("camp+rocm") + for arch_ in ROCmPackage.amdgpu_targets: + depends_on( + "camp+rocm amdgpu_target={0}".format(arch_), + when="amdgpu_target={0}".format(arch_), + ) + + conflicts("+numa", when="@:0.3.2") + conflicts("~c", when="+fortran", msg="Fortran API requires C API") + + # device allocator must be used with more current umpire versions, rocm 5.4.0 and greater, + # and with either rocm or cuda enabled + conflicts("+device_alloc", when="@:2022.03.0") + conflicts("+device_alloc", when="^hip@:5.3.99") + conflicts("+device_alloc", when="~rocm~cuda") + + conflicts("+deviceconst", when="~rocm~cuda") + conflicts("~openmp", when="+omptarget", msg="OpenMP target requires OpenMP") + conflicts("+cuda", when="+rocm") + conflicts("+tools", when="+rocm") + conflicts( + "+rocm", when="+omptarget", msg="Cant support both rocm and openmp device backends at once" + ) + conflicts("+ipc_shmem", when="@:5.0.1") + conflicts("+mpi3_shmem", when="@:2024.07.0") + conflicts("+mpi3_shmem", when="~mpi") + conflicts("+ipc_shmem", when="+mpi3_shmem @:2025.03.0") + + conflicts("+sqlite_experimental", when="@:6.0.0") + conflicts("+sanitizer_tests", when="~asan") + + # device allocator exports device code, which requires static libs + # currently only available for cuda. + conflicts("+shared", when="+cuda") + + def _get_sys_type(self, spec): + sys_type = spec.architecture + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type + + @property + def cache_name(self): + hostname = socket.gethostname() + if "SYS_TYPE" in env: + hostname = hostname.rstrip("1234567890") + return "{0}-{1}-{2}@{3}-{4}.cmake".format( + hostname, + self._get_sys_type(self.spec), + self.spec.compiler.name, + self.spec.compiler.version, + self.spec.dag_hash(8), + ) + + def initconfig_compiler_entries(self): + spec = self.spec + compiler = self.compiler + # Default entries are already defined in CachedCMakePackage, inherit them: + entries = super().initconfig_compiler_entries() + + option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" + + if spec.satisfies("+fortran") and compiler.fc is not None: + entries.append(cmake_cache_option("ENABLE_FORTRAN", True)) + else: + entries.append(cmake_cache_option("ENABLE_FORTRAN", False)) + + entries.append( + cmake_cache_option("{}ENABLE_C".format(option_prefix), spec.satisfies("+c")) + ) + + llnl_link_helpers(entries, spec, compiler) + + return entries + + def initconfig_hardware_entries(self): + spec = self.spec + compiler = self.compiler + entries = super().initconfig_hardware_entries() + + entries.append("#------------------{0}".format("-" * 30)) + entries.append("# Package custom hardware settings") + entries.append("#------------------{0}\n".format("-" * 30)) + + option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" + + if spec.satisfies("+cuda"): + entries.append(cmake_cache_option("ENABLE_CUDA", True)) + # Umpire used to pick only the first architecture in the list. The shared logic in + # CachedCMakePackage keeps the list of architectures. + cuda_for_radiuss_projects(entries, spec) + else: + entries.append(cmake_cache_option("ENABLE_CUDA", False)) + + if spec.satisfies("+rocm"): + entries.append(cmake_cache_option("ENABLE_HIP", True)) + hip_for_radiuss_projects(entries, spec, compiler) + else: + entries.append(cmake_cache_option("ENABLE_HIP", False)) + + entries.append( + cmake_cache_option( + "{}ENABLE_DEVICE_CONST".format(option_prefix), spec.satisfies("+deviceconst") + ) + ) + + entries.append( + cmake_cache_option( + "{}ENABLE_OPENMP_TARGET".format(option_prefix), spec.satisfies("+omptarget") + ) + ) + + if spec.satisfies("+omptarget") and spec.satisfies("%xl"): + entries.append(cmake_cache_string("OpenMP_CXX_FLAGS", "-qsmp;-qoffload")) + + return entries + + def initconfig_mpi_entries(self): + spec = self.spec + + entries = super().initconfig_mpi_entries() + entries.append(cmake_cache_option("ENABLE_MPI", spec.satisfies("+mpi"))) + entries.append( + cmake_cache_option("UMPIRE_ENABLE_MPI3_SHARED_MEMORY", spec.satisfies("+mpi3_shmem")) + ) + + if spec.satisfies("+mpi"): + mpi_for_radiuss_projects(entries, spec, env) + + return entries + + def initconfig_package_entries(self): + spec = self.spec + entries = [] + + option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" + + # TPL locations + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# TPLs") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) + if spec.satisfies("@5.0.0:"): + entries.append(cmake_cache_path("camp_DIR", spec["camp"].prefix)) + + if spec.satisfies("@2024.02.0:"): + entries.append(cmake_cache_path("fmt_DIR", spec["fmt"].prefix)) + + # Build options + entries.append("#------------------{0}".format("-" * 60)) + entries.append("# Build Options") + entries.append("#------------------{0}\n".format("-" * 60)) + + entries.append(cmake_cache_string("CMAKE_BUILD_TYPE", spec.variants["build_type"].value)) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", spec.satisfies("+shared"))) + entries.append(cmake_cache_option("ENABLE_WARNINGS_AS_ERRORS", spec.satisfies("+werror"))) + + # Generic options that have a prefixed equivalent in Umpire CMake + entries.append(cmake_cache_option("ENABLE_OPENMP", spec.satisfies("+openmp"))) + entries.append(cmake_cache_option("ENABLE_EXAMPLES", spec.satisfies("+examples"))) + entries.append(cmake_cache_option("ENABLE_DOCS", False)) + if spec.satisfies("tests=benchmarks") or spec.satisfies("+dev_benchmarks"): + # BLT requires ENABLE_TESTS=True to enable benchmarks + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", True)) + entries.append(cmake_cache_option("ENABLE_TESTS", True)) + else: + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", False)) + entries.append(cmake_cache_option("ENABLE_TESTS", not spec.satisfies("tests=none"))) + + # Prefixed options that used to be name without one + entries.append( + cmake_cache_option("{}ENABLE_NUMA".format(option_prefix), spec.satisfies("+numa")) + ) + entries.append( + cmake_cache_option( + "{}ENABLE_DEVELOPER_BENCHMARKS".format(option_prefix), + spec.satisfies("+dev_benchmarks"), + ) + ) + entries.append( + cmake_cache_option("{}ENABLE_TOOLS".format(option_prefix), spec.satisfies("+tools")) + ) + entries.append( + cmake_cache_option( + "{}ENABLE_BACKTRACE".format(option_prefix), spec.satisfies("+backtrace") + ) + ) + entries.append( + cmake_cache_option("{}ENABLE_ASAN".format(option_prefix), spec.satisfies("+asan")) + ) + entries.append( + cmake_cache_option( + "{}ENABLE_SANITIZER_TESTS".format(option_prefix), + spec.satisfies("+sanitizer_tests"), + ) + ) + + # Recent options, were never name without prefix + entries.append( + cmake_cache_option("UMPIRE_ENABLE_DEVICE_ALLOCATOR", spec.satisfies("+device_alloc")) + ) + entries.append( + cmake_cache_option( + "UMPIRE_ENABLE_SQLITE_EXPERIMENTAL", spec.satisfies("+sqlite_experimental") + ) + ) + if spec.satisfies("+sqlite_experimental"): + entries.append(cmake_cache_path("SQLite3_ROOT", spec["sqlite"].prefix)) + + # This option was renamed later than the others + if spec.satisfies("@2022.10.0:"): + entries.append( + cmake_cache_option("UMPIRE_ENABLE_IPC_SHARED_MEMORY", spec.satisfies("+ipc_shmem")) + ) + else: + entries.append( + cmake_cache_option("ENABLE_IPC_SHARED_MEMORY", spec.satisfies("+ipc_shmem")) + ) + + if spec.satisfies("~fmt_header_only"): + entries.append(cmake_cache_string("UMPIRE_FMT_TARGET", "fmt::fmt")) + + return entries + + def cmake_args(self): + return [] + + def setup_run_environment(self, env): + for library in ["lib", "lib64"]: + lib_path = join_path(self.prefix, library) + if os.path.exists(lib_path): + env.append_path("LD_LIBRARY_PATH", lib_path) + + def run_example(self, exe, expected): + """Perform stand-alone checks on the installed package.""" + + exe_run = which(join_path(self.prefix.bin, exe)) + if exe_run is None: + raise SkipTest(f"{exe} is not installed for version {self.version}") + out = exe_run(output=str.split, error=str.split) + check_outputs(expected, out) + + def test_malloc(self): + """Run Malloc""" + self.run_example("malloc", ["99 should be 99"]) + + def test_recipe_dynamic_pool_heuristic(self): + """Multiple use allocator test""" + self.run_example("recipe_dynamic_pool_heuristic", ["in the pool", "releas"]) + + def test_recipe_no_introspection(self): + """Test without introspection""" + self.run_example("recipe_no_introspection", ["has allocated", "used"]) + + def test_strategy_example(self): + """Memory allocation strategy test""" + self.run_example("strategy_example", ["Available allocators", "HOST"]) + + def test_tut_copy(self): + """Copy data test""" + self.run_example("tut_copy", ["Copied source data"]) + + def test_tut_introspection(self): + """Keep track of pointer allocation test""" + self.run_example("tut_introspection", ["Allocator used is HOST", "size of the allocation"]) + + def test_tut_memset(self): + """Set entire block of memory to one value test""" + self.run_example("tut_memset", ["Set data from HOST"]) + + def test_tut_move(self): + """Move memory test""" + self.run_example("tut_move", ["Moved source data", "HOST"]) + + def test_tut_reallocate(self): + """Reallocate memory test""" + self.run_example("tut_reallocate", ["Reallocated data"]) + + def test_vector_allocator(self): + """Allocate vector memory test""" + self.run_example("vector_allocator", [""]) diff --git a/scripts/spack_packages/packages/vtk/package.py b/scripts/spack_packages/packages/vtk/package.py index 39be1dfb..95aff50f 100644 --- a/scripts/spack_packages/packages/vtk/package.py +++ b/scripts/spack_packages/packages/vtk/package.py @@ -6,8 +6,7 @@ import os import sys -from spack import * - +from spack.package import * class Vtk(CMakePackage): """The Visualization Toolkit (VTK) is an open-source, freely @@ -19,7 +18,7 @@ class Vtk(CMakePackage): list_url = "http://www.vtk.org/download/" maintainers = ['chuckatkins', 'danlipsa'] - + version("9.4.2", sha256="36c98e0da96bb12a30fe53708097aa9492e7b66d5c3b366e1c8dc251e2856a02", preferred=True) version("9.3.1", sha256="8354ec084ea0d2dc3d23dbe4243823c4bfc270382d0ce8d658939fd50061cab8") version("9.2.6", sha256="06fc8d49c4e56f498c40fcb38a563ed8d4ec31358d0101e8988f0bb4d539dd12") @@ -53,7 +52,7 @@ class Vtk(CMakePackage): depends_on('py-mpi4py', when='+python+mpi', type='run') depends_on('mpi', when='+mpi') - + patch_dir = os.path.join(os.path.dirname(__file__), '9.4.2-patch') if os.path.isdir(patch_dir): for fname in sorted(os.listdir(patch_dir)): diff --git a/scripts/uberenv b/scripts/uberenv index a76a2942..52184816 160000 --- a/scripts/uberenv +++ b/scripts/uberenv @@ -1 +1 @@ -Subproject commit a76a2942f0b575f7d9047dfb87d699e2b6d18f12 +Subproject commit 521848167c6a1e25aebf55e40d0ec51d7027108c