From 8ec5c1a051c4e2b96c96b7585a71d467edd0b7f2 Mon Sep 17 00:00:00 2001 From: Brian Han Date: Thu, 20 Jun 2024 13:38:29 -0700 Subject: [PATCH] Moving spack environment and recipes to thirdPartyLibs; make uberenv a submodule --- .gitmodules | 3 + .../blueos_3_ppc64le_ib_p9/spack.yaml | 137 +++ scripts/pygeosx_configs/pygeosx.json | 11 + .../toss_4_x86_64_ib/spack.yaml | 142 +++ .../blueos_3_ppc64le_ib_p9/spack.yaml | 204 ++++ scripts/spack_configs/darwin/compilers.yaml | 17 + scripts/spack_configs/darwin/packages.yaml | 134 +++ scripts/spack_configs/summit/compilers.yaml | 31 + scripts/spack_configs/summit/packages.yaml | 70 ++ .../summit_python/compilers.yaml | 1 + .../spack_configs/summit_python/packages.yaml | 120 +++ .../spack_configs/toss_4_x86_64_ib/spack.yaml | 185 ++++ .../spack_packages/packages/essl/package.py | 49 + .../spack_packages/packages/geosx/package.py | 768 +++++++++++++++ .../spack_packages/packages/hdf5/package.py | 747 +++++++++++++++ .../packages/pygeosx/package.py | 25 + .../packages/trilinos/cray_secas.patch | 26 + .../trilinos/fix_clang_errors_12_18_1.patch | 39 + .../packages/trilinos/package.py | 890 ++++++++++++++++++ .../spack_packages/packages/vtk/package.py | 102 ++ .../packages/vtk/vtkXMLReader-fpe.patch | 19 + scripts/spack_packages/repo.yaml | 2 + scripts/uberenv | 1 + 23 files changed, 3723 insertions(+) create mode 100644 scripts/pygeosx_configs/blueos_3_ppc64le_ib_p9/spack.yaml create mode 100644 scripts/pygeosx_configs/pygeosx.json create mode 100644 scripts/pygeosx_configs/toss_4_x86_64_ib/spack.yaml create mode 100644 scripts/spack_configs/blueos_3_ppc64le_ib_p9/spack.yaml create mode 100644 scripts/spack_configs/darwin/compilers.yaml create mode 100644 scripts/spack_configs/darwin/packages.yaml create mode 100644 scripts/spack_configs/summit/compilers.yaml create mode 100644 scripts/spack_configs/summit/packages.yaml create mode 100644 scripts/spack_configs/summit_python/compilers.yaml create mode 100644 scripts/spack_configs/summit_python/packages.yaml create mode 100644 scripts/spack_configs/toss_4_x86_64_ib/spack.yaml create mode 100644 scripts/spack_packages/packages/essl/package.py create mode 100644 scripts/spack_packages/packages/geosx/package.py create mode 100644 scripts/spack_packages/packages/hdf5/package.py create mode 100644 scripts/spack_packages/packages/pygeosx/package.py create mode 100644 scripts/spack_packages/packages/trilinos/cray_secas.patch create mode 100644 scripts/spack_packages/packages/trilinos/fix_clang_errors_12_18_1.patch create mode 100644 scripts/spack_packages/packages/trilinos/package.py create mode 100644 scripts/spack_packages/packages/vtk/package.py create mode 100644 scripts/spack_packages/packages/vtk/vtkXMLReader-fpe.patch create mode 100644 scripts/spack_packages/repo.yaml create mode 160000 scripts/uberenv diff --git a/.gitmodules b/.gitmodules index 71c162e1..b88da2f1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "cmake/blt"] path = cmake/blt url = ../../LLNL/blt.git +[submodule "scripts/uberenv"] + path = scripts/uberenv + url = ../../LLNL/uberenv.git 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 00000000..565a1207 --- /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 00000000..41b485dc --- /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 00000000..0fb9dc34 --- /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 00000000..0ca90a26 --- /dev/null +++ b/scripts/spack_configs/blueos_3_ppc64le_ib_p9/spack.yaml @@ -0,0 +1,204 @@ +#------------------------------------------------------------------------------------------------------------ +# 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.d475cdfc63ac59ea9a554493a06e4033b8d6fade" + + chai: + require: "@git.6fe3470ad020303530af2f3dbbfe18826bd3319b=develop" + + 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 + flex: + buildable: False + externals: + - spec: flex@2.5.37 + prefix: /usr + gettext: + buildable: False + externals: + - spec: gettext@0.19.8.1 + prefix: /usr/bin/ + zlib: + buildable: false + externals: + - spec: zlib@1.2.7 + prefix: /usr diff --git a/scripts/spack_configs/darwin/compilers.yaml b/scripts/spack_configs/darwin/compilers.yaml new file mode 100644 index 00000000..00889a4a --- /dev/null +++ b/scripts/spack_configs/darwin/compilers.yaml @@ -0,0 +1,17 @@ +compilers: +- compiler: + spec: clang@12.0.0-apple + paths: + cc: /usr/bin/clang + cxx: /usr/bin/clang++ + f77: /usr/local/bin/gfortran + fc: /usr/local/bin/gfortran + flags: + cflags: + cxxflags: + fflags: + operating_system: catalina + target: x86_64 + modules: [] + environment: {} + extra_rpaths: [] diff --git a/scripts/spack_configs/darwin/packages.yaml b/scripts/spack_configs/darwin/packages.yaml new file mode 100644 index 00000000..5b05bd37 --- /dev/null +++ b/scripts/spack_configs/darwin/packages.yaml @@ -0,0 +1,134 @@ +packages: + all: + target: [default] + compiler: [clang] + providers: + mpi: [openmpi] + blas: [netlib-lapack] + lapack: [netlib-lapack] + + openmpi: + buildable: False + externals: + - spec: openmpi@4.0.5 + prefix: /usr/local/Cellar/open-mpi/4.0.5/ + + netlib-lapack: + buildable: False + externals: + - spec: netlib-lapack + prefix: /usr/lib/ + + cmake: + buildable: False + externals: + - spec: cmake@3.18.4 + prefix: /usr/local/Cellar/cmake/3.18.4/ + + readline: + buildable: False + externals: + - spec: readline + prefix: /usr/lib/ + + zlib: + buildable: False + externals: + - spec: zlib@1.2.11 + prefix: /usr/lib/ + + m4: + buildable: False + externals: + - spec: m4@1.4.6 + prefix: /usr/bin/ + + diffutils: + buildable: False + externals: + - spec: diffutils@2.8.1 + prefix: /usr/bin/ + + python: + buildable: False + externals: + - spec: python@3.8.6 + prefix: /usr/local/Cellar/python@3.8/3.8.6/ + + # 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/bin/ + # + # 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/spack_configs/summit/compilers.yaml b/scripts/spack_configs/summit/compilers.yaml new file mode 100644 index 00000000..2499a594 --- /dev/null +++ b/scripts/spack_configs/summit/compilers.yaml @@ -0,0 +1,31 @@ +compilers: +- compiler: + spec: gcc@9.1.0 + paths: + cc: /sw/summit/gcc/9.1.0-alpha+20190716/bin/gcc + cxx: /sw/summit/gcc/9.1.0-alpha+20190716/bin/g++ + f77: /sw/summit/gcc/9.1.0-alpha+20190716/bin/gfortran + fc: /sw/summit/gcc/9.1.0-alpha+20190716/bin/gfortran + flags: + cflags: -mcpu=native -mtune=native + cxxflags: -mcpu=native -mtune=native + operating_system: rhel8 + target: ppc64le + modules: [gcc/9.1.0] + environment: {} + extra_rpaths: [] +- compiler: + spec: gcc@10.2.0 + paths: + cc: /sw/summit/gcc/10.2.0-2/bin/gcc + cxx: /sw/summit/gcc/10.2.0-2/bin/g++ + f77: /sw/summit/gcc/10.2.0-2/bin/gfortran + fc: /sw/summit/gcc/10.2.0-2/bin/gfortran + flags: + cflags: -mcpu=native -mtune=native + cxxflags: -mcpu=native -mtune=native + operating_system: rhel8 + target: ppc64le + modules: [gcc/10.2.0] + environment: {} + extra_rpaths: [] diff --git a/scripts/spack_configs/summit/packages.yaml b/scripts/spack_configs/summit/packages.yaml new file mode 100644 index 00000000..30bd2940 --- /dev/null +++ b/scripts/spack_configs/summit/packages.yaml @@ -0,0 +1,70 @@ +packages: + all: + target: [default] + compiler: [gcc] + providers: + mpi: [spectrum-mpi] + blas: [openblas] + lapack: [openblas] + + openblas: + buildable: False + externals: + - spec: openblas@0.3.15 threads=openmp + modules: + - openblas/0.3.15-omp + + spectrum-mpi: + buildable: False + externals: + - spec: spectrum-mpi@10.4.0.3-20210112 + modules: + - spectrum-mpi/10.4.0.3-20210112 + + cuda: + buildable: False + externals: + - spec: cuda@11.0.3 + modules: + - cuda/11.0.3 + - spec: cuda@11.3.1 + modules: + - cuda/11.3.1 + + cmake: + buildable: False + externals: + - spec: cmake@3.18.4 + modules: + - cmake/3.18.4 + + 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 + modules: + - python/3.8-anaconda3 diff --git a/scripts/spack_configs/summit_python/compilers.yaml b/scripts/spack_configs/summit_python/compilers.yaml new file mode 100644 index 00000000..c0fbf0f7 --- /dev/null +++ b/scripts/spack_configs/summit_python/compilers.yaml @@ -0,0 +1 @@ +../summit/compilers.yaml \ No newline at end of file diff --git a/scripts/spack_configs/summit_python/packages.yaml b/scripts/spack_configs/summit_python/packages.yaml new file mode 100644 index 00000000..094c8474 --- /dev/null +++ b/scripts/spack_configs/summit_python/packages.yaml @@ -0,0 +1,120 @@ +packages: + all: + target: [default] + compiler: [gcc] + providers: + mpi: [spectrum-mpi] + blas: [openblas] + lapack: [openblas] + + openblas: + buildable: False + externals: + - spec: openblas@0.3.9 threads=openmp + modules: + - openblas/0.3.9-omp + + spectrum-mpi: + buildable: False + externals: + - spec: spectrum-mpi@10.3.1.2-20200121 + modules: + - spectrum-mpi/10.3.1.2-20200121 + + cuda: + buildable: False + externals: + - spec: cuda@11.2.0 + modules: + - cuda/11.2.0 + + cmake: + buildable: False + externals: + - spec: cmake@3.14.5 + modules: + - cmake/3.14.2 + + 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/ + + 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: /gpfs/alpine/geo127/proj-shared/libs-for-geosx + + 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/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 00000000..cd287cf6 --- /dev/null +++ b/scripts/spack_configs/toss_4_x86_64_ib/spack.yaml @@ -0,0 +1,185 @@ +#------------------------------------------------------------------------------------------------------------ +# 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.d475cdfc63ac59ea9a554493a06e4033b8d6fade" + + chai: + require: "@git.6fe3470ad020303530af2f3dbbfe18826bd3319b=develop" + + 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 + gettext: + buildable: False + externals: + - spec: gettext@0.19.8.1 + prefix: /usr/bin/ + flex: + buildable: False + externals: + - spec: flex@2.6.1 + prefix: /usr diff --git a/scripts/spack_packages/packages/essl/package.py b/scripts/spack_packages/packages/essl/package.py new file mode 100644 index 00000000..0a4377ff --- /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/geosx/package.py b/scripts/spack_packages/packages/geosx/package.py new file mode 100644 index 00000000..00336819 --- /dev/null +++ b/scripts/spack_packages/packages/geosx/package.py @@ -0,0 +1,768 @@ +# 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 * +import warnings + +import socket +import os + +from os import environ as env +from os.path import join as pjoin + +# Tested specs are located at scripts/spack_configs/<$SYS_TYPE>/spack.yaml (e.g. %clang@10.0.1) + +# WARNING: +petsc variant is yet to be tested. + + +def cmake_cache_entry(name, value, comment=""): + """Generate a string for a cmake cache variable""" + + return 'set(%s "%s" CACHE PATH "%s")\n\n' % (name, value, comment) + + +def cmake_cache_list(name, value, comment=""): + """Generate a list for a cmake cache variable""" + + indent = 5 + len(name) + join_str = '\n' + ' ' * indent + return 'set(%s %s CACHE STRING "%s")\n\n' % (name, join_str.join(value), comment) + + +def cmake_cache_string(name, string, comment=""): + """Generate a string for a cmake cache variable""" + + return 'set(%s "%s" CACHE STRING "%s")\n\n' % (name, string, comment) + + +def cmake_cache_option(name, boolean_value, comment=""): + """Generate a string for a cmake configuration option""" + + value = "ON" if boolean_value else "OFF" + return 'set(%s %s CACHE BOOL "%s")\n\n' % (name, value, comment) + + +class Geosx(CMakePackage, CudaPackage): + """GEOSX simulation framework.""" + + homepage = "https://github.com/GEOS-DEV/GEOS" + git = "https://github.com/GEOS-DEV/GEOS.git" + + # GEOSX needs submodules to build, but not necessary to build dependencies + version('develop', branch='develop') + + # SPHINX_BEGIN_VARIANTS + + variant('openmp', default=True, description='Build with OpenMP support.') + variant('shared', default=True, description='Build Shared Libs.') + variant('caliper', default=True, description='Build Caliper support.') + variant('vtk', default=True, description='Build VTK support.') + variant('trilinos', default=True, description='Build Trilinos support.') + variant('hypre', default=True, description='Build HYPRE 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='hypre', + description='Linear algebra interface.', + values=('trilinos', 'hypre', 'petsc'), + multi=False) + 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='Add support for addr2line.') + + # SPHINX_BEGIN_DEPENDS + + depends_on('cmake@3.23:', type='build') + + depends_on('blt') + + # + # Virtual packages + # + depends_on('mpi') + depends_on('blas') + depends_on('lapack') + + # + # Performance portability + # + depends_on('raja ~examples~exercises~shared') + depends_on("raja~openmp", when="~openmp") + depends_on("raja+openmp", when="+openmp") + + depends_on('umpire +c~examples+fortran~device_alloc~shared') + depends_on("umpire~openmp", when="~openmp") + depends_on("umpire+openmp", when="+openmp") + + depends_on('chai +raja~examples~shared') + depends_on("chai~openmp", when="~openmp") + depends_on("chai+openmp", when="+openmp") + + depends_on('camp') + + 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~separable_compilation 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.12.1') + depends_on('silo@4.11~fortran') + + depends_on('conduit@0.8.2~test~fortran~hdf5_compat') + + depends_on('adiak@0.2.2', when='+caliper') + depends_on('caliper@2.10.0~gotcha~sampler~libunwind~libdw', when='+caliper') + + depends_on('pugixml@1.13') + + depends_on('fmt@10.0.0 cxxstd=14') + depends_on('vtk@9.2.6', when='+vtk') + + # + # Math + # + depends_on('parmetis@4.0.3+int64') + + depends_on('superlu-dist +int64') + depends_on("superlu-dist~openmp", when="~openmp") + depends_on("superlu-dist+openmp", when="+openmp") + + depends_on('scotch@7.0.3 +mpi +int64', when='+scotch') + + depends_on('suite-sparse@5.10.1') + depends_on("suite-sparse~openmp", when="~openmp") + depends_on("suite-sparse+openmp", when="+openmp") + + trilinos_packages = '+aztec+stratimikos~amesos2~anasazi~belos~ifpack2~muelu~sacado+thyra' + depends_on('trilinos@13.4.1 ' + trilinos_packages, when='+trilinos') + depends_on("trilinos~openmp", when="~openmp") + depends_on("trilinos+openmp", when="+openmp") + + depends_on("hypre +superlu-dist+mixedint+mpi", when='+hypre~cuda') + + depends_on("hypre +cuda+superlu-dist+mixedint+mpi+umpire+unified-memory cflags='-fPIC' cxxflags='-fPIC'", when='+hypre+cuda') + depends_on("hypre~openmp", when="~openmp") + depends_on("hypre+openmp", when="+openmp") + 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('petsc@3.13.0~hdf5~hypre+int64', when='+petsc') + depends_on('petsc+ptscotch', when='+petsc+scotch') + + # + # Python + # + depends_on('python') + + + # + # Dev tools + # + depends_on('uncrustify', when='+uncrustify') + + # + # Documentation + # + depends_on('doxygen@1.8.20', when='+docs', type='build') + depends_on('py-sphinx@1.6.3:', when='+docs', type='build') + + # SPHINX_END_DEPENDS + + # + # Conflicts + # + conflicts('~trilinos lai=trilinos', msg='To use Trilinos 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.') + + # 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) + def check(self): + """ + Searches the CMake-generated Makefile for the target ``test`` + and runs it if found. + """ + with working_dir(self.build_directory): + ctest('-V', '--force-new-ctest-process', '-j 1') + + @run_after('build') + def build_docs(self): + if '+docs' in self.spec: + with working_dir(self.build_directory): + make('docs') + + def _get_sys_type(self, spec): + sys_type = str(spec.architecture) + # if on llnl systems, we can use the SYS_TYPE + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type + + def _get_host_config_path(self, spec, lvarray=False): + var = '' + if '+cuda' in spec: + var = '-'.join([var, 'cuda']) + + hostname = socket.gethostname().rstrip('1234567890') + + if lvarray: + hostname = "lvarray-" + hostname + + host_config_path = "%s-%s-%s%s.cmake" % (hostname, self._get_sys_type(spec), (str(spec.compiler)).replace('=',''), var) + + dest_dir = self.stage.source_path + host_config_path = os.path.abspath(pjoin(dest_dir, host_config_path)) + return host_config_path + + 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. + + 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) + 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("# 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)) + + cfg.write(cmake_cache_option('ENABLE_MPI', True)) + cfg.write(cmake_cache_entry('MPI_C_COMPILER', spec['mpi'].mpicc)) + cfg.write(cmake_cache_entry('MPI_CXX_COMPILER', spec['mpi'].mpicxx)) + + 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')) + cfg.write(cmake_cache_entry('MPIEXEC_NUMPROC_FLAG', '-n')) + else: + cfg.write(cmake_cache_entry('MPIEXEC', 'jsrun')) + cfg.write(cmake_cache_list('MPIEXEC_NUMPROC_FLAG', ['-g1', '--bind', 'rs', '-n'])) + else: + # Taken from cached_cmake class: + # https://github.com/spack/spack/blob/develop/lib/spack/spack/build_systems/cached_cmake.py#L180-234 + + # Check for slurm + using_slurm = False + slurm_checks = ["+slurm", "schedulers=slurm", "process_managers=slurm"] + if any(spec["mpi"].satisfies(variant) for variant in slurm_checks): + using_slurm = True + + # Determine MPIEXEC + if using_slurm: + if spec["mpi"].external: + # Heuristic until we have dependents on externals + mpiexec = "/usr/bin/srun" + else: + mpiexec = os.path.join(spec["slurm"].prefix.bin, "srun") + elif hasattr(spec["mpi"].package, "mpiexec"): + mpiexec = spec["mpi"].package.mpiexec + else: + mpiexec = os.path.join(spec["mpi"].prefix.bin, "mpirun") + if not os.path.exists(mpiexec): + mpiexec = os.path.join(spec["mpi"].prefix.bin, "mpiexec") + + if not os.path.exists(mpiexec): + msg = "Unable to determine MPIEXEC, %s tests may fail" % self.pkg.name + cfg.write("# {0}\n".format(msg)) + tty.warn(msg) + else: + # starting with cmake 3.10, FindMPI expects MPIEXEC_EXECUTABLE + # vs the older versions which expect MPIEXEC + if spec["cmake"].satisfies("@3.10:"): + cfg.write(cmake_cache_path("MPIEXEC_EXECUTABLE", mpiexec)) + else: + cfg.write(cmake_cache_path("MPIEXEC", mpiexec)) + + # Determine MPIEXEC_NUMPROC_FLAG + if using_slurm: + cfg.write(cmake_cache_string("MPIEXEC_NUMPROC_FLAG", "-n")) + else: + cfg.write(cmake_cache_string("MPIEXEC_NUMPROC_FLAG", "-np")) + + + cfg.write("#{0}\n".format("-" * 80)) + cfg.write("# OpenMP\n") + cfg.write("#{0}\n\n".format("-" * 80)) + + if '+openmp' in spec: + cfg.write(cmake_cache_option('ENABLE_OPENMP', True)) + else: + cfg.write(cmake_cache_option('ENABLE_OPENMP', False)) + + 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)) + + # System specific flags + if sys_type in ('linux-rhel7-ppc64le', 'linux-rhel8-ppc64le', 'blueos_3_ppc64le_ib_p9'): + 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)) + + # yapf: disable + io_tpls = ( + ('hdf5', 'HDF5', True), + ('conduit', 'CONDUIT', True), + ('silo', 'SILO', True), + ('pugixml', 'PUGIXML', True), + ('vtk', 'VTK', '+vtk' 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)) + else: + cfg.write(cmake_cache_option('ENABLE_{}'.format(cmake_name), False)) + + cfg.write('#{0}\n'.format('-' * 80)) + cfg.write('# System Math Libraries\n') + cfg.write('#{0}\n\n'.format('-' * 80)) + 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)) + elif '+essl' in spec: + cfg.write(cmake_cache_option('ENABLE_ESSL', True)) + cfg.write(cmake_cache_entry('ESSL_INCLUDE_DIRS', spec['essl'].prefix.include)) + cfg.write(cmake_cache_list('ESSL_LIBRARIES', spec['essl'].libs + spec['cuda'].libs)) + + cfg.write(cmake_cache_option('FORTRAN_MANGLE_NO_UNDERSCORE', True)) + else: + cfg.write(cmake_cache_list('BLAS_LIBRARIES', spec['blas'].libs)) + cfg.write(cmake_cache_list('LAPACK_LIBRARIES', spec['lapack'].libs)) + + # yapf: disable + math_tpls = ( + ('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 + + cfg.write('#{0}\n'.format('-' * 80)) + cfg.write('# Math TPLs\n') + cfg.write('#{0}\n\n'.format('-' * 80)) + for tpl, cmake_name, enable in math_tpls: + if enable: + cfg.write(cmake_cache_entry('{}_DIR'.format(cmake_name), spec[tpl].prefix)) + + if tpl == 'hypre' and '+cuda' in spec: + cfg.write(cmake_cache_string('ENABLE_HYPRE_DEVICE', "CUDA")) + 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: + cfg.write(cmake_cache_entry('GEOSX_LA_INTERFACE', 'Hypre')) + if 'lai=petsc' in spec: + cfg.write(cmake_cache_entry('GEOSX_LA_INTERFACE', 'Petsc')) + + 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)) + else: + cfg.write(cmake_cache_option('ENABLE_PYGEOSX', False)) + + 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_DOCS', False)) + 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)) + + 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') + cfg.write('#{0}\n\n'.format('-' * 80)) + + 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 + # host_config_path = self._get_host_config_path(spec) + + # options = [] + # options.extend(['-C', host_config_path]) + + # # Shared libs + # options.append(self.define_from_variant('BUILD_SHARED_LIBS', 'shared')) + + # if '~tests~examples~benchmarks' in spec: + # options.append('-DGEOS_ENABLE_TESTS=OFF') + # else: + # options.append('-DGEOS_ENABLE_TESTS=ON') + + # if '~test' in spec: + # options.append('-DDISABLE_UNIT_TESTS=ON') + # elif "+tests" in spec and ('%intel' in spec or '%xl' in spec): + # warnings.warn('The LvArray unit tests take an excessive amount of' + # ' time to build with the Intel or IBM compilers.') + + # options.append(self.define_from_variant('ENABLE_EXAMPLES', 'examples')) + # options.append(self.define_from_variant('ENABLE_BENCHMARKS', + # 'benchmarks')) + # options.append(self.define_from_variant('ENABLE_DOCS', 'docs')) + + # return options diff --git a/scripts/spack_packages/packages/hdf5/package.py b/scripts/spack_packages/packages/hdf5/package.py new file mode 100644 index 00000000..061251f5 --- /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/pygeosx/package.py b/scripts/spack_packages/packages/pygeosx/package.py new file mode 100644 index 00000000..aaa1ddc4 --- /dev/null +++ b/scripts/spack_packages/packages/pygeosx/package.py @@ -0,0 +1,25 @@ +# 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. + NOTE: It is recommended to download and install python3 and package + dependencies using your Linux distribution's package manager (Spack + builds of python tend to be much slower). """ + + 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") + depends_on("py-test") 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 00000000..14eb4ad3 --- /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 00000000..6da3f431 --- /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 00000000..a34d0203 --- /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/vtk/package.py b/scripts/spack_packages/packages/vtk/package.py new file mode 100644 index 00000000..b1a666f8 --- /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 00000000..c998db19 --- /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 00000000..19bb9d85 --- /dev/null +++ b/scripts/spack_packages/repo.yaml @@ -0,0 +1,2 @@ +repo: + namespace: geos diff --git a/scripts/uberenv b/scripts/uberenv new file mode 160000 index 00000000..205672b8 --- /dev/null +++ b/scripts/uberenv @@ -0,0 +1 @@ +Subproject commit 205672b8b2520d7dc69acefe8738960cd5db0937