diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 11784f7afa2..babbbaa1283 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -5,6 +5,7 @@ on: branches: - develop pull_request: + workflow_dispatch: # Cancels in-progress workflows for a PR when updated concurrency: @@ -14,7 +15,6 @@ concurrency: # Please define `build.args.GEOS_TPL_TAG` in `.devcontainer/devcontainer.json` jobs: - # Jobs will be cancelled if PR is a draft. # PR status must be "Open" to run CI. is_not_draft_pull_request: @@ -28,17 +28,23 @@ jobs: - name: Check that the PR is not a draft (cancel rest of jobs otherwise) id: extract_pr_info run: | - # We do not rely on the `github.event.pull_request.labels` information since it's cached at the job. - # Changing labels or assignee in the PR would not allow to simply re-run the job with a different outcome. - pr_json=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}) - - # We stop the workflow if the pr is draft - draft_status=$(echo ${pr_json} | jq '.draft') - echo "Draft status of PR is ${draft_status}." - if [[ $draft_status == true ]]; then exit 1 ; fi + if [[ ${{github.event_name}} == 'pull_request' ]]; then + # We do not rely on the `github.event.pull_request.labels` information since it's cached at the job. + # Changing labels or assignee in the PR would not allow to simply re-run the job with a different outcome. + pr_json=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}) + + # We stop the workflow if the pr is draft + draft_status=$(echo ${pr_json} | jq '.draft') + echo "Draft status of PR is ${draft_status}." + if [[ $draft_status == true ]]; then exit 1 ; fi + + # If the workflow is meant to continue, we extract additional information for the json of the pr. + echo "LABELS=$(echo ${pr_json} | jq -crM '[.labels[].name]')" >> "$GITHUB_OUTPUT" + else + echo "LABELS=['ci: ready to be merged']" >> "$GITHUB_OUTPUT" + fi + - # If the workflow is meant to continue, we extract additional information for the json of the pr. - echo "LABELS=$(echo ${pr_json} | jq -crM '[.labels[].name]')" >> "$GITHUB_OUTPUT" # The TPL tag is contained in the codespaces configuration to avoid duplications. - name: Checkout .devcontainer/devcontainer.json uses: actions/checkout@v3 @@ -280,6 +286,11 @@ jobs: if: ${{ always() }} steps: - run: | + echo "if_not_unassigned_pull_request: ${{needs.if_not_unassigned_pull_request.result}}" + echo "are_submodules_in_sync: ${{needs.are_submodules_in_sync.result}}" + echo "check_code_style_and_documentation: ${{needs.check_code_style_and_documentation.result}}" + echo "cpu_builds: ${{needs.cpu_builds.result}}" + echo "cuda_builds: ${{needs.cuda_builds.result}}" ${{ needs.if_not_unassigned_pull_request.result == 'success' && needs.are_submodules_in_sync.result == 'success' && diff --git a/.gitmodules b/.gitmodules index 076fd28d3c3..a2d2fa8ccf5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "src/coreComponents/fileIO/coupling/hdf5_interface"] path = src/coreComponents/fileIO/coupling/hdf5_interface url = ../../GEOS-DEV/hdf5_interface.git +[submodule "scripts/uberenv"] + path = scripts/uberenv + url = ../../LLNL/uberenv.git diff --git a/.uberenv_config.json b/.uberenv_config.json new file mode 100644 index 00000000000..883612c2c25 --- /dev/null +++ b/.uberenv_config.json @@ -0,0 +1,11 @@ +{ +"package_name": "geosx", +"package_version": "develop", +"package_final_phase": "lvarray_hostconfig", +"package_source_dir": "../..", +"spack_url": "https://github.com/spack/spack", +"spack_commit": "e8658d6493887ef702dd38f0e9ee5870a1651c1e", +"spack_configs_path": "scripts/spack_configs", +"spack_packages_path": "scripts/spack_packages/packages", +"spack_concretizer": "clingo" +} diff --git a/scripts/pygeosx_configs/blueos_3_ppc64le_ib_p9/spack.yaml b/scripts/pygeosx_configs/blueos_3_ppc64le_ib_p9/spack.yaml new file mode 100644 index 00000000000..565a12075fc --- /dev/null +++ b/scripts/pygeosx_configs/blueos_3_ppc64le_ib_p9/spack.yaml @@ -0,0 +1,137 @@ +#------------------------------------------------------------------------------------------------------------ +# SPDX-License-Identifier: LGPL-2.1-only +# +# Copyright (c) 2018-2020 Lawrence Livermore National Security LLC +# Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University +# Copyright (c) 2018-2020 TotalEnergies +# Copyright (c) 2019- GEOSX Contributors +# All rights reserved +# +# See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. +#------------------------------------------------------------------------------------------------------------ + +# %gcc@8.3.1 +# +# Uberenv command to build pygeosx dependencies: +# python3 ./scripts/uberenv/uberenv.py --spec="%gcc@8.3.1" --project-json="scripts/pygeosx_configs/pygeosx.json" + +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: + default: + root: ../view + projections: + all: '{name}-{version}' + + compilers:: + - compiler: + spec: gcc@8.3.1 + paths: + cc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gcc + cxx: /usr/tce/packages/gcc/gcc-8.3.1/bin/g++ + f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + flags: + # Fix for "undefined reference to `_gfortran_transfer_integer_write'" + ldlibs: -lgfortran + operating_system: rhel7 + target: ppc64le + modules: [] + environment: {} + extra_rpaths: [] + + packages: + all: + compiler: [gcc] + providers: + mpi: [spectrum-mpi] + blas: [openblas] + lapack: [openblas] + + spectrum-mpi: + buildable: False + externals: + - spec: spectrum-mpi@release%gcc@8.3.1 + prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-8.3.1 + + cuda: + buildable: False + externals: + - spec: cuda@11.2.2 +allow-unsupported-compilers + prefix: /usr/tce/packages/cuda/cuda-11.2.0 + + # System level packages to not build + cmake: + buildable: False + externals: + - spec: cmake@3.21.1 + prefix: /usr/tce/packages/cmake/cmake-3.21.1 + readline: + buildable: False + externals: + - spec: readline@7.0 + prefix: /collab/usr/gapps/python/build/spack-coralea.3/opt/spack/linux-rhel7-ppc64le/gcc-4.9.3/readline-7.0-owal6z2zh5zotgvdmwow6sgdn6cqfn43/ + m4: + buildable: False + externals: + - spec: m4@1.4.16 + prefix: /usr + perl: + buildable: false + externals: + - spec: perl@5.16.3 + prefix: /usr + pkg-config: + buildable: false + externals: + - spec: pkg-config@0.27.1 + prefix: /usr + diffutils: + buildable: False + externals: + - spec: diffutils@3.3 + prefix: /usr/bin/ + autoconf: + buildable: False + externals: + - spec: autoconf@2.69 + prefix: /usr + automake: + buildable: False + externals: + - spec: automake@1.13.4 + prefix: /usr + libtool: + buildable: False + externals: + - spec: libtool@2.4.2 + prefix: /usr + bison: + buildable: False + externals: + - spec: bison@3.0.4 + prefix: /usr + flex: + buildable: False + externals: + - spec: flex@2.5.37 + prefix: /usr + tk: + buildable: False + externals: + - spec: tk@8.5 + prefix: /usr + tcl: + buildable: False + externals: + - spec: tcl@8.5 + prefix: /usr diff --git a/scripts/pygeosx_configs/pygeosx.json b/scripts/pygeosx_configs/pygeosx.json new file mode 100644 index 00000000000..41b485dc130 --- /dev/null +++ b/scripts/pygeosx_configs/pygeosx.json @@ -0,0 +1,11 @@ +{ +"package_name": "pygeosx", +"package_version": "fakeversion", +"package_final_phase": "", +"package_source_dir": "../..", +"spack_url": "https://github.com/spack/spack", +"spack_commit": "e8658d6493887ef702dd38f0e9ee5870a1651c1e", +"spack_configs_path": "scripts/pygeosx_configs", +"spack_packages_path": "scripts/spack_packages/packages", +"spack_concretizer": "clingo" +} diff --git a/scripts/pygeosx_configs/toss_4_x86_64_ib/spack.yaml b/scripts/pygeosx_configs/toss_4_x86_64_ib/spack.yaml new file mode 100644 index 00000000000..0fb9dc34d75 --- /dev/null +++ b/scripts/pygeosx_configs/toss_4_x86_64_ib/spack.yaml @@ -0,0 +1,142 @@ +#------------------------------------------------------------------------------------------------------------ +# SPDX-License-Identifier: LGPL-2.1-only +# +# Copyright (c) 2018-2020 Lawrence Livermore National Security LLC +# Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University +# Copyright (c) 2018-2020 TotalEnergies +# Copyright (c) 2019- GEOSX Contributors +# All rights reserved +# +# See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. +#------------------------------------------------------------------------------------------------------------ + +# %gcc@10.3.1 +# +# Uberenv command to build pygeosx dependencies: +# python3 ./scripts/uberenv/uberenv.py --spec="%gcc@10.3.1" --project-json="scripts/pygeosx_configs/pygeosx.json" + +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: + default: + root: ../view + projections: + all: '{name}-{version}' + + compilers:: + - compiler: + spec: gcc@10.3.1 + paths: + cc: /usr/tce/packages/gcc/gcc-10.3.1-magic/bin/gcc + cxx: /usr/tce/packages/gcc/gcc-10.3.1-magic/bin/g++ + f77: /usr/tce/packages/gcc/gcc-10.3.1-magic/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-10.3.1-magic/bin/gfortran + operating_system: rhel8 + target: x86_64 + modules: [] + environment: {} + extra_rpaths: [] + + packages: + all: + target: [ivybridge] + compiler: [clang] + providers: + mpi: [mvapich2] + blas: [intel-oneapi-mkl] + lapack: [intel-oneapi-mkl] + + # Lock down which MPI we are using + mvapich2: + buildable: False + externals: + - spec: mvapich2@2.3%gcc@10.3.1 + prefix: /usr/tce/packages/mvapich2/mvapich2-2.3.6-gcc-10.3.1-magic + + intel-oneapi-mkl: + externals: + - spec: "intel-oneapi-mkl@2023.0.0" + prefix: /opt/intel/oneapi + buildable: False + + # System level packages to not build + papi: + buildable: False + externals: + - spec: papi@6.0.0.1 + prefix: /usr/tce/packages/papi/papi-6.0.0.1/ + cmake: + version: [3.26.3] + buildable: false + externals: + - spec: cmake@3.26.3 + prefix: /usr/tce/packages/cmake/cmake-3.26.3 + readline: + externals: + - spec: readline@7.0 + prefix: /collab/usr/gapps/python/build/spack-toss3.3/opt/spack/linux-rhel7-x86_64/gcc-4.9.3/readline-7.0-e5jqqjmcjknidgwvi353pd6umpixzxr2 + buildable: false + m4: + buildable: False + externals: + - spec: m4@1.4.18 + prefix: /usr + perl: + buildable: false + externals: + - spec: perl@5.26.3 + prefix: /usr + pkg-config: + buildable: false + externals: + - spec: pkg-config@1.8.0 + prefix: /usr + diffutils: + buildable: False + externals: + - spec: diffutils@3.3 + prefix: /usr/bin + autoconf: + buildable: False + externals: + - spec: autoconf@2.69 + prefix: /usr + automake: + buildable: False + externals: + - spec: automake@1.16.1 + prefix: /usr + libtool: + buildable: False + externals: + - spec: libtool@2.4.6 + prefix: /usr + bison: + buildable: False + externals: + - spec: bison@3.0.4 + prefix: /usr + flex: + buildable: False + externals: + - spec: flex@2.6.1 + prefix: /usr + tk: + buildable: False + externals: + - spec: tk@8.6 + prefix: /usr + tcl: + buildable: False + externals: + - spec: tcl@8.6 + prefix: /usr diff --git a/scripts/spack_configs/blueos_3_ppc64le_ib_p9/spack.yaml b/scripts/spack_configs/blueos_3_ppc64le_ib_p9/spack.yaml new file mode 100644 index 00000000000..798f19bff0b --- /dev/null +++ b/scripts/spack_configs/blueos_3_ppc64le_ib_p9/spack.yaml @@ -0,0 +1,196 @@ +#------------------------------------------------------------------------------------------------------------ +# SPDX-License-Identifier: LGPL-2.1-only +# +# Copyright (c) 2018-2020 Lawrence Livermore National Security LLC +# Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University +# Copyright (c) 2018-2020 TotalEnergies +# Copyright (c) 2019- GEOSX Contributors +# All rights reserved +# +# See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. +#------------------------------------------------------------------------------------------------------------ + +# geosx@develop%clang@10.0.1+cuda cuda_arch=70 ^cuda@11.8.0+allow-unsupported-compilers +# geosx@develop%gcc@8.3.1+cuda cuda_arch=70 ^cuda@11.8.0+allow-unsupported-compilers +# geosx@develop%clang@13.0.1+cuda cuda_arch=70 ^cuda@11.8.0+allow-unsupported-compilers +# +# Uberenv command to build geos dependencies: +# python3 ./scripts/uberenv/uberenv.py --spec="%clang@10.0.1+cuda~uncrustify cuda_arch=70 ^cuda@11.8.0+allow-unsupported-compilers" +# +# python3 ./scripts/uberenv/uberenv.py --spec="%gcc@8.3.1+cuda~uncrustify cuda_arch=70 ^cuda@11.8.0+allow-unsupported-compilers" +# +# python3 ./scripts/uberenv/uberenv.py --spec="%clang@13.0.1+cuda~uncrustify cuda_arch=70 ^cuda@11.8.0+allow-unsupported-compilers" + + +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 + + compilers:: + - compiler: + spec: clang@10.0.1 + paths: + cc: /usr/tce/packages/clang/clang-10.0.1-gcc-8.3.1/bin/clang + cxx: /usr/tce/packages/clang/clang-10.0.1-gcc-8.3.1/bin/clang++ + f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + flags: {} + operating_system: rhel7 + target: ppc64le + modules: [] + environment: {} + extra_rpaths: [] + - compiler: + spec: clang@13.0.1 + paths: + cc: /usr/tce/packages/clang/clang-13.0.1-gcc-8.3.1/bin/clang + cxx: /usr/tce/packages/clang/clang-13.0.1-gcc-8.3.1/bin/clang++ + f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + flags: {} + operating_system: rhel7 + target: ppc64le + modules: [] + environment: {} + extra_rpaths: [] + - compiler: + spec: gcc@8.3.1 + paths: + cc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gcc + cxx: /usr/tce/packages/gcc/gcc-8.3.1/bin/g++ + f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + flags: + # Fix for "undefined reference to `_gfortran_transfer_integer_write'" + ldlibs: -lgfortran + operating_system: rhel7 + target: ppc64le + modules: [] + environment: {} + extra_rpaths: [] + + packages: + all: + compiler: [gcc, clang] + providers: + mpi: [spectrum-mpi] + blas: [essl] + lapack: [essl] + + blt: + require: "@git.5a792c1775e7a7628d84dcde31652a689f1df7b5=develop" + + hypre: + require: "@git.57bfb26e268ddf003668c5d0b5938ae258922a83" + + umpire: + require: "@git.4bd9b2ded81d3216b3f62e2aad62d0e34fe2c256=develop" + + raja: + require: "@git.e330b2560747d5417cd7bd265fab3fb91d32ecbd=develop" + + camp: + require: "@git.ac34c25b722a06b138bc045d38bfa5e8fa3ec9c5=main" + + uncrustify: + require: "@git.401a4098bce9dcc47e024987403f2d59d9ba7bd2" + + superlu-dist: + require: "@git.0f6efc377df2440c235452d13d28d2c717f832a1" + + spectrum-mpi: + buildable: False + externals: + - spec: spectrum-mpi@release%gcc@8.3.1 + prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-8.3.1 + # Previously clang@upstream - clingo doesn't like "upstream" version + - spec: spectrum-mpi@release%clang@10.0.1 + prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-10.0.1-gcc-8.3.1 + - spec: spectrum-mpi@release%clang@13.0.1 + prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-13.0.1-gcc-8.3.1 + + essl: + buildable: False + externals: + - spec: essl@6.3.0.2 + prefix: /usr/tcetmp/packages/essl/essl-6.3.0.2/ + + cuda: + buildable: False + externals: + - spec: cuda@11.8.0 +allow-unsupported-compilers + prefix: /usr/tce/packages/cuda/cuda-11.8.0 + + # System level packages to not build + cmake: + buildable: False + externals: + - spec: cmake@3.23.1 + prefix: /usr/tce/packages/cmake/cmake-3.23.1 + readline: + buildable: False + externals: + - spec: readline@7.0 + prefix: /collab/usr/gapps/python/build/spack-coralea.3/opt/spack/linux-rhel7-ppc64le/gcc-4.9.3/readline-7.0-owal6z2zh5zotgvdmwow6sgdn6cqfn43/ + m4: + buildable: False + externals: + - spec: m4@1.4.16 + prefix: /usr + perl: + buildable: false + externals: + - spec: perl@5.16.3 + prefix: /usr + pkg-config: + buildable: false + externals: + - spec: pkg-config@0.27.1 + prefix: /usr + diffutils: + buildable: False + externals: + - spec: diffutils@3.3 + prefix: /usr/bin/ + # This needs to be the prefix to the python3 LC installation + # or pygeosx package built by spack/uberenv + python: + buildable: False + externals: + - spec: python@3.8.2 + prefix: /usr/gapps/GEOSX/thirdPartyLibs/python/lassen-gcc-python/python/ + autoconf: + buildable: False + externals: + - spec: autoconf@2.69 + prefix: /usr + automake: + buildable: False + externals: + - spec: automake@1.13.4 + prefix: /usr + libtool: + buildable: False + externals: + - spec: libtool@2.4.2 + prefix: /usr + bison: + buildable: False + externals: + - spec: bison@3.0.4 + prefix: /usr + flex: + buildable: False + externals: + - spec: flex@2.5.37 + prefix: /usr diff --git a/scripts/uberenv/spack_configs/darwin/compilers.yaml b/scripts/spack_configs/darwin/compilers.yaml similarity index 100% rename from scripts/uberenv/spack_configs/darwin/compilers.yaml rename to scripts/spack_configs/darwin/compilers.yaml diff --git a/scripts/uberenv/spack_configs/darwin/packages.yaml b/scripts/spack_configs/darwin/packages.yaml similarity index 100% rename from scripts/uberenv/spack_configs/darwin/packages.yaml rename to scripts/spack_configs/darwin/packages.yaml diff --git a/scripts/uberenv/spack_configs/summit/compilers.yaml b/scripts/spack_configs/summit/compilers.yaml similarity index 100% rename from scripts/uberenv/spack_configs/summit/compilers.yaml rename to scripts/spack_configs/summit/compilers.yaml diff --git a/scripts/uberenv/spack_configs/summit/packages.yaml b/scripts/spack_configs/summit/packages.yaml similarity index 100% rename from scripts/uberenv/spack_configs/summit/packages.yaml rename to scripts/spack_configs/summit/packages.yaml diff --git a/scripts/uberenv/spack_configs/summit_python/compilers.yaml b/scripts/spack_configs/summit_python/compilers.yaml similarity index 100% rename from scripts/uberenv/spack_configs/summit_python/compilers.yaml rename to scripts/spack_configs/summit_python/compilers.yaml diff --git a/scripts/uberenv/spack_configs/summit_python/packages.yaml b/scripts/spack_configs/summit_python/packages.yaml similarity index 100% rename from scripts/uberenv/spack_configs/summit_python/packages.yaml rename to scripts/spack_configs/summit_python/packages.yaml diff --git a/scripts/spack_configs/toss_3_x86_64_ib/spack.yaml b/scripts/spack_configs/toss_3_x86_64_ib/spack.yaml new file mode 100644 index 00000000000..ce601ad9237 --- /dev/null +++ b/scripts/spack_configs/toss_3_x86_64_ib/spack.yaml @@ -0,0 +1,194 @@ +#------------------------------------------------------------------------------------------------------------ +# SPDX-License-Identifier: LGPL-2.1-only +# +# Copyright (c) 2018-2020 Lawrence Livermore National Security LLC +# Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University +# Copyright (c) 2018-2020 TotalEnergies +# Copyright (c) 2019- GEOSX Contributors +# All rights reserved +# +# See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. +#------------------------------------------------------------------------------------------------------------ + +# geosx@develop%clang@10.0.0 +# +# Uberenv command to build pygeosx dependencies: +# python3 ./scripts/uberenv/uberenv.py --spec="%clang@10.0.0" + +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 + + compilers:: + - compiler: + spec: clang@10.0.0 + paths: + cc: /usr/tce/packages/clang/clang-10.0.0/bin/clang + cxx: /usr/tce/packages/clang/clang-10.0.0/bin/clang++ + f77: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran + flags: + cflags: --gcc-toolchain=/usr/tce/packages/gcc/gcc-8.1.0 + cxxflags: --gcc-toolchain=/usr/tce/packages/gcc/gcc-8.1.0 + operating_system: rhel7 + target: x86_64 + modules: [] + environment: {} + extra_rpaths: [] + - compiler: + spec: clang@10.0.1 + paths: + cc: /usr/tce/packages/clang/clang-10.0.1/bin/clang + cxx: /usr/tce/packages/clang/clang-10.0.1/bin/clang++ + f77: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran + flags: + cflags: --gcc-toolchain=/usr/tce/packages/gcc/gcc-8.1.0 + cxxflags: --gcc-toolchain=/usr/tce/packages/gcc/gcc-8.1.0 + operating_system: rhel7 + target: x86_64 + modules: [] + environment: {} + extra_rpaths: [] + - compiler: + spec: gcc@8.1.0 + paths: + cc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gcc + cxx: /usr/tce/packages/gcc/gcc-8.1.0/bin/g++ + f77: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran + flags: {} + operating_system: rhel7 + target: x86_64 + modules: [] + environment: {} + extra_rpaths: [] + - compiler: + spec: intel@19.1.2 + paths: + cc: /usr/tce/packages/intel/intel-19.1.2/bin/icc + cxx: /usr/tce/packages/intel/intel-19.1.2/bin/icpc + f77: /usr/tce/packages/intel/intel-19.1.2/bin/ifort + fc: /usr/tce/packages/intel/intel-19.1.2/bin/ifort + flags: + cflags: -gcc-name=/usr/tce/packages/gcc/gcc-8.3.1/bin/gcc + cxxflags: -gxx-name=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ + fflags: -gcc-name=/usr/tce/packages/gcc/gcc-8.3.1/bin/gcc + operating_system: rhel7 + target: x86_64 + modules: [] + environment: {} + extra_rpaths: [] + + packages: + all: + target: [ivybridge] + compiler: [gcc, clang, intel] + providers: + mpi: [mvapich2] + blas: [intel-mkl] + lapack: [intel-mkl] + + # Lock down which MPI we are using + mvapich2: + buildable: False + externals: + - spec: mvapich2@2.3%gcc@8.3.1 + prefix: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.3.1/ + - spec: mvapich2@2.3%clang@10.0.1 + prefix: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-10.0.1 + + # Lock down blas, lapack implementation + intel-mkl: + buildable: False + externals: + - spec: intel-mkl@2020.0.166 threads=openmp + prefix: /usr/tce/packages/mkl/mkl-2020.0/ + + # System level packages to not build + papi: + buildable: False + externals: + - spec: papi@5.5.1 + prefix: /usr/tce/packages/papi/papi-5.5.1/ + cmake: + version: [3.23.1] + buildable: false + externals: + - spec: cmake@3.23.1 + prefix: /usr/tce/packages/cmake/cmake-3.23.1 + readline: + externals: + - spec: readline@7.0 + prefix: /collab/usr/gapps/python/build/spack-toss3.3/opt/spack/linux-rhel7-x86_64/gcc-4.9.3/readline-7.0-e5jqqjmcjknidgwvi353pd6umpixzxr2 + buildable: false + zlib: + buildable: False + externals: + - spec: zlib@1.2.7 + prefix: /usr + m4: + buildable: False + externals: + - spec: m4@1.4.16 + prefix: /usr + perl: + buildable: false + externals: + - spec: perl@5.16.3 + prefix: /usr + pkg-config: + buildable: false + externals: + - spec: pkg-config@0.27.1 + prefix: /usr + diffutils: + buildable: False + externals: + - spec: diffutils@3.3 + prefix: /usr/bin + python: + buildable: False + externals: + - spec: python@3.8.2 + prefix: /usr/tce/packages/python/python-3.8.2/ + py-sphinx: + buildable: False + externals: + - spec: py-sphinx@1.6.3 + prefix: /collab/usr/gapps/python/build/spack-toss3.2/opt/spack/linux-rhel7-x86_64/gcc-4.9.3/python-2.7.14-7rci3jkmuht2uiwp433afigveuf4ocnu/ + autoconf: + buildable: False + externals: + - spec: autoconf@2.69 + prefix: /usr + automake: + buildable: False + externals: + - spec: automake@1.13.4 + prefix: /usr + libtool: + buildable: False + externals: + - spec: libtool@2.4.2 + prefix: /usr + bison: + buildable: False + externals: + - spec: bison@3.0.4 + prefix: /usr + flex: + buildable: False + externals: + - spec: flex@2.5.37 + prefix: /usr diff --git a/scripts/spack_configs/toss_4_x86_64_ib/spack.yaml b/scripts/spack_configs/toss_4_x86_64_ib/spack.yaml new file mode 100644 index 00000000000..817a6e8199d --- /dev/null +++ b/scripts/spack_configs/toss_4_x86_64_ib/spack.yaml @@ -0,0 +1,182 @@ +#------------------------------------------------------------------------------------------------------------ +# SPDX-License-Identifier: LGPL-2.1-only +# +# Copyright (c) 2018-2020 Lawrence Livermore National Security LLC +# Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University +# Copyright (c) 2018-2020 TotalEnergies +# Copyright (c) 2019- GEOSX Contributors +# All rights reserved +# +# See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. +#------------------------------------------------------------------------------------------------------------ + +# geosx@develop%clang@14.0.6 +# geosx@develop%gcc@12.1.1 +# +# Uberenv command to build pygeosx dependencies: +# python3 ./scripts/uberenv/uberenv.py --spec="%clang@14.0.6 +docs" +# +# python3 ./scripts/uberenv/uberenv.py --spec="%gcc@12.1.1 +docs" + +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 + + compilers:: + - compiler: + spec: clang@14.0.6 + paths: + cc: /usr/tce/packages/clang/clang-14.0.6-magic/bin/clang + cxx: /usr/tce/packages/clang/clang-14.0.6-magic/bin/clang++ + f77: /usr/tce/packages/gcc/gcc-12.1.1-magic/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-12.1.1-magic/bin/gfortran + operating_system: rhel8 + target: x86_64 + modules: [] + environment: {} + extra_rpaths: [] + - compiler: + spec: gcc@12.1.1 + paths: + cc: /usr/tce/packages/gcc/gcc-12.1.1-magic/bin/gcc + cxx: /usr/tce/packages/gcc/gcc-12.1.1-magic/bin/g++ + f77: /usr/tce/packages/gcc/gcc-12.1.1-magic/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-12.1.1-magic/bin/gfortran + flags: {} + operating_system: rhel8 + target: x86_64 + modules: [] + environment: {} + extra_rpaths: [] + + packages: + all: + target: [ivybridge] + compiler: [gcc, clang] + providers: + mpi: [mvapich2] + blas: [intel-oneapi-mkl] + lapack: [intel-oneapi-mkl] + + blt: + require: "@git.5a792c1775e7a7628d84dcde31652a689f1df7b5=develop" + + hypre: + require: "@git.57bfb26e268ddf003668c5d0b5938ae258922a83" + + umpire: + require: "@git.4bd9b2ded81d3216b3f62e2aad62d0e34fe2c256=develop" + + raja: + require: "@git.e330b2560747d5417cd7bd265fab3fb91d32ecbd=develop" + + camp: + require: "@git.ac34c25b722a06b138bc045d38bfa5e8fa3ec9c5=main" + + uncrustify: + require: "@git.401a4098bce9dcc47e024987403f2d59d9ba7bd2" + + superlu-dist: + require: "@git.0f6efc377df2440c235452d13d28d2c717f832a1" + + # Lock down which MPI we are using + mvapich2: + buildable: False + externals: + - spec: mvapich2@2.3%gcc@12.1.1 + prefix: /usr/tce/packages/mvapich2/mvapich2-2.3.6-gcc-12.1.1-magic + - spec: mvapich2@2.3%clang@14.0.6 + prefix: /usr/tce/packages/mvapich2/mvapich2-2.3.6-clang-14.0.6-magic + + intel-oneapi-mkl: + externals: + - spec: "intel-oneapi-mkl@2023.2.0" + prefix: /opt/intel/oneapi + buildable: False + + # System level packages to not build + papi: + buildable: False + externals: + - spec: papi@6.0.0.1 + prefix: /usr/tce/packages/papi/papi-6.0.0.1/ + cmake: + version: [3.26.3] + buildable: false + externals: + - spec: cmake@3.26.3 + prefix: /usr/tce/packages/cmake/cmake-3.26.3 + readline: + externals: + - spec: readline@7.0 + prefix: /collab/usr/gapps/python/build/spack-toss3.3/opt/spack/linux-rhel7-x86_64/gcc-4.9.3/readline-7.0-e5jqqjmcjknidgwvi353pd6umpixzxr2 + buildable: false + m4: + buildable: False + externals: + - spec: m4@1.4.18 + prefix: /usr + perl: + buildable: false + externals: + - spec: perl@5.26.3 + prefix: /usr + pkg-config: + buildable: false + externals: + - spec: pkg-config@1.8.0 + prefix: /usr + diffutils: + buildable: False + externals: + - spec: diffutils@3.3 + prefix: /usr/bin + # This needs to be the prefix to the pygeosx LC installation + # or system install with pygeosx dependencies + python: + buildable: False + externals: + - spec: python@3.10.8 + prefix: /usr/gapps/GEOSX/thirdPartyLibs/python/quartz-gcc-python/python/ + # This needs to be the prefix to the pygeosx LC installation + # or system install with pygeosx dependencies + py-sphinx: + buildable: False + externals: + - spec: py-sphinx@1.6.3 + prefix: /usr/gapps/GEOSX/thirdPartyLibs/python/quartz-gcc-python/python/ + autoconf: + buildable: False + externals: + - spec: autoconf@2.69 + prefix: /usr + automake: + buildable: False + externals: + - spec: automake@1.16.1 + prefix: /usr + libtool: + buildable: False + externals: + - spec: libtool@2.4.6 + prefix: /usr + bison: + buildable: False + externals: + - spec: bison@3.0.4 + prefix: /usr + flex: + buildable: False + externals: + - spec: flex@2.6.1 + prefix: /usr diff --git a/scripts/spack_packages/packages/chai/package.py b/scripts/spack_packages/packages/chai/package.py new file mode 100644 index 00000000000..6ce16a6a510 --- /dev/null +++ b/scripts/spack_packages/packages/chai/package.py @@ -0,0 +1,198 @@ +# Copyright 2013-2023 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 * + + +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("davidbeckingsale") + + # GEOS_EDIT_START + version("2023.06.0", tag="v2023.06.0", submodules=False) + # GEOS_EDIT_END + + version("develop", branch="develop", submodules=False) + version("main", branch="main", submodules=False) + version("2022.03.0", tag="v2022.03.0", submodules=False) + version("2.4.0", tag="v2.4.0", submodules=True) + version("2.3.0", tag="v2.3.0", submodules=True) + version("2.2.2", tag="v2.2.2", submodules=True) + version("2.2.1", tag="v2.2.1", submodules=True) + version("2.2.0", tag="v2.2.0", submodules=True) + version("2.1.1", tag="v2.1.1", submodules=True) + version("2.1.0", tag="v2.1.0", submodules=True) + version("2.0.0", tag="v2.0.0", submodules=True) + version("1.2.0", tag="v1.2.0", submodules=True) + version("1.1.0", tag="v1.1.0", submodules=True) + version("1.0", tag="v1.0", submodules=True) + + variant("enable_pick", default=False, description="Enable pick method") + variant("shared", default=True, description="Build Shared Libs") + variant("raja", default=False, description="Build plugin for RAJA") + variant("benchmarks", default=False, description="Build benchmarks.") + 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=False, description="Build tests") + + depends_on("cmake@3.8:", type="build") + depends_on("cmake@3.9:", type="build", when="+cuda") + depends_on("cmake@3.14:", when="@2022.03.0:") + + # GEOS_EDIT_START + depends_on("blt@0.5.3:", type="build", when="@2023.06.0:") + # # GEOS_EDIT_END + depends_on("blt@0.5.0:", type="build", when="@2022.03.0:") + depends_on("blt@0.4.1:", type="build", when="@2.4.0:") + depends_on("blt@0.4.0:", type="build", when="@2.3.0") + depends_on("blt@0.3.6:", type="build", when="@:2.2.2") + + depends_on("umpire") + # GEOS_EDIT_START + depends_on("umpire@2023.06.0:", when="@2023.06.0:") + # GEOS_EDIT_END + depends_on("umpire@2022.03.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@main", when="@main") + + 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("+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@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") + depends_on("raja@2022.03.0:", when="@2022.03.0:") + # GEOS_EDIT_START + depends_on("raja@2023.06.0:", when="@2023.06.0:") + # GEOS_EDIT_END + depends_on("raja@main", when="@main") + + 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), + ) + + conflicts("+benchmarks", when="~tests") + + 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}.cmake".format( + hostname, + self._get_sys_type(self.spec), + self.spec.compiler.name, + self.spec.compiler.version, + ) + + def initconfig_compiler_entries(self): + spec = self.spec + entries = super(Chai, self).initconfig_compiler_entries() + if "+rocm" in spec: + entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) + return entries + + def initconfig_hardware_entries(self): + spec = self.spec + entries = super(Chai, self).initconfig_hardware_entries() + + entries.append(cmake_cache_option("ENABLE_OPENMP", "+openmp" in spec)) + + if "+cuda" in spec: + entries.append(cmake_cache_option("ENABLE_CUDA", True)) + # GEOS_EDIT_START + #entries.append(cmake_cache_option("CMAKE_CUDA_SEPARABLE_COMPILATION", True)) + #entries.append(cmake_cache_option("CUDA_SEPARABLE_COMPILATION", True)) + # GEOS_EDIT_END + + if not spec.satisfies("cuda_arch=none"): + cuda_arch = spec.variants["cuda_arch"].value + entries.append(cmake_cache_string("CUDA_ARCH", "sm_{0}".format(cuda_arch[0]))) + entries.append( + cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", "{0}".format(cuda_arch[0])) + ) + flag = "-arch sm_{0}".format(cuda_arch[0]) + entries.append(cmake_cache_string("CMAKE_CUDA_FLAGS", "{0}".format(flag))) + else: + entries.append(cmake_cache_option("ENABLE_CUDA", False)) + + if "+rocm" in spec: + entries.append(cmake_cache_option("ENABLE_HIP", True)) + entries.append(cmake_cache_path("HIP_ROOT_DIR", "{0}".format(spec["hip"].prefix))) + archs = self.spec.variants["amdgpu_target"].value + if archs != "none": + arch_str = ",".join(archs) + entries.append( + cmake_cache_string("HIP_HIPCC_FLAGS", "--amdgpu-target={0}".format(arch_str)) + ) + else: + entries.append(cmake_cache_option("ENABLE_HIP", False)) + + return entries + + def initconfig_package_entries(self): + spec = self.spec + entries = [] + + option_prefix = "CHAI_" if spec.satisfies("@2022.03.0:") else "" + + entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix)) + if "+raja" in spec: + entries.append(cmake_cache_option("{}ENABLE_RAJA_PLUGIN".format(option_prefix), True)) + entries.append(cmake_cache_path("RAJA_DIR", spec["raja"].prefix)) + entries.append( + cmake_cache_option("{}ENABLE_PICK".format(option_prefix), "+enable_pick" in spec) + ) + entries.append(cmake_cache_path("umpire_DIR", spec["umpire"].prefix.share.umpire.cmake)) + entries.append(cmake_cache_option("ENABLE_TESTS", "+tests" in spec)) + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", "+benchmarks" in spec)) + entries.append( + cmake_cache_option("{}ENABLE_EXAMPLES".format(option_prefix), "+examples" in spec) + ) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", "+shared" in spec)) + + return entries + + def cmake_args(self): + options = [] + return options diff --git a/scripts/spack_packages/packages/essl/package.py b/scripts/spack_packages/packages/essl/package.py new file mode 100644 index 00000000000..0a4377ff49a --- /dev/null +++ b/scripts/spack_packages/packages/essl/package.py @@ -0,0 +1,49 @@ +# 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) +from spack.package import * + + +# Recipe for pre-built essl library on blueos machines. +# Defines additonal flags for blueos: +# https://lc.llnl.gov/confluence/display/SIERRA/Math+Libraries +class Essl(BundlePackage): + """IBM's Engineering and Scientific Subroutine Library (ESSL).""" + + homepage = "https://www.ibm.com/systems/power/software/essl/" + + version("6.3.0.2") + + provides("blas") + provides("lapack") + + @property + def blas_libs(self): + spec = self.spec + prefix = self.prefix + + essl_root = prefix.lib64 + essl_libs = ["libesslsmpcuda", "liblapackforessl", "liblapackforessl_"] + all_libs = find_libraries(essl_libs, root=essl_root, shared=True) + + cuda_toolkit_root = "/usr/tce/packages/cuda/cuda-11.8.0/lib64" + cuda_libs = ["libcublas", "libcudart", "libcublasLt"] + all_libs += find_libraries(cuda_libs, root=cuda_toolkit_root, shared=True) + + return all_libs + + @property + def lapack_libs(self): + spec = self.spec + prefix = self.prefix + + essl_root = prefix.lib64 + essl_libs = ["libesslsmpcuda", "liblapackforessl", "liblapackforessl_"] + all_libs = find_libraries(essl_libs, root=essl_root, shared=True) + + cuda_toolkit_root = "/usr/tce/packages/cuda/cuda-11.8.0/lib64" + cuda_libs = ["libcublas", "libcudart", "libcublasLt"] + all_libs += find_libraries(cuda_libs, root=cuda_toolkit_root, shared=True) + + return all_libs diff --git a/scripts/spack_packages/packages/fesapi/package.py b/scripts/spack_packages/packages/fesapi/package.py new file mode 100644 index 00000000000..6e95779990f --- /dev/null +++ b/scripts/spack_packages/packages/fesapi/package.py @@ -0,0 +1,46 @@ +# 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) + +import os +import sys + +from spack.package import * + + +class Fesapi(CMakePackage): + + url = "https://github.com/F2I-Consulting/fesapi/archive/refs/tags/v2.4.0.0.tar.gz" + git = "https://github.com/F2I-Consulting/fesapi.git" + + version("2.4.0.0", sha256="a711e8a1218c876a2799f4d05a9820da71eb5503b5d51b834fae98d9fe635381") + + depends_on("hdf5") + depends_on("boost@1.67.0") + depends_on("minizip") + + def cmake_args(self): + spec = self.spec + + cppflags = " ".join(spec.compiler_flags["cppflags"]) + cxxflags = cppflags + " ".join(spec.compiler_flags["cxxflags"]) + cmake_args = [ + self.define('CMAKE_C_COMPILER', spec['mpi'].mpicc), + self.define('CMAKE_CXX_COMPILER', spec['mpi'].mpicxx), + self.define('CMAKE_CXX_FLAGS', cxxflags), + self.define('HDF5_ROOT', spec['hdf5'].prefix), + # fesAPI/spack can detect wrong version otherwise + self.define('HDF5_VERSION', spec['hdf5'].version), + self.define('MINIZIP_INCLUDE_DIR', spec['minizip'].prefix.include + "/minizip"), + self.define('MINIZIP_LIBRARY_RELEASE', spec['minizip'].prefix.lib), + self.define('Boost_INCLUDE_DIR', spec['boost'].prefix.include), + "-DWITH_EXAMPLE:BOOL=OFF", + "-DWITH_DOTNET_WRAPPING:BOOL=OFF", + "-DWITH_JAVA_WRAPPING:BOOL=OFF", + "-DWITH_PYTHON_WRAPPING:BOOL=OFF", + "-DWITH_RESQML2_2:BOOL=OFF", + "-DWITH_TEST:BOOL=OFF", + ] + + return cmake_args diff --git a/scripts/uberenv/packages/geosx/package.py b/scripts/spack_packages/packages/geosx/package.py similarity index 50% rename from scripts/uberenv/packages/geosx/package.py rename to scripts/spack_packages/packages/geosx/package.py index 0672ae7797d..85548940940 100644 --- a/scripts/uberenv/packages/geosx/package.py +++ b/scripts/spack_packages/packages/geosx/package.py @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2023 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) @@ -12,14 +12,9 @@ from os import environ as env from os.path import join as pjoin -# ./scripts/uberenv/uberenv.py --spec="%clang +mkl ^chai ^caliper+papi" +# Tested specs are located at scripts/spack_configs/<$SYS_TYPE>/spack.yaml (e.g. %clang@10.0.1) -# ./scripts/uberenv/uberenv.py --spec="%clang +mkl ^raja build_type=Release ^umpire build_type=Release ^chai build_type=Release ^adiak build_type=Release ^caliper+papi build_type=Release ^pugixml build_type=Release ^parmetis build_type=Release ^superlu-dist build_type=Release ^trilinos build_type=Release" - -# ./scripts/uberenv/uberenv.py --spec="%clang +essl +cuda ~petsc cuda_arch=70 ^raja build_type=Release cuda_arch=70 ^umpire build_type=Release cuda_arch=70 ^chai build_type=Release cuda_arch=70 ^adiak build_type=Release ^caliper~papi build_type=Release ^pugixml build_type=Release ^parmetis build_type=Release ^superlu-dist build_type=Release ^trilinos build_type=Release" - -# PETSC doesn't compile on Lassen -# ./scripts/uberenv/uberenv.py --spec="%gcc +essl ~petsc +cuda cuda_arch=70 ^cuda@10.1.243 ^raja cuda_arch=70 ^umpire cuda_arch=70 ^chai cuda_arch=70 ^caliper~papi" +# WARNING: +petsc variant is yet to be tested. def cmake_cache_entry(name, value, comment=""): @@ -55,40 +50,42 @@ class Geosx(CMakePackage, CudaPackage): homepage = "https://github.com/GEOS-DEV/GEOS" git = "https://github.com/GEOS-DEV/GEOS.git" - version('develop', branch='develop', submodules='True') + # GEOSX needs submodules to build, but not necessary to build dependencies + version('develop', branch='develop') # SPHINX_BEGIN_VARIANTS variant('shared', default=True, description='Build Shared Libs.') variant('caliper', default=True, description='Build Caliper support.') - variant('mkl', default=False, description='Use the Intel MKL library.') - variant('essl', default=False, description='Use the IBM ESSL library.') - variant('suite-sparse', default=True, description='Build SuiteSparse support.') + variant('vtk', default=True, description='Build VTK support.') + variant('fesapi', default=False, description='Build fesapi support.') variant('trilinos', default=True, description='Build Trilinos support.') variant('hypre', default=True, description='Build HYPRE support.') - variant('hypre-cuda', default=False, description='Build HYPRE with CUDA support.') - variant('petsc', default=True, description='Build PETSc support.') + variant('petsc', default=False, description='Build PETSc support.') variant('scotch', default=True, description='Build Scotch support.') + variant('uncrustify', default=True, description='Build Uncrustify support.') variant('lai', - default='trilinos', + default='hypre', description='Linear algebra interface.', values=('trilinos', 'hypre', 'petsc'), multi=False) - variant('pygeosx', default=False, description='Build the GEOSX python interface.') + variant('pygeosx', default=True, description='Enable pygeosx.') # SPHINX_END_VARIANTS # variant('tests', default=True, description='Build tests') # variant('benchmarks', default=False, description='Build benchmarks') # variant('examples', default=False, description='Build examples') - # variant('docs', default=False, description='Build docs') - # variant('addr2line', default=True, - # description='Build support for addr2line.') + + variant('docs', default=False, description='Build docs') + variant('addr2line', default=True, + description='Add support for addr2line.') # SPHINX_BEGIN_DEPENDS - depends_on('cmake@3.8:', type='build') - depends_on('cmake@3.9:', when='+cuda', type='build') + depends_on('cmake@3.23:', type='build') + + depends_on('blt') # # Virtual packages @@ -100,80 +97,79 @@ class Geosx(CMakePackage, CudaPackage): # # Performance portability # - depends_on('raja@0.12.1 +openmp +shared ~examples ~exercises') - depends_on('raja +cuda', when='+cuda') + depends_on('raja +openmp~examples~exercises~shared') + + depends_on('umpire +c+openmp~examples+fortran~device_alloc~shared') + + depends_on('chai@2023.06.0 +raja+openmp~examples~shared') - depends_on('umpire@4.1.2 ~c +shared +openmp ~examples') - depends_on('umpire +cuda', when='+cuda') + depends_on('camp') - depends_on('chai@2.2.2 +shared +raja ~benchmarks ~examples') - depends_on('chai@2.2.2 +cuda', when='+cuda') + with when('+cuda'): + for sm_ in CudaPackage.cuda_arch_values: + depends_on('raja+cuda cuda_arch={0}'.format(sm_), when='cuda_arch={0}'.format(sm_)) + depends_on('umpire+cuda cuda_arch={0}'.format(sm_), when='cuda_arch={0}'.format(sm_)) + depends_on('chai+cuda cuda_arch={0}'.format(sm_), when='cuda_arch={0}'.format(sm_)) + depends_on('camp+cuda cuda_arch={0}'.format(sm_), when='cuda_arch={0}'.format(sm_)) # # IO # - depends_on('hdf5@1.10.5: +shared +pic +mpi', when='~vtk') + depends_on('hdf5@1.12.1') + depends_on('silo@4.11~fortran') - depends_on('conduit@0.5.0 +shared ~test ~fortran +mpi +hdf5 ~hdf5_compat') + depends_on('conduit@0.8.2~test~fortran~hdf5_compat') - depends_on('silo@4.10: ~fortran +shared ~silex +pic +mpi ~zlib') + depends_on('adiak@0.2.2', when='+caliper') + depends_on('caliper@2.10.0~gotcha~sampler~libunwind~libdw', when='+caliper') - depends_on('adiak@0.2: +mpi +shared', when='+caliper') - depends_on('caliper@2.4: +shared +adiak +mpi ~callpath ~libpfm ~gotcha ~sampler', when='+caliper') + depends_on('pugixml@1.13') - depends_on('pugixml@1.8: +shared') + depends_on('fmt@10.0.0 cxxstd=14') + depends_on('vtk@9.2.6', when='+vtk') - depends_on('fmt@8.0: cxxstd=14 +pic') + depends_on('fesapi', when='+fesapi') # # Math # - depends_on('intel-mkl +shared ~ilp64', when='+mkl') + depends_on('parmetis@4.0.3+int64') - # depends_on('essl ~ilp64 threads=openmp +lapack +cuda', when='+essl') + depends_on('superlu-dist +int64+openmp') - depends_on('parmetis@4.0.3: +shared +int64') + depends_on('scotch@7.0.3 +mpi +int64', when='+scotch') - depends_on('scotch@6.0.9: +mpi +int64', when='+scotch') + depends_on('suite-sparse@5.10.1+openmp') - depends_on('superlu-dist +int64 +openmp +shared', when='~petsc') - depends_on('superlu-dist@6.3.0 +int64 +openmp +shared', when='+petsc') + trilinos_build_options = '+openmp' + trilinos_packages = '+aztec+stratimikos~amesos2~anasazi~belos~ifpack2~muelu~sacado+thyra' + depends_on('trilinos@13.4.1 ' + trilinos_build_options + trilinos_packages, when='+trilinos') - depends_on('suite-sparse@5.8.1: +pic +openmp +amd +camd +colamd +ccolamd +cholmod +umfpack', when='+suite-sparse') - depends_on('suite-sparse +blas-no-underscore', when='%gcc +suite-sparse +essl') + depends_on("hypre +superlu-dist+mixedint+mpi+openmp", when='+hypre~cuda') - trilinos_build_options = '~fortran +openmp +shared' - trilinos_tpls = '~boost ~glm ~gtest ~hdf5 ~hypre ~matio ~metis +mpi ~mumps ~netcdf ~suite-sparse' - trilinos_packages = '+amesos +aztec +epetra +epetraext +ifpack +kokkos +ml +stk +stratimikos +teuchos +tpetra ~amesos2 ~anasazi ~belos ~exodus ~ifpack2 ~muelu ~sacado ~zoltan ~zoltan2' - depends_on('trilinos@12.18.1 ' + trilinos_build_options + trilinos_tpls + trilinos_packages, when='+trilinos') - depends_on('trilinos +blas_lowercase_no_underscore', when='+trilinos +essl') - # depends_on('trilinos +force-new-lapack', when='+trilinos +essl') + depends_on("hypre +cuda+superlu-dist+mixedint+mpi+openmp+umpire+unified-memory cxxflags='-fPIC'", when='+hypre+cuda') + with when('+cuda'): + for sm_ in CudaPackage.cuda_arch_values: + depends_on('hypre+cuda cuda_arch={0}'.format(sm_), when='cuda_arch={0}'.format(sm_)) - depends_on('hypre@2.20.300 +shared +superlu-dist +mixedint +mpi +openmp', when='+hypre') - depends_on('hypre@2.20.300 +cuda +shared +superlu-dist +mpi +openmp +unified-memory +cusparse', when='+hypre-cuda') - - petsc_build_options = '+shared +mpi' - petsc_tpls = '+metis ~hdf5 ~hypre +superlu-dist +int64' - depends_on('petsc@3.13.0: ' + petsc_build_options + petsc_tpls, when='+petsc') + depends_on('petsc@3.13.0~hdf5~hypre+int64', when='+petsc') + depends_on('petsc+ptscotch', when='+petsc+scotch') # # Python # - depends_on('python +shared +pic', when='+pygeosx') - depends_on('py-numpy@1.19: +blas +lapack +force-parallel-build', when='+pygeosx') - depends_on('py-scipy@1.5.2: +force-parallel-build', when='+pygeosx') - depends_on('py-mpi4py@3.0.3:', when='+pygeosx') - depends_on('py-pip', when='+pygeosx') + depends_on('python') + # # Dev tools # - depends_on('uncrustify@0.71:') + depends_on('uncrustify', when='+uncrustify') # # Documentation # - depends_on('doxygen@1.8.13:', 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') # SPHINX_END_DEPENDS @@ -181,17 +177,13 @@ class Geosx(CMakePackage, CudaPackage): # # Conflicts # - conflicts('+mkl +essl', msg='Cannot use both MKL and ESSL.') - conflicts('+essl ~cuda', msg='Cannot use ESSL without CUDA.') - conflicts('~trilinos lai=trilinos', msg='To use Trilinos as the Linear Algebra Interface you must build it.') - conflicts('~hypre ~hypre-cuda lai=hypre', msg='To use HYPRE as the Linear Algebra Interface you must build it.') + conflicts('~hypre lai=hypre', msg='To use HYPRE as the Linear Algebra Interface you must build it.') conflicts('~petsc lai=petsc', msg='To use PETSc as the Linear Algebra Interface you must build it.') - conflicts('+hypre +hypre-cuda', msg='Only one of the two can be used at a time.') - conflicts('+hypre-cuda ~cuda', msg='When building hypre-cuda CUDA must be enabled.') - - phases = ['hostconfig', 'cmake', 'build', 'install'] + # Only phases necessary for building dependencies and generate host configs + phases = ['geos_hostconfig', 'lvarray_hostconfig'] + #phases = ['hostconfig', 'cmake', 'build', 'install'] @run_after('build') @on_package_attributes(run_tests=True) @@ -216,19 +208,23 @@ def _get_sys_type(self, spec): sys_type = env["SYS_TYPE"] return sys_type - def _get_host_config_path(self, spec): + def _get_host_config_path(self, spec, lvarray=False): var = '' if '+cuda' in spec: var = '-'.join([var, 'cuda']) hostname = socket.gethostname().rstrip('1234567890') - host_config_path = "%s-%s-%s%s.cmake" % (hostname, self._get_sys_type(spec), spec.compiler, var) + + if lvarray: + hostname = "lvarray-" + hostname + + host_config_path = "%s-%s-%s%s.cmake" % (hostname, self._get_sys_type(spec), (str(spec.compiler)).replace('=',''), var) dest_dir = self.stage.source_path host_config_path = os.path.abspath(pjoin(dest_dir, host_config_path)) return host_config_path - def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): + def geos_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): """ This method creates a 'host-config' file that specifies all of the options used to configure and build GEOSX. @@ -304,6 +300,12 @@ def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): if "%clang arch=linux-rhel7-ppc64le" in spec: cfg.write(cmake_cache_entry("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("#{0}\n".format("-" * 80)) cfg.write("# MPI\n") cfg.write("#{0}\n\n".format("-" * 80)) @@ -312,7 +314,7 @@ def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_entry('MPI_C_COMPILER', spec['mpi'].mpicc)) cfg.write(cmake_cache_entry('MPI_CXX_COMPILER', spec['mpi'].mpicxx)) - if sys_type in ('linux-rhel7-ppc64le', 'linux-rhel8-ppc64le'): + if sys_type in ('linux-rhel7-ppc64le', 'linux-rhel8-ppc64le', 'blueos_3_ppc64le_ib_p9'): cfg.write(cmake_cache_option('ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC', True)) if socket.gethostname().rstrip('1234567890') == "lassen": cfg.write(cmake_cache_entry('MPIEXEC', 'lrun')) @@ -332,7 +334,7 @@ def 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', 14)) + cfg.write(cmake_cache_entry('CMAKE_CUDA_STANDARD', 17)) cudatoolkitdir = spec['cuda'].prefix cfg.write(cmake_cache_entry('CUDA_TOOLKIT_ROOT_DIR', cudatoolkitdir)) @@ -352,33 +354,52 @@ def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): if not spec.satisfies('cuda_arch=none'): cuda_arch = spec.variants['cuda_arch'].value cmake_cuda_flags += ' -arch sm_{0}'.format(cuda_arch[0]) + cfg.write(cmake_cache_string('CMAKE_CUDA_ARCHITECTURES', cuda_arch[0])) cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS', cmake_cuda_flags)) - cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS_RELEASE', '-O3 -Xcompiler -O3 -DNDEBUG')) - cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS_RELWITHDEBINFO', '-O3 -g -lineinfo -Xcompiler -O3')) - cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS_DEBUG', '-O0 -Xcompiler -O0 -g -G')) + cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS_RELEASE', '-O3 -DNDEBUG -Xcompiler -DNDEBUG -Xcompiler -O3 -Xcompiler -mcpu=powerpc64le -Xcompiler -mtune=powerpc64le')) + cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS_RELWITHDEBINFO', '-g -lineinfo ${CMAKE_CUDA_FLAGS_RELEASE}')) + cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS_DEBUG', '-g -G -O0 -Xcompiler -O0')) else: cfg.write(cmake_cache_option('ENABLE_CUDA', False)) - performance_portability_tpls = (('raja', 'RAJA', True), ('umpire', 'UMPIRE', True), ('chai', 'CHAI', True)) cfg.write('#{0}\n'.format('-' * 80)) cfg.write('# Performance Portability TPLs\n') cfg.write('#{0}\n\n'.format('-' * 80)) - for tpl, cmake_name, enable in performance_portability_tpls: - if enable: - cfg.write(cmake_cache_entry('{}_DIR'.format(cmake_name), spec[tpl].prefix)) - else: - cfg.write(cmake_cache_option('ENABLE_{}'.format(cmake_name), False)) - io_tpls = (('hdf5', 'HDF5', True), ('conduit', 'CONDUIT', True), ('silo', 'SILO', True), - ('adiak', 'ADIAK', '+caliper' - in spec), ('caliper', 'CALIPER', '+caliper' - in spec), ('pugixml', 'PUGIXML', True), ('vtk', 'VTK', False)('fmt', 'FMT', True)) + cfg.write(cmake_cache_option('ENABLE_CHAI', True)) + cfg.write(cmake_cache_entry('CHAI_DIR', spec['chai'].prefix)) + + cfg.write(cmake_cache_entry('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_entry('CAMP_DIR', spec['camp'].prefix)) + + # yapf: disable + io_tpls = ( + ('hdf5', 'HDF5', True), + ('conduit', 'CONDUIT', True), + ('silo', 'SILO', True), + ('pugixml', 'PUGIXML', True), + ('vtk', 'VTK', '+vtk' in spec), + ('fesapi', 'FESAPI', '+fesapi' in spec), + ('fmt', 'FMT', True) + ) + # yapf: enable + cfg.write('#{0}\n'.format('-' * 80)) cfg.write('# IO TPLs\n') cfg.write('#{0}\n\n'.format('-' * 80)) + + 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')) + for tpl, cmake_name, enable in io_tpls: if enable: cfg.write(cmake_cache_entry('{}_DIR'.format(cmake_name), spec[tpl].prefix)) @@ -388,7 +409,11 @@ def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('#{0}\n'.format('-' * 80)) cfg.write('# System Math Libraries\n') cfg.write('#{0}\n\n'.format('-' * 80)) - if '+mkl' in spec: + if '+intel-oneapi-mkl' in spec: + 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_list('MKL_LIBRARIES', spec['intel-oneapi-mkl'].libs)) + elif '+mkl' in spec: 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_list('MKL_LIBRARIES', spec['intel-mkl'].libs)) @@ -404,14 +429,14 @@ def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): # yapf: disable math_tpls = ( - ('metis', 'METIS', True), - ('parmetis', 'PARMETIS', True), - ('scotch', 'SCOTCH', '+scotch' in spec), - ('superlu-dist', 'SUPERLU_DIST', True), - ('suite-sparse', 'SUITESPARSE', '+suite-sparse' in spec), - ('trilinos', 'TRILINOS', '+trilinos' in spec), - ('hypre', 'HYPRE', '+hypre' in spec or '+hypre-cuda' in spec), - ('petsc', 'PETSC', '+petsc' in spec) + ('metis', 'METIS', True), + ('parmetis', 'PARMETIS', True), + ('scotch', 'SCOTCH', '+scotch' in spec), + ('superlu-dist', 'SUPERLU_DIST', True), + ('suite-sparse', 'SUITESPARSE', True), + ('trilinos', 'TRILINOS', '+trilinos' in spec), + ('hypre', 'HYPRE', '+hypre' in spec), + ('petsc', 'PETSC', '+petsc' in spec) ) # yapf: enable @@ -421,13 +446,17 @@ def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): for tpl, cmake_name, enable in math_tpls: if enable: cfg.write(cmake_cache_entry('{}_DIR'.format(cmake_name), spec[tpl].prefix)) - if tpl == 'hypre' and '+hypre-cuda' in spec: + + if tpl == 'hypre' and '+cuda' in spec: cfg.write(cmake_cache_string('ENABLE_HYPRE_DEVICE', "CUDA")) - elif tpl == 'hypre' and '+hypre-hip' in spec: + elif tpl == 'hypre' and '+hip' in spec: cfg.write(cmake_cache_string('ENABLE_HYPRE_DEVICE', "HIP")) else: cfg.write(cmake_cache_option('ENABLE_{}'.format(cmake_name), False)) + if '+caliper' in spec and '+hypre' in spec and '+cuda' not in spec: + cfg.write(cmake_cache_option('ENABLE_CALIPER_HYPRE', True)) + if 'lai=trilinos' in spec: cfg.write(cmake_cache_entry('GEOSX_LA_INTERFACE', 'Trilinos')) if 'lai=hypre' in spec: @@ -438,9 +467,12 @@ def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('#{0}\n'.format('-' * 80)) 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'))) + if '+pygeosx' in spec: cfg.write(cmake_cache_option('ENABLE_PYGEOSX', True)) - cfg.write(cmake_cache_entry('Python3_EXECUTABLE', os.path.join(spec['python'].prefix.bin, 'python3'))) else: cfg.write(cmake_cache_option('ENABLE_PYGEOSX', False)) @@ -461,13 +493,18 @@ def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write('#{0}\n'.format('-' * 80)) cfg.write('# Development tools\n') cfg.write('#{0}\n\n'.format('-' * 80)) - cfg.write( - cmake_cache_entry('UNCRUSTIFY_EXECUTABLE', os.path.join(spec['uncrustify'].prefix.bin, 'uncrustify'))) - # cfg.write('#{0}\n'.format('-' * 80)) - # cfg.write('# addr2line\n') - # cfg.write('#{0}\n\n'.format('-' * 80)) - # cfg.write(cmake_cache_option('ENABLE_ADDR2LINE', '+addr2line' in spec)) + 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'))) + + 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('#{0}\n'.format('-' * 80)) cfg.write('# Other\n') @@ -476,6 +513,172 @@ def hostconfig(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_option('ENABLE_MATHPRESSO', False)) cfg.write(cmake_cache_option('ENABLE_XML_UPDATES', False)) + # ATS + # Lassen + if sys_type in ('blueos_3_ppc64le_ib_p9'): + cfg.write(cmake_cache_string('ATS_ARGUMENTS', '--ats jsrun_omp --ats jsrun_bind=packed')) + # Quartz + if sys_type in ('toss_4_x86_64_ib'): + cfg.write(cmake_cache_string('ATS_ARGUMENTS', '--machine slurm36')) + + def lvarray_hostconfig(self, spec, prefix, py_site_pkgs_dir=None): + """ + This method creates a 'host-config' file that specifies + all of the options used to configure and build LvArray. + + Note: + The `py_site_pkgs_dir` arg exists to allow a package that + subclasses this package provide a specific site packages + dir when calling this function. `py_site_pkgs_dir` should + be an absolute path or `None`. + + This is necessary because the spack `site_packages_dir` + var will not exist in the base class. For more details + on this issue see: https://github.com/spack/spack/issues/6261 + """ + + ####################### + # Compiler Info + ####################### + c_compiler = env["SPACK_CC"] + cpp_compiler = env["SPACK_CXX"] + + ####################################################################### + # By directly fetching the names of the actual compilers we appear + # to doing something evil here, but this is necessary to create a + # 'host config' file that works outside of the spack install env. + ####################################################################### + + sys_type = self._get_sys_type(spec) + + ############################################## + # Find and record what CMake is used + ############################################## + + cmake_exe = spec['cmake'].command.path + cmake_exe = os.path.realpath(cmake_exe) + + host_config_path = self._get_host_config_path(spec, lvarray=True) + with open(host_config_path, "w") as cfg: + cfg.write("#{0}\n".format("#" * 80)) + cfg.write("# Generated host-config - Edit at own risk!\n") + cfg.write("#{0}\n".format("#" * 80)) + + cfg.write("#{0}\n".format("-" * 80)) + cfg.write("# SYS_TYPE: {0}\n".format(sys_type)) + cfg.write("# Compiler Spec: {0}\n".format(spec.compiler)) + cfg.write("# CMake executable path: %s\n" % cmake_exe) + cfg.write("#{0}\n\n".format("-" * 80)) + + ####################### + # Compiler Settings + ####################### + + 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)) + cflags = ' '.join(spec.compiler_flags['cflags']) + if cflags: + cfg.write(cmake_cache_entry("CMAKE_C_FLAGS", cflags)) + + cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) + cxxflags = ' '.join(spec.compiler_flags['cxxflags']) + if cxxflags: + cfg.write(cmake_cache_entry("CMAKE_CXX_FLAGS", cxxflags)) + + release_flags = "-O3 -DNDEBUG" + cfg.write(cmake_cache_string("CMAKE_CXX_FLAGS_RELEASE", release_flags)) + reldebinf_flags = "-O3 -g -DNDEBUG" + cfg.write(cmake_cache_string("CMAKE_CXX_FLAGS_RELWITHDEBINFO", reldebinf_flags)) + debug_flags = "-O0 -g" + 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('#{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)) + + cudatoolkitdir = spec['cuda'].prefix + cfg.write(cmake_cache_entry('CUDA_TOOLKIT_ROOT_DIR', cudatoolkitdir)) + cudacompiler = '${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc' + cfg.write(cmake_cache_entry('CMAKE_CUDA_COMPILER', cudacompiler)) + + cmake_cuda_flags = ('-restrict --expt-extended-lambda -Werror ' + 'cross-execution-space-call,reorder,' + 'deprecated-declarations') + + archSpecifiers = ('-mtune', '-mcpu', '-march', '-qtune', '-qarch') + for archSpecifier in archSpecifiers: + for compilerArg in spec.compiler_flags['cxxflags']: + if compilerArg.startswith(archSpecifier): + cmake_cuda_flags += ' -Xcompiler ' + compilerArg + + if not spec.satisfies('cuda_arch=none'): + cuda_arch = spec.variants['cuda_arch'].value + cmake_cuda_flags += ' -arch sm_{0}'.format(cuda_arch[0]) + cfg.write(cmake_cache_string('CMAKE_CUDA_ARCHITECTURES', cuda_arch[0])) + + cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS', cmake_cuda_flags)) + + cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS_RELEASE', '-O3 -DNDEBUG -Xcompiler -DNDEBUG -Xcompiler -O3 -Xcompiler -mcpu=powerpc64le -Xcompiler -mtune=powerpc64le')) + cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS_RELWITHDEBINFO', '-g -lineinfo ${CMAKE_CUDA_FLAGS_RELEASE}')) + cfg.write(cmake_cache_string('CMAKE_CUDA_FLAGS_DEBUG', '-g -G -O0 -Xcompiler -O0')) + + else: + cfg.write(cmake_cache_option('ENABLE_CUDA', False)) + + cfg.write('#{0}\n'.format('-' * 80)) + cfg.write('# Performance Portability TPLs\n') + 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_entry('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_entry('CAMP_DIR', spec['camp'].prefix)) + + cfg.write('#{0}\n'.format('-' * 80)) + cfg.write('# IO TPLs\n') + cfg.write('#{0}\n\n'.format('-' * 80)) + + 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('#{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'))) + + doxygen_bin_dir = spec['doxygen'].prefix.bin + cfg.write(cmake_cache_entry('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)) + + cfg.write('#{0}\n'.format('-' * 80)) + cfg.write('# Development tools\n') + cfg.write('#{0}\n\n'.format('-' * 80)) + + 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)) + def cmake_args(self): pass # spec = self.spec diff --git a/scripts/spack_packages/packages/hdf5/package.py b/scripts/spack_packages/packages/hdf5/package.py new file mode 100644 index 00000000000..061251f5320 --- /dev/null +++ b/scripts/spack_packages/packages/hdf5/package.py @@ -0,0 +1,747 @@ +# 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/py-pydata-sphinx-theme/package.py b/scripts/spack_packages/packages/py-pydata-sphinx-theme/package.py new file mode 100644 index 00000000000..2d9229245bd --- /dev/null +++ b/scripts/spack_packages/packages/py-pydata-sphinx-theme/package.py @@ -0,0 +1,17 @@ +# Copyright 2013-2023 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) + +from spack.package import * + +class PyPydataSphinxTheme(PythonPackage): + """A clean, three-column, Bootstrap-based Sphinx theme by and for the PyData community""" + + homepage = "https://github.com/pydata/pydata-sphinx-theme" + pypi = "pydata-sphinx-theme/pydata_sphinx_theme-0.13.3.tar.gz" + + version("0.13.3", sha256="827f16b065c4fd97e847c11c108bf632b7f2ff53a3bca3272f63f3f3ff782ecc") + + depends_on("python", type=("build", "run")) + depends_on("py-setuptools", type="build") \ No newline at end of file diff --git a/scripts/spack_packages/packages/py-sphinxcontrib-plantuml/package.py b/scripts/spack_packages/packages/py-sphinxcontrib-plantuml/package.py new file mode 100644 index 00000000000..de642a3dec4 --- /dev/null +++ b/scripts/spack_packages/packages/py-sphinxcontrib-plantuml/package.py @@ -0,0 +1,17 @@ +# Copyright 2013-2023 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) + +from spack.package import * + +class PySphinxcontribPlantuml(PythonPackage): + """PlantUML for Sphinx""" + + homepage = "https://github.com/sphinx-contrib/plantuml" + pypi = "sphinxcontrib-plantuml/sphinxcontrib-plantuml-0.26.tar.gz" + + version("0.26", sha256="adb3397d5cb0613632cd3dad7894381422bac24464c393cb050404dd6712b1a7") + + depends_on("python", type=("build", "run")) + depends_on("py-setuptools", type="build") \ No newline at end of file diff --git a/scripts/spack_packages/packages/pygeosx/package.py b/scripts/spack_packages/packages/pygeosx/package.py new file mode 100644 index 00000000000..723ad48c510 --- /dev/null +++ b/scripts/spack_packages/packages/pygeosx/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2023 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) + +from spack import * + +class Pygeosx(BundlePackage): + """This is a set of libraries necessary for the pygeosx ATS environment""" + + version('fakeversion') + + depends_on("py-numpy@1.21.0:1.23.4+blas+lapack") + depends_on('py-mpi4py') + depends_on('py-virtualenv') + depends_on('python@3.10:+shared+pic+tkinter+optimizations') + depends_on("py-scipy") + depends_on("openblas") + depends_on("py-matplotlib") + depends_on("py-sphinx") + depends_on("py-sphinx-argparse") \ No newline at end of file diff --git a/scripts/spack_packages/packages/trilinos/cray_secas.patch b/scripts/spack_packages/packages/trilinos/cray_secas.patch new file mode 100644 index 00000000000..14eb4ad36c0 --- /dev/null +++ b/scripts/spack_packages/packages/trilinos/cray_secas.patch @@ -0,0 +1,26 @@ +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 new file mode 100644 index 00000000000..6da3f4314da --- /dev/null +++ b/scripts/spack_packages/packages/trilinos/fix_clang_errors_12_18_1.patch @@ -0,0 +1,39 @@ +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 new file mode 100644 index 00000000000..a34d0203dc1 --- /dev/null +++ b/scripts/spack_packages/packages/trilinos/package.py @@ -0,0 +1,890 @@ +# 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') + 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') + 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'), + ]) + + 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 00000000000..a37abf7055f --- /dev/null +++ b/scripts/spack_packages/packages/umpire/package.py @@ -0,0 +1,299 @@ +# Copyright 2013-2023 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 + +import llnl.util.tty as tty + +from spack.package import * +from spack.pkg.builtin.camp import hip_repair_cache + + +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("davidbeckingsale") + + # GEOS_EDIT_START + version("2023.06.0", branch="v2023.06.0", submodules=False) + # GEOS_EDIT_END + + + version("develop", branch="develop", submodules=False) + version("main", branch="main", submodules=False) + version("2022.03.1", tag="v2022.03.1", submodules=False) + version("2022.03.0", tag="v2022.03.0", submodules=False) + version("6.0.0", tag="v6.0.0", submodules=True) + version("5.0.1", tag="v5.0.1", submodules=True) + version("5.0.0", tag="v5.0.0", submodules=True) + version("4.1.2", tag="v4.1.2", submodules=True) + version("4.1.1", tag="v4.1.1", submodules=True) + version("4.1.0", tag="v4.1.0", submodules=True) + version("4.0.1", tag="v4.0.1", submodules=True) + version("4.0.0", tag="v4.0.0", submodules=True) + version("3.0.0", tag="v3.0.0", submodules=True) + version("2.1.0", tag="v2.1.0", submodules=True) + version("2.0.0", tag="v2.0.0", submodules=True) + version("1.1.0", tag="v1.1.0", submodules=True) + version("1.0.1", tag="v1.0.1", submodules=True) + version("1.0.0", tag="v1.0.0", submodules=True) + version("0.3.5", tag="v0.3.5", submodules=True) + version("0.3.4", tag="v0.3.4", submodules=True) + version("0.3.3", tag="v0.3.3", submodules=True) + version("0.3.2", tag="v0.3.2", submodules=True) + version("0.3.1", tag="v0.3.1", submodules=True) + version("0.3.0", tag="v0.3.0", submodules=True) + version("0.2.4", tag="v0.2.4", submodules=True) + version("0.2.3", tag="v0.2.3", submodules=True) + version("0.2.2", tag="v0.2.2", submodules=True) + version("0.2.1", tag="v0.2.1", submodules=True) + version("0.2.0", tag="v0.2.0", submodules=True) + version("0.1.4", tag="v0.1.4", submodules=True) + version("0.1.3", tag="v0.1.3", submodules=True) + + # GEOS_EDIT_START + # Unused patches + + #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") + # GEOS_EDIT_END + + # 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:", + ) + + variant("fortran", default=False, description="Build C/Fortran API") + variant("c", default=True, description="Build C API") + 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("deviceconst", default=False, description="Enables support for constant device memory") + variant("examples", default=True, description="Build Umpire Examples") + variant( + "tests", + default="none", + values=("none", "basic", "benchmarks"), + multi=False, + description="Tests to run", + ) + variant("device_alloc", default=True, description="Build Umpire Device Allocator") + + depends_on("cmake@3.8:", type="build") + depends_on("cmake@3.9:", when="+cuda", type="build") + depends_on("cmake@3.14:", when="@2022.03.0:") + + # GEOS_EDIT_START + depends_on("blt@0.5.3:", type="build", when="@2023.06.0:") + # GEOS_EDIT_END + depends_on("blt@0.5.0:", type="build", when="@2022.03.0:") + depends_on("blt@0.4.1", type="build", when="@6.0.0") + depends_on("blt@0.4.0:", type="build", when="@4.1.3:5.0.1") + depends_on("blt@0.3.6:", type="build", when="@:4.1.2") + + depends_on("camp", when="@5.0.0:") + 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("camp@2022.03.2:", when="@2022.03.0:") + # GEOS_EDIT_START + depends_on("camp@2023.06.0:", when="@2023.06.0:") + # GEOS_EDIT_END + depends_on("camp@main", when="@main") + depends_on("camp@main", when="@develop") + depends_on("camp+openmp", when="+openmp") + depends_on("camp~cuda", when="~cuda") + + 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") + conflicts("+device_alloc", when="@:2022.03.0") + + # device allocator exports device code, which requires static libs + # currently only available for cuda. + conflicts("+shared", when="+cuda") + + # https://github.com/LLNL/Umpire/issues/653 + # This range looks weird, but it ensures the concretizer looks at it as a + # range, not as a concrete version, so that it also matches 10.3.* versions. + conflicts("%gcc@10.3.0:10.3", 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}.cmake".format( + hostname, + self._get_sys_type(self.spec), + self.spec.compiler.name, + self.spec.compiler.version, + ) + + def initconfig_compiler_entries(self): + spec = self.spec + entries = super().initconfig_compiler_entries() + + if "+rocm" in spec: + entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) + + option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" + + if "+fortran" in spec and self.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), "+c" in spec)) + + return entries + + def initconfig_hardware_entries(self): + spec = self.spec + entries = super().initconfig_hardware_entries() + + option_prefix = "UMPIRE_" if spec.satisfies("@2022.03.0:") else "" + + if "+cuda" in spec: + entries.append(cmake_cache_option("ENABLE_CUDA", True)) + + if not spec.satisfies("cuda_arch=none"): + cuda_arch = spec.variants["cuda_arch"].value + entries.append(cmake_cache_string("CUDA_ARCH", "sm_{0}".format(cuda_arch[0]))) + entries.append( + cmake_cache_string("CMAKE_CUDA_ARCHITECTURES", "{0}".format(cuda_arch[0])) + ) + flag = "-arch sm_{0}".format(cuda_arch[0]) + entries.append(cmake_cache_string("CMAKE_CUDA_FLAGS", "{0}".format(flag))) + + entries.append( + cmake_cache_option( + "{}ENABLE_DEVICE_CONST".format(option_prefix), spec.satisfies("+deviceconst") + ) + ) + else: + entries.append(cmake_cache_option("ENABLE_CUDA", False)) + + if "+rocm" in spec: + entries.append(cmake_cache_option("ENABLE_HIP", True)) + entries.append(cmake_cache_path("HIP_ROOT_DIR", "{0}".format(spec["hip"].prefix))) + hip_repair_cache(entries, spec) + archs = self.spec.variants["amdgpu_target"].value + if archs != "none": + arch_str = ",".join(archs) + entries.append( + cmake_cache_string("HIP_HIPCC_FLAGS", "--amdgpu-target={0}".format(arch_str)) + ) + entries.append( + cmake_cache_string("CMAKE_HIP_ARCHITECTURES", "{0}".format(arch_str)) + ) + else: + entries.append(cmake_cache_option("ENABLE_HIP", False)) + + 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)) + entries.append(cmake_cache_option("{}ENABLE_NUMA".format(option_prefix), "+numa" in spec)) + # GEOS_EDIT_START + + # The wrong way to initialize OpenMP from spack upstream + # entries.append( + # cmake_cache_option("{}ENABLE_OPENMP".format(option_prefix), "+openmp" in spec) + # ) + entries.append(cmake_cache_option( + "ENABLE_OPENMP", "+openmp" in spec)) + # GEOS_EDIT_END + entries.append(cmake_cache_option("ENABLE_BENCHMARKS", "tests=benchmarks" in spec)) + entries.append( + cmake_cache_option("{}ENABLE_EXAMPLES".format(option_prefix), "+examples" in spec) + ) + entries.append(cmake_cache_option("{}ENABLE_DOCS".format(option_prefix), False)) + entries.append( + cmake_cache_option("UMPIRE_ENABLE_DEVICE_ALLOCATOR", "+device_alloc" in spec) + ) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", "+shared" in spec)) + entries.append(cmake_cache_option("ENABLE_TESTS", "tests=none" not in spec)) + + return entries + + def cmake_args(self): + options = [] + return options + + def test(self): + """Perform stand-alone checks on the installed package.""" + if self.spec.satisfies("@:1") or not os.path.isdir(self.prefix.bin): + tty.info("Skipping: checks not installed in bin for v{0}".format(self.version)) + return + + # Run a subset of examples PROVIDED installed + # tutorials with readily checkable outputs. + checks = { + "malloc": ["99 should be 99"], + "recipe_dynamic_pool_heuristic": ["in the pool", "releas"], + "recipe_no_introspection": ["has allocated", "used"], + "strategy_example": ["Available allocators", "HOST"], + "tut_copy": ["Copied source data"], + "tut_introspection": ["Allocator used is HOST", "size of the allocation"], + "tut_memset": ["Set data from HOST"], + "tut_move": ["Moved source data", "HOST"], + "tut_reallocate": ["Reallocated data"], + "vector_allocator": [""], + } + + for exe in checks: + expected = checks[exe] + reason = "test: checking output from {0}".format(exe) + self.run_test( + exe, + [], + expected, + 0, + installed=False, + purpose=reason, + skip_missing=True, + work_dir=self.prefix.bin, + ) \ No newline at end of file diff --git a/scripts/spack_packages/packages/vtk/package.py b/scripts/spack_packages/packages/vtk/package.py new file mode 100644 index 00000000000..b1a666f82fe --- /dev/null +++ b/scripts/spack_packages/packages/vtk/package.py @@ -0,0 +1,102 @@ +# 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) + +import os +import sys + +from spack import * + + +class Vtk(CMakePackage): + """The Visualization Toolkit (VTK) is an open-source, freely + available software system for 3D computer graphics, image + processing and visualization. """ + + homepage = "http://www.vtk.org" + url = "https://www.vtk.org/files/release/9.0/VTK-9.0.0.tar.gz" + list_url = "http://www.vtk.org/download/" + + maintainers = ['chuckatkins', 'danlipsa'] + + version("9.2.6", sha256="06fc8d49c4e56f498c40fcb38a563ed8d4ec31358d0101e8988f0bb4d539dd12") + version('9.1.0', sha256='8fed42f4f8f1eb8083107b68eaa9ad71da07110161a3116ad807f43e5ca5ce96') + version('9.0.3', sha256='bc3eb9625b2b8dbfecb6052a2ab091fc91405de4333b0ec68f3323815154ed8a') + version('9.0.1', sha256='1b39a5e191c282861e7af4101eaa8585969a2de05f5646c9199a161213a622c7') + version('9.0.0', sha256='15def4e6f84d72f82386617fe595ec124dda3cbd13ea19a0dcd91583197d8715') + version('8.2.0', sha256='34c3dc775261be5e45a8049155f7228b6bd668106c72a3c435d95730d17d57bb') + version('8.1.2', sha256='0995fb36857dd76ccfb8bb07350c214d9f9099e80b1e66b4a8909311f24ff0db') + version('8.1.1', sha256='71a09b4340f0a9c58559fe946dc745ab68a866cf20636a41d97b6046cb736324') + version('8.1.0', sha256='6e269f07b64fb13774f5925161fb4e1f379f4e6a0131c8408c555f6b58ef3cb7') + version('8.0.1', sha256='49107352923dea6de05a7b4c3906aaf98ef39c91ad81c383136e768dcf304069') + version('7.1.0', sha256='5f3ea001204d4f714be972a810a62c0f2277fbb9d8d2f8df39562988ca37497a') + version('7.0.0', sha256='78a990a15ead79cdc752e86b83cfab7dbf5b7ef51ba409db02570dbdd9ec32c3') + version('6.3.0', sha256='92a493354c5fa66bea73b5fc014154af5d9f3f6cee8d20a826f4cd5d4b0e8a5e') + version('6.1.0', sha256='bd7df10a479606d529a8b71f466c44a2bdd11fd534c62ce0aa44fad91883fa34') + + variant('python', default=False, description='Enable Python support') + variant('mpi', default=True, description='Enable MPI support') + + patch('vtkXMLReader-fpe.patch', when='@9.1.0:') + + extends('python', when='+python') + + # Acceptable python versions depend on vtk version + # We need vtk at least 8.0.1 for python@3, + # and at least 9.0 for python@3.8 + depends_on('python@2.7:2.9', when='@:8.0 +python', type=('build', 'run')) + depends_on('python@2.7:3.7.99', when='@8.0.1:8.9 +python', type=('build', 'run')) + depends_on('python@2.7:', when='@9.0: +python', type=('build', 'run')) + + # We need mpi4py if buidling python wrappers and using MPI + depends_on('py-mpi4py', when='+python+mpi', type='run') + + depends_on('mpi', when='+mpi') + + def cmake_args(self): + spec = self.spec + + # yapf: disable + # Added GEOSX Arguments + if '+mpi' in spec: + mpi_args = [ + self.define('CMAKE_C_COMPILER', spec['mpi'].mpicc), + self.define('CMAKE_CXX_COMPILER', spec['mpi'].mpicxx), + self.define('CMAKE_CXX_FLAGS', self.spec.compiler_flags["cxxflags"]), + '-DVTK_USE_MPI=ON', + '-DVTK_MODULE_ENABLE_VTK_IOParallelXML=YES', + '-DVTK_MODULE_ENABLE_VTK_FiltersParallelDIY2=YES' + ] + else: + mpi_args = [ + self.define('CMAKE_C_COMPILER', self.compiler.cc), + self.define('CMAKE_CXX_COMPILER', self.compiler.cxx), + self.define('CMAKE_CXX_FLAGS', self.spec.compiler_flags["cxxflags"]), + '-DVTK_USE_MPI=OFF', + '-DVTK_MODULE_ENABLE_VTK_IOParallelXML=NO', + '-DVTK_MODULE_ENABLE_VTK_FiltersParallelDIY2=NO', + ] + + cmake_args= [ + '-DVTK_GROUP_ENABLE_Imaging=DONT_WANT', + '-DVTK_GROUP_ENABLE_MPI=DONT_WANT', + '-DVTK_GROUP_ENABLE_Qt=DONT_WANT', + '-DVTK_GROUP_ENABLE_Rendering=DONT_WANT', + '-DVTK_GROUP_ENABLE_StandAlone=DONT_WANT', + '-DVTK_GROUP_ENABLE_Views=DONT_WANT', + '-DVTK_GROUP_ENABLE_Web=DONT_WANT', + '-DVTK_BUILD_ALL_MODULES=OFF', + '-DVTK_WRAP_PYTHON=OFF', + '-DVTK_WRAP_JAVA=OFF', + '-DVTK_MODULE_ENABLE_VTK_vtkm=DONT_WANT', + '-DVTK_MODULE_ENABLE_VTK_IOXML=YES', + '-DVTK_MODULE_ENABLE_VTK_IOLegacy=YES', + '-DVTK_BUILD_TESTING=OFF', + '-DVTK_LEGACY_REMOVE=ON' + ] + # yapf: enable + + cmake_args = mpi_args + cmake_args + + return cmake_args diff --git a/scripts/spack_packages/packages/vtk/vtkXMLReader-fpe.patch b/scripts/spack_packages/packages/vtk/vtkXMLReader-fpe.patch new file mode 100644 index 00000000000..c998db19811 --- /dev/null +++ b/scripts/spack_packages/packages/vtk/vtkXMLReader-fpe.patch @@ -0,0 +1,19 @@ +--- a/IO/XML/vtkXMLReader.cxx 2023-02-14 20:03:53.000000000 -0800 ++++ b/IO/XML/vtkXMLReader.cxx.patch 2023-05-12 08:52:36.017274000 -0700 +@@ -53,6 +53,7 @@ + #include + #include + #include ++#include + #include + #include // C++ locale + #include +@@ -1958,7 +1959,7 @@ + if (!this->AbortExecute) + { + // Round progress to nearest 100th. +- float rounded = static_cast(int((progress * 100) + 0.5f)) / 100.f; ++ float const rounded = std::round(progress * 100) * 0.01; + if (this->GetProgress() != rounded) + { + this->UpdateProgress(rounded); \ No newline at end of file diff --git a/scripts/spack_packages/repo.yaml b/scripts/spack_packages/repo.yaml new file mode 100644 index 00000000000..19bb9d851f8 --- /dev/null +++ b/scripts/spack_packages/repo.yaml @@ -0,0 +1,2 @@ +repo: + namespace: geos diff --git a/scripts/test_submodule_updated.sh b/scripts/test_submodule_updated.sh index 1d88fb0c38a..e2668a41f60 100755 --- a/scripts/test_submodule_updated.sh +++ b/scripts/test_submodule_updated.sh @@ -1,7 +1,7 @@ #!/bin/bash # Submodules not checking for -declare -ar exclusion_list=( "blt" "integratedTests" ) +declare -ar exclusion_list=( "blt" "integratedTests" "uberenv" ) echo "Submodules that are excluded from sync test : ${exclusion_list[@]}" # Do not pull large files diff --git a/scripts/uberenv b/scripts/uberenv new file mode 160000 index 00000000000..d0cf52c5894 --- /dev/null +++ b/scripts/uberenv @@ -0,0 +1 @@ +Subproject commit d0cf52c58949eeb5226e7dbee8b6ac4cbea48b0c diff --git a/scripts/uberenv/README.md b/scripts/uberenv/README.md deleted file mode 100644 index 82d682017e2..00000000000 --- a/scripts/uberenv/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# uberenv -Automates using Spack (https://www.spack.io/) to build and deploy software. - -Uberenv is a short python script that helps automate using Spack to build -third-party dependencies for development and to deploy Spack packages. - -Uberenv was released as part of the Conduit (https://github.com/LLNL/conduit/). It is included in-source in several projects, this repo is used to hold the latest reference version. - -For more details, see Uberenv's documention: - -https://uberenv.readthedocs.io - -You can also find details about how it is used in Conduit's documentation: - -https://llnl-conduit.readthedocs.io/en/latest/building.html#building-conduit-and-third-party-dependencies - -Conduit's source repo also serves as an example for uberenv and spack configuration files, etc: - -https://github.com/LLNL/conduit/tree/master/scripts/uberenv diff --git a/scripts/uberenv/gen_spack_env_script.py b/scripts/uberenv/gen_spack_env_script.py deleted file mode 100644 index 742e7367d5d..00000000000 --- a/scripts/uberenv/gen_spack_env_script.py +++ /dev/null @@ -1,131 +0,0 @@ -############################################################################### -# Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. -# -# Produced at the Lawrence Livermore National Laboratory -# -# LLNL-CODE-716457 -# -# All rights reserved. -# -# This file is part of Ascent. -# -# For details, see: http://ascent.readthedocs.io/. -# -# Please also read ascent/LICENSE -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the disclaimer below. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the disclaimer (as noted below) in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of the LLNS/LLNL nor the names of its contributors may -# be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, -# LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################### -import os -import sys -import subprocess - -from os.path import join as pjoin - -# if you have bad luck with spack load, this -# script is for you! -# -# Looks for subdir: spack or uberenv_libs/spack -# queries spack for given package names and -# creates a bash script that adds those to your path -# -# -# usage: -# python gen_spack_env_script.py [spack_pkg_1 spack_pkg_2 ...] -# - - -def sexe(cmd, ret_output=False, echo=True): - """ Helper for executing shell commands. """ - if echo: - print("[exe: {}]".format(cmd)) - if ret_output: - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - res = p.communicate()[0] - res = res.decode('utf8') - return p.returncode, res - else: - return subprocess.call(cmd, shell=True) - - -def spack_exe(spath=None): - if spath is None: - to_try = [pjoin("uberenv_libs", "spack"), "spack"] - for p in to_try: - abs_p = os.path.abspath(p) - print("[looking for spack directory at: {}]".format(abs_p)) - if os.path.isdir(abs_p): - print("[FOUND spack directory at: {}]".format(abs_p)) - return os.path.abspath(pjoin(abs_p, "bin", "spack")) - print("[ERROR: failed to find spack directory!]") - sys.exit(-1) - else: - spack_exe = os.path.abspath(spath, "bin", "spack") - if not os.path.isfile(spack_exec): - print("[ERROR: failed to find spack directory at spath={}]").format(spath) - sys.exit(-1) - return spack_exe - - -def find_pkg(pkg_name): - r, rout = sexe(spack_exe() + " find -p " + pkg_name, ret_output=True) - print(rout) - for l in rout.split("\n"): - print(l) - lstrip = l.strip() - if not lstrip == "" and \ - not lstrip.startswith("==>") and \ - not lstrip.startswith("--"): - return {"name": pkg_name, "path": l.split()[-1]} - print("[ERROR: failed to find package named '{}']".format(pkg_name)) - sys.exit(-1) - - -def path_cmd(pkg): - return ('export PATH={}:$PATH\n'.format((pjoin(pkg["path"], "bin")))) - - -def write_env_script(pkgs): - ofile = open("s_env.sh", "w") - for p in pkgs: - print("[found {} at {}]".format(p["name"], p["path"])) - ofile.write("# {}\n".format(p["name"])) - ofile.write(path_cmd(p)) - print("[created {}]".format(os.path.abspath("s_env.sh"))) - - -def main(): - pkgs = [find_pkg(pkg) for pkg in sys.argv[1:]] - if len(pkgs) > 0: - write_env_script(pkgs) - else: - print("usage: python gen_spack_env_script.py spack_pkg_1 spack_pkg_2 ...") - - -if __name__ == "__main__": - main() diff --git a/scripts/uberenv/project.json b/scripts/uberenv/project.json deleted file mode 100644 index 8c5339c2d8f..00000000000 --- a/scripts/uberenv/project.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "package_name" : "geosx", - "package_version" : "develop", - "package_final_phase" : "hostconfig", - "package_source_dir" : "../..", - "spack_url": "git@github.com:corbett5/spack.git", - "spack_branch": "package/corbett/geosx", - "spack_activate" : {}, - "spack_clean_packages": ["geosx"], - "build_jobs": 100 -} diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml deleted file mode 100644 index d59c746ec41..00000000000 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml +++ /dev/null @@ -1,46 +0,0 @@ -compilers: -- compiler: - spec: clang@10.0.1 - paths: - cc: /usr/tce/packages/clang/clang-ibm-10.0.1-gcc-8.3.1/bin/clang - cxx: /usr/tce/packages/clang/clang-ibm-10.0.1-gcc-8.3.1/bin/clang++ - f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - flags: - cflags: -mcpu=native -mtune=native -Wl,--no-toc-optimize - cxxflags: -mcpu=native -mtune=native -Wl,--no-toc-optimize - operating_system: rhel7 - target: ppc64le - modules: [] - environment: {} - extra_rpaths: [] -- compiler: - spec: clang@11.0.1 - paths: - cc: /usr/tce/packages/clang/clang-ibm-11.0.1/bin/clang - cxx: /usr/tce/packages/clang/clang-ibm-11.0.1/bin/clang++ - f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - flags: - cflags: -mcpu=native -mtune=native - cxxflags: -mcpu=native -mtune=native - operating_system: rhel7 - target: ppc64le - modules: [] - environment: {} - extra_rpaths: [] -- compiler: - spec: gcc@8.3.1 - paths: - cc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gcc - cxx: /usr/tce/packages/gcc/gcc-8.3.1/bin/g++ - f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - flags: - cflags: -mcpu=native -mtune=native - cxxflags: -mcpu=native -mtune=native - operating_system: rhel7 - target: ppc64le - modules: [] - environment: {} - extra_rpaths: [] diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml deleted file mode 100644 index aa204efc586..00000000000 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml +++ /dev/null @@ -1,67 +0,0 @@ -packages: - all: - target: [default] - compiler: [gcc, clang] - providers: - mpi: [spectrum-mpi] - blas: [essl] - lapack: [essl] - - spectrum-mpi: - buildable: False - externals: - - spec: spectrum-mpi@10.3.1.03rtm0 %gcc@8.3.1 - prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-8.3.1/ - - spec: spectrum-mpi@10.3.1.03rtm0 %clang@10.0.1 - prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-ibm-10.0.1-gcc-8.3.1/ - - spec: spectrum-mpi@10.3.1.03rtm0 %clang@11.0.1 - prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-ibm-11.0.1/ - - essl: - buildable: False - externals: - - spec: essl@6.2.1 ~ilp64 threads=openmp +cuda +lapack - prefix: /usr/tcetmp/packages/essl/essl-6.2.1/ - - cuda: - buildable: False - externals: - - spec: cuda@10.1.243 - modules: - - cuda/10.1.243 - - cmake: - buildable: False - externals: - - spec: cmake@3.14.5 - prefix: /usr/tce/packages/cmake/cmake-3.14.5 - - readline: - buildable: False - externals: - - spec: readline@6.2 - prefix: /usr/lib64/ - - zlib: - buildable: False - externals: - - spec: zlib@1.2.7 - prefix: /usr/ - - m4: - buildable: False - externals: - - spec: m4@1.4.16 - prefix: /usr/bin/ - - diffutils: - buildable: False - externals: - - spec: diffutils@3.3 - prefix: /usr/bin/ - - python: - buildable: False - externals: - - spec: python@3.8.2 - prefix: /usr/tce/packages/python/python-3.8.2/ diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9_python/compilers.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9_python/compilers.yaml deleted file mode 100644 index 6de2dd3cd96..00000000000 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9_python/compilers.yaml +++ /dev/null @@ -1,31 +0,0 @@ -compilers: -- compiler: - spec: clang@10.0.1 - paths: - cc: /usr/tce/packages/clang/clang-ibm-10.0.1-gcc-8.3.1/bin/clang - cxx: /usr/tce/packages/clang/clang-ibm-10.0.1-gcc-8.3.1/bin/clang++ - f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - flags: - cflags: -mcpu=native -mtune=native - cxxflags: -mcpu=native -mtune=native - operating_system: rhel7 - target: ppc64le - modules: [] - environment: {} - extra_rpaths: [] -- compiler: - spec: gcc@8.3.1 - paths: - cc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gcc - cxx: /usr/tce/packages/gcc/gcc-8.3.1/bin/g++ - f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - flags: - cflags: -mcpu=native -mtune=native - cxxflags: -mcpu=native -mtune=native - operating_system: rhel7 - target: ppc64le - modules: [] - environment: {} - extra_rpaths: [] diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9_python/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9_python/packages.yaml deleted file mode 100644 index dd9466ffc8f..00000000000 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9_python/packages.yaml +++ /dev/null @@ -1,132 +0,0 @@ -packages: - all: - target: [default] - compiler: [gcc, clang] - providers: - mpi: [spectrum-mpi] - blas: [essl] - lapack: [essl] - - spectrum-mpi: - buildable: False - externals: - - spec: spectrum-mpi@10.3.1.03rtm0 %gcc@8.3.1 - prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-8.3.1/ - - spec: spectrum-mpi@10.3.1.03rtm0 %clang@10.0.1 - prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-ibm-10.0.1-gcc-8.3.1/ - - essl: - buildable: False - externals: - - spec: essl@6.2.1 ~ilp64 threads=openmp +cuda +lapack - prefix: /usr/tcetmp/packages/essl/essl-6.2.1/ - - cuda: - buildable: False - externals: - - spec: cuda@10.1.243 - modules: - - cuda/10.1.243 - - cmake: - buildable: False - externals: - - spec: cmake@3.14.5 - prefix: /usr/tce/packages/cmake/cmake-3.14.5 - - readline: - buildable: False - externals: - - spec: readline@6.2 - prefix: /usr/lib64/ - - zlib: - buildable: False - externals: - - spec: zlib@1.2.7 - prefix: /usr/ - - m4: - buildable: False - externals: - - spec: m4@1.4.16 - prefix: /usr/bin/ - - diffutils: - buildable: False - externals: - - spec: diffutils@3.3 - prefix: /usr/bin/ - - bison: - buildable: False - externals: - - spec: bison@3.0.4 - prefix: /usr/bin/ - - flex: - buildable: False - externals: - - spec: flex@2.5.37 - prefix: /usr/bin/ - - bzip2: - buildable: False - externals: - - spec: bzip2@1.0.6 - prefix: /usr/bin/ - - expat: - buildable: False - externals: - - spec: expat@1.6.0 - prefix: /usr/lib64/ - - gdbm: - buildable: False - externals: - - spec: gdbm@4.0.0 - prefix: /usr/lib64/ - - gettext: - buildable: False - externals: - - spec: gettext@0.19.8.1 - prefix: /usr/bin/ - - openssl: - buildable: False - externals: - - spec: openssl@1.0.2k-fips - prefix: /usr/ - - libffi: - buildable: False - externals: - - spec: libffi@6.0.1 - prefix: /usr/lib64/ - - libuuid: - buildable: False - externals: - - spec: libuuid@1.3.0 - prefix: /usr/lib64/ - - ncurses: - buildable: False - externals: - - spec: ncurses@5.9 - prefix: /usr/lib64/ - - xz: - buildable: False - externals: - - spec: xz@5.2.2 - prefix: /usr/bin/ - - pkg-config: - buildable: False - externals: - - spec: pkg-config@0.27.1 - prefix: /usr/bin/ - diff --git a/scripts/uberenv/spack_configs/config.yaml b/scripts/uberenv/spack_configs/config.yaml deleted file mode 100644 index 2806a4a15af..00000000000 --- a/scripts/uberenv/spack_configs/config.yaml +++ /dev/null @@ -1,78 +0,0 @@ -# ------------------------------------------------------------------------- -# This is the default spack configuration file. -# -# Settings here are versioned with Spack and are intended to provide -# sensible defaults out of the box. Spack maintainers should edit this -# file to keep it current. -# -# Users can override these settings by editing the following files. -# -# Per-spack-instance settings (overrides defaults): -# $SPACK_ROOT/etc/spack/config.yaml -# Per-user settings (overrides default and site settings): -# ~/.spack/config.yaml -# -# See https://spack.readthedocs.io/en/latest/config_yaml.html -# ------------------------------------------------------------------------- -config: - # This is the path to the root of the Spack install tree. - # You can use $spack here to refer to the root of the spack instance. - install_tree: $spack/.. - - # Locations where templates should be found - template_dirs: - - $spack/templates - - # # install directory layout - # install_path_scheme: "${ARCHITECTURE}-${COMPILERNAME}@${COMPILERVER}/${PACKAGE}@${VERSION}" - - # Locations where different types of modules should be installed. - module_roots: - tcl: $spack/share/spack/modules - lmod: $spack/share/spack/lmod - - - # Temporary locations Spack can try to use for builds. - # - # Spack will use the first one it finds that exists and is writable. - # You can use $tempdir to refer to the system default temp directory - # (as returned by tempfile.gettempdir()). - # - # A value of $spack/var/spack/stage indicates that Spack should run - # builds directly inside its install directory without staging them in - # temporary space. - # - # The build stage can be purged with `spack purge --stage`. - build_stage: - - $spack/../builds - - - # Cache directory already downloaded source tarballs and archived - # repositories. This can be purged with `spack purge --downloads`. - source_cache: $spack/var/spack/cache - - - # Cache directory for miscellaneous files, like the package index. - # This can be purged with `spack purge --misc-cache` - misc_cache: .spack/misccache - - - # If this is false, tools like curl that use SSL will not verify - # certifiates. (e.g., curl will use use the -k option) - verify_ssl: true - - - # If set to true, Spack will always check checksums after downloading - # archives. If false, Spack skips the checksum step. - checksum: true - - - # If set to true, `spack install` and friends will NOT clean - # potentially harmful variables from the build environment. Use wisely. - dirty: false - - - # The default number of jobs to use when running `make` in parallel. - # Spack will use up to this many jobs but limits it to the physical core count. - # The default value is 16. - build_jobs: 1000 diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/compilers.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/compilers.yaml deleted file mode 100644 index e8a7b553ef5..00000000000 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/compilers.yaml +++ /dev/null @@ -1,81 +0,0 @@ -compilers: -- compiler: - spec: clang@10.0.0 - paths: - cc: /usr/tce/packages/clang/clang-10.0.0/bin/clang - cxx: /usr/tce/packages/clang/clang-10.0.0/bin/clang++ - f77: /usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran - flags: - cflags: -march=native -mtune=native - cxxflags: -march=native -mtune=native - fflags: -march=native -mtune=native - operating_system: rhel7 - target: x86_64 - modules: [] - environment: {} - extra_rpaths: [] -- compiler: - spec: clang@10.0.1 - paths: - cc: /usr/tce/packages/clang/clang-10.0.1/bin/clang - cxx: /usr/tce/packages/clang/clang-10.0.1/bin/clang++ - f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - flags: - cflags: -march=native -mtune=native - cxxflags: -march=native -mtune=native - fflags: -march=native -mtune=native - operating_system: rhel7 - target: x86_64 - modules: [] - environment: {} - extra_rpaths: [] -- compiler: - spec: gcc@8.1.0 - paths: - cc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gcc - cxx: /usr/tce/packages/gcc/gcc-8.1.0/bin/g++ - f77: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran - flags: - cflags: -march=native -mtune=native - cxxflags: -march=native -mtune=native - fflags: -march=native -mtune=native - operating_system: rhel7 - target: x86_64 - modules: [] - environment: {} - extra_rpaths: [] -- compiler: - spec: gcc@8.3.1 - paths: - cc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gcc - cxx: /usr/tce/packages/gcc/gcc-8.3.1/bin/g++ - f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran - flags: - cflags: -march=native -mtune=native - cxxflags: -march=native -mtune=native - fflags: -march=native -mtune=native - operating_system: rhel7 - target: x86_64 - modules: [] - environment: {} - extra_rpaths: [] -- compiler: - spec: intel@19.1.2 - paths: - cc: /usr/tce/packages/intel/intel-19.1.2/bin/icc - cxx: /usr/tce/packages/intel/intel-19.1.2/bin/icpc - f77: /usr/tce/packages/intel/intel-19.1.2/bin/ifort - fc: /usr/tce/packages/intel/intel-19.1.2/bin/ifort - flags: - cflags: -gcc-name=/usr/tce/packages/gcc/gcc-8.3.1/bin/gcc -march=native -mtune=native - cxxflags: -gxx-name=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ -march=native -mtune=native - fflags: -gcc-name=/usr/tce/packages/gcc/gcc-8.3.1/bin/gcc -march=native -mtune=native - operating_system: rhel7 - target: x86_64 - modules: [] - environment: {} - extra_rpaths: [] diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml deleted file mode 100644 index 234367ee2f0..00000000000 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml +++ /dev/null @@ -1,70 +0,0 @@ -packages: - all: - target: [default] - compiler: [gcc, clang, intel] - providers: - mpi: [mvapich2] - blas: [intel-mkl] - lapack: [intel-mkl] - - mvapich2: - buildable: False - externals: - - spec: mvapich2@2.3 %gcc@8.3.1 - prefix: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.3.1/ - - spec: mvapich2@2.3 %clang@10.0.1 - prefix: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-10.0.1 - - intel-mkl: - buildable: False - externals: - - spec: intel-mkl@2020.0.166 threads=openmp - prefix: /usr/tce/packages/mkl/mkl-2020.0/ - - papi: - buildable: False - externals: - - spec: papi@5.5.1 - prefix: /usr/tce/packages/papi/papi-5.5.1/ - - cmake: - buildable: False - externals: - - spec: cmake@3.14.5 - prefix: /usr/tce/packages/cmake/cmake-3.14.5/ - - readline: - buildable: False - externals: - - spec: readline@6.2 - prefix: /usr/lib64/ - - zlib: - buildable: False - externals: - - spec: zlib@1.2.7 - prefix: /usr/ - - m4: - buildable: False - externals: - - spec: m4@1.4.16 - prefix: /usr/bin - - diffutils: - buildable: False - externals: - - spec: diffutils@3.3 - prefix: /usr/bin - - python: - buildable: False - externals: - - spec: python@3.8.2 - prefix: /usr/tce/packages/python/python-3.8.2/ - - py-sphinx: - buildable: False - externals: - - spec: py-sphinx@1.6.3 - prefix: /collab/usr/gapps/python/build/spack-toss3.2/opt/spack/linux-rhel7-x86_64/gcc-4.9.3/python-2.7.14-7rci3jkmuht2uiwp433afigveuf4ocnu/ diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib_python/compilers.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib_python/compilers.yaml deleted file mode 120000 index af5c3714c79..00000000000 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib_python/compilers.yaml +++ /dev/null @@ -1 +0,0 @@ -../toss_3_x86_64_ib/compilers.yaml \ No newline at end of file diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib_python/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib_python/packages.yaml deleted file mode 100644 index f3d0c55e710..00000000000 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib_python/packages.yaml +++ /dev/null @@ -1,146 +0,0 @@ -packages: - all: - target: [default] - compiler: [gcc, clang, intel] - providers: - mpi: [mvapich2] - blas: [intel-mkl] - lapack: [intel-mkl] - - mvapich2: - buildable: False - externals: - - spec: mvapich2@2.3 %clang@10.0.0 - prefix: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-10.0.0 - - spec: mvapich2@2.3 %clang@10.0.1 - prefix: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-10.0.1 - - spec: mvapich2@2.3 %gcc@8.1.0 - prefix: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.1.0/ - - spec: mvapich2@2.3 %gcc@8.3.1 - prefix: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.3.1/ - - intel-mkl: - buildable: False - externals: - - spec: intel-mkl@2019.0 threads=openmp %clang@10.0.0 - prefix: /usr/tce/packages/mkl/mkl-2019.0/ - - spec: intel-mkl@2020.0.166 threads=openmp %clang@10.0.1 - prefix: /usr/tce/packages/mkl/mkl-2020.0/ - - spec: intel-mkl@2019.0 threads=openmp %gcc@8.1.0 - prefix: /usr/tce/packages/mkl/mkl-2019.0/ - - spec: intel-mkl@2020.0.166 threads=openmp %gcc@8.3.1 - prefix: /usr/tce/packages/mkl/mkl-2020.0/ - - papi: - buildable: False - externals: - - spec: papi@5.5.1 - prefix: /usr/tce/packages/papi/papi-5.5.1/ - - cmake: - buildable: False - externals: - - spec: cmake@3.14.5 - prefix: /usr/tce/packages/cmake/cmake-3.14.5/ - - readline: - buildable: False - externals: - - spec: readline@6.2 - prefix: /usr/lib64/ - - zlib: - buildable: False - externals: - - spec: zlib@1.2.7 - prefix: /usr/ - - m4: - buildable: False - externals: - - spec: m4@1.4.16 - prefix: /usr/bin - - diffutils: - buildable: False - externals: - - spec: diffutils@3.3 - prefix: /usr/bin - - py-sphinx: - buildable: False - externals: - - spec: py-sphinx@1.6.3 - prefix: /collab/usr/gapps/python/build/spack-toss3.2/opt/spack/linux-rhel7-x86_64/gcc-4.9.3/python-2.7.14-7rci3jkmuht2uiwp433afigveuf4ocnu/ - - bison: - buildable: False - externals: - - spec: bison@3.0.4 - prefix: /usr/bin/ - - flex: - buildable: False - externals: - - spec: flex@2.5.37 - prefix: /usr/bin/ - - bzip2: - buildable: False - externals: - - spec: bzip2@1.0.6 - prefix: /usr/bin/ - - expat: - buildable: False - externals: - - spec: expat@1.6.0 - prefix: /usr/lib64/ - - gdbm: - buildable: False - externals: - - spec: gdbm@4.0.0 - prefix: /usr/lib64/ - - gettext: - buildable: False - externals: - - spec: gettext@0.19.8.1 - prefix: /usr/bin/ - - openssl: - buildable: False - externals: - - spec: openssl@1.0.2 - prefix: /usr/ - - libffi: - buildable: False - externals: - - spec: libffi@6.0.1 - prefix: /usr/lib64/ - - libuuid: - buildable: False - externals: - - spec: libuuid@1.3.0 - prefix: /usr/lib64/ - - ncurses: - buildable: False - externals: - - spec: ncurses@5.9 - prefix: /usr/lib64/ - - xz: - buildable: False - externals: - - spec: xz@5.2.2 - prefix: /usr/bin/ - - pkg-config: - buildable: False - externals: - - spec: pkg-config@0.27.1 - prefix: /usr/bin/ diff --git a/scripts/uberenv/uberenv.py b/scripts/uberenv/uberenv.py deleted file mode 100755 index a768fd4b10b..00000000000 --- a/scripts/uberenv/uberenv.py +++ /dev/null @@ -1,773 +0,0 @@ -#!/bin/sh -"exec" "python3" "-u" "-B" "$0" "$@" -############################################################################### -# Copyright (c) 2014-2020, Lawrence Livermore National Security, LLC. -# -# Produced at the Lawrence Livermore National Laboratory -# -# LLNL-CODE-666778 -# -# All rights reserved. -# -# This file is part of Conduit. -# -# For details, see https://lc.llnl.gov/conduit/. -# -# Please also read conduit/LICENSE -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the disclaimer below. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the disclaimer (as noted below) in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of the LLNS/LLNL nor the names of its contributors may -# be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, -# LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################### -""" - file: uberenv.py - - description: automates using spack to install a project. - -""" - -import os -import sys -import subprocess -import shutil -import socket -import platform -import json -import datetime -import glob -import re - -from optparse import OptionParser - -from os import environ as env -from os.path import join as pjoin - - -def sexe(cmd, ret_output=False, echo=False): - """ Helper for executing shell commands. """ - if echo: - print("[exe: {}]".format(cmd)) - if ret_output: - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - out = p.communicate()[0] - out = out.decode('utf8') - return p.returncode, out - else: - return subprocess.call(cmd, shell=True) - - -def parse_args(): - "Parses args from command line" - parser = OptionParser() - parser.add_option("--install", - action="store_true", - dest="install", - default=False, - help="Install `package_name`, not just its dependencies.") - - # where to install - parser.add_option("--prefix", dest="prefix", default="uberenv_libs", help="destination directory") - - # what compiler to use - parser.add_option("--spec", dest="spec", default=None, help="spack compiler spec") - - # optional location of spack mirror - parser.add_option("--mirror", dest="mirror", default=None, help="spack mirror directory") - - # flag to create mirror - parser.add_option("--create-mirror", - action="store_true", - dest="create_mirror", - default=False, - help="Create spack mirror") - - # optional location of spack upstream - parser.add_option("--upstream", dest="upstream", default=None, help="add an external spack instance as upstream") - - # this option allows a user to explicitly to select a - # group of spack settings files (compilers.yaml , packages.yaml) - parser.add_option("--spack-config-dir", - dest="spack_config_dir", - default=None, - help="dir with spack settings files (compilers.yaml, packages.yaml, etc)") - - # overrides package_name - parser.add_option("--package-name", dest="package_name", default=None, help="override the default package name") - - # controls after which package phase spack should stop - parser.add_option("--package-final-phase", - dest="package_final_phase", - default=None, - help="override the default phase after which spack should stop") - - # controls source_dir spack should use to build the package - parser.add_option("--package-source-dir", - dest="package_source_dir", - default=None, - help="override the default source dir spack should use") - - # a file that holds settings for a specific project - # using uberenv.py - parser.add_option("--project-json", - dest="project_json", - default=pjoin(uberenv_script_dir(), "project.json"), - help="uberenv project settings json file") - - # flag to use insecure curl + git - parser.add_option("-k", action="store_true", dest="ignore_ssl_errors", default=False, help="Ignore SSL Errors") - - # option to force a spack pull - parser.add_option("--pull", - action="store_true", - dest="spack_pull", - default=False, - help="Pull if spack repo already exists") - - # option to force for clean of packages specified to - # be cleaned in the project.json - parser.add_option("--clean", - action="store_true", - dest="spack_clean", - default=False, - help="Force uninstall of packages specified in project.json") - - # option to tell spack to run tests - parser.add_option("--run_tests", - action="store_true", - dest="run_tests", - default=False, - help="Invoke build tests during spack install") - - # option to init osx sdk env flags - parser.add_option("--macos-sdk-env-setup", - action="store_true", - dest="macos_sdk_env_setup", - default=False, - help="Set several env vars to select OSX SDK settings." - "This was necessary for older versions of macOS " - " but can cause issues with macOS versions >= 10.13. " - " so it is disabled by default.") - - ############### - # parse args - ############### - opts, extras = parser.parse_args() - # we want a dict b/c the values could - # be passed without using optparse - opts = vars(opts) - if not opts["spack_config_dir"] is None: - opts["spack_config_dir"] = os.path.abspath(opts["spack_config_dir"]) - if not os.path.isdir(opts["spack_config_dir"]): - print("[ERROR: invalid spack config dir: {} ]".format(opts["spack_config_dir"])) - sys.exit(-1) - # if rel path is given for the mirror, we need to evaluate here -- before any - # chdirs to avoid confusion related to what it is relative to. - # (it should be relative to where uberenv is run from, so it matches what you expect - # from shell completion, etc) - if not opts["mirror"] is None: - if not opts["mirror"].startswith("http") and not os.path.isabs(opts["mirror"]): - opts["mirror"] = os.path.abspath(opts["mirror"]) - return opts, extras - - -def uberenv_script_dir(): - # returns the directory of the uberenv.py script - return os.path.dirname(os.path.abspath(__file__)) - - -def load_json_file(json_file): - # reads json file - return json.load(open(json_file)) - - -def is_darwin(): - return "darwin" in platform.system().lower() - - -def is_windows(): - return "windows" in platform.system().lower() - - -class UberEnv(): - """ Base class for package manager """ - - def __init__(self, opts, extra_opts): - self.opts = opts - self.extra_opts = extra_opts - - # load project settings - self.project_opts = load_json_file(opts["project_json"]) - print("[uberenv project settings: {}]".format(str(self.project_opts))) - print("[uberenv options: {}]".format(str(self.opts))) - - def setup_paths_and_dirs(self): - self.uberenv_path = os.path.dirname(os.path.realpath(__file__)) - - def set_from_args_or_json(self, setting): - try: - setting_value = self.project_opts[setting] - except (KeyError): - print("ERROR: {} must at least be defined in project.json".format(setting)) - raise - else: - if self.opts[setting]: - setting_value = self.opts[setting] - return setting_value - - def set_from_json(self, setting): - try: - setting_value = self.project_opts[setting] - except (KeyError): - print("ERROR: {} must at least be defined in project.json".format(setting)) - raise - return setting_value - - def detect_platform(self): - # find supported sets of compilers.yaml, packages,yaml - res = None - if is_darwin(): - res = "darwin" - elif "SYS_TYPE" in os.environ.keys(): - sys_type = os.environ["SYS_TYPE"].lower() - res = sys_type - return res - - -class SpackEnv(UberEnv): - """ Helper to clone spack and install libraries on MacOS an Linux """ - - def __init__(self, opts, extra_opts): - UberEnv.__init__(self, opts, extra_opts) - - self.pkg_name = self.set_from_args_or_json("package_name") - self.pkg_version = self.set_from_json("package_version") - self.pkg_final_phase = self.set_from_args_or_json("package_final_phase") - self.pkg_src_dir = self.set_from_args_or_json("package_source_dir") - - self.spec_hash = "" - self.use_install = False - - # Some additional setup for macos - if is_darwin(): - if opts["macos_sdk_env_setup"]: - # setup osx deployment target and sdk settings - setup_osx_sdk_env_vars() - else: - print("[skipping MACOSX env var setup]") - - # setup default spec - if opts["spec"] is None: - if is_darwin(): - opts["spec"] = "%clang" - else: - opts["spec"] = "%gcc" - self.opts["spec"] = "@{}{}".format(self.pkg_version, opts["spec"]) - elif not opts["spec"].startswith("@"): - self.opts["spec"] = "@{}{}".format(self.pkg_version, opts["spec"]) - else: - self.opts["spec"] = "{}".format(opts["spec"]) - - print("[spack spec: {}]".format(self.opts["spec"])) - - def setup_paths_and_dirs(self): - # get the current working path, and the glob used to identify the - # package files we want to hot-copy to spack - - UberEnv.setup_paths_and_dirs(self) - - self.pkgs = pjoin(self.uberenv_path, "packages", "*") - - # setup destination paths - self.dest_dir = os.path.abspath(self.opts["prefix"]) - self.dest_spack = pjoin(self.dest_dir, "spack") - print("[installing to: {0}]".format(self.dest_dir)) - - # print a warning if the dest path already exists - if not os.path.isdir(self.dest_dir): - os.mkdir(self.dest_dir) - else: - print("[info: destination '{}' already exists]".format(self.dest_dir)) - - if os.path.isdir(self.dest_spack): - print("[info: destination '{}' already exists]".format(self.dest_spack)) - - self.pkg_src_dir = os.path.join(self.uberenv_path, self.pkg_src_dir) - if not os.path.isdir(self.pkg_src_dir): - print("[ERROR: package_source_dir '{}' does not exist]".format(self.pkg_src_dir)) - sys.exit(-1) - - def find_spack_pkg_path_from_hash(self, pkg_name, pkg_hash): - res, out = sexe("spack/bin/spack find -p /{}".format(pkg_hash), ret_output=True) - for l in out.split("\n"): - if l.startswith(pkg_name): - return {"name": pkg_name, "path": l.split()[-1]} - print("[ERROR: failed to find package named '{}']".format(pkg_name)) - sys.exit(-1) - - def find_spack_pkg_path(self, pkg_name, spec=""): - res, out = sexe("spack/bin/spack find -p " + pkg_name + spec, ret_output=True) - for l in out.split("\n"): - # TODO: at least print a warning when several choices exist. This will - # pick the first in the list. - if l.startswith(pkg_name): - return {"name": pkg_name, "path": l.split()[-1]} - print("[ERROR: failed to find package named '{}']".format(pkg_name)) - sys.exit(-1) - - # Extract the first line of the full spec - def read_spack_full_spec(self, pkg_name, spec): - res, out = sexe("spack/bin/spack spec " + pkg_name + " " + spec, ret_output=True) - for l in out.split("\n"): - if l.startswith(pkg_name) and l.count("@") > 0 and l.count("arch=") > 0: - return l.strip() - - def clone_repo(self): - if not os.path.isdir(self.dest_spack): - - # compose clone command for the dest path, spack url and branch - print("[info: cloning spack develop branch from github]") - - os.chdir(self.dest_dir) - - clone_opts = ("-c http.sslVerify=false " if self.opts["ignore_ssl_errors"] else "") - - spack_url = self.project_opts.get("spack_url", "https://github.com/spack/spack.git") - spack_branch = self.project_opts.get("spack_branch", "develop") - - clone_cmd = "git {0} clone -b {1} {2}".format(clone_opts, spack_branch, spack_url) - sexe(clone_cmd, echo=True) - - if "spack_commit" in self.project_opts: - # optionally, check out a specific commit - os.chdir(pjoin(self.dest_dir, "spack")) - sha1 = self.project_opts["spack_commit"] - res, current_sha1 = sexe("git log -1 --pretty=%H", ret_output=True) - if sha1 != current_sha1: - print("[info: using spack commit {}]".format(sha1)) - sexe("git stash", echo=True) - sexe("git fetch origin {0}".format(sha1), echo=True) - sexe("git checkout {0}".format(sha1), echo=True) - - if self.opts["spack_pull"]: - # do a pull to make sure we have the latest - os.chdir(pjoin(self.dest_dir, "spack")) - sexe("git stash", echo=True) - sexe("git pull", echo=True) - - def config_dir(self): - """ path to compilers.yaml, which we will use for spack's compiler setup""" - spack_config_dir = self.opts["spack_config_dir"] - if spack_config_dir is None: - uberenv_plat = self.detect_platform() - if not uberenv_plat is None: - spack_config_dir = os.path.abspath(pjoin(self.uberenv_path, "spack_configs", uberenv_plat)) - return spack_config_dir - - def disable_spack_config_scopes(self, spack_dir): - # disables all config scopes except "defaults", which we will - # force our settings into - spack_lib_config = pjoin(spack_dir, "lib", "spack", "spack", "config.py") - print("[disabling config scope (except defaults) in: {}]".format(spack_lib_config)) - cfg_script = open(spack_lib_config).read() - for cfg_scope_stmt in [ - "('system', os.path.join(spack.paths.system_etc_path, 'spack')),", - "('site', os.path.join(spack.paths.etc_path, 'spack')),", "('user', spack.paths.user_config_path)" - ]: - cfg_script = cfg_script.replace(cfg_scope_stmt, "#DISABLED BY UBERENV: " + cfg_scope_stmt) - open(spack_lib_config, "w").write(cfg_script) - - def patch(self): - - cfg_dir = self.config_dir() - spack_dir = self.dest_spack - - # force spack to use only "defaults" config scope - self.disable_spack_config_scopes(spack_dir) - spack_etc_defaults_dir = pjoin(spack_dir, "etc", "spack", "defaults") - - # copy in "defaults" config.yaml - config_yaml = os.path.abspath(pjoin(self.uberenv_path, "spack_configs", "config.yaml")) - sexe("cp {} {}/".format(config_yaml, spack_etc_defaults_dir), echo=True) - - # copy in other settings per platform - if not cfg_dir is None: - print("[copying uberenv compiler and packages settings from {0}]".format(cfg_dir)) - - config_yaml = pjoin(cfg_dir, "config.yaml") - compilers_yaml = pjoin(cfg_dir, "compilers.yaml") - packages_yaml = pjoin(cfg_dir, "packages.yaml") - - if os.path.isfile(config_yaml): - sexe("cp {} {}/".format(config_yaml, spack_etc_defaults_dir), echo=True) - - if os.path.isfile(compilers_yaml): - sexe("cp {} {}/".format(compilers_yaml, spack_etc_defaults_dir), echo=True) - - if os.path.isfile(packages_yaml): - sexe("cp {} {}/".format(packages_yaml, spack_etc_defaults_dir), echo=True) - else: - # let spack try to auto find compilers - sexe("spack/bin/spack compiler find", echo=True) - - # hot-copy our packages into spack - if self.pkgs: - dest_spack_pkgs = pjoin(spack_dir, "var", "spack", "repos", "builtin", "packages") - print("[copying patched packages from {0}]".format(self.pkgs)) - sexe("cp -Rf {} {}".format(self.pkgs, dest_spack_pkgs)) - - def clean_build(self): - # clean out any temporary spack build stages - cln_cmd = "spack/bin/spack clean " - res = sexe(cln_cmd, echo=True) - - # clean out any spack cached stuff - cln_cmd = "spack/bin/spack clean --all" - res = sexe(cln_cmd, echo=True) - - # check if we need to force uninstall of selected packages - if self.opts["spack_clean"]: - if self.project_opts.has_key("spack_clean_packages"): - for cln_pkg in self.project_opts["spack_clean_packages"]: - if not self.find_spack_pkg_path(cln_pkg) is None: - unist_cmd = "spack/bin/spack uninstall -f -y --all --dependents " + cln_pkg - res = sexe(unist_cmd, echo=True) - - def show_info(self): - # prints install status and 32 characters hash - options = "--install-status --very-long" - spec_cmd = "spack/bin/spack spec {0} {1}{2}".format(options, self.pkg_name, self.opts["spec"]) - - res, out = sexe(spec_cmd, ret_output=True, echo=True) - print(out) - - #Check if spec is already installed - for line in out.split("\n"): - # Example of matching line: ("status" "hash" "package"...) - # [+] hf3cubkgl74ryc3qwen73kl4yfh2ijgd serac@develop%clang@10.0.0-apple~debug~devtools~glvis arch=darwin-mojave-x86_64 - if re.match(r"^(\[\+\]| - ) [a-z0-9]{32} " + re.escape(self.pkg_name), line): - self.spec_hash = line.split(" ")[1] - # if spec already installed - if line.startswith("[+]"): - pkg_path = self.find_spack_pkg_path_from_hash(self.pkg_name, self.spec_hash) - install_path = pkg_path["path"] - # testing that the path exists is mandatory until Spack team fixes - # https://github.com/spack/spack/issues/16329 - if os.path.isdir(install_path): - print("[Warning: {} {} has already been installed in {}]".format( - self.pkg_name, self.opts["spec"], install_path)) - print("[Warning: Uberenv will proceed using this directory]".format(self.pkg_name)) - self.use_install = True - - return res - - def install(self): - # use the uberenv package to trigger the right builds - # and build an host-config.cmake file - - if not self.use_install: - install_cmd = "spack/bin/spack " - if self.opts["ignore_ssl_errors"]: - install_cmd += "-k " - if not self.opts["install"]: - install_cmd += "dev-build --quiet -d {} ".format(self.pkg_src_dir) - if self.pkg_final_phase: - install_cmd += "-u {} ".format(self.pkg_final_phase) - else: - install_cmd += "install " - if self.opts["run_tests"]: - install_cmd += "--test=root " - install_cmd += self.pkg_name + self.opts["spec"] - res = sexe(install_cmd, echo=True) - - if res != 0: - print("[ERROR: failure of spack install/dev-build]") - return res - - full_spec = self.read_spack_full_spec(self.pkg_name, self.opts["spec"]) - if "spack_activate" in self.project_opts: - print("[activating dependent packages]") - # get the full spack spec for our project - pkg_names = self.project_opts["spack_activate"].keys() - for pkg_name in pkg_names: - pkg_spec_requirements = self.project_opts["spack_activate"][pkg_name] - activate = True - for req in pkg_spec_requirements: - if req not in full_spec: - activate = False - break - if activate: - activate_cmd = "spack/bin/spack activate " + pkg_name - sexe(activate_cmd, echo=True) - # note: this assumes package extends python when +python - # this may fail general cases - if self.opts["install"] and "+python" in full_spec: - activate_cmd = "spack/bin/spack activate /" + self.spec_hash - sexe(activate_cmd, echo=True) - # if user opt'd for an install, we want to symlink the final - # install to an easy place: - if self.opts["install"] or self.use_install: - pkg_path = self.find_spack_pkg_path_from_hash(self.pkg_name, self.spec_hash) - if self.pkg_name != pkg_path["name"]: - print("[ERROR: Could not find install of {}]".format(self.pkg_name)) - return -1 - else: - # Symlink host-config file - hc_glob = glob.glob(pjoin(pkg_path["path"], "*.cmake")) - if len(hc_glob) > 0: - hc_path = hc_glob[0] - hc_fname = os.path.split(hc_path)[1] - if os.path.islink(hc_fname): - os.unlink(hc_fname) - elif os.path.isfile(hc_fname): - sexe("rm -f {}".format(hc_fname)) - print("[symlinking host config file to {}]".format(pjoin(self.dest_dir, hc_fname))) - os.symlink(hc_path, hc_fname) - - # Symlink install directory - if self.opts["install"]: - pkg_lnk_dir = "{}-install".format(self.pkg_name) - if os.path.islink(pkg_lnk_dir): - os.unlink(pkg_lnk_dir) - print("") - print("[symlinking install to {}]".format(pjoin(self.dest_dir, pkg_lnk_dir))) - os.symlink(pkg_path["path"], os.path.abspath(pkg_lnk_dir)) - print("") - print("[install complete!]") - # otherwise we are in the "only dependencies" case and the host-config - # file has to be copied from the do-be-deleted spack-build dir. - else: - pattern = "*{}.cmake".format(self.pkg_name) - build_dir = pjoin(self.pkg_src_dir, "spack-build") - hc_glob = glob.glob(pjoin(build_dir, pattern)) - if len(hc_glob) > 0: - hc_path = hc_glob[0] - hc_fname = os.path.split(hc_path)[1] - if os.path.islink(hc_fname): - os.unlink(hc_fname) - print("[copying host config file to {}]".format(pjoin(self.dest_dir, hc_fname))) - sexe("cp {} {}".format(hc_path, hc_fname)) - print("[removing project build directory {}]".format(pjoin(build_dir))) - sexe("rm -rf {}".format(build_dir)) - - def get_mirror_path(self): - mirror_path = self.opts["mirror"] - if not mirror_path: - print("[--create-mirror requires a mirror directory]") - sys.exit(-1) - return mirror_path - - def create_mirror(self): - """ - Creates a spack mirror for pkg_name at mirror_path. - """ - - mirror_path = self.get_mirror_path() - - mirror_cmd = "spack/bin/spack " - if self.opts["ignore_ssl_errors"]: - mirror_cmd += "-k " - mirror_cmd += "mirror create -d {} --dependencies {}{}".format(mirror_path, self.pkg_name, self.opts["spec"]) - return sexe(mirror_cmd, echo=True) - - def find_spack_mirror(self, mirror_name): - """ - Returns the path of a defaults scoped spack mirror with the - given name, or None if no mirror exists. - """ - res, out = sexe("spack/bin/spack mirror list", ret_output=True) - mirror_path = None - for mirror in out.split('\n'): - if mirror: - parts = mirror.split() - if parts[0] == mirror_name: - mirror_path = parts[1] - return mirror_path - - def use_mirror(self): - """ - Configures spack to use mirror at a given path. - """ - mirror_name = self.pkg_name - mirror_path = self.get_mirror_path() - existing_mirror_path = self.find_spack_mirror(mirror_name) - - if existing_mirror_path and mirror_path != existing_mirror_path: - # Existing mirror has different URL, error out - print("[removing existing spack mirror `{}` @ {}]".format(mirror_name, existing_mirror_path)) - # - # Note: In this case, spack says it removes the mirror, but we still - # get errors when we try to add a new one, sounds like a bug - # - sexe("spack/bin/spack mirror remove --scope=defaults {} ".format(mirror_name), echo=True) - existing_mirror_path = None - if not existing_mirror_path: - # Add if not already there - sexe("spack/bin/spack mirror add --scope=defaults {} {}".format(mirror_name, mirror_path), echo=True) - print("[using mirror {}]".format(mirror_path)) - - def find_spack_upstream(self, upstream_name): - """ - Returns the path of a defaults scoped spack upstream with the - given name, or None if no upstream exists. - """ - upstream_path = None - - res, out = sexe('spack/bin/spack config get upstreams', ret_output=True) - if (not out) and ("upstreams:" in out): - out = out.replace(' ', '') - out = out.replace('install_tree:', '') - out = out.replace(':', '') - out = out.splitlines() - out = out[1:] - upstreams = dict(zip(out[::2], out[1::2])) - - for name in upstreams.keys(): - if name == upstream_name: - upstream_path = upstreams[name] - - return upstream_path - - def use_spack_upstream(self): - """ - Configures spack to use upstream at a given path. - """ - upstream_path = self.opts["upstream"] - if not upstream_path: - print("[--create-upstream requires a upstream directory]") - sys.exit(-1) - upstream_path = os.path.abspath(upstream_path) - upstream_name = self.pkg_name - existing_upstream_path = self.find_spack_upstream(upstream_name) - if (not existing_upstream_path) or (upstream_path != os.path.abspath(existing_upstream_path)): - # Existing upstream has different URL, error out - print("[removing existing spack upstream configuration file]") - sexe("rm spack/etc/spack/defaults/upstreams.yaml") - with open('spack/etc/spack/defaults/upstreams.yaml', 'w+') as upstreams_cfg_file: - upstreams_cfg_file.write("upstreams:\n") - upstreams_cfg_file.write(" {}:\n".format(upstream_name)) - upstreams_cfg_file.write(" install_tree: {}\n".format(upstream_path)) - - -def find_osx_sdks(): - """ - Finds installed osx sdks, returns dict mapping version to file system path - """ - res = {} - sdks = glob.glob("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk") - for sdk in sdks: - sdk_base = os.path.split(sdk)[1] - ver = sdk_base[len("MacOSX"):sdk_base.rfind(".")] - res[ver] = sdk - return res - - -def setup_osx_sdk_env_vars(): - """ - Finds installed osx sdks, returns dict mapping version to file system path - """ - # find current osx version (10.11.6) - dep_tgt = platform.mac_ver()[0] - # sdk file names use short version (ex: 10.11) - dep_tgt_short = dep_tgt[:dep_tgt.rfind(".")] - # find installed sdks, ideally we want the sdk that matches the current os - sdk_root = None - sdks = find_osx_sdks() - if dep_tgt_short in sdks.keys(): - # matches our osx, use this one - sdk_root = sdks[dep_tgt_short] - elif len(sdks) > 0: - # for now, choose first one: - dep_tgt = sdks.keys()[0] - sdk_root = sdks[dep_tgt] - else: - # no valid sdks, error out - print( - "[ERROR: Could not find OSX SDK @ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/]" - ) - sys.exit(-1) - - env["MACOSX_DEPLOYMENT_TARGET"] = dep_tgt - env["SDKROOT"] = sdk_root - print("[setting MACOSX_DEPLOYMENT_TARGET to {}]".format(env["MACOSX_DEPLOYMENT_TARGET"])) - print("[setting SDKROOT to {}]".format(env["SDKROOT"])) - - -def main(): - """ - Clones and runs a package manager to setup third_party libs. - Also creates a host-config.cmake file that can be used by our project. - """ - - # parse args from command line - opts, extra_opts = parse_args() - - # Initialize the environment - env = SpackEnv(opts, extra_opts) - - # Setup the necessary paths and directories - env.setup_paths_and_dirs() - - # Clone the package manager - env.clone_repo() - - os.chdir(env.dest_dir) - - # Patch the package manager, as necessary - env.patch() - - # Clean the build - env.clean_build() - - # Show the spec for what will be built - env.show_info() - - ########################################################## - # we now have an instance of spack configured how we - # need it to build our tpls at this point there are two - # possible next steps: - # - # *) create a mirror of the packages - # OR - # *) build - # - ########################################################## - if opts["create_mirror"]: - return env.create_mirror() - else: - if not opts["mirror"] is None: - env.use_mirror() - - if not opts["upstream"] is None: - env.use_spack_upstream() - - res = env.install() - - return res - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/src/cmake/thirdparty/SetupGeosxThirdParty.cmake b/src/cmake/thirdparty/SetupGeosxThirdParty.cmake index af7217eed92..e6ce967a316 100644 --- a/src/cmake/thirdparty/SetupGeosxThirdParty.cmake +++ b/src/cmake/thirdparty/SetupGeosxThirdParty.cmake @@ -2,7 +2,7 @@ # 3rd Party Dependencies #################################### -macro(find_and_register) +macro(find_and_import) set(singleValueArgs NAME HEADER) set(multiValueArgs INCLUDE_DIRECTORIES LIBRARY_DIRECTORIES @@ -15,23 +15,23 @@ macro(find_and_register) "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) if(NOT DEFINED arg_NAME) - message(FATAL_ERROR "The find_and_register required parameter NAME specifies the name of the library to register.") + message(FATAL_ERROR "The find_and_import required parameter NAME specifies the name of the library to import.") endif() if(NOT DEFINED arg_INCLUDE_DIRECTORIES) - message(FATAL_ERROR "The find_and_register required parameter INCLUDE_DIRECTORIES specifies the directories to search for the given header.") + message(FATAL_ERROR "The find_and_import required parameter INCLUDE_DIRECTORIES specifies the directories to search for the given header.") endif() if(NOT DEFINED arg_LIBRARY_DIRECTORIES) - message(FATAL_ERROR "The find_and_register required parameter LIBRARY_DIRECTORIES specifies the directories to search for the given libraries.") + message(FATAL_ERROR "The find_and_import required parameter LIBRARY_DIRECTORIES specifies the directories to search for the given libraries.") endif() if(NOT DEFINED arg_HEADER) - message(FATAL_ERROR "The find_and_register required parameter HEADER specifies the header to search for.") + message(FATAL_ERROR "The find_and_import required parameter HEADER specifies the header to search for.") endif() if(NOT DEFINED arg_LIBRARIES) - message(FATAL_ERROR "The find_and_register required parameter LIBRARIES specifies the libraries to search for.") + message(FATAL_ERROR "The find_and_import required parameter LIBRARIES specifies the libraries to search for.") endif() find_path(${arg_NAME}_INCLUDE_DIR ${arg_HEADER} @@ -51,13 +51,13 @@ macro(find_and_register) PATHS ${arg_LIBRARY_DIRECTORIES} REQUIRED ON) - blt_register_library(NAME ${arg_NAME} + blt_import_library(NAME ${arg_NAME} INCLUDES ${${arg_NAME}_INCLUDE_DIR} LIBRARIES ${${arg_NAME}_LIBRARIES} ${arg_EXTRA_LIBRARIES} TREAT_INCLUDES_AS_SYSTEM ON DEPENDS_ON ${arg_DEPENDS}) -endmacro(find_and_register) +endmacro(find_and_import) macro(extract_version_from_header) @@ -224,7 +224,7 @@ endif() if(DEFINED SILO_DIR AND ENABLE_SILO) message(STATUS "SILO_DIR = ${SILO_DIR}") - find_and_register(NAME silo + find_and_import(NAME silo INCLUDE_DIRECTORIES ${SILO_DIR}/include LIBRARY_DIRECTORIES ${SILO_DIR}/lib HEADER silo.h @@ -244,14 +244,20 @@ endif() if(DEFINED PUGIXML_DIR) message(STATUS "PUGIXML_DIR = ${PUGIXML_DIR}") + set(ENABLE_PUGIXML ON CACHE BOOL "") + find_package(pugixml REQUIRED PATHS ${PUGIXML_DIR} NO_DEFAULT_PATH) message( " ----> pugixml_VERSION = ${pugixml_VERSION}") - set(ENABLE_PUGIXML ON CACHE BOOL "") - set(thirdPartyLibs ${thirdPartyLibs} pugixml ) + if(TARGET pugixml::pugixml) + set(thirdPartyLibs ${thirdPartyLibs} pugixml::pugixml) + endif() + if(TARGET pugixml) + set(thirdPartyLibs ${thirdPartyLibs} pugixml) + endif() else() message(FATAL_ERROR "GEOSX requires pugixml, set PUGIXML_DIR to the pugixml installation directory.") endif() @@ -422,7 +428,7 @@ endif() if(DEFINED MATHPRESSO_DIR) message(STATUS "MATHPRESSO_DIR = ${MATHPRESSO_DIR}") - find_and_register(NAME mathpresso + find_and_import(NAME mathpresso INCLUDE_DIRECTORIES ${MATHPRESSO_DIR}/include LIBRARY_DIRECTORIES ${MATHPRESSO_DIR}/lib HEADER mathpresso/mathpresso.h @@ -445,7 +451,7 @@ endif() if(DEFINED METIS_DIR) message(STATUS "METIS_DIR = ${METIS_DIR}") - find_and_register(NAME metis + find_and_import(NAME metis INCLUDE_DIRECTORIES ${METIS_DIR}/include LIBRARY_DIRECTORIES ${METIS_DIR}/lib HEADER metis.h @@ -475,7 +481,7 @@ endif() if(DEFINED PARMETIS_DIR) message(STATUS "PARMETIS_DIR = ${PARMETIS_DIR}") - find_and_register(NAME parmetis + find_and_import(NAME parmetis INCLUDE_DIRECTORIES ${PARMETIS_DIR}/include LIBRARY_DIRECTORIES ${PARMETIS_DIR}/lib HEADER parmetis.h @@ -505,13 +511,13 @@ endif() if(DEFINED SCOTCH_DIR) message(STATUS "SCOTCH_DIR = ${SCOTCH_DIR}") - find_and_register(NAME scotch + find_and_import(NAME scotch INCLUDE_DIRECTORIES ${SCOTCH_DIR}/include LIBRARY_DIRECTORIES ${SCOTCH_DIR}/lib HEADER scotch.h LIBRARIES scotch scotcherr ) - find_and_register(NAME ptscotch + find_and_import(NAME ptscotch INCLUDE_DIRECTORIES ${SCOTCH_DIR}/include LIBRARY_DIRECTORIES ${SCOTCH_DIR}/lib DEPENDS scotch @@ -541,7 +547,7 @@ endif() if(DEFINED SUPERLU_DIST_DIR) message(STATUS "SUPERLU_DIST_DIR = ${SUPERLU_DIST_DIR}") - find_and_register(NAME superlu_dist + find_and_import(NAME superlu_dist INCLUDE_DIRECTORIES ${SUPERLU_DIST_DIR}/include LIBRARY_DIRECTORIES ${SUPERLU_DIST_DIR}/lib PATHS ${SUPERLU_DIST_DIR}/lib64 HEADER superlu_defs.h @@ -572,7 +578,7 @@ endif() if(DEFINED SUITESPARSE_DIR) message(STATUS "SUITESPARSE_DIR = ${SUITESPARSE_DIR}") - find_and_register(NAME suitesparse + find_and_import(NAME suitesparse INCLUDE_DIRECTORIES ${SUITESPARSE_DIR}/include LIBRARY_DIRECTORIES ${SUITESPARSE_DIR}/lib ${SUITESPARSE_DIR}/lib64 HEADER umfpack.h @@ -616,7 +622,7 @@ if(DEFINED HYPRE_DIR AND ENABLE_HYPRE) set( HYPRE_DEPENDS ${HYPRE_DEPENDS} roc::rocblas roc::rocsparse roc::rocsolver roc::rocrand ) endif( ) - find_and_register(NAME hypre + find_and_import(NAME hypre INCLUDE_DIRECTORIES ${HYPRE_DIR}/include LIBRARY_DIRECTORIES ${HYPRE_DIR}/lib HEADER HYPRE.h @@ -711,7 +717,7 @@ if(DEFINED PETSC_DIR AND ENABLE_PETSC) set( PETSC_DEPENDS ${PETSC_DEPENDS} superlu_dist ) endif() - find_and_register(NAME petsc + find_and_import(NAME petsc INCLUDE_DIRECTORIES ${PETSC_DIR}/include LIBRARY_DIRECTORIES ${PETSC_DIR}/lib HEADER petscvec.h @@ -877,7 +883,7 @@ option(GEOSX_LA_INTERFACE_${upper_LAI} "${upper_LAI} LA interface is selected" O # if(DEFINED FESAPI_DIR) # message(STATUS "FESAPI_DIR = ${FESAPI_DIR}") -# find_and_register(NAME FesapiCpp +# find_and_import(NAME FesapiCpp # INCLUDE_DIRECTORIES ${FESAPI_DIR}/include # LIBRARY_DIRECTORIES ${FESAPI_DIR}/lib # HEADER fesapi/nsDefinitions.h diff --git a/src/coreComponents/LvArray b/src/coreComponents/LvArray index 52aac7fd723..6057f598b00 160000 --- a/src/coreComponents/LvArray +++ b/src/coreComponents/LvArray @@ -1 +1 @@ -Subproject commit 52aac7fd7233365a01206634f4d8b1b2b5be8e15 +Subproject commit 6057f598b005db6efd132f60c298ad9c827fe3cd diff --git a/src/coreComponents/common/CMakeLists.txt b/src/coreComponents/common/CMakeLists.txt index f8a0ca5345d..5600a8fae85 100644 --- a/src/coreComponents/common/CMakeLists.txt +++ b/src/coreComponents/common/CMakeLists.txt @@ -47,7 +47,31 @@ set( common_sources Units.cpp ) -set( dependencyList ${parallelDeps} lvarray pugixml::pugixml RAJA chai conduit::conduit fmt::fmt ) +set( dependencyList ${parallelDeps} lvarray RAJA chai ) + +if (TARGET conduit::conduit) + set( dependencyList ${dependencyList} conduit::conduit ) +endif() + +if (TARGET conduit) + set( dependencyList ${dependencyList} conduit ) +endif() + +if (TARGET fmt::fmt) + set( dependencyList ${dependencyList} fmt::fmt ) +endif() + +if (TARGET fmt) + set( dependencyList ${dependencyList} fmt ) +endif() + +if (TARGET pugixml::pugixml) + set( dependencyList ${dependencyList} pugixml::pugixml ) +endif() + +if (TARGET pugixml) + set( dependencyList ${dependencyList} pugixml ) +endif() if ( ENABLE_MKL ) list( APPEND dependencyList mkl ) diff --git a/src/coreComponents/common/Format.hpp b/src/coreComponents/common/Format.hpp index 2bdec54d274..e2a73a8789c 100644 --- a/src/coreComponents/common/Format.hpp +++ b/src/coreComponents/common/Format.hpp @@ -23,9 +23,11 @@ #ifdef GEOSX_USE_FMT #define FMT_HEADER_ONLY -#include -#include -#include +// Differentiate between standalone fmt path and umpire's fmt path +#include "../include/fmt/core.h" +#include "../include/fmt/chrono.h" +#include "../include/fmt/ranges.h" +#include "../include/fmt/xchar.h" #define GEOS_FMT_NS fmt #else // use C++20's #include diff --git a/src/coreComponents/dataRepository/ConduitRestart.cpp b/src/coreComponents/dataRepository/ConduitRestart.cpp index 8a109807d01..c569afd80cd 100644 --- a/src/coreComponents/dataRepository/ConduitRestart.cpp +++ b/src/coreComponents/dataRepository/ConduitRestart.cpp @@ -64,7 +64,7 @@ string readRootNode( string const & rootPath ) conduit::Node node; conduit::relay::io::load( rootPath + ".root", "hdf5", node ); - int const nFiles = node.child( "number_of_files" ).value(); + int const nFiles = node.fetch_existing( "number_of_files" ).value(); GEOS_THROW_IF_NE( nFiles, MpiWrapper::commSize(), InputError ); string const filePattern = node.fetch_existing( "file_pattern" ).as_string(); diff --git a/src/coreComponents/functions/unitTests/CMakeLists.txt b/src/coreComponents/functions/unitTests/CMakeLists.txt index c532b4eac94..84f7539e085 100644 --- a/src/coreComponents/functions/unitTests/CMakeLists.txt +++ b/src/coreComponents/functions/unitTests/CMakeLists.txt @@ -11,13 +11,29 @@ set( dependencyList ${parallelDeps} gtest functions ) # list( APPEND dependencyList ${geosx_core_libs} ) # endif() +if (TARGET pugixml::pugixml) + list( APPEND dependencyList pugixml::pugixml ) +endif() + +if (TARGET pugixml) + list( APPEND dependencyList pugixml ) +endif() + +if (TARGET fmt::fmt) + list( APPEND dependencyList fmt::fmt ) +endif() + +if (TARGET fmt) + list( APPEND dependencyList fmt ) +endif() + # Add gtest C++ based tests foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} - SOURCES ${test} - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} ) + SOURCES ${test} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${dependencyList} ) geos_add_test( NAME ${test_name} COMMAND ${test_name} ) diff --git a/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt b/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt index 5ec347f77c6..b0f63e151c5 100644 --- a/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt @@ -42,6 +42,22 @@ if( ENABLE_PVTPackage ) list( APPEND dependencyList PVTPackage ) endif() +if (TARGET pugixml::pugixml) + list( APPEND dependencyList pugixml::pugixml ) +endif() + +if (TARGET pugixml) + list( APPEND dependencyList pugixml ) +endif() + +if (TARGET fmt::fmt) + list( APPEND dependencyList fmt::fmt ) +endif() + +if (TARGET fmt) + list( APPEND dependencyList fmt ) +endif() + # Add gtest C++ based tests foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) diff --git a/src/coreComponents/unitTests/dataRepositoryTests/CMakeLists.txt b/src/coreComponents/unitTests/dataRepositoryTests/CMakeLists.txt index b62cfdd3a66..56a290d20b9 100644 --- a/src/coreComponents/unitTests/dataRepositoryTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/dataRepositoryTests/CMakeLists.txt @@ -15,6 +15,22 @@ else() list( APPEND dependencyList ${geosx_core_libs} ) endif() +if (TARGET pugixml::pugixml) + list( APPEND dependencyList pugixml::pugixml ) +endif() + +if (TARGET pugixml) + list( APPEND dependencyList pugixml ) +endif() + +if (TARGET fmt::fmt) + list( APPEND dependencyList fmt::fmt ) +endif() + +if (TARGET fmt) + list( APPEND dependencyList fmt ) +endif() + # Add gtest C++ based tests foreach(test ${dataRepository_tests}) get_filename_component( test_name ${test} NAME_WE ) diff --git a/src/coreComponents/unitTests/fieldSpecificationTests/CMakeLists.txt b/src/coreComponents/unitTests/fieldSpecificationTests/CMakeLists.txt index 23fcfdfe745..a49b0723762 100644 --- a/src/coreComponents/unitTests/fieldSpecificationTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/fieldSpecificationTests/CMakeLists.txt @@ -13,6 +13,22 @@ else() list( APPEND dependencyList ${geosx_core_libs} ) endif() +if (TARGET pugixml::pugixml) + list( APPEND dependencyList pugixml::pugixml ) +endif() + +if (TARGET pugixml) + list( APPEND dependencyList pugixml ) +endif() + +if (TARGET fmt::fmt) + list( APPEND dependencyList fmt::fmt ) +endif() + +if (TARGET fmt) + list( APPEND dependencyList fmt ) +endif() + # Add gtest C++ based tests foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) diff --git a/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt b/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt index 367d78ab0c0..597d97dff87 100644 --- a/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt @@ -22,6 +22,22 @@ if( ENABLE_PVTPackage ) list( APPEND dependencyList PVTPackage ) endif() +if (TARGET pugixml::pugixml) + list( APPEND dependencyList pugixml::pugixml ) +endif() + +if (TARGET pugixml) + list( APPEND dependencyList pugixml ) +endif() + +if (TARGET fmt::fmt) + list( APPEND dependencyList fmt::fmt ) +endif() + +if (TARGET fmt) + list( APPEND dependencyList fmt ) +endif() + # Add gtest C++ based tests foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) diff --git a/src/coreComponents/unitTests/linearAlgebraTests/CMakeLists.txt b/src/coreComponents/unitTests/linearAlgebraTests/CMakeLists.txt index a15e61e04d2..d05530ef8a0 100644 --- a/src/coreComponents/unitTests/linearAlgebraTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/linearAlgebraTests/CMakeLists.txt @@ -14,13 +14,30 @@ else() list( APPEND dependencyList ${geosx_core_libs} ) endif() +if (TARGET pugixml::pugixml) + set( dependencyList ${dependencyList} pugixml::pugixml ) +endif() + +if (TARGET pugixml) + set( dependencyList ${dependencyList} pugixml ) +endif() + +if (TARGET fmt::fmt) + set( dependencyList ${dependencyList} fmt::fmt ) +endif() + +if (TARGET fmt) + set( dependencyList ${dependencyList} fmt ) +endif() + foreach(test ${LAI_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} ) + DEPENDS_ON ${dependencyList} + ) if ( ENABLE_MPI ) geos_add_test( NAME ${test_name} diff --git a/src/coreComponents/unitTests/meshTests/CMakeLists.txt b/src/coreComponents/unitTests/meshTests/CMakeLists.txt index a6d41e649c2..c9903e0e5c6 100644 --- a/src/coreComponents/unitTests/meshTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/meshTests/CMakeLists.txt @@ -27,6 +27,22 @@ else() list( APPEND dependencyList ${geosx_core_libs} ) endif() +if (TARGET pugixml::pugixml) + list( APPEND dependencyList pugixml::pugixml ) +endif() + +if (TARGET pugixml) + list( APPEND dependencyList pugixml ) +endif() + +if (TARGET fmt::fmt) + list( APPEND dependencyList fmt::fmt ) +endif() + +if (TARGET fmt) + list( APPEND dependencyList fmt ) +endif() + # Add gtest C++ based tests foreach( test ${gtest_geosx_tests} ) get_filename_component( test_name ${test} NAME_WE ) diff --git a/src/coreComponents/unitTests/virtualElementTests/CMakeLists.txt b/src/coreComponents/unitTests/virtualElementTests/CMakeLists.txt index 5752ea70ea3..ad301d299ba 100644 --- a/src/coreComponents/unitTests/virtualElementTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/virtualElementTests/CMakeLists.txt @@ -10,6 +10,22 @@ else() list( APPEND dependencyList ${geosx_core_libs} ) endif() +if (TARGET pugixml::pugixml) + list( APPEND dependencyList pugixml::pugixml ) +endif() + +if (TARGET pugixml) + list( APPEND dependencyList pugixml ) +endif() + +if (TARGET fmt::fmt) + list( APPEND dependencyList fmt::fmt ) +endif() + +if (TARGET fmt) + list( APPEND dependencyList fmt ) +endif() + # Add gtest C++ based tests foreach(test ${testSources}) get_filename_component( test_name ${test} NAME_WE ) diff --git a/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt b/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt index 67b5306afce..136e02696d7 100644 --- a/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt @@ -11,13 +11,29 @@ else() list( APPEND dependencyList ${geosx_core_libs} ) endif() +if (TARGET pugixml::pugixml) + list( APPEND dependencyList pugixml::pugixml ) +endif() + +if (TARGET pugixml) + list( APPEND dependencyList pugixml ) +endif() + +if (TARGET fmt::fmt) + list( APPEND dependencyList fmt::fmt ) +endif() + +if (TARGET fmt) + list( APPEND dependencyList fmt ) +endif() + # Add gtest C++ based tests foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} ) + DEPENDS_ON ${dependencyList} ) # Guard to prevent GCC (version 8) from giving warnings due # to some sort of possible conversion from int to long unsigned. diff --git a/src/coreComponents/unitTests/wellsTests/CMakeLists.txt b/src/coreComponents/unitTests/wellsTests/CMakeLists.txt index fc85199a155..dcf6a699034 100644 --- a/src/coreComponents/unitTests/wellsTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/wellsTests/CMakeLists.txt @@ -18,6 +18,22 @@ if( ENABLE_PVTPackage ) list( APPEND dependencyList PVTPackage ) endif() +if (TARGET pugixml::pugixml) + list( APPEND dependencyList pugixml::pugixml ) +endif() + +if (TARGET pugixml) + list( APPEND dependencyList pugixml ) +endif() + +if (TARGET fmt::fmt) + list( APPEND dependencyList fmt::fmt ) +endif() + +if (TARGET fmt) + list( APPEND dependencyList fmt ) +endif() + # Add gtest C++ based tests foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) diff --git a/src/coreComponents/unitTests/xmlTests/CMakeLists.txt b/src/coreComponents/unitTests/xmlTests/CMakeLists.txt index 2820a00b0ef..f2b1c7bb5fc 100644 --- a/src/coreComponents/unitTests/xmlTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/xmlTests/CMakeLists.txt @@ -24,6 +24,14 @@ else() list( APPEND dependencyList ${geosx_core_libs} ) endif() +if (TARGET pugixml::pugixml) + set( dependencyList ${dependencyList} pugixml::pugixml ) +endif() + +if (TARGET pugixml) + set( dependencyList ${dependencyList} pugixml ) +endif() + # create test executables foreach(test ${gtest_geosx_tests} ${gtest_tests_with_input}) get_filename_component( test_name ${test} NAME_WE ) diff --git a/src/docs/sphinx/buildGuide/SpackUberenv.rst b/src/docs/sphinx/buildGuide/SpackUberenv.rst index ff386687fc9..7b2dc11714f 100644 --- a/src/docs/sphinx/buildGuide/SpackUberenv.rst +++ b/src/docs/sphinx/buildGuide/SpackUberenv.rst @@ -11,43 +11,52 @@ Building the dependencies can be as simple as running ./scripts/uberenv/uberenv.py -This will create a directory ``uberenv_libs`` in the current working directory, clone Spack into ``uberenv_libs/spack`` and install the dependencies into ``uberenv_libs/system_dependent_path``. It will then spit out a host-config file in the current directory which you can use to build GEOS. While the above command **should** work on every system, it should never be used. Invoked as such, Spack will ignore any system libraries you have installed and will go down a rabbit hole building dependencies. Furthermore this does not allow you to choose the compiler to build. Both of these are easily solved by creating a directory with a ``packages.yaml`` and a ``compilers.yaml``. +This will create a directory ``uberenv_libs`` (or a directory name you specify by adding ``--prefix directory-name``) in the current working directory, clone Spack into ``uberenv_libs/spack`` and install the dependencies into ``uberenv_libs/system_dependent_path``. It will then spit out a host-config file in the current directory which you can use to build GEOS. While the above command **should** work on every system, it **should never be used**. Invoked as such, Spack will ignore any system libraries you have installed and will go down a rabbit hole building dependencies. Furthermore this does not allow you to choose the compiler to build. Both of these are easily solved by creating a directory with a ``spack.yaml``. -To prevent this from happening you'll need to create a directory with a ``packages.yaml`` file and a ``compilers.yaml`` file. You can find working examples for commonly used systems in `scripts/uberenv/spack_configs `_. It is worth noting that each LC system type has two such directories, for example there is a ``toss_3_x85_54_ib`` and ``toss_3_x85_54_ib_python`` directory. This is because when building ``pygeosx`` Python needs to be built from scratch, and as such cannot be listed in ``packages.yaml``. However, when not building ``pygeosx`` other dependencies depend on python, but an existing system version works just fine, so it can be put in ``packages.yaml`` to prevent Spack from building it. +To prevent this from happening you'll need to create a directory with a ``spack.yaml`` file. You can find working examples for commonly used systems in `scripts/spack_configs `_. -Once you have these files setup you can run Uberenv again and instruct it to use them with. If for instance you added Clang 10.0.1 to the ``compilers.yaml`` file the your command would look something like this: +Once you have these files setup you can run Uberenv again and instruct it to use them with. If for instance you added Clang 10.0.1 to the ``spack.yaml`` file the your command would look something like this: .. code-block:: console - ./scripts/uberenv/uberenv.py --spack-config-dir=/path/to/your/config/directory/ --spec="%clang@10.0.1" + ./scripts/uberenv/uberenv.py --spack-config-dir=/path/to/your/config/directory/ --spec="%clang@14.0.6" + +It is worth noting that GEOS has `two project json files `_ (``.uberenv_config.json`` and ``scripts/pygeosx_configs/pygeosx.json``) and two configuration directories for LC systems (``scripts/spack_configs`` and ``scripts/pygeosx_configs``). The ``.uberenv_config.json`` project json file and ``scripts/spack_configs`` directory is for building GEOS. The ``scripts/pygeosx_configs/pygeosx.json`` project json file and ``scripts/pygeosx_configs`` directory is for building ``pygeosx``. This is because ``pygeosx`` has a separate list of required compilers and packages to build from GEOS (e.g. ``pygeosx``'s numpy dependency recommends building with gcc and using openblas for BLAS/LAPACK). However, when not building ``pygeosx`` other dependencies depend on python, but an existing system version works just fine, so it can be put in GEOS's ``spack.yaml`` to prevent Spack from building it. By default, Uberenv will find and use ``.uberenv_config.json`` to build GEOS, but you can use the ``--project-json`` command line option to target ``scripts/pygeosx_configs/pygeosx.json`` to build ``pygeosx``: + +.. code-block:: console + + ./scripts/uberenv/uberenv.py --spack-config-dir=/path/to/your/config/directory/ --spec="%clang@14.0.6" --project-json="scripts/pygeosx_configs/pygeosx.json" .. note:: - When building ``pygeosx``, Spack will build various python packages, however by default they are not installed in python. There are various ways of accomplishing `this `_, but the recommended approach is to use ``spack activate``. The command would look something like this ``./uberenv_libs/spack/bin/spack activate py-numpy py-scipy py-pip py-mpi4py`` + When building ``pygeosx``, Spack will build various python packages, however by default they are not installed in python. There are various ways of accomplishing `this `_, but the recommended approach is to use spack environments. Once you build ``pygeosx`` using Uberenv, Spack will create a view that ensures the Spack-built python can find the built python packages. For example, with a default ``uberenv_libs`` directory of dependencies, the path to the view of python will be ``uberenv_libs/._view/*/bin/python3``. If you want to use your ``pygeosx`` python3 executable in GEOS, you will need to update your host-config's ``Python3_ROOT_DIR`` and ``Python3_EXECUTABLE`` to the path to Spack's view of python. Build Configuration ------------------- -The GEOS Spack package has a lot of options for controlling which dependencies you would like to build and how you'd like them built. The GEOS Spack package file is at ```scripts/uberenv/packages/geosx/package.py `_.`` The variants for the package are as follows +.. warning:: + The spack build system is undergoing updates. The ``petsc`` variant and others are still a work in progress. + +The GEOS Spack package has a lot of options for controlling which dependencies you would like to build and how you'd like them built. The GEOS Spack package file is at ```scripts/spack_packages/packages/geosx/package.py `_.`` The variants for the package are as follows -.. literalinclude:: ../../../../scripts/uberenv/packages/geosx/package.py +.. literalinclude:: ../../../../scripts/spack_packages/packages/geosx/package.py :language: python :start-after: # SPHINX_BEGIN_VARIANTS :end-before: # SPHINX_END_VARIANTS -For example if you wanted to build with GCC 8.3.1, without Caliper and with PETSC as the Linear Algebra Interface, your spec would be ``%gcc@8.3.1 ~caliper lai=petsc``. +For example if you wanted to build with GCC 8.3.1, without Caliper and with Hypre as the Linear Algebra Interface, your spec would be ``%gcc@8.3.1 ~caliper lai=hypre``. The GEOS Spack package lists out the libraries that GEOS depends ons. Currently these dependencies are -.. literalinclude:: ../../../../scripts/uberenv/packages/geosx/package.py +.. literalinclude:: ../../../../scripts/spack_packages/packages/geosx/package.py :language: python :start-after: # SPHINX_BEGIN_DEPENDS :end-before: # SPHINX_END_DEPENDS -Using the Spack spec syntax you can inturn specify variants for each of the dependencies of GEOS. So for example if you could modify the spec above to build RAJA in debug by using ``%gcc@8.3.1 ~caliper lai=petsc ^raja build_type=Debug``. When building with Uberenv Spack should print out a table containing the full spec for every dependency it will build. If you would like to look at the variants for say RAJA in more detail you can find the package file at ``uberenv_libs/spack/var/spack/repos/builtin/packages/raja/package.py``. +Using the Spack spec syntax you can inturn specify variants for each of the dependencies of GEOS. So for example if you could modify the spec above to build RAJA in debug by using ``%gcc@8.3.1 ~caliper lai=hypre ^raja build_type=Debug``. When building with Uberenv Spack should print out a table containing the full spec for every dependency it will build. If you would like to look at the variants for say RAJA in more detail you can find the package file at ``uberenv_libs/spack/var/spack/repos/builtin/packages/raja/package.py``. Adding a Dependency (Advanced) ------------------------------ -Adding a dependency to GEOS is straight forward if the dependency already builds with Spack. If that is the case then all you need to do is add a ``depends_on('cool-new-library')`` to the GEOS ``package.py`` file. If however the dependency doesn't have a Spack package, you will have to add one by creating a ``cool-new-library/package.yaml`` file in the ``scripts/uberenv/packages`` directory and adding the logic to build it there. +Adding a dependency to GEOS is straight forward if the dependency already builds with Spack. If that is the case then all you need to do is add a ``depends_on('cool-new-library')`` to the GEOS ``package.py`` file. If however the dependency doesn't have a Spack package, you will have to add one by creating a ``cool-new-library/package.yaml`` file in the ``scripts/spack_packages/packages`` directory and adding the logic to build it there. -Oftentimes (unfortunately), even when a package already exists, it might not work out of the box for your system. In this case copy over the existing ``package.py`` file from the Spack repository into ``scripts/uberenv/packages/cool-new-library/package.py``, as if you were adding a new package, and perform your modifications there. Once you have the package working, copy the package back into the Spack repository (running Uberenv should do this for you) and commit+push your changes to Spack. +Oftentimes (unfortunately), even when a package already exists, it might not work out of the box for your system. In this case copy over the existing ``package.py`` file from the Spack repository into ``scripts/spack_packages/packages/cool-new-library/package.py``, as if you were adding a new package, and perform your modifications there. Once you have the package working, copy the package back into the Spack repository (running Uberenv should do this for you) and commit+push your changes to Spack.