From b3502c0009864b8975455017ad969fb7d7b376fa Mon Sep 17 00:00:00 2001 From: bcumming Date: Tue, 4 Feb 2025 13:41:56 +0100 Subject: [PATCH 1/6] first configuration and recipes --- .gitignore | 12 + ci/ci.yml | 29 + config.yaml | 52 ++ recipes/climana/24.10/compilers.yaml | 5 + recipes/climana/24.10/config.yaml | 6 + recipes/climana/24.10/environments.yaml | 56 ++ recipes/climana/24.10/modules.yaml | 36 + recipes/climana/24.10/post-install | 39 + .../repo/packages/r/change_optflags_tmp.patch | 67 ++ .../climana/24.10/repo/packages/r/package.py | 280 +++++++ .../24.10/repo/packages/r/package.py.back | 262 +++++++ .../repo/packages/r/relocate-which.patch | 52 ++ .../climana/24.10/repo/packages/r/zlib.patch | 29 + recipes/climana/24.7/compilers.yaml | 5 + recipes/climana/24.7/config.yaml | 6 + recipes/climana/24.7/environments.yaml | 54 ++ recipes/climana/24.7/modules.yaml | 36 + recipes/climana/24.7/post-install | 39 + .../repo/packages/r/change_optflags_tmp.patch | 67 ++ .../climana/24.7/repo/packages/r/package.py | 280 +++++++ .../24.7/repo/packages/r/package.py.back | 262 +++++++ .../24.7/repo/packages/r/relocate-which.patch | 52 ++ .../climana/24.7/repo/packages/r/zlib.patch | 29 + recipes/icon/25.2/gh200/compilers.yaml | 9 + recipes/icon/25.2/gh200/config.yaml | 6 + recipes/icon/25.2/gh200/environments.yaml | 36 + recipes/icon/25.2/gh200/extra/reframe.yaml | 6 + recipes/icon/25.2/gh200/modules.yaml | 26 + recipes/mch/readme.md | 61 ++ recipes/mch/v5/compilers.yaml | 9 + recipes/mch/v5/config.yaml | 6 + recipes/mch/v5/environments.yaml | 110 +++ recipes/mch/v5/modules.yaml | 75 ++ recipes/mch/v5/repo/packages/nvhpc/package.py | 463 ++++++++++++ recipes/mch/v6/compilers.yaml | 9 + recipes/mch/v6/config.yaml | 6 + recipes/mch/v6/environments.yaml | 109 +++ recipes/mch/v6/modules.yaml | 75 ++ recipes/mch/v6/readme.md | 4 + .../v6/repo/packages/aws-ofi-nccl/package.py | 66 ++ .../mch/v6/repo/packages/cray-gtl/package.py | 123 +++ .../v6/repo/packages/cray-mpich/package.py | 210 ++++++ .../mch/v6/repo/packages/cray-pals/package.py | 89 +++ .../mch/v6/repo/packages/cray-pmi/package.py | 107 +++ recipes/mch/v6/repo/packages/cuda/package.py | 705 ++++++++++++++++++ recipes/mch/v6/repo/packages/nvhpc/package.py | 541 ++++++++++++++ recipes/mch/v7/compilers.yaml | 9 + recipes/mch/v7/config.yaml | 6 + recipes/mch/v7/environments.yaml | 88 +++ recipes/mch/v7/modules.yaml | 58 ++ recipes/mch/v7/readme.md | 1 + recipes/mch/v8/compilers.yaml | 9 + recipes/mch/v8/config.yaml | 6 + recipes/mch/v8/environments.yaml | 82 ++ recipes/mch/v8/modules.yaml | 62 ++ recipes/mch/v8/readme.md | 1 + .../eccodes/cmake_install_rpath.patch | 11 + .../packages/eccodes/openjpeg_jasper.patch | 39 + .../mch/v8/repo/packages/eccodes/package.py | 385 ++++++++++ .../mch/v8/repo/packages/eccodes/readme.md | 1 + recipes/validation/compilers.yaml | 5 + recipes/validation/config.yaml | 6 + recipes/validation/environments.yaml | 29 + recipes/validation/modules.yaml | 36 + .../repo/packages/r/change_optflags_tmp.patch | 67 ++ recipes/validation/repo/packages/r/package.py | 262 +++++++ recipes/validation/repo/packages/r/zlib.patch | 29 + 67 files changed, 5798 insertions(+) create mode 100644 .gitignore create mode 100644 ci/ci.yml create mode 100644 config.yaml create mode 100644 recipes/climana/24.10/compilers.yaml create mode 100644 recipes/climana/24.10/config.yaml create mode 100644 recipes/climana/24.10/environments.yaml create mode 100644 recipes/climana/24.10/modules.yaml create mode 100755 recipes/climana/24.10/post-install create mode 100644 recipes/climana/24.10/repo/packages/r/change_optflags_tmp.patch create mode 100644 recipes/climana/24.10/repo/packages/r/package.py create mode 100644 recipes/climana/24.10/repo/packages/r/package.py.back create mode 100644 recipes/climana/24.10/repo/packages/r/relocate-which.patch create mode 100644 recipes/climana/24.10/repo/packages/r/zlib.patch create mode 100644 recipes/climana/24.7/compilers.yaml create mode 100644 recipes/climana/24.7/config.yaml create mode 100644 recipes/climana/24.7/environments.yaml create mode 100644 recipes/climana/24.7/modules.yaml create mode 100755 recipes/climana/24.7/post-install create mode 100644 recipes/climana/24.7/repo/packages/r/change_optflags_tmp.patch create mode 100644 recipes/climana/24.7/repo/packages/r/package.py create mode 100644 recipes/climana/24.7/repo/packages/r/package.py.back create mode 100644 recipes/climana/24.7/repo/packages/r/relocate-which.patch create mode 100644 recipes/climana/24.7/repo/packages/r/zlib.patch create mode 100644 recipes/icon/25.2/gh200/compilers.yaml create mode 100644 recipes/icon/25.2/gh200/config.yaml create mode 100644 recipes/icon/25.2/gh200/environments.yaml create mode 100644 recipes/icon/25.2/gh200/extra/reframe.yaml create mode 100644 recipes/icon/25.2/gh200/modules.yaml create mode 100644 recipes/mch/readme.md create mode 100644 recipes/mch/v5/compilers.yaml create mode 100644 recipes/mch/v5/config.yaml create mode 100644 recipes/mch/v5/environments.yaml create mode 100644 recipes/mch/v5/modules.yaml create mode 100644 recipes/mch/v5/repo/packages/nvhpc/package.py create mode 100644 recipes/mch/v6/compilers.yaml create mode 100644 recipes/mch/v6/config.yaml create mode 100644 recipes/mch/v6/environments.yaml create mode 100644 recipes/mch/v6/modules.yaml create mode 100644 recipes/mch/v6/readme.md create mode 100644 recipes/mch/v6/repo/packages/aws-ofi-nccl/package.py create mode 100644 recipes/mch/v6/repo/packages/cray-gtl/package.py create mode 100644 recipes/mch/v6/repo/packages/cray-mpich/package.py create mode 100644 recipes/mch/v6/repo/packages/cray-pals/package.py create mode 100644 recipes/mch/v6/repo/packages/cray-pmi/package.py create mode 100644 recipes/mch/v6/repo/packages/cuda/package.py create mode 100644 recipes/mch/v6/repo/packages/nvhpc/package.py create mode 100644 recipes/mch/v7/compilers.yaml create mode 100644 recipes/mch/v7/config.yaml create mode 100644 recipes/mch/v7/environments.yaml create mode 100644 recipes/mch/v7/modules.yaml create mode 100644 recipes/mch/v7/readme.md create mode 100644 recipes/mch/v8/compilers.yaml create mode 100644 recipes/mch/v8/config.yaml create mode 100644 recipes/mch/v8/environments.yaml create mode 100644 recipes/mch/v8/modules.yaml create mode 100644 recipes/mch/v8/readme.md create mode 100644 recipes/mch/v8/repo/packages/eccodes/cmake_install_rpath.patch create mode 100644 recipes/mch/v8/repo/packages/eccodes/openjpeg_jasper.patch create mode 100644 recipes/mch/v8/repo/packages/eccodes/package.py create mode 100644 recipes/mch/v8/repo/packages/eccodes/readme.md create mode 100644 recipes/validation/compilers.yaml create mode 100644 recipes/validation/config.yaml create mode 100644 recipes/validation/environments.yaml create mode 100644 recipes/validation/modules.yaml create mode 100644 recipes/validation/repo/packages/r/change_optflags_tmp.patch create mode 100644 recipes/validation/repo/packages/r/package.py create mode 100644 recipes/validation/repo/packages/r/zlib.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca436aa --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# vim temp files +.*.sw[pnoq] + +# the pipeline repository, cloned by ci/ci.yaml +uenv-pipeline + +# generated by test.sh +tmp.sh + +# python gubbins +__pycache__ + diff --git a/ci/ci.yml b/ci/ci.yml new file mode 100644 index 0000000..b15e01b --- /dev/null +++ b/ci/ci.yml @@ -0,0 +1,29 @@ +stages: + - configure + - run + +pipeline-configure: + stage: configure + tags: [rosa-k8s-lightweight] + image: docker.io/python:latest + script: + - git clone https://github.com/eth-cscs/uenv-pipeline.git + - ./uenv-pipeline/configure-pipeline -c./config.yaml -r./recipes -s$system -u$uenv -a$uarch -o./pipeline.yml + artifacts: + paths: + - pipeline.yml + - uenv-pipeline + +generated-pipeline: + stage: run + needs: [pipeline-configure] + variables: + CSCS_NOTIFICATION_CONTEXT: "$system-$uarch-$uenv" + PARENT_PIPELINE_ID: "$CI_PIPELINE_ID" + trigger: + include: + - artifact: pipeline.yml + job: pipeline-configure + forward: + pipeline_variables: true + strategy: depend diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..8bdd692 --- /dev/null +++ b/config.yaml @@ -0,0 +1,52 @@ +clusters: + balfrin: + targets: + - + uarch: 'a100' + partition: 'normal' + variables: + F7T_URL: 'https://api.cscs.ch/mch/firecrest/v1' + - + uarch: 'zen3' + partition: 'postproc' + variables: + F7T_URL: 'https://api.cscs.ch/mch/firecrest/v1' + runner: f7t + santis: + targets: + - + uarch: 'gh200' + partition: 'normal' + variables: + F7T_URL: "https://api.cscs.ch/hpc/firecrest/v1" + runner: f7t +uenvs: + climana: + "24.10": + recipes: + zen2: '24.10' + zen3: '24.10' + a100: '24.10' + deploy: + balfrin: [zen3, a100] + develop: False + icon: + "25.2": + recipes: + gh200: '25.2/gh200' + deploy: + santis: [gh200] + develop: False + mch: + "v7": + recipes: + a100: 'v7' + deploy: + balfrin: [a100] + develop: False + "v8": + recipes: + a100: 'v8' + deploy: + balfrin: [a100] + develop: False diff --git a/recipes/climana/24.10/compilers.yaml b/recipes/climana/24.10/compilers.yaml new file mode 100644 index 0000000..99cfe61 --- /dev/null +++ b/recipes/climana/24.10/compilers.yaml @@ -0,0 +1,5 @@ +bootstrap: + spec: gcc@11.3 +gcc: + specs: + - gcc@12.3 diff --git a/recipes/climana/24.10/config.yaml b/recipes/climana/24.10/config.yaml new file mode 100644 index 0000000..e2d3f0c --- /dev/null +++ b/recipes/climana/24.10/config.yaml @@ -0,0 +1,6 @@ +name: mch +store: /user-environment +spack: + commit: releases/v0.22 + repo: https://github.com/spack/spack.git +description: MCH climate analysys toolkit diff --git a/recipes/climana/24.10/environments.yaml b/recipes/climana/24.10/environments.yaml new file mode 100644 index 0000000..e6e81af --- /dev/null +++ b/recipes/climana/24.10/environments.yaml @@ -0,0 +1,56 @@ +climana: + compiler: + - toolchain: gcc + spec: gcc@12 + unify: when_possible + mpi: + spec: cray-mpich@8.1.28 + packages: + - perl + - autoconf + - m4 + - automake + - texinfo + - libtool + - gawk + - curl + specs: + # choose fftw instead of the default intel-oneapi-mkl. + # this saves ~2GB of space, and reduces image build time. + - cdo ^[virtuals=fftw-api] fftw + - gdal + - geos + - gsl + - hdf5@1.12.2 +fortran +threadsafe ~mpi + - imagemagick + - ncview + - nco + - ncl + - netcdf-c@4.8.1~mpi ^hdf5~mpi api=v18 + - proj + - python@3.11 + - sqlite + - udunits + # R and its packages + # +X is required for png, tiff, jpeg, etc support + - r@4.4 +X + # install here so that the openssl built by Spack is used. + - r-curl + # R needs to find all of the following use pkg-config + # so we add them to the view, where they will be picked up. + - freetype + - fribidi + - glib + - harfbuzz + - libjpeg-turbo + - libpng + - libtiff + - zstd + # required as a runtime dependency of the ssl R package + - openssl + views: + climana: + link: roots + uenv: + prefix_paths: + LD_LIBRARY_PATH: [lib, lib64] diff --git a/recipes/climana/24.10/modules.yaml b/recipes/climana/24.10/modules.yaml new file mode 100644 index 0000000..80dce73 --- /dev/null +++ b/recipes/climana/24.10/modules.yaml @@ -0,0 +1,36 @@ +modules: + # Paths to check when creating modules for all module sets + prefix_inspections: + bin: + - PATH + lib: + - LD_LIBRARY_PATH + lib64: + - LD_LIBRARY_PATH + lib/pkgconfig: + - PKG_CONFIG_PATH + lib64/pkgconfig: + - PKG_CONFIG_PATH + + default: + arch_folder: false + # Where to install modules + roots: + tcl: /user-environment/modules + tcl: + all: + autoload: none + netcdf-c: + environment: + set: + NETCDF_C_ROOT: '{prefix}' + hash_length: 0 + exclude_implicits: true + include: + - hdf5 + - zlib+shared + exclude: + - '%gcc@7.5.0' + - 'gcc %gcc@7.5.0' + projections: + all: '{name}/{version}' diff --git a/recipes/climana/24.10/post-install b/recipes/climana/24.10/post-install new file mode 100755 index 0000000..bf70a6d --- /dev/null +++ b/recipes/climana/24.10/post-install @@ -0,0 +1,39 @@ +#!/bin/bash + +# don't generate an error message if a glob does not match any files +shopt -s nullglob + +# where all of the applications built by spack are installed +# this has to change if +# - the compiler version used to build software changes +# - we build for a different micro-architecture +# - we upgrade to SLES 16 +install_base=/user-environment/linux-sles15-zen3/gcc-12.3.0 +view_base=/user-environment/env/climana + +# iterate over all of the locations where pkgconfig files are likely to be installed +for pkbase in "lib/pkgconfig" "lib64/pkgconfig" "share/pkgconfig" "rlib/pkgconfig" +do + # find all directories that match the pattern + pkgpaths=$(find $install_base -type d -path '*/'$pkbase) + + # iterate over each directory, searching for pkg-config .pc files + for pkpath in $pkgpaths + do + pcfiles=($pkpath/*.pc) + for pcpath in ${pcfiles[@]} + do + pcfile=$(basename $pcpath) + from=$pkpath/$pcfile + to_root=$view_base/$pkbase + to=$to_root/$pcfile + mkdir -p $to_root + if [ ! -e $to ]; then + echo '+ ' $pkbase/$pcfile + ln -s "$from" "$to" + else + echo 'skip ' $pkbase/$pcfile + fi + done + done +done diff --git a/recipes/climana/24.10/repo/packages/r/change_optflags_tmp.patch b/recipes/climana/24.10/repo/packages/r/change_optflags_tmp.patch new file mode 100644 index 0000000..4e39b02 --- /dev/null +++ b/recipes/climana/24.10/repo/packages/r/change_optflags_tmp.patch @@ -0,0 +1,67 @@ +diff -ur R-3.6.3.org/configure R-3.6.3/configure +--- R-3.6.3.org/configure 2020-03-09 11:09:16.060825352 +0900 ++++ R-3.6.3/configure 2020-03-09 11:10:47.011280195 +0900 +@@ -6470,13 +6470,13 @@ + CFLAGS=$ac_save_CFLAGS + elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then +- CFLAGS="-g -O2" ++ CFLAGS="-g -O1" + else + CFLAGS="-g" + fi + else + if test "$GCC" = yes; then +- CFLAGS="-O2" ++ CFLAGS="-O1" + else + CFLAGS= + fi +@@ -7445,13 +7445,13 @@ + FCFLAGS=$ac_save_FCFLAGS + elif test $ac_cv_prog_fc_g = yes; then + if test "x$ac_cv_fc_compiler_gnu" = xyes; then +- FCFLAGS="-g -O2" ++ FCFLAGS="-g -O1" + else + FCFLAGS="-g" + fi + else + if test "x$ac_cv_fc_compiler_gnu" = xyes; then +- FCFLAGS="-O2" ++ FCFLAGS="-O1" + else + FCFLAGS= + fi +@@ -7717,13 +7717,13 @@ + CXXFLAGS=$ac_save_CXXFLAGS + elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then +- CXXFLAGS="-g -O2" ++ CXXFLAGS="-g -O1" + else + CXXFLAGS="-g" + fi + else + if test "$GXX" = yes; then +- CXXFLAGS="-O2" ++ CXXFLAGS="-O1" + else + CXXFLAGS= + fi +@@ -8336,13 +8336,13 @@ + OBJCFLAGS=$ac_save_OBJCFLAGS + elif test $ac_cv_prog_objc_g = yes; then + if test "$GOBJC" = yes; then +- OBJCFLAGS="-g -O2" ++ OBJCFLAGS="-g -O1" + else + OBJCFLAGS="-g" + fi + else + if test "$GOBJC" = yes; then +- OBJCFLAGS="-O2" ++ OBJCFLAGS="-O1" + else + OBJCFLAGS= + fi diff --git a/recipes/climana/24.10/repo/packages/r/package.py b/recipes/climana/24.10/repo/packages/r/package.py new file mode 100644 index 0000000..bc41186 --- /dev/null +++ b/recipes/climana/24.10/repo/packages/r/package.py @@ -0,0 +1,280 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os + +from spack.package import * + + +class R(AutotoolsPackage): + """R is 'GNU S', a freely available language and environment for + statistical computing and graphics which provides a wide variety of + statistical and graphical techniques: linear and nonlinear modelling, + statistical tests, time series analysis, classification, clustering, etc. + Please consult the R project homepage for further information.""" + + homepage = "https://www.r-project.org" + url = "https://cloud.r-project.org/src/base/R-4/R-4.4.0.tar.gz" + + extendable = True + + license("GPL-2.0-or-later") + + version("4.4.0", sha256="ace4125f9b976d2c53bcc5fca30c75e30d4edc401584859cbadb080e72b5f030") + version("4.3.3", sha256="80851231393b85bf3877ee9e39b282e750ed864c5ec60cbd68e6e139f0520330") + version("4.3.2", sha256="b3f5760ac2eee8026a3f0eefcb25b47723d978038eee8e844762094c860c452a") + version("4.3.1", sha256="8dd0bf24f1023c6f618c3b317383d291b4a494f40d73b983ac22ffea99e4ba99") + version("4.3.0", sha256="45dcc48b6cf27d361020f77fde1a39209e997b81402b3663ca1c010056a6a609") + version("4.2.3", sha256="55e4a9a6d43be314e2c03d0266a6fa5444afdce50b303bfc3b82b3979516e074") + version("4.2.2", sha256="0ff62b42ec51afa5713caee7c4fde7a0c45940ba39bef8c5c9487fef0c953df5") + version("4.2.1", sha256="4d52db486d27848e54613d4ee977ad952ec08ce17807e1b525b10cd4436c643f") + version("4.2.0", sha256="38eab7719b7ad095388f06aa090c5a2b202791945de60d3e2bb0eab1f5097488") + version("4.1.3", sha256="15ff5b333c61094060b2a52e9c1d8ec55cc42dd029e39ca22abdaa909526fed6") + version("4.1.2", sha256="2036225e9f7207d4ce097e54972aecdaa8b40d7d9911cd26491fac5a0fab38af") + version("4.1.1", sha256="515e03265752257d0b7036f380f82e42b46ed8473f54f25c7b67ed25bbbdd364") + version("4.1.0", sha256="e8e68959d7282ca147360fc9644ada9bd161bab781bab14d33b8999a95182781") + version("4.0.5", sha256="0a3ee079aa772e131fe5435311ab627fcbccb5a50cabc54292e6f62046f1ffef") + version("4.0.4", sha256="523f27d69744a08c8f0bd5e1e6c3d89a4db29ed983388ba70963a3cd3a4a802e") + version("4.0.3", sha256="09983a8a78d5fb6bc45d27b1c55f9ba5265f78fa54a55c13ae691f87c5bb9e0d") + version("4.0.2", sha256="d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75") + version("4.0.1", sha256="95fe24a4d8d8f8f888460c8f5fe4311cec656e7a1722d233218bc03861bc6f32") + version("4.0.0", sha256="06beb0291b569978484eb0dcb5d2339665ec745737bdfb4e873e7a5a75492940") + version("3.6.3", sha256="89302990d8e8add536e12125ec591d6951022cf8475861b3690bc8bf1cefaa8f") + version("3.6.2", sha256="bd65a45cddfb88f37370fbcee4ac8dd3f1aebeebe47c2f968fd9770ba2bbc954") + version("3.6.1", sha256="5baa9ebd3e71acecdcc3da31d9042fb174d55a42829f8315f2457080978b1389") + version("3.6.0", sha256="36fcac3e452666158e62459c6fc810adc247c7109ed71c5b6c3ad5fc2bf57509") + version("3.5.3", sha256="2bfa37b7bd709f003d6b8a172ddfb6d03ddd2d672d6096439523039f7a8e678c") + version("3.5.2", sha256="e53d8c3cf20f2b8d7a9c1631b6f6a22874506fb392034758b3bb341c586c5b62") + version("3.5.1", sha256="0463bff5eea0f3d93fa071f79c18d0993878fd4f2e18ae6cf22c1639d11457ed") + version("3.5.0", sha256="fd1725535e21797d3d9fea8963d99be0ba4c3aecadcf081b43e261458b416870") + version("3.4.4", sha256="b3e97d2fab7256d1c655c4075934725ba1cd7cb9237240a11bb22ccdad960337") + version("3.4.3", sha256="7a3cb831de5b4151e1f890113ed207527b7d4b16df9ec6b35e0964170007f426") + version("3.4.2", sha256="971e30c2436cf645f58552905105d75788bd9733bddbcb7c4fbff4c1a6d80c64") + version("3.4.1", sha256="02b1135d15ea969a3582caeb95594a05e830a6debcdb5b85ed2d5836a6a3fc78") + version("3.4.0", sha256="288e9ed42457c47720780433b3d5c3c20983048b789291cc6a7baa11f9428b91") + version("3.3.3", sha256="5ab768053a275084618fb669b4fbaadcc39158998a87e8465323829590bcfc6c") + version("3.3.2", sha256="d294ad21e9f574fb4828ebb3a94b8cb34f4f304a41687a994be00dd41a4e514c") + version("3.3.1", sha256="3dc59ae5831f5380f83c169bac2103ad052efe0ecec4ffa74bde4d85a0fda9e2") + version("3.3.0", sha256="9256b154b1a5993d844bee7b1955cd49c99ad72cef03cce3cd1bdca1310311e4") + version("3.2.5", sha256="60745672dce5ddc201806fa59f6d4e0ba6554d8ed78d0f9f0d79a629978f80b5") + version("3.2.3", sha256="b93b7d878138279234160f007cb9b7f81b8a72c012a15566e9ec5395cfd9b6c1") + version("3.2.2", sha256="9c9152e74134b68b0f3a1c7083764adc1cb56fd8336bec003fd0ca550cd2461d") + version("3.2.1", sha256="d59dbc3f04f4604a5cf0fb210b8ea703ef2438b3ee65fd5ab536ec5234f4c982") + version("3.2.0", sha256="f5ae953f18ba6f3d55b46556bbbf73441350f9fd22625402b723a2b81ff64f35") + version("3.1.3", sha256="07e98323935baa38079204bfb9414a029704bb9c0ca5ab317020ae521a377312") + version("3.1.2", sha256="bcd150afcae0e02f6efb5f35a6ab72432be82e849ec52ce0bb89d8c342a8fa7a") + + variant("X", default=False, description="Enable X11 support (TCLTK, PNG, JPEG, TIFF, CAIRO)") + variant("memory_profiling", default=False, description="Enable memory profiling") + variant("rmath", default=False, description="Build standalone Rmath library") + + depends_on("blas") + depends_on("lapack") + + depends_on("bzip2") + depends_on("curl+libidn2") + # R didn't anticipate the celebratory non-breaking major version bump of curl 8. + depends_on("curl@:7", when="@:4.2") + depends_on("icu4c") + depends_on("java") + depends_on("libtirpc") + depends_on("ncurses") + depends_on("pcre", when="@:3.6.3") + depends_on("pcre2", when="@4:") + depends_on("readline") + depends_on("xz") + depends_on("which", type=("build", "run")) + depends_on("zlib-api") + depends_on("zlib@1.2.5:", when="^[virtuals=zlib-api] zlib") + depends_on("texinfo", type="build") + + with when("+X"): + depends_on("cairo+X+gobject+pdf") + depends_on("pango+X") + depends_on("harfbuzz+graphite2") + depends_on("jpeg") + depends_on("libpng") + depends_on("libtiff") + depends_on("libx11") + depends_on("libxmu") + depends_on("libxt") + depends_on("tk") + + patch("zlib.patch", when="@:3.3.2") + + # R cannot be built with '-O2' optimization + # with Fujitsu Compiler @4.1.0 now. + # Until the Fujitsu compiler resolves this problem, + # temporary fix to lower the optimization level. + patch("change_optflags_tmp.patch", when="%fj@4.1.0") + + # Make R use a symlink to which in Sys.which, otherwise an absolute path + # gets stored as compressed byte code, which is not relocatable + patch("relocate-which.patch") + + # CVE-2024-27322 Patch only needed in R 4.3.3 and below; doesn't apply to R older than 3.5.0. + patch( + "https://github.com/r-devel/r-svn/commit/f7c46500f455eb4edfc3656c3fa20af61b16abb7.patch?full_index=1", + sha256="56c77763cb104aa9cb63420e585da63cb2c23bc03fa3ef9d088044eeff9d7380", + when="@3.5.0:4.3.3", + ) + + build_directory = "spack-build" + + # R custom URL version + def url_for_version(self, version): + """Handle R's customed URL versions""" + url = "https://cloud.r-project.org/src/base" + return url + "/R-%s/R-%s.tar.gz" % (version.up_to(1), version) + + @property + def etcdir(self): + return join_path(prefix, "rlib", "R", "etc") + + @run_after("install") + def install_rmath(self): + if "+rmath" in self.spec: + with working_dir(join_path(self.build_directory, "src", "nmath", "standalone")): + make() + make("install", parallel=False) + + def configure_args(self): + spec = self.spec + prefix = self.prefix + + extra_rpath = join_path(prefix, "rlib", "R", "lib") + + blas_flags: str = spec["blas"].libs.ld_flags + lapack_flags: str = spec["lapack"].libs.ld_flags + + # R uses LAPACK in Fortran, which requires libmkl_gf_* when gfortran is used. + # TODO: cleaning this up seem to require both compilers as dependencies and use variants. + if spec["lapack"].name in INTEL_MATH_LIBRARIES and "gfortran" in self.compiler.fc: + xlp64 = "ilp64" if spec["lapack"].satisfies("+ilp64") else "lp64" + blas_flags = blas_flags.replace(f"mkl_intel_{xlp64}", f"mkl_gf_{xlp64}") + lapack_flags = lapack_flags.replace(f"mkl_intel_{xlp64}", f"mkl_gf_{xlp64}") + + config_args = [ + "--with-internal-tzcode", + "--libdir={0}".format(join_path(prefix, "rlib")), + "--enable-R-shlib", + "--enable-R-framework=no", + "--without-recommended-packages", + f"LDFLAGS=-Wl,-rpath,{extra_rpath}", + f"--with-blas={blas_flags}", + f"--with-lapack={lapack_flags}", + # cannot disable docs with a normal configure option + "ac_cv_path_PDFLATEX=", + "ac_cv_path_PDFTEX=", + "ac_cv_path_TEX=", + "ac_cv_path_TEXI2DVI=", + ] + + if "+X" in spec: + config_args.append("--with-cairo") + config_args.append("--with-jpeglib") + config_args.append("--with-libpng") + config_args.append("--with-libtiff") + config_args.append("--with-tcltk") + config_args.append("--with-x") + + tcl_config_path = join_path(spec["tcl"].libs.directories[0], "tclConfig.sh") + config_args.append("--with-tcl-config={0}".format(tcl_config_path)) + + tk_config_path = join_path(spec["tk"].libs.directories[0], "tkConfig.sh") + config_args.append("--with-tk-config={0}".format(tk_config_path)) + else: + config_args.append("--without-cairo") + config_args.append("--without-jpeglib") + config_args.append("--without-libpng") + config_args.append("--without-libtiff") + config_args.append("--without-tcltk") + config_args.append("--without-x") + + if "+memory_profiling" in spec: + config_args.append("--enable-memory-profiling") + + # Set FPICFLAGS for compilers except 'gcc'. + if self.compiler.name != "gcc": + config_args.append("FPICFLAGS={0}".format(self.compiler.cc_pic_flag)) + + if self.spec.satisfies("@:3.6.1 %gcc@10:"): + config_args.append("CFLAGS=-fcommon") + config_args.append("FFLAGS=-fallow-argument-mismatch") + + return config_args + + @run_after("install") + def copy_makeconf(self): + # Make a copy of Makeconf because it will be needed to properly build R + # dependencies in Spack. + src_makeconf = join_path(self.etcdir, "Makeconf") + dst_makeconf = join_path(self.etcdir, "Makeconf.spack") + install(src_makeconf, dst_makeconf) + + # To respect order of execution, we should filter after we made the copy above + filter_compiler_wrappers("Makeconf", relative_root=os.path.join("rlib", "R", "etc")) + + # ======================================================================== + # Set up environment to make install easy for R extensions. + # ======================================================================== + + @property + def r_lib_dir(self): + return join_path("rlib", "R", "library") + + def setup_dependent_build_environment(self, env, dependent_spec): + # Set R_LIBS to include the library dir for the + # extension and any other R extensions it depends on. + r_libs_path = [] + for d in dependent_spec.traverse(deptype=("build", "run")): + if d.package.extends(self.spec): + r_libs_path.append(join_path(d.prefix, self.r_lib_dir)) + + r_libs_path = ":".join(r_libs_path) + env.set("R_LIBS", r_libs_path) + # R_LIBS_USER gets set to a directory in HOME/R if it is not set, such as + # during package installation with the --vanilla flag. Set it to null + # to ensure that it does not point to a directory that may contain R + # packages. + env.set("R_LIBS_USER", "") + env.set("R_MAKEVARS_SITE", join_path(self.etcdir, "Makeconf.spack")) + + # Use the number of make_jobs set in spack. The make program will + # determine how many jobs can actually be started. + env.set("MAKEFLAGS", "-j{0}".format(make_jobs)) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + def setup_dependent_run_environment(self, env, dependent_spec): + # For run time environment set only the path for dependent_spec and + # prepend it to R_LIBS + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + if dependent_spec.package.extends(self.spec): + env.prepend_path("R_LIBS", join_path(dependent_spec.prefix, self.r_lib_dir)) + + def setup_run_environment(self, env): + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib", "R", "lib")) + env.prepend_path("PKG_CONFIG_PATH", join_path(self.prefix, "rlib", "pkgconfig")) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + if "+rmath" in self.spec: + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib")) + + def setup_dependent_package(self, module, dependent_spec): + """Called before R modules' install() methods. In most cases, + extensions will only need to have one line: + R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir), + self.stage.source_path)""" + + # R extension builds can have a global R executable function + module.R = Executable(join_path(self.spec.prefix.bin, "R")) + + # Add variable for library directry + module.r_lib_dir = join_path(dependent_spec.prefix, self.r_lib_dir) + + # Make the site packages directory for extensions, if it does not exist + # already. + if dependent_spec.package.is_extension: + mkdirp(module.r_lib_dir) diff --git a/recipes/climana/24.10/repo/packages/r/package.py.back b/recipes/climana/24.10/repo/packages/r/package.py.back new file mode 100644 index 0000000..df61847 --- /dev/null +++ b/recipes/climana/24.10/repo/packages/r/package.py.back @@ -0,0 +1,262 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import re + +from spack.package import * + + +class R(AutotoolsPackage): + """R is 'GNU S', a freely available language and environment for + statistical computing and graphics which provides a wide variety of + statistical and graphical techniques: linear and nonlinear modelling, + statistical tests, time series analysis, classification, clustering, etc. + Please consult the R project homepage for further information.""" + + homepage = "https://www.r-project.org" + url = "https://cloud.r-project.org/src/base/R-3/R-3.4.3.tar.gz" + + extendable = True + + maintainers("glennpj") + + version("4.2.2", sha256="0ff62b42ec51afa5713caee7c4fde7a0c45940ba39bef8c5c9487fef0c953df5") + version("4.2.1", sha256="4d52db486d27848e54613d4ee977ad952ec08ce17807e1b525b10cd4436c643f") + version("4.2.0", sha256="38eab7719b7ad095388f06aa090c5a2b202791945de60d3e2bb0eab1f5097488") + version("4.1.3", sha256="15ff5b333c61094060b2a52e9c1d8ec55cc42dd029e39ca22abdaa909526fed6") + version("4.1.2", sha256="2036225e9f7207d4ce097e54972aecdaa8b40d7d9911cd26491fac5a0fab38af") + version("4.1.1", sha256="515e03265752257d0b7036f380f82e42b46ed8473f54f25c7b67ed25bbbdd364") + version("4.1.0", sha256="e8e68959d7282ca147360fc9644ada9bd161bab781bab14d33b8999a95182781") + version("4.0.5", sha256="0a3ee079aa772e131fe5435311ab627fcbccb5a50cabc54292e6f62046f1ffef") + version("4.0.4", sha256="523f27d69744a08c8f0bd5e1e6c3d89a4db29ed983388ba70963a3cd3a4a802e") + version("4.0.3", sha256="09983a8a78d5fb6bc45d27b1c55f9ba5265f78fa54a55c13ae691f87c5bb9e0d") + version("4.0.2", sha256="d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75") + version("4.0.1", sha256="95fe24a4d8d8f8f888460c8f5fe4311cec656e7a1722d233218bc03861bc6f32") + version("4.0.0", sha256="06beb0291b569978484eb0dcb5d2339665ec745737bdfb4e873e7a5a75492940") + version("3.6.3", sha256="89302990d8e8add536e12125ec591d6951022cf8475861b3690bc8bf1cefaa8f") + version("3.6.2", sha256="bd65a45cddfb88f37370fbcee4ac8dd3f1aebeebe47c2f968fd9770ba2bbc954") + version("3.6.1", sha256="5baa9ebd3e71acecdcc3da31d9042fb174d55a42829f8315f2457080978b1389") + version("3.6.0", sha256="36fcac3e452666158e62459c6fc810adc247c7109ed71c5b6c3ad5fc2bf57509") + version("3.5.3", sha256="2bfa37b7bd709f003d6b8a172ddfb6d03ddd2d672d6096439523039f7a8e678c") + version("3.5.2", sha256="e53d8c3cf20f2b8d7a9c1631b6f6a22874506fb392034758b3bb341c586c5b62") + version("3.5.1", sha256="0463bff5eea0f3d93fa071f79c18d0993878fd4f2e18ae6cf22c1639d11457ed") + version("3.5.0", sha256="fd1725535e21797d3d9fea8963d99be0ba4c3aecadcf081b43e261458b416870") + version("3.4.4", sha256="b3e97d2fab7256d1c655c4075934725ba1cd7cb9237240a11bb22ccdad960337") + version("3.4.3", sha256="7a3cb831de5b4151e1f890113ed207527b7d4b16df9ec6b35e0964170007f426") + version("3.4.2", sha256="971e30c2436cf645f58552905105d75788bd9733bddbcb7c4fbff4c1a6d80c64") + version("3.4.1", sha256="02b1135d15ea969a3582caeb95594a05e830a6debcdb5b85ed2d5836a6a3fc78") + version("3.4.0", sha256="288e9ed42457c47720780433b3d5c3c20983048b789291cc6a7baa11f9428b91") + version("3.3.3", sha256="5ab768053a275084618fb669b4fbaadcc39158998a87e8465323829590bcfc6c") + version("3.3.2", sha256="d294ad21e9f574fb4828ebb3a94b8cb34f4f304a41687a994be00dd41a4e514c") + version("3.3.1", sha256="3dc59ae5831f5380f83c169bac2103ad052efe0ecec4ffa74bde4d85a0fda9e2") + version("3.3.0", sha256="9256b154b1a5993d844bee7b1955cd49c99ad72cef03cce3cd1bdca1310311e4") + version("3.2.5", sha256="60745672dce5ddc201806fa59f6d4e0ba6554d8ed78d0f9f0d79a629978f80b5") + version("3.2.3", sha256="b93b7d878138279234160f007cb9b7f81b8a72c012a15566e9ec5395cfd9b6c1") + version("3.2.2", sha256="9c9152e74134b68b0f3a1c7083764adc1cb56fd8336bec003fd0ca550cd2461d") + version("3.2.1", sha256="d59dbc3f04f4604a5cf0fb210b8ea703ef2438b3ee65fd5ab536ec5234f4c982") + version("3.2.0", sha256="f5ae953f18ba6f3d55b46556bbbf73441350f9fd22625402b723a2b81ff64f35") + version("3.1.3", sha256="07e98323935baa38079204bfb9414a029704bb9c0ca5ab317020ae521a377312") + version("3.1.2", sha256="bcd150afcae0e02f6efb5f35a6ab72432be82e849ec52ce0bb89d8c342a8fa7a") + + variant( + "external-lapack", default=False, description="Links to externally installed BLAS/LAPACK" + ) + variant("X", default=False, description="Enable X11 support (TCLTK, PNG, JPEG, TIFF, CAIRO)") + variant("memory_profiling", default=False, description="Enable memory profiling") + variant("rmath", default=False, description="Build standalone Rmath library") + + depends_on("blas", when="+external-lapack") + depends_on("lapack", when="+external-lapack") + depends_on("bzip2") + # R didn't anticipate the celebratory + # non-breaking major version bump of curl 8. + depends_on("curl+libidn2@:7") + depends_on("icu4c") + depends_on("java") + depends_on("ncurses") + depends_on("pcre", when="@:3.6.3") + depends_on("pcre2", when="@4:") + depends_on("readline") + depends_on("xz") + depends_on("which", type=("build", "run")) + depends_on("zlib@1.2.5:") + depends_on("texinfo", type="build") + depends_on("cairo+X+gobject+pdf", when="+X") + depends_on("pango+X", when="+X") + depends_on("harfbuzz+graphite2", when="+X") + depends_on("jpeg", when="+X") + depends_on("libpng", when="+X") + depends_on("libtiff", when="+X") + depends_on("libx11", when="+X") + depends_on("libxmu", when="+X") + depends_on("libxt", when="+X") + depends_on("tk", when="+X") + + patch("zlib.patch", when="@:3.3.2") + + # R cannot be built with '-O2' optimization + # with Fujitsu Compiler @4.1.0 now. + # Until the Fujitsu compiler resolves this problem, + # temporary fix to lower the optimization level. + patch("change_optflags_tmp.patch", when="%fj@4.1.0") + + # R custom URL version + def url_for_version(self, version): + """Handle R's customed URL versions""" + url = "https://cloud.r-project.org/src/base" + return url + "/R-%s/R-%s.tar.gz" % (version.up_to(1), version) + + @property + def etcdir(self): + return join_path(prefix, "rlib", "R", "etc") + + @run_after("install") + def install_rmath(self): + if "+rmath" in self.spec: + with working_dir("src/nmath/standalone"): + make() + make("install", parallel=False) + + def configure_args(self): + spec = self.spec + prefix = self.prefix + + config_args = [ + "--libdir={0}".format(join_path(prefix, "rlib")), + "--enable-R-shlib", + "--enable-BLAS-shlib", + "--enable-R-framework=no", + "--without-recommended-packages", + "LDFLAGS=-L{0} -Wl,-rpath,{0}".format(join_path(prefix, "rlib", "R", "lib")), + # cannot disable docs with a normal configure option + "ac_cv_path_PDFLATEX=", + "ac_cv_path_PDFTEX=", + "ac_cv_path_TEX=", + "ac_cv_path_TEXI2DVI=", + ] + + if "+external-lapack" in spec: + if "^mkl" in spec and "gfortran" in self.compiler.fc: + mkl_re = re.compile(r"(mkl_)intel(_i?lp64\b)") + config_args.extend( + [ + mkl_re.sub( + r"\g<1>gf\g<2>", "--with-blas={0}".format(spec["blas"].libs.ld_flags) + ), + "--with-lapack", + ] + ) + else: + config_args.extend( + ["--with-blas={0}".format(spec["blas"].libs.ld_flags), "--with-lapack"] + ) + + if "+X" in spec: + config_args.append("--with-cairo") + config_args.append("--with-jpeglib") + config_args.append("--with-libpng") + config_args.append("--with-libtiff") + config_args.append("--with-tcltk") + config_args.append("--with-x") + + tcl_config_path = join_path(spec["tcl"].libs.directories[0], "tclConfig.sh") + config_args.append("--with-tcl-config={0}".format(tcl_config_path)) + + tk_config_path = join_path(spec["tk"].libs.directories[0], "tkConfig.sh") + config_args.append("--with-tk-config={0}".format(tk_config_path)) + else: + config_args.append("--without-cairo") + config_args.append("--without-jpeglib") + config_args.append("--without-libpng") + config_args.append("--without-libtiff") + config_args.append("--without-tcltk") + config_args.append("--without-x") + + if "+memory_profiling" in spec: + config_args.append("--enable-memory-profiling") + + # Set FPICFLAGS for compilers except 'gcc'. + if self.compiler.name != "gcc": + config_args.append("FPICFLAGS={0}".format(self.compiler.cc_pic_flag)) + + if self.spec.satisfies("@:3.6.1 %gcc@10:"): + config_args.append("CFLAGS=-fcommon") + config_args.append("FFLAGS=-fallow-argument-mismatch") + + return config_args + + @run_after("install") + def copy_makeconf(self): + # Make a copy of Makeconf because it will be needed to properly build R + # dependencies in Spack. + src_makeconf = join_path(self.etcdir, "Makeconf") + dst_makeconf = join_path(self.etcdir, "Makeconf.spack") + install(src_makeconf, dst_makeconf) + + # To respect order of execution, we should filter after we made the copy above + filter_compiler_wrappers("Makeconf", relative_root=os.path.join("rlib", "R", "etc")) + + # ======================================================================== + # Set up environment to make install easy for R extensions. + # ======================================================================== + + @property + def r_lib_dir(self): + return join_path("rlib", "R", "library") + + def setup_dependent_build_environment(self, env, dependent_spec): + # Set R_LIBS to include the library dir for the + # extension and any other R extensions it depends on. + r_libs_path = [] + for d in dependent_spec.traverse(deptype=("build", "run")): + if d.package.extends(self.spec): + r_libs_path.append(join_path(d.prefix, self.r_lib_dir)) + + r_libs_path = ":".join(r_libs_path) + env.set("R_LIBS", r_libs_path) + # R_LIBS_USER gets set to a directory in HOME/R if it is not set, such as + # during package installation with the --vanilla flag. Set it to null + # to ensure that it does not point to a directory that may contain R + # packages. + env.set("R_LIBS_USER", "") + env.set("R_MAKEVARS_SITE", join_path(self.etcdir, "Makeconf.spack")) + + # Use the number of make_jobs set in spack. The make program will + # determine how many jobs can actually be started. + env.set("MAKEFLAGS", "-j{0}".format(make_jobs)) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + def setup_dependent_run_environment(self, env, dependent_spec): + # For run time environment set only the path for dependent_spec and + # prepend it to R_LIBS + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + if dependent_spec.package.extends(self.spec): + env.prepend_path("R_LIBS", join_path(dependent_spec.prefix, self.r_lib_dir)) + + def setup_run_environment(self, env): + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib", "R", "lib")) + env.prepend_path("PKG_CONFIG_PATH", join_path(self.prefix, "rlib", "pkgconfig")) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + if "+rmath" in self.spec: + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib")) + + def setup_dependent_package(self, module, dependent_spec): + """Called before R modules' install() methods. In most cases, + extensions will only need to have one line: + R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir), + self.stage.source_path)""" + + # R extension builds can have a global R executable function + module.R = Executable(join_path(self.spec.prefix.bin, "R")) + + # Add variable for library directry + module.r_lib_dir = join_path(dependent_spec.prefix, self.r_lib_dir) + + # Make the site packages directory for extensions, if it does not exist + # already. + if dependent_spec.package.is_extension: + mkdirp(module.r_lib_dir) diff --git a/recipes/climana/24.10/repo/packages/r/relocate-which.patch b/recipes/climana/24.10/repo/packages/r/relocate-which.patch new file mode 100644 index 0000000..d8e18e1 --- /dev/null +++ b/recipes/climana/24.10/repo/packages/r/relocate-which.patch @@ -0,0 +1,52 @@ +From 3f2b1b6c94460fd4d3e9f03c9f17a25db2d2b473 Mon Sep 17 00:00:00 2001 +From: Harmen Stoppels +Date: Wed, 10 Jan 2024 12:40:40 +0100 +Subject: [PATCH] base: use a symlink for which instead of hard-coded string + +--- + share/make/basepkg.mk | 8 ++++---- + src/library/base/R/unix/system.unix.R | 6 +++--- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/share/make/basepkg.mk b/share/make/basepkg.mk +index c0a69c8a0af338ec002156236e47b9d7efea8165..4cf6387870915001cbb8b1439509ff4955cc67b1 100644 +--- a/share/make/basepkg.mk ++++ b/share/make/basepkg.mk +@@ -72,16 +72,16 @@ mkRbase: + else \ + cat $(RSRC) > "$${f}"; \ + fi; \ +- f2=$${TMPDIR:-/tmp}/R2$$$$; \ +- sed -e "s:@WHICH@:${WHICH}:" "$${f}" > "$${f2}"; \ +- rm -f "$${f}"; \ +- $(SHELL) $(top_srcdir)/tools/move-if-change "$${f2}" all.R) ++ $(SHELL) $(top_srcdir)/tools/move-if-change "$${f}" all.R) + @if ! test -f $(top_builddir)/library/$(pkg)/R/$(pkg); then \ + $(INSTALL_DATA) all.R $(top_builddir)/library/$(pkg)/R/$(pkg); \ + else if test all.R -nt $(top_builddir)/library/$(pkg)/R/$(pkg); then \ + $(INSTALL_DATA) all.R $(top_builddir)/library/$(pkg)/R/$(pkg); \ + fi \ + fi ++ @if ! test -f $(top_builddir)/library/$(pkg)/R/which; then \ ++ cd $(top_builddir)/library/$(pkg)/R/ && $(LN_S) $(WHICH) which; \ ++ fi + + mkdesc: + @if test -f DESCRIPTION; then \ +diff --git a/src/library/base/R/unix/system.unix.R b/src/library/base/R/unix/system.unix.R +index 3bb7d0cb27cc73a024bcea3e41e2e0c5c7e9648a..78271c8c12cb3217bc068e9d53ef9e3060e8dcc9 100644 +--- a/src/library/base/R/unix/system.unix.R ++++ b/src/library/base/R/unix/system.unix.R +@@ -114,9 +114,9 @@ system2 <- function(command, args = character(), + Sys.which <- function(names) + { + res <- character(length(names)); names(res) <- names +- ## hopefully configure found [/usr]/bin/which +- which <- "@WHICH@" +- if (!nzchar(which)) { ++ which <- file.path(R.home(), "library", "base", "R", "which") ++ ## which should be a symlink to the system's which ++ if (!file.exists(which)) { + warning("'which' was not found on this platform") + return(res) + } diff --git a/recipes/climana/24.10/repo/packages/r/zlib.patch b/recipes/climana/24.10/repo/packages/r/zlib.patch new file mode 100644 index 0000000..673d535 --- /dev/null +++ b/recipes/climana/24.10/repo/packages/r/zlib.patch @@ -0,0 +1,29 @@ +*** a/configure 2017-01-21 21:48:35.077000000 +0000 +--- b/configure 2017-01-21 21:50:50.700000000 +0000 +*************** +*** 35496,35505 **** + #include + #include + int main() { +! #ifdef ZLIB_VERSION +! /* Work around Debian bug: it uses 1.2.3.4 even though there was no such +! version on the master site zlib.net */ +! exit(strncmp(ZLIB_VERSION, "1.2.5", 5) < 0); + #else + exit(1); + #endif +--- 35496,35509 ---- + #include + #include + int main() { +! /* Checking ZLIB_VERNUM trick learned here: +! * https://github.com/TransitApp/protobuf/blob/master/configure.ac#L95 +! */ +! #ifdef ZLIB_VERNUM +! if (ZLIB_VERNUM < 0x1250) { +! exit(1); +! } +! exit(0); + #else + exit(1); + #endif diff --git a/recipes/climana/24.7/compilers.yaml b/recipes/climana/24.7/compilers.yaml new file mode 100644 index 0000000..99cfe61 --- /dev/null +++ b/recipes/climana/24.7/compilers.yaml @@ -0,0 +1,5 @@ +bootstrap: + spec: gcc@11.3 +gcc: + specs: + - gcc@12.3 diff --git a/recipes/climana/24.7/config.yaml b/recipes/climana/24.7/config.yaml new file mode 100644 index 0000000..1d8b508 --- /dev/null +++ b/recipes/climana/24.7/config.yaml @@ -0,0 +1,6 @@ +name: mch +store: /user-environment +spack: + commit: releases/v0.22 + repo: https://github.com/spack/spack.git +description: Tools for MCH validation. diff --git a/recipes/climana/24.7/environments.yaml b/recipes/climana/24.7/environments.yaml new file mode 100644 index 0000000..1cb0e92 --- /dev/null +++ b/recipes/climana/24.7/environments.yaml @@ -0,0 +1,54 @@ +climana: + compiler: + - toolchain: gcc + spec: gcc@12 + unify: when_possible + mpi: + spec: cray-mpich@8.1.28 + packages: + - perl + - autoconf + - m4 + - automake + - texinfo + - libtool + - gawk + - curl + specs: + # choose fftw instead of the default intel-oneapi-mkl. + # this saves ~2GB of space, and reduces image build time. + - cdo ^[virtuals=fftw-api] fftw + - gdal + - geos + - gsl + - hdf5@1.12.2 +fortran +threadsafe ~mpi + - ncview + - nco + - ncl + - netcdf-c@4.8.1~mpi ^hdf5~mpi api=v18 + - proj + - python@3.11 + - sqlite + - udunits + # R and its packages + # +X is required for png, tiff, jpeg, etc support + - r@4.4 +X + # install here so that the openssl built by Spack is used. + - r-curl + # R needs to find all of the following use pkg-config + # so we add them to the view, where they will be picked up. + - freetype + - fribidi + - glib + - harfbuzz + - libjpeg-turbo + - libpng + - libtiff + # required as a runtime dependency of the ssl R package + - openssl + views: + climana: + link: roots + uenv: + prefix_paths: + LD_LIBRARY_PATH: [lib, lib64] diff --git a/recipes/climana/24.7/modules.yaml b/recipes/climana/24.7/modules.yaml new file mode 100644 index 0000000..80dce73 --- /dev/null +++ b/recipes/climana/24.7/modules.yaml @@ -0,0 +1,36 @@ +modules: + # Paths to check when creating modules for all module sets + prefix_inspections: + bin: + - PATH + lib: + - LD_LIBRARY_PATH + lib64: + - LD_LIBRARY_PATH + lib/pkgconfig: + - PKG_CONFIG_PATH + lib64/pkgconfig: + - PKG_CONFIG_PATH + + default: + arch_folder: false + # Where to install modules + roots: + tcl: /user-environment/modules + tcl: + all: + autoload: none + netcdf-c: + environment: + set: + NETCDF_C_ROOT: '{prefix}' + hash_length: 0 + exclude_implicits: true + include: + - hdf5 + - zlib+shared + exclude: + - '%gcc@7.5.0' + - 'gcc %gcc@7.5.0' + projections: + all: '{name}/{version}' diff --git a/recipes/climana/24.7/post-install b/recipes/climana/24.7/post-install new file mode 100755 index 0000000..bf70a6d --- /dev/null +++ b/recipes/climana/24.7/post-install @@ -0,0 +1,39 @@ +#!/bin/bash + +# don't generate an error message if a glob does not match any files +shopt -s nullglob + +# where all of the applications built by spack are installed +# this has to change if +# - the compiler version used to build software changes +# - we build for a different micro-architecture +# - we upgrade to SLES 16 +install_base=/user-environment/linux-sles15-zen3/gcc-12.3.0 +view_base=/user-environment/env/climana + +# iterate over all of the locations where pkgconfig files are likely to be installed +for pkbase in "lib/pkgconfig" "lib64/pkgconfig" "share/pkgconfig" "rlib/pkgconfig" +do + # find all directories that match the pattern + pkgpaths=$(find $install_base -type d -path '*/'$pkbase) + + # iterate over each directory, searching for pkg-config .pc files + for pkpath in $pkgpaths + do + pcfiles=($pkpath/*.pc) + for pcpath in ${pcfiles[@]} + do + pcfile=$(basename $pcpath) + from=$pkpath/$pcfile + to_root=$view_base/$pkbase + to=$to_root/$pcfile + mkdir -p $to_root + if [ ! -e $to ]; then + echo '+ ' $pkbase/$pcfile + ln -s "$from" "$to" + else + echo 'skip ' $pkbase/$pcfile + fi + done + done +done diff --git a/recipes/climana/24.7/repo/packages/r/change_optflags_tmp.patch b/recipes/climana/24.7/repo/packages/r/change_optflags_tmp.patch new file mode 100644 index 0000000..4e39b02 --- /dev/null +++ b/recipes/climana/24.7/repo/packages/r/change_optflags_tmp.patch @@ -0,0 +1,67 @@ +diff -ur R-3.6.3.org/configure R-3.6.3/configure +--- R-3.6.3.org/configure 2020-03-09 11:09:16.060825352 +0900 ++++ R-3.6.3/configure 2020-03-09 11:10:47.011280195 +0900 +@@ -6470,13 +6470,13 @@ + CFLAGS=$ac_save_CFLAGS + elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then +- CFLAGS="-g -O2" ++ CFLAGS="-g -O1" + else + CFLAGS="-g" + fi + else + if test "$GCC" = yes; then +- CFLAGS="-O2" ++ CFLAGS="-O1" + else + CFLAGS= + fi +@@ -7445,13 +7445,13 @@ + FCFLAGS=$ac_save_FCFLAGS + elif test $ac_cv_prog_fc_g = yes; then + if test "x$ac_cv_fc_compiler_gnu" = xyes; then +- FCFLAGS="-g -O2" ++ FCFLAGS="-g -O1" + else + FCFLAGS="-g" + fi + else + if test "x$ac_cv_fc_compiler_gnu" = xyes; then +- FCFLAGS="-O2" ++ FCFLAGS="-O1" + else + FCFLAGS= + fi +@@ -7717,13 +7717,13 @@ + CXXFLAGS=$ac_save_CXXFLAGS + elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then +- CXXFLAGS="-g -O2" ++ CXXFLAGS="-g -O1" + else + CXXFLAGS="-g" + fi + else + if test "$GXX" = yes; then +- CXXFLAGS="-O2" ++ CXXFLAGS="-O1" + else + CXXFLAGS= + fi +@@ -8336,13 +8336,13 @@ + OBJCFLAGS=$ac_save_OBJCFLAGS + elif test $ac_cv_prog_objc_g = yes; then + if test "$GOBJC" = yes; then +- OBJCFLAGS="-g -O2" ++ OBJCFLAGS="-g -O1" + else + OBJCFLAGS="-g" + fi + else + if test "$GOBJC" = yes; then +- OBJCFLAGS="-O2" ++ OBJCFLAGS="-O1" + else + OBJCFLAGS= + fi diff --git a/recipes/climana/24.7/repo/packages/r/package.py b/recipes/climana/24.7/repo/packages/r/package.py new file mode 100644 index 0000000..bc41186 --- /dev/null +++ b/recipes/climana/24.7/repo/packages/r/package.py @@ -0,0 +1,280 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os + +from spack.package import * + + +class R(AutotoolsPackage): + """R is 'GNU S', a freely available language and environment for + statistical computing and graphics which provides a wide variety of + statistical and graphical techniques: linear and nonlinear modelling, + statistical tests, time series analysis, classification, clustering, etc. + Please consult the R project homepage for further information.""" + + homepage = "https://www.r-project.org" + url = "https://cloud.r-project.org/src/base/R-4/R-4.4.0.tar.gz" + + extendable = True + + license("GPL-2.0-or-later") + + version("4.4.0", sha256="ace4125f9b976d2c53bcc5fca30c75e30d4edc401584859cbadb080e72b5f030") + version("4.3.3", sha256="80851231393b85bf3877ee9e39b282e750ed864c5ec60cbd68e6e139f0520330") + version("4.3.2", sha256="b3f5760ac2eee8026a3f0eefcb25b47723d978038eee8e844762094c860c452a") + version("4.3.1", sha256="8dd0bf24f1023c6f618c3b317383d291b4a494f40d73b983ac22ffea99e4ba99") + version("4.3.0", sha256="45dcc48b6cf27d361020f77fde1a39209e997b81402b3663ca1c010056a6a609") + version("4.2.3", sha256="55e4a9a6d43be314e2c03d0266a6fa5444afdce50b303bfc3b82b3979516e074") + version("4.2.2", sha256="0ff62b42ec51afa5713caee7c4fde7a0c45940ba39bef8c5c9487fef0c953df5") + version("4.2.1", sha256="4d52db486d27848e54613d4ee977ad952ec08ce17807e1b525b10cd4436c643f") + version("4.2.0", sha256="38eab7719b7ad095388f06aa090c5a2b202791945de60d3e2bb0eab1f5097488") + version("4.1.3", sha256="15ff5b333c61094060b2a52e9c1d8ec55cc42dd029e39ca22abdaa909526fed6") + version("4.1.2", sha256="2036225e9f7207d4ce097e54972aecdaa8b40d7d9911cd26491fac5a0fab38af") + version("4.1.1", sha256="515e03265752257d0b7036f380f82e42b46ed8473f54f25c7b67ed25bbbdd364") + version("4.1.0", sha256="e8e68959d7282ca147360fc9644ada9bd161bab781bab14d33b8999a95182781") + version("4.0.5", sha256="0a3ee079aa772e131fe5435311ab627fcbccb5a50cabc54292e6f62046f1ffef") + version("4.0.4", sha256="523f27d69744a08c8f0bd5e1e6c3d89a4db29ed983388ba70963a3cd3a4a802e") + version("4.0.3", sha256="09983a8a78d5fb6bc45d27b1c55f9ba5265f78fa54a55c13ae691f87c5bb9e0d") + version("4.0.2", sha256="d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75") + version("4.0.1", sha256="95fe24a4d8d8f8f888460c8f5fe4311cec656e7a1722d233218bc03861bc6f32") + version("4.0.0", sha256="06beb0291b569978484eb0dcb5d2339665ec745737bdfb4e873e7a5a75492940") + version("3.6.3", sha256="89302990d8e8add536e12125ec591d6951022cf8475861b3690bc8bf1cefaa8f") + version("3.6.2", sha256="bd65a45cddfb88f37370fbcee4ac8dd3f1aebeebe47c2f968fd9770ba2bbc954") + version("3.6.1", sha256="5baa9ebd3e71acecdcc3da31d9042fb174d55a42829f8315f2457080978b1389") + version("3.6.0", sha256="36fcac3e452666158e62459c6fc810adc247c7109ed71c5b6c3ad5fc2bf57509") + version("3.5.3", sha256="2bfa37b7bd709f003d6b8a172ddfb6d03ddd2d672d6096439523039f7a8e678c") + version("3.5.2", sha256="e53d8c3cf20f2b8d7a9c1631b6f6a22874506fb392034758b3bb341c586c5b62") + version("3.5.1", sha256="0463bff5eea0f3d93fa071f79c18d0993878fd4f2e18ae6cf22c1639d11457ed") + version("3.5.0", sha256="fd1725535e21797d3d9fea8963d99be0ba4c3aecadcf081b43e261458b416870") + version("3.4.4", sha256="b3e97d2fab7256d1c655c4075934725ba1cd7cb9237240a11bb22ccdad960337") + version("3.4.3", sha256="7a3cb831de5b4151e1f890113ed207527b7d4b16df9ec6b35e0964170007f426") + version("3.4.2", sha256="971e30c2436cf645f58552905105d75788bd9733bddbcb7c4fbff4c1a6d80c64") + version("3.4.1", sha256="02b1135d15ea969a3582caeb95594a05e830a6debcdb5b85ed2d5836a6a3fc78") + version("3.4.0", sha256="288e9ed42457c47720780433b3d5c3c20983048b789291cc6a7baa11f9428b91") + version("3.3.3", sha256="5ab768053a275084618fb669b4fbaadcc39158998a87e8465323829590bcfc6c") + version("3.3.2", sha256="d294ad21e9f574fb4828ebb3a94b8cb34f4f304a41687a994be00dd41a4e514c") + version("3.3.1", sha256="3dc59ae5831f5380f83c169bac2103ad052efe0ecec4ffa74bde4d85a0fda9e2") + version("3.3.0", sha256="9256b154b1a5993d844bee7b1955cd49c99ad72cef03cce3cd1bdca1310311e4") + version("3.2.5", sha256="60745672dce5ddc201806fa59f6d4e0ba6554d8ed78d0f9f0d79a629978f80b5") + version("3.2.3", sha256="b93b7d878138279234160f007cb9b7f81b8a72c012a15566e9ec5395cfd9b6c1") + version("3.2.2", sha256="9c9152e74134b68b0f3a1c7083764adc1cb56fd8336bec003fd0ca550cd2461d") + version("3.2.1", sha256="d59dbc3f04f4604a5cf0fb210b8ea703ef2438b3ee65fd5ab536ec5234f4c982") + version("3.2.0", sha256="f5ae953f18ba6f3d55b46556bbbf73441350f9fd22625402b723a2b81ff64f35") + version("3.1.3", sha256="07e98323935baa38079204bfb9414a029704bb9c0ca5ab317020ae521a377312") + version("3.1.2", sha256="bcd150afcae0e02f6efb5f35a6ab72432be82e849ec52ce0bb89d8c342a8fa7a") + + variant("X", default=False, description="Enable X11 support (TCLTK, PNG, JPEG, TIFF, CAIRO)") + variant("memory_profiling", default=False, description="Enable memory profiling") + variant("rmath", default=False, description="Build standalone Rmath library") + + depends_on("blas") + depends_on("lapack") + + depends_on("bzip2") + depends_on("curl+libidn2") + # R didn't anticipate the celebratory non-breaking major version bump of curl 8. + depends_on("curl@:7", when="@:4.2") + depends_on("icu4c") + depends_on("java") + depends_on("libtirpc") + depends_on("ncurses") + depends_on("pcre", when="@:3.6.3") + depends_on("pcre2", when="@4:") + depends_on("readline") + depends_on("xz") + depends_on("which", type=("build", "run")) + depends_on("zlib-api") + depends_on("zlib@1.2.5:", when="^[virtuals=zlib-api] zlib") + depends_on("texinfo", type="build") + + with when("+X"): + depends_on("cairo+X+gobject+pdf") + depends_on("pango+X") + depends_on("harfbuzz+graphite2") + depends_on("jpeg") + depends_on("libpng") + depends_on("libtiff") + depends_on("libx11") + depends_on("libxmu") + depends_on("libxt") + depends_on("tk") + + patch("zlib.patch", when="@:3.3.2") + + # R cannot be built with '-O2' optimization + # with Fujitsu Compiler @4.1.0 now. + # Until the Fujitsu compiler resolves this problem, + # temporary fix to lower the optimization level. + patch("change_optflags_tmp.patch", when="%fj@4.1.0") + + # Make R use a symlink to which in Sys.which, otherwise an absolute path + # gets stored as compressed byte code, which is not relocatable + patch("relocate-which.patch") + + # CVE-2024-27322 Patch only needed in R 4.3.3 and below; doesn't apply to R older than 3.5.0. + patch( + "https://github.com/r-devel/r-svn/commit/f7c46500f455eb4edfc3656c3fa20af61b16abb7.patch?full_index=1", + sha256="56c77763cb104aa9cb63420e585da63cb2c23bc03fa3ef9d088044eeff9d7380", + when="@3.5.0:4.3.3", + ) + + build_directory = "spack-build" + + # R custom URL version + def url_for_version(self, version): + """Handle R's customed URL versions""" + url = "https://cloud.r-project.org/src/base" + return url + "/R-%s/R-%s.tar.gz" % (version.up_to(1), version) + + @property + def etcdir(self): + return join_path(prefix, "rlib", "R", "etc") + + @run_after("install") + def install_rmath(self): + if "+rmath" in self.spec: + with working_dir(join_path(self.build_directory, "src", "nmath", "standalone")): + make() + make("install", parallel=False) + + def configure_args(self): + spec = self.spec + prefix = self.prefix + + extra_rpath = join_path(prefix, "rlib", "R", "lib") + + blas_flags: str = spec["blas"].libs.ld_flags + lapack_flags: str = spec["lapack"].libs.ld_flags + + # R uses LAPACK in Fortran, which requires libmkl_gf_* when gfortran is used. + # TODO: cleaning this up seem to require both compilers as dependencies and use variants. + if spec["lapack"].name in INTEL_MATH_LIBRARIES and "gfortran" in self.compiler.fc: + xlp64 = "ilp64" if spec["lapack"].satisfies("+ilp64") else "lp64" + blas_flags = blas_flags.replace(f"mkl_intel_{xlp64}", f"mkl_gf_{xlp64}") + lapack_flags = lapack_flags.replace(f"mkl_intel_{xlp64}", f"mkl_gf_{xlp64}") + + config_args = [ + "--with-internal-tzcode", + "--libdir={0}".format(join_path(prefix, "rlib")), + "--enable-R-shlib", + "--enable-R-framework=no", + "--without-recommended-packages", + f"LDFLAGS=-Wl,-rpath,{extra_rpath}", + f"--with-blas={blas_flags}", + f"--with-lapack={lapack_flags}", + # cannot disable docs with a normal configure option + "ac_cv_path_PDFLATEX=", + "ac_cv_path_PDFTEX=", + "ac_cv_path_TEX=", + "ac_cv_path_TEXI2DVI=", + ] + + if "+X" in spec: + config_args.append("--with-cairo") + config_args.append("--with-jpeglib") + config_args.append("--with-libpng") + config_args.append("--with-libtiff") + config_args.append("--with-tcltk") + config_args.append("--with-x") + + tcl_config_path = join_path(spec["tcl"].libs.directories[0], "tclConfig.sh") + config_args.append("--with-tcl-config={0}".format(tcl_config_path)) + + tk_config_path = join_path(spec["tk"].libs.directories[0], "tkConfig.sh") + config_args.append("--with-tk-config={0}".format(tk_config_path)) + else: + config_args.append("--without-cairo") + config_args.append("--without-jpeglib") + config_args.append("--without-libpng") + config_args.append("--without-libtiff") + config_args.append("--without-tcltk") + config_args.append("--without-x") + + if "+memory_profiling" in spec: + config_args.append("--enable-memory-profiling") + + # Set FPICFLAGS for compilers except 'gcc'. + if self.compiler.name != "gcc": + config_args.append("FPICFLAGS={0}".format(self.compiler.cc_pic_flag)) + + if self.spec.satisfies("@:3.6.1 %gcc@10:"): + config_args.append("CFLAGS=-fcommon") + config_args.append("FFLAGS=-fallow-argument-mismatch") + + return config_args + + @run_after("install") + def copy_makeconf(self): + # Make a copy of Makeconf because it will be needed to properly build R + # dependencies in Spack. + src_makeconf = join_path(self.etcdir, "Makeconf") + dst_makeconf = join_path(self.etcdir, "Makeconf.spack") + install(src_makeconf, dst_makeconf) + + # To respect order of execution, we should filter after we made the copy above + filter_compiler_wrappers("Makeconf", relative_root=os.path.join("rlib", "R", "etc")) + + # ======================================================================== + # Set up environment to make install easy for R extensions. + # ======================================================================== + + @property + def r_lib_dir(self): + return join_path("rlib", "R", "library") + + def setup_dependent_build_environment(self, env, dependent_spec): + # Set R_LIBS to include the library dir for the + # extension and any other R extensions it depends on. + r_libs_path = [] + for d in dependent_spec.traverse(deptype=("build", "run")): + if d.package.extends(self.spec): + r_libs_path.append(join_path(d.prefix, self.r_lib_dir)) + + r_libs_path = ":".join(r_libs_path) + env.set("R_LIBS", r_libs_path) + # R_LIBS_USER gets set to a directory in HOME/R if it is not set, such as + # during package installation with the --vanilla flag. Set it to null + # to ensure that it does not point to a directory that may contain R + # packages. + env.set("R_LIBS_USER", "") + env.set("R_MAKEVARS_SITE", join_path(self.etcdir, "Makeconf.spack")) + + # Use the number of make_jobs set in spack. The make program will + # determine how many jobs can actually be started. + env.set("MAKEFLAGS", "-j{0}".format(make_jobs)) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + def setup_dependent_run_environment(self, env, dependent_spec): + # For run time environment set only the path for dependent_spec and + # prepend it to R_LIBS + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + if dependent_spec.package.extends(self.spec): + env.prepend_path("R_LIBS", join_path(dependent_spec.prefix, self.r_lib_dir)) + + def setup_run_environment(self, env): + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib", "R", "lib")) + env.prepend_path("PKG_CONFIG_PATH", join_path(self.prefix, "rlib", "pkgconfig")) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + if "+rmath" in self.spec: + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib")) + + def setup_dependent_package(self, module, dependent_spec): + """Called before R modules' install() methods. In most cases, + extensions will only need to have one line: + R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir), + self.stage.source_path)""" + + # R extension builds can have a global R executable function + module.R = Executable(join_path(self.spec.prefix.bin, "R")) + + # Add variable for library directry + module.r_lib_dir = join_path(dependent_spec.prefix, self.r_lib_dir) + + # Make the site packages directory for extensions, if it does not exist + # already. + if dependent_spec.package.is_extension: + mkdirp(module.r_lib_dir) diff --git a/recipes/climana/24.7/repo/packages/r/package.py.back b/recipes/climana/24.7/repo/packages/r/package.py.back new file mode 100644 index 0000000..df61847 --- /dev/null +++ b/recipes/climana/24.7/repo/packages/r/package.py.back @@ -0,0 +1,262 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import re + +from spack.package import * + + +class R(AutotoolsPackage): + """R is 'GNU S', a freely available language and environment for + statistical computing and graphics which provides a wide variety of + statistical and graphical techniques: linear and nonlinear modelling, + statistical tests, time series analysis, classification, clustering, etc. + Please consult the R project homepage for further information.""" + + homepage = "https://www.r-project.org" + url = "https://cloud.r-project.org/src/base/R-3/R-3.4.3.tar.gz" + + extendable = True + + maintainers("glennpj") + + version("4.2.2", sha256="0ff62b42ec51afa5713caee7c4fde7a0c45940ba39bef8c5c9487fef0c953df5") + version("4.2.1", sha256="4d52db486d27848e54613d4ee977ad952ec08ce17807e1b525b10cd4436c643f") + version("4.2.0", sha256="38eab7719b7ad095388f06aa090c5a2b202791945de60d3e2bb0eab1f5097488") + version("4.1.3", sha256="15ff5b333c61094060b2a52e9c1d8ec55cc42dd029e39ca22abdaa909526fed6") + version("4.1.2", sha256="2036225e9f7207d4ce097e54972aecdaa8b40d7d9911cd26491fac5a0fab38af") + version("4.1.1", sha256="515e03265752257d0b7036f380f82e42b46ed8473f54f25c7b67ed25bbbdd364") + version("4.1.0", sha256="e8e68959d7282ca147360fc9644ada9bd161bab781bab14d33b8999a95182781") + version("4.0.5", sha256="0a3ee079aa772e131fe5435311ab627fcbccb5a50cabc54292e6f62046f1ffef") + version("4.0.4", sha256="523f27d69744a08c8f0bd5e1e6c3d89a4db29ed983388ba70963a3cd3a4a802e") + version("4.0.3", sha256="09983a8a78d5fb6bc45d27b1c55f9ba5265f78fa54a55c13ae691f87c5bb9e0d") + version("4.0.2", sha256="d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75") + version("4.0.1", sha256="95fe24a4d8d8f8f888460c8f5fe4311cec656e7a1722d233218bc03861bc6f32") + version("4.0.0", sha256="06beb0291b569978484eb0dcb5d2339665ec745737bdfb4e873e7a5a75492940") + version("3.6.3", sha256="89302990d8e8add536e12125ec591d6951022cf8475861b3690bc8bf1cefaa8f") + version("3.6.2", sha256="bd65a45cddfb88f37370fbcee4ac8dd3f1aebeebe47c2f968fd9770ba2bbc954") + version("3.6.1", sha256="5baa9ebd3e71acecdcc3da31d9042fb174d55a42829f8315f2457080978b1389") + version("3.6.0", sha256="36fcac3e452666158e62459c6fc810adc247c7109ed71c5b6c3ad5fc2bf57509") + version("3.5.3", sha256="2bfa37b7bd709f003d6b8a172ddfb6d03ddd2d672d6096439523039f7a8e678c") + version("3.5.2", sha256="e53d8c3cf20f2b8d7a9c1631b6f6a22874506fb392034758b3bb341c586c5b62") + version("3.5.1", sha256="0463bff5eea0f3d93fa071f79c18d0993878fd4f2e18ae6cf22c1639d11457ed") + version("3.5.0", sha256="fd1725535e21797d3d9fea8963d99be0ba4c3aecadcf081b43e261458b416870") + version("3.4.4", sha256="b3e97d2fab7256d1c655c4075934725ba1cd7cb9237240a11bb22ccdad960337") + version("3.4.3", sha256="7a3cb831de5b4151e1f890113ed207527b7d4b16df9ec6b35e0964170007f426") + version("3.4.2", sha256="971e30c2436cf645f58552905105d75788bd9733bddbcb7c4fbff4c1a6d80c64") + version("3.4.1", sha256="02b1135d15ea969a3582caeb95594a05e830a6debcdb5b85ed2d5836a6a3fc78") + version("3.4.0", sha256="288e9ed42457c47720780433b3d5c3c20983048b789291cc6a7baa11f9428b91") + version("3.3.3", sha256="5ab768053a275084618fb669b4fbaadcc39158998a87e8465323829590bcfc6c") + version("3.3.2", sha256="d294ad21e9f574fb4828ebb3a94b8cb34f4f304a41687a994be00dd41a4e514c") + version("3.3.1", sha256="3dc59ae5831f5380f83c169bac2103ad052efe0ecec4ffa74bde4d85a0fda9e2") + version("3.3.0", sha256="9256b154b1a5993d844bee7b1955cd49c99ad72cef03cce3cd1bdca1310311e4") + version("3.2.5", sha256="60745672dce5ddc201806fa59f6d4e0ba6554d8ed78d0f9f0d79a629978f80b5") + version("3.2.3", sha256="b93b7d878138279234160f007cb9b7f81b8a72c012a15566e9ec5395cfd9b6c1") + version("3.2.2", sha256="9c9152e74134b68b0f3a1c7083764adc1cb56fd8336bec003fd0ca550cd2461d") + version("3.2.1", sha256="d59dbc3f04f4604a5cf0fb210b8ea703ef2438b3ee65fd5ab536ec5234f4c982") + version("3.2.0", sha256="f5ae953f18ba6f3d55b46556bbbf73441350f9fd22625402b723a2b81ff64f35") + version("3.1.3", sha256="07e98323935baa38079204bfb9414a029704bb9c0ca5ab317020ae521a377312") + version("3.1.2", sha256="bcd150afcae0e02f6efb5f35a6ab72432be82e849ec52ce0bb89d8c342a8fa7a") + + variant( + "external-lapack", default=False, description="Links to externally installed BLAS/LAPACK" + ) + variant("X", default=False, description="Enable X11 support (TCLTK, PNG, JPEG, TIFF, CAIRO)") + variant("memory_profiling", default=False, description="Enable memory profiling") + variant("rmath", default=False, description="Build standalone Rmath library") + + depends_on("blas", when="+external-lapack") + depends_on("lapack", when="+external-lapack") + depends_on("bzip2") + # R didn't anticipate the celebratory + # non-breaking major version bump of curl 8. + depends_on("curl+libidn2@:7") + depends_on("icu4c") + depends_on("java") + depends_on("ncurses") + depends_on("pcre", when="@:3.6.3") + depends_on("pcre2", when="@4:") + depends_on("readline") + depends_on("xz") + depends_on("which", type=("build", "run")) + depends_on("zlib@1.2.5:") + depends_on("texinfo", type="build") + depends_on("cairo+X+gobject+pdf", when="+X") + depends_on("pango+X", when="+X") + depends_on("harfbuzz+graphite2", when="+X") + depends_on("jpeg", when="+X") + depends_on("libpng", when="+X") + depends_on("libtiff", when="+X") + depends_on("libx11", when="+X") + depends_on("libxmu", when="+X") + depends_on("libxt", when="+X") + depends_on("tk", when="+X") + + patch("zlib.patch", when="@:3.3.2") + + # R cannot be built with '-O2' optimization + # with Fujitsu Compiler @4.1.0 now. + # Until the Fujitsu compiler resolves this problem, + # temporary fix to lower the optimization level. + patch("change_optflags_tmp.patch", when="%fj@4.1.0") + + # R custom URL version + def url_for_version(self, version): + """Handle R's customed URL versions""" + url = "https://cloud.r-project.org/src/base" + return url + "/R-%s/R-%s.tar.gz" % (version.up_to(1), version) + + @property + def etcdir(self): + return join_path(prefix, "rlib", "R", "etc") + + @run_after("install") + def install_rmath(self): + if "+rmath" in self.spec: + with working_dir("src/nmath/standalone"): + make() + make("install", parallel=False) + + def configure_args(self): + spec = self.spec + prefix = self.prefix + + config_args = [ + "--libdir={0}".format(join_path(prefix, "rlib")), + "--enable-R-shlib", + "--enable-BLAS-shlib", + "--enable-R-framework=no", + "--without-recommended-packages", + "LDFLAGS=-L{0} -Wl,-rpath,{0}".format(join_path(prefix, "rlib", "R", "lib")), + # cannot disable docs with a normal configure option + "ac_cv_path_PDFLATEX=", + "ac_cv_path_PDFTEX=", + "ac_cv_path_TEX=", + "ac_cv_path_TEXI2DVI=", + ] + + if "+external-lapack" in spec: + if "^mkl" in spec and "gfortran" in self.compiler.fc: + mkl_re = re.compile(r"(mkl_)intel(_i?lp64\b)") + config_args.extend( + [ + mkl_re.sub( + r"\g<1>gf\g<2>", "--with-blas={0}".format(spec["blas"].libs.ld_flags) + ), + "--with-lapack", + ] + ) + else: + config_args.extend( + ["--with-blas={0}".format(spec["blas"].libs.ld_flags), "--with-lapack"] + ) + + if "+X" in spec: + config_args.append("--with-cairo") + config_args.append("--with-jpeglib") + config_args.append("--with-libpng") + config_args.append("--with-libtiff") + config_args.append("--with-tcltk") + config_args.append("--with-x") + + tcl_config_path = join_path(spec["tcl"].libs.directories[0], "tclConfig.sh") + config_args.append("--with-tcl-config={0}".format(tcl_config_path)) + + tk_config_path = join_path(spec["tk"].libs.directories[0], "tkConfig.sh") + config_args.append("--with-tk-config={0}".format(tk_config_path)) + else: + config_args.append("--without-cairo") + config_args.append("--without-jpeglib") + config_args.append("--without-libpng") + config_args.append("--without-libtiff") + config_args.append("--without-tcltk") + config_args.append("--without-x") + + if "+memory_profiling" in spec: + config_args.append("--enable-memory-profiling") + + # Set FPICFLAGS for compilers except 'gcc'. + if self.compiler.name != "gcc": + config_args.append("FPICFLAGS={0}".format(self.compiler.cc_pic_flag)) + + if self.spec.satisfies("@:3.6.1 %gcc@10:"): + config_args.append("CFLAGS=-fcommon") + config_args.append("FFLAGS=-fallow-argument-mismatch") + + return config_args + + @run_after("install") + def copy_makeconf(self): + # Make a copy of Makeconf because it will be needed to properly build R + # dependencies in Spack. + src_makeconf = join_path(self.etcdir, "Makeconf") + dst_makeconf = join_path(self.etcdir, "Makeconf.spack") + install(src_makeconf, dst_makeconf) + + # To respect order of execution, we should filter after we made the copy above + filter_compiler_wrappers("Makeconf", relative_root=os.path.join("rlib", "R", "etc")) + + # ======================================================================== + # Set up environment to make install easy for R extensions. + # ======================================================================== + + @property + def r_lib_dir(self): + return join_path("rlib", "R", "library") + + def setup_dependent_build_environment(self, env, dependent_spec): + # Set R_LIBS to include the library dir for the + # extension and any other R extensions it depends on. + r_libs_path = [] + for d in dependent_spec.traverse(deptype=("build", "run")): + if d.package.extends(self.spec): + r_libs_path.append(join_path(d.prefix, self.r_lib_dir)) + + r_libs_path = ":".join(r_libs_path) + env.set("R_LIBS", r_libs_path) + # R_LIBS_USER gets set to a directory in HOME/R if it is not set, such as + # during package installation with the --vanilla flag. Set it to null + # to ensure that it does not point to a directory that may contain R + # packages. + env.set("R_LIBS_USER", "") + env.set("R_MAKEVARS_SITE", join_path(self.etcdir, "Makeconf.spack")) + + # Use the number of make_jobs set in spack. The make program will + # determine how many jobs can actually be started. + env.set("MAKEFLAGS", "-j{0}".format(make_jobs)) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + def setup_dependent_run_environment(self, env, dependent_spec): + # For run time environment set only the path for dependent_spec and + # prepend it to R_LIBS + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + if dependent_spec.package.extends(self.spec): + env.prepend_path("R_LIBS", join_path(dependent_spec.prefix, self.r_lib_dir)) + + def setup_run_environment(self, env): + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib", "R", "lib")) + env.prepend_path("PKG_CONFIG_PATH", join_path(self.prefix, "rlib", "pkgconfig")) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + if "+rmath" in self.spec: + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib")) + + def setup_dependent_package(self, module, dependent_spec): + """Called before R modules' install() methods. In most cases, + extensions will only need to have one line: + R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir), + self.stage.source_path)""" + + # R extension builds can have a global R executable function + module.R = Executable(join_path(self.spec.prefix.bin, "R")) + + # Add variable for library directry + module.r_lib_dir = join_path(dependent_spec.prefix, self.r_lib_dir) + + # Make the site packages directory for extensions, if it does not exist + # already. + if dependent_spec.package.is_extension: + mkdirp(module.r_lib_dir) diff --git a/recipes/climana/24.7/repo/packages/r/relocate-which.patch b/recipes/climana/24.7/repo/packages/r/relocate-which.patch new file mode 100644 index 0000000..d8e18e1 --- /dev/null +++ b/recipes/climana/24.7/repo/packages/r/relocate-which.patch @@ -0,0 +1,52 @@ +From 3f2b1b6c94460fd4d3e9f03c9f17a25db2d2b473 Mon Sep 17 00:00:00 2001 +From: Harmen Stoppels +Date: Wed, 10 Jan 2024 12:40:40 +0100 +Subject: [PATCH] base: use a symlink for which instead of hard-coded string + +--- + share/make/basepkg.mk | 8 ++++---- + src/library/base/R/unix/system.unix.R | 6 +++--- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/share/make/basepkg.mk b/share/make/basepkg.mk +index c0a69c8a0af338ec002156236e47b9d7efea8165..4cf6387870915001cbb8b1439509ff4955cc67b1 100644 +--- a/share/make/basepkg.mk ++++ b/share/make/basepkg.mk +@@ -72,16 +72,16 @@ mkRbase: + else \ + cat $(RSRC) > "$${f}"; \ + fi; \ +- f2=$${TMPDIR:-/tmp}/R2$$$$; \ +- sed -e "s:@WHICH@:${WHICH}:" "$${f}" > "$${f2}"; \ +- rm -f "$${f}"; \ +- $(SHELL) $(top_srcdir)/tools/move-if-change "$${f2}" all.R) ++ $(SHELL) $(top_srcdir)/tools/move-if-change "$${f}" all.R) + @if ! test -f $(top_builddir)/library/$(pkg)/R/$(pkg); then \ + $(INSTALL_DATA) all.R $(top_builddir)/library/$(pkg)/R/$(pkg); \ + else if test all.R -nt $(top_builddir)/library/$(pkg)/R/$(pkg); then \ + $(INSTALL_DATA) all.R $(top_builddir)/library/$(pkg)/R/$(pkg); \ + fi \ + fi ++ @if ! test -f $(top_builddir)/library/$(pkg)/R/which; then \ ++ cd $(top_builddir)/library/$(pkg)/R/ && $(LN_S) $(WHICH) which; \ ++ fi + + mkdesc: + @if test -f DESCRIPTION; then \ +diff --git a/src/library/base/R/unix/system.unix.R b/src/library/base/R/unix/system.unix.R +index 3bb7d0cb27cc73a024bcea3e41e2e0c5c7e9648a..78271c8c12cb3217bc068e9d53ef9e3060e8dcc9 100644 +--- a/src/library/base/R/unix/system.unix.R ++++ b/src/library/base/R/unix/system.unix.R +@@ -114,9 +114,9 @@ system2 <- function(command, args = character(), + Sys.which <- function(names) + { + res <- character(length(names)); names(res) <- names +- ## hopefully configure found [/usr]/bin/which +- which <- "@WHICH@" +- if (!nzchar(which)) { ++ which <- file.path(R.home(), "library", "base", "R", "which") ++ ## which should be a symlink to the system's which ++ if (!file.exists(which)) { + warning("'which' was not found on this platform") + return(res) + } diff --git a/recipes/climana/24.7/repo/packages/r/zlib.patch b/recipes/climana/24.7/repo/packages/r/zlib.patch new file mode 100644 index 0000000..673d535 --- /dev/null +++ b/recipes/climana/24.7/repo/packages/r/zlib.patch @@ -0,0 +1,29 @@ +*** a/configure 2017-01-21 21:48:35.077000000 +0000 +--- b/configure 2017-01-21 21:50:50.700000000 +0000 +*************** +*** 35496,35505 **** + #include + #include + int main() { +! #ifdef ZLIB_VERSION +! /* Work around Debian bug: it uses 1.2.3.4 even though there was no such +! version on the master site zlib.net */ +! exit(strncmp(ZLIB_VERSION, "1.2.5", 5) < 0); + #else + exit(1); + #endif +--- 35496,35509 ---- + #include + #include + int main() { +! /* Checking ZLIB_VERNUM trick learned here: +! * https://github.com/TransitApp/protobuf/blob/master/configure.ac#L95 +! */ +! #ifdef ZLIB_VERNUM +! if (ZLIB_VERNUM < 0x1250) { +! exit(1); +! } +! exit(0); + #else + exit(1); + #endif diff --git a/recipes/icon/25.2/gh200/compilers.yaml b/recipes/icon/25.2/gh200/compilers.yaml new file mode 100644 index 0000000..34698b6 --- /dev/null +++ b/recipes/icon/25.2/gh200/compilers.yaml @@ -0,0 +1,9 @@ +bootstrap: + spec: gcc@12.3 +gcc: + specs: + - gcc@12.3 +llvm: + requires: gcc@13.3 + specs: + - nvhpc@25.1 diff --git a/recipes/icon/25.2/gh200/config.yaml b/recipes/icon/25.2/gh200/config.yaml new file mode 100644 index 0000000..5f9ad15 --- /dev/null +++ b/recipes/icon/25.2/gh200/config.yaml @@ -0,0 +1,6 @@ +name: icon +store: /user-environment +spack: + commit: releases/v0.22 + repo: https://github.com/spack/spack.git +description: Compilers and libraries required to build ICON diff --git a/recipes/icon/25.2/gh200/environments.yaml b/recipes/icon/25.2/gh200/environments.yaml new file mode 100644 index 0000000..24b3ace --- /dev/null +++ b/recipes/icon/25.2/gh200/environments.yaml @@ -0,0 +1,36 @@ +nvidia: + compiler: + - toolchain: gcc + spec: gcc + - toolchain: llvm + spec: nvhpc + unify: when_possible + mpi: + spec: cray-mpich@8.1.30%nvhpc + gpu: cuda + specs: + - boost%gcc ~mpi + - python@3.10% + - cuda@12.6 + - eccodes@2.25.0%nvhpc +tools +fortran +aec +openmp jp2k=jasper + - hdf5%nvhpc +szip +hl +fortran +mpi + - netcdf-c%nvhpc + - netcdf-cxx4%nvhpc + - netcdf-fortran%nvhpc + - osu-micro-benchmarks@5.9%nvhpc + - openblas@0.3.21%nvhpc + # everything needed for nccl on SS11 + - nccl%gcc + - nccl-tests%gcc + # extras + - libfyaml + - zlib-ng + - cmake + variants: + - cuda_arch=90 + - +mpi + - +cuda + packages: [] + views: + default: + link: roots diff --git a/recipes/icon/25.2/gh200/extra/reframe.yaml b/recipes/icon/25.2/gh200/extra/reframe.yaml new file mode 100644 index 0000000..363f809 --- /dev/null +++ b/recipes/icon/25.2/gh200/extra/reframe.yaml @@ -0,0 +1,6 @@ +default: + features: [osu-micro-benchmarks, mpi, serial, openmp] + cc: mpicc + cxx: mpic++ + ftn: mpifort + activation: /user-environment/env/default/activate.sh diff --git a/recipes/icon/25.2/gh200/modules.yaml b/recipes/icon/25.2/gh200/modules.yaml new file mode 100644 index 0000000..a4010ae --- /dev/null +++ b/recipes/icon/25.2/gh200/modules.yaml @@ -0,0 +1,26 @@ +modules: + # Paths to check when creating modules for all module sets + prefix_inspections: + bin: + - PATH + lib: + - LD_LIBRARY_PATH + lib64: + - LD_LIBRARY_PATH + + default: + arch_folder: false + # Where to install modules + roots: + tcl: /snap/modules + tcl: + all: + autoload: run + hash_length: 0 + hide_implicits: true + exclude: + - '%gcc@7.5.0' + - '%gcc@12' + - 'gcc %gcc@7.5.0' + projections: + all: '{name}/{version}' diff --git a/recipes/mch/readme.md b/recipes/mch/readme.md new file mode 100644 index 0000000..cbbd7ac --- /dev/null +++ b/recipes/mch/readme.md @@ -0,0 +1,61 @@ +The software stacks for MCH, for use on Balfrin and Tasna. + +## Versioning + +The MCH software stack is released as versions: v1, v2, v3, etc, which are mounted at `/user-environment/v[123...]`, not the default `/user-environment` mount point. +These mount points are created specifically on the MCH systems. + +Notes about the versions are available on the CSCS internal confluence: + +https://confluence.cscs.ch/display/MCH/Balfrin+PE + +**Note**: the pipeline is only configured to build `v7` and `v8`, however the recipes for `v5` and `v6` are retained while these images are mounted on Balfrin and Tasna. + +Recipes for v1-v4 are removed, because it is no longer possible to build them on Balfrin and Tasna due to system upgrades. + +## Building + +The CI/CD pipeline builds the MCH software stacks to be mounted at the standard `/user-environment` mount point. +This makes it easy to build release candidates and test them using the `uenv` command line tool. + +We still build the software stack that is mounted permanantly "by hand", because it is mounted at the `/mch-environment/$version` mount point. + +Note that we can + +```bash +#!/bin/bash + +export TAG=balfrin-v5 +# set the mount point - development/testing versions are installed directly on +# $SCRATCH. The deployment version at /mch-environment/vX the build has to be +# rerun with MOUNT set appropriately +export MOUNT=/mch-environment/v8 +export CACHE_PATH=$SCRATCH/uenv-cache/ + +mkdir work +cd work +work=$(pwd) + +echo === getting stackinator +git clone --quiet git@github.com:eth-cscs/stackinator.git +(cd stackinator; ./bootstrap.sh) +export PATH=$work/stackinator/bin:$PATH + +echo === getting recipe +git clone --quiet git@github.com:C2SM/software-stack-recipes.git +# optionally you might have to switch to a tag/commit/branch +#(cd alps-uenv && git checkout $TAG) +recipes=$work/alps-uenv/recipes + +echo === getting cluster configuration +git clone --quiet git@github.com:eth-cscs/alps-cluster-config.git +systems=$work/alps-cluster-config + +# Note, you will need to have created a key: +# https://eth-cscs.github.io/stackinator/build-caches/ +echo "root: $CACHE_PATH" > cache.yaml +echo "key: $CACHE_PATH/push-key.gpg" >> cache.yaml + +echo === configuring the build stack +stack-config -b /dev/shm/mch-stack/build -r $recipes/mch/a100 -s $systems/balfrin -c ./cache.yaml -m $MOUNT +``` diff --git a/recipes/mch/v5/compilers.yaml b/recipes/mch/v5/compilers.yaml new file mode 100644 index 0000000..8baf3d6 --- /dev/null +++ b/recipes/mch/v5/compilers.yaml @@ -0,0 +1,9 @@ +bootstrap: + spec: gcc@11 +gcc: + specs: + - gcc@11.3 +llvm: + requires: gcc@11 + specs: + - nvhpc@23.3 diff --git a/recipes/mch/v5/config.yaml b/recipes/mch/v5/config.yaml new file mode 100644 index 0000000..03192f6 --- /dev/null +++ b/recipes/mch/v5/config.yaml @@ -0,0 +1,6 @@ +name: mch-balfrin +store: /user-environment +spack: + commit: releases/v0.19 + repo: https://github.com/spack/spack.git +description: The compiler toolchains, libraries and tools required for the MCH production software stack. diff --git a/recipes/mch/v5/environments.yaml b/recipes/mch/v5/environments.yaml new file mode 100644 index 0000000..c418073 --- /dev/null +++ b/recipes/mch/v5/environments.yaml @@ -0,0 +1,110 @@ +tools: + compiler: + - toolchain: gcc + spec: gcc@11.3 + unify: when_possible + specs: + - ccache + - cmake@3.24 + - python@3.7 + - python@3.10 + - libtree + - meson + - ninja + - tmux + - tree + - ruby@3.1.0 + - r@4.0.5 + packages: + - perl + views: + tools: + exclude: ['python@3.7'] +prgenv-nvidia: + compiler: + - toolchain: gcc + spec: gcc@11.3 + - toolchain: llvm + spec: nvhpc + unify: when_possible + mpi: + spec: cray-mpich@8.1.18.4 + gpu: cuda + packages: + - perl + - curl + - gmake + - autoconf + - automake + specs: + - osu-micro-benchmarks@5.9%nvhpc + - cuda@11.8 + - eccodes@2.25.0%nvhpc +tools +fortran +aec +openmp jp2k=jasper + - eccodes@2.19.1%nvhpc +tools +fortran +aec +openmp jp2k=jasper + - netcdf-c@4.8.1%nvhpc + - netcdf-fortran@4.5.4%nvhpc + - hdf5@1.12.2%nvhpc +szip +hl +fortran +mpi + - openblas@0.3.21%nvhpc + - libfyaml@0.7.12%nvhpc + # Explicitly concretise the packages below with gcc as they shouldn't be + # built with nvhpc. + - ca-certificates-mozilla%gcc + - jasper%gcc + - libaec%gcc + - libiconv%gcc + - libjpeg-turbo%gcc + - libtool%gcc + - libxml2%gcc + - m4%gcc + - nasm%gcc + - ncurses%gcc + - openssl%gcc + - patchelf%gcc + - pkgconf%gcc + - xz%gcc + - zlib%gcc + - nco@5.0.1%gcc + - cdo@2.0.5%gcc + variants: + - cuda_arch=80 + - +mpi + - +cuda + views: + prgenv-icon: + exclude: ['eccodes@2.19.1'] +prgenv-gcc: + compiler: + - toolchain: gcc + spec: gcc@11.3 + unify: when_possible + mpi: + spec: cray-mpich@8.1.18.4 + gpu: cuda + packages: + - perl + - curl + specs: + - cuda@11.8 + - osu-micro-benchmarks@5.9 + - openblas@0.3.21 + - libfyaml@0.7.12 + - hdf5@1.12.2 +fortran +threadsafe ~mpi + - hdf5@1.12.2 +fortran +threadsafe +mpi + - netlib-scalapack@2.2.0 + - eccodes@2.25.0 +tools +fortran +aec +openmp jp2k=jasper + - eccodes@2.19.1 +tools +fortran +aec +openmp jp2k=jasper + - netcdf-c@4.8.1+mpi ^hdf5+mpi api=v18 + - netcdf-c@4.8.1~mpi ^hdf5~mpi api=v18 + - netcdf-fortran@4.5.4 ^netcdf-c+mpi + - netcdf-fortran@4.5.4 ^netcdf-c~mpi + variants: + - cuda_arch=80 + - +mpi + - +cuda + views: + prgenv-gcc-serial: + exclude: + - hdf5+mpi + - netcdf-c+mpi + - netcdf-fortran ^netcdf-c+mpi + - eccodes@2.25.0 diff --git a/recipes/mch/v5/modules.yaml b/recipes/mch/v5/modules.yaml new file mode 100644 index 0000000..dc7ad15 --- /dev/null +++ b/recipes/mch/v5/modules.yaml @@ -0,0 +1,75 @@ +modules: + # Paths to check when creating modules for all module sets + prefix_inspections: + bin: + - PATH + lib: + - LD_LIBRARY_PATH + lib64: + - LD_LIBRARY_PATH + lib/pkgconfig: + - PKG_CONFIG_PATH + lib64/pkgconfig: + - PKG_CONFIG_PATH + + default: + arch_folder: false + # Where to install modules + roots: + tcl: /user-environment/modules + tcl: + all: + autoload: none + eccodes: + environment: + set: + ECCODES_DIR: '{prefix}' + ECCODES_INCLUDE: '{prefix}/include' + ECCODES_VERSION: '{version}' + netlib-scalapack: + environment: + set: + NETLIB_SCALAPACK_ROOT: '{prefix}' + openblas: + environment: + set: + OPENBLAS_ROOT: '{prefix}' + netcdf-c: + environment: + set: + NETCDF_C_ROOT: '{prefix}' + hash_length: 0 + exclude_implicits: true + include: + - cuda + - hdf5 + - zlib+shared + exclude: + - '%gcc@7.5.0' + - 'gcc %gcc@7.5.0' + - 'autoconf' + - 'automake' + - 'c-blosc' + - 'ca-certificates-mozilla' + - 'diffutils' + - 'gnuconfig' + - 'jasper' + - 'libaec' + - 'libiconv' + - 'libtool' + - 'libxcrypt' + - 'patchelf' + - 'pkgconf' + - 'm4' + - 'ncurses' + - 'openssl' + - 'xz' + projections: + all: '{name}/{version}-{compiler.name}' + nvhpc: '{name}/{version}' + gcc: '{name}/{version}' + cray-mpich: 'cray-mpich-binary/{version}' + python: '{name}/{version}' + hdf5%gcc~mpi: '{name}/{version}-serial-{compiler.name}' + netcdf-c~mpi: '{name}/{version}-serial-{compiler.name}' + netcdf-fortran^netcdf-c~mpi: '{name}/{version}-serial-{compiler.name}' diff --git a/recipes/mch/v5/repo/packages/nvhpc/package.py b/recipes/mch/v5/repo/packages/nvhpc/package.py new file mode 100644 index 0000000..43318d5 --- /dev/null +++ b/recipes/mch/v5/repo/packages/nvhpc/package.py @@ -0,0 +1,463 @@ +# 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) +# +# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + +import platform + +from spack.package import * +from spack.util.prefix import Prefix + +# FIXME Remove hack for polymorphic versions +# This package uses a ugly hack to be able to dispatch, given the same +# version, to different binary packages based on the platform that is +# running spack. See #13827 for context. +# If you need to add a new version, please be aware that: +# - versions in the following dict are automatically added to the package +# - version tuple must be in the form (checksum, url) +# - checksum must be sha256 +# - package key must be in the form '{os}-{arch}' where 'os' is in the +# format returned by platform.system() and 'arch' by platform.machine() +_versions = { + "23.3": { + "Linux-aarch64": ( + "48c837de0b1d2dc31c313b19da752d27527e706cb4150c7a6185a4218fc24ef3", + "https://developer.download.nvidia.com/hpc-sdk/23.3/nvhpc_2023_233_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "0f2b5b2fff8ffed13428c55809841b4abd3dfe61e2b1a866bbe959e4bcd50223", + "https://developer.download.nvidia.com/hpc-sdk/23.3/nvhpc_2023_233_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "b94d2b4ae5a23c1a0af7d5b07c785f5057850fe3a6ee5ba0aacdde1019af5d12", + "https://developer.download.nvidia.com/hpc-sdk/23.3/nvhpc_2023_233_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "23.1": { + "Linux-aarch64": ( + "5b430e03752954ea62ac1c745b1735cfdaa43b2e981a9412c1465ecb0412fff6", + "https://developer.download.nvidia.com/hpc-sdk/23.1/nvhpc_2023_231_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "81759e7c747bf4f552b75e7657301f76ecc0828b94fe860f81108c6e83e6ad2b", + "https://developer.download.nvidia.com/hpc-sdk/23.1/nvhpc_2023_231_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "55a064415f6d4ce6a01823ee27ebd266f4fb579679871e7c1a7c054bdc18e9f5", + "https://developer.download.nvidia.com/hpc-sdk/23.1/nvhpc_2023_231_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.11": { + "Linux-aarch64": ( + "e60e798657c33b06754d33dfd5ab3bea2882d4a9b9476102303edf2bbe3b7a95", + "https://developer.download.nvidia.com/hpc-sdk/22.11/nvhpc_2022_2211_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "ef800203cf6040b3a5df24f19944b272f62caee8362875bcb394e86dc1de2353", + "https://developer.download.nvidia.com/hpc-sdk/22.11/nvhpc_2022_2211_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "cb91b3a04368457d5cfe3c0e9c0611591fdc8076b01ea977343fe7db7fdcfa3c", + "https://developer.download.nvidia.com/hpc-sdk/22.11/nvhpc_2022_2211_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.9": { + "Linux-aarch64": ( + "bc4473f04b49bc9a26f08c17a72360650ddf48a3b6eefacdc525d79c8d730f30", + "https://developer.download.nvidia.com/hpc-sdk/22.9/nvhpc_2022_229_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "9aac31d36bb09f6653544978021f5b78c272112e7748871566f7e930f5e7475b", + "https://developer.download.nvidia.com/hpc-sdk/22.9/nvhpc_2022_229_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "aebfeb826ace3dabf9699f72390ca0340f8789a8ef6fe4032e3c7b794f073ea3", + "https://developer.download.nvidia.com/hpc-sdk/22.9/nvhpc_2022_229_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.7": { + "Linux-aarch64": ( + "2aae3fbfd2d0d2d09448a36166c42311368f5600c7c346f159c280b412fe924a", + "https://developer.download.nvidia.com/hpc-sdk/22.7/nvhpc_2022_227_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "6dd4fd382c22769e4fa9508714119abd7d1df3dc58c69414a14b0b0dbc34564f", + "https://developer.download.nvidia.com/hpc-sdk/22.7/nvhpc_2022_227_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "3ce1c346f8bc7e50defb41c545c8907fdc012ff60b27eb8985cf3213f19d863a", + "https://developer.download.nvidia.com/hpc-sdk/22.7/nvhpc_2022_227_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.5": { + "Linux-aarch64": ( + "ceeee84e6227e973ad1beded6008d330e3790f7c4598b948fa530fedfa830a16", + "https://developer.download.nvidia.com/hpc-sdk/22.5/nvhpc_2022_225_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "54d1e45664352d0f9f85ab476dd39496dd1b290e0e1221d3bf63afb940dbe16d", + "https://developer.download.nvidia.com/hpc-sdk/22.5/nvhpc_2022_225_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "7674bcf7a77570fafee5b8299959c9e998a9a10bb27904335cf1a58b71766137", + "https://developer.download.nvidia.com/hpc-sdk/22.5/nvhpc_2022_225_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.3": { + "Linux-aarch64": ( + "e0ea1cbb726556f6879f4b5dfe17238f8e7680c772368577945a85c0e08328f0", + "https://developer.download.nvidia.com/hpc-sdk/22.3/nvhpc_2022_223_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "5e80db6010adc85fe799dac961ae69e43fdf18d35243666c96a70ecdb80bd280", + "https://developer.download.nvidia.com/hpc-sdk/22.3/nvhpc_2022_223_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "bc60a6faf2237bf20550718f71079a714563fa85df62c341cb833f70eb2fe7bb", + "https://developer.download.nvidia.com/hpc-sdk/22.3/nvhpc_2022_223_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.2": { + "Linux-aarch64": ( + "a8241d1139a768d9a0066d1853748160e4098253024e17e997983884d0d33a19", + "https://developer.download.nvidia.com/hpc-sdk/22.2/nvhpc_2022_222_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "f84f72423452968d5bbe02e297f188682c4759864a736a72b32acb3433db3a26", + "https://developer.download.nvidia.com/hpc-sdk/22.2/nvhpc_2022_222_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "8dfb4007d6912b2722946358ac69409592c1f03426d81971ffbcb6fc5fea2cb8", + "https://developer.download.nvidia.com/hpc-sdk/22.2/nvhpc_2022_222_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.1": { + "Linux-aarch64": ( + "05cfa8c520a34eab01272a261b157d421a9ff7129fca7d859b944ce6a16d2255", + "https://developer.download.nvidia.com/hpc-sdk/22.1/nvhpc_2022_221_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "9fa9b64fba2c9b287b5800693417d8065c695d18cab0526bad41d9aecc8be2b3", + "https://developer.download.nvidia.com/hpc-sdk/22.1/nvhpc_2022_221_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "7e4366509ed9031ff271e73327dd3121909902a81ac436307801a5373efaff5e", + "https://developer.download.nvidia.com/hpc-sdk/22.1/nvhpc_2022_221_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.11": { + "Linux-aarch64": ( + "3b11bcd9cca862fabfce1e7bcaa2050ea12130c7e897f4e7859ba4c155d20720", + "https://developer.download.nvidia.com/hpc-sdk/21.11/nvhpc_2021_2111_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "ac51ed92de4eb5e1bdb064ada5bbace5b89ac732ad6c6473778edfb8d29a6527", + "https://developer.download.nvidia.com/hpc-sdk/21.11/nvhpc_2021_2111_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "d8d8ccd0e558d22bcddd955f2233219c96f7de56aa8e09e7be833e384d32d6aa", + "https://developer.download.nvidia.com/hpc-sdk/21.11/nvhpc_2021_2111_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.9": { + "Linux-aarch64": ( + "52c2c66e30043add4afccedf0ba77daa0000bf42e0db844baa630bb635b91a7d", + "https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2021_219_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "cff0b55fb782be1982bfeec1d9763b674ddbf84ff2c16b364495299266320289", + "https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2021_219_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "7de6a6880fd7e59afe0dee51f1fae4d3bff1ca0fb8ee234b24e1f2fdff23ffc9", + "https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2021_219_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.7": { + "Linux-aarch64": ( + "73eb3513845b59645f118b1e313472f54519dc252d5f5c32a05df2a2a8a19878", + "https://developer.download.nvidia.com/hpc-sdk/21.7/nvhpc_2021_217_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "37ea23b5a9c696fb3fdb82855643afc4e02aea618102ec801206441f10fc9fba", + "https://developer.download.nvidia.com/hpc-sdk/21.7/nvhpc_2021_217_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "49d6e23492d131474698cf12971722d42e13a54a4eddec382e66e1053b4ac902", + "https://developer.download.nvidia.com/hpc-sdk/21.7/nvhpc_2021_217_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.5": { + "Linux-aarch64": ( + "1a1748cd7cf538199d92ab3b1208935fa4a62708ba21125aeadb328ddc7380d4", + "https://developer.download.nvidia.com/hpc-sdk/21.5/nvhpc_2021_215_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "4674931a5ce28724308cb9cebd546eefa3f0646d3d08adbea28ba5ad27f0c163", + "https://developer.download.nvidia.com/hpc-sdk/21.5/nvhpc_2021_215_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "21989e52c58a6914743631c8200de1fec7e10b3449c6c1833f3032ee74b85f8e", + "https://developer.download.nvidia.com/hpc-sdk/21.5/nvhpc_2021_215_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.3": { + "Linux-aarch64": ( + "88e0dbf8fcdd06a2ba06aacf65ae1625b8683688f6593ed3bf8ce129ce1b17b7", + "https://developer.download.nvidia.com/hpc-sdk/21.3/nvhpc_2021_213_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "08cd0cd6c80d633f107b44f88685ada7f014fbf6eac19ef5ae4a7952cabe4037", + "https://developer.download.nvidia.com/hpc-sdk/21.3/nvhpc_2021_213_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "391d5604a70f61bdd4ca6a3e4692f6f2391948990c8a35c395b6867341890031", + "https://developer.download.nvidia.com/hpc-sdk/21.3/nvhpc_2021_213_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.2": { + "Linux-aarch64": ( + "fe19c0232f7c9534f8699b7432483c9cc649f1e92e7f0961d1aa7c54d83297ff", + "https://developer.download.nvidia.com/hpc-sdk/21.2/nvhpc_2021_212_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "6b69b6e4ebec6a91b9f1627384c50adad79ebdd25dfb20a5f64cf01c3a07f11a", + "https://developer.download.nvidia.com/hpc-sdk/21.2/nvhpc_2021_212_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "a3e3393040185ae844002fbc6c8eb4ffdfb97ce8b2ce29d796fe7e9a521fdc59", + "https://developer.download.nvidia.com/hpc-sdk/21.2/nvhpc_2021_212_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.1": { + "Linux-aarch64": ( + "b276e7c0ff78cee837a597d9136cd1d8ded27a9d1fdae1e7d674e2a072a9a6aa", + "https://developer.download.nvidia.com/hpc-sdk/21.1/nvhpc_2021_211_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "bc236c212097bac6b7d04d627d9cc6b75bb6cd473a0b6a1bf010559ce328a2b0", + "https://developer.download.nvidia.com/hpc-sdk/21.1/nvhpc_2021_211_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "d529daf46404724ac3f005be4239f2c30e53f5220bb9453f367dccc3a74d6b41", + "https://developer.download.nvidia.com/hpc-sdk/21.1/nvhpc_2021_211_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "20.11": { + "Linux-aarch64": ( + "2f26ca45b07b694b8669e4f761760d4f7faa8d032b21e430adee1af0a27032c1", + "https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc_2020_2011_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "99e5a5437e82f3914e0fe81feb761a5b599a3fe8b31f3c2cac8ae47e8cdc7b0f", + "https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc_2020_2011_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "c80fc26e5ba586696f7030f03054c1aaca0752a891c7923faf47eb23b66857ec", + "https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc_2020_2011_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "20.9": { + "Linux-aarch64": ( + "3bfb3d17f5ee99998bcc30d738e818d3b94b828e2d8da7db48bf152a01e22023", + "https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc_2020_209_Linux_aarch64_cuda_11.0.tar.gz", + ), + "Linux-ppc64le": ( + "b2966d4047e1dfd981ce63b333ab9c0acbdc2a6a505fa217456ac9fa3b8e7474", + "https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc_2020_209_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "fe665ab611b03846a90bd70ca4e08c1e59ab527364b971ed0304e0ae73c778d8", + "https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc_2020_209_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "20.7": { + "Linux-aarch64": ( + "5b83ca1919199ac0aa609309b31c345c5a6453dd3131fddeef9e3ee9059a0e9b", + "https://developer.download.nvidia.com/hpc-sdk/20.7/nvhpc_2020_207_Linux_aarch64_cuda_11.0.tar.gz", + ), + "Linux-ppc64le": ( + "800ead240bdf61611910b2f6df24ee1d7359377ff3767c923738dd81fcea9312", + "https://developer.download.nvidia.com/hpc-sdk/20.7/nvhpc_2020_207_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "a5c5c8726d2210f2310a852c6d6e03c9ef8c75e3643e9c94e24909f5e9c2ea7a", + "https://developer.download.nvidia.com/hpc-sdk/20.7/nvhpc_2020_207_Linux_x86_64_cuda_multi.tar.gz", + ), + }, +} + + +class Nvhpc(Package): + """The NVIDIA HPC SDK is a comprehensive suite of compilers, libraries + and tools essential to maximizing developer productivity and the + performance and portability of HPC applications. The NVIDIA HPC + SDK C, C++, and Fortran compilers support GPU acceleration of HPC + modeling and simulation applications with standard C++ and + Fortran, OpenACC directives, and CUDA. GPU-accelerated math + libraries maximize performance on common HPC algorithms, and + optimized communications libraries enable standards-based + multi-GPU and scalable systems programming. Performance profiling + and debugging tools simplify porting and optimization of HPC + applications.""" + + homepage = "https://developer.nvidia.com/hpc-sdk" + + maintainers = ["samcmill"] + + tags = ["e4s"] + + for ver, packages in _versions.items(): + key = "{0}-{1}".format(platform.system(), platform.machine()) + pkg = packages.get(key) + if pkg: + version(ver, sha256=pkg[0], url=pkg[1]) + + variant("blas", default=True, description="Enable BLAS") + variant( + "install_type", + default="single", + values=("single", "network"), + multi=False, + description="Network installs are for installations shared " + "by different operating systems", + ) + variant("lapack", default=True, description="Enable LAPACK") + variant("mpi", default=False, description="Enable MPI") + + provides("blas", when="+blas") + provides("lapack", when="+lapack") + provides("mpi", when="+mpi") + + # TODO: effectively gcc is a direct dependency of nvhpc, but we cannot express that + # properly. For now, add conflicts for non-gcc compilers instead. + for __compiler in spack.compilers.supported_compilers(): + if __compiler != "gcc": + conflicts("%{0}".format(__compiler), msg="nvhpc must be installed with %gcc") + + def _version_prefix(self): + return join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version) + + def setup_build_environment(self, env): + env.set("NVHPC_SILENT", "true") + env.set("NVHPC_ACCEPT_EULA", "accept") + env.set("NVHPC_INSTALL_DIR", self.prefix) + + if self.spec.variants["install_type"].value == "network": + local_dir = join_path(self._version_prefix(), "share_objects") + env.set("NVHPC_INSTALL_TYPE", "network") + env.set("NVHPC_INSTALL_LOCAL_DIR", local_dir) + else: + env.set("NVHPC_INSTALL_TYPE", "single") + + def install(self, spec, prefix): + compilers_bin = join_path(self._version_prefix(), "compilers", "bin") + install = Executable("./install") + makelocalrc = Executable(join_path(compilers_bin, "makelocalrc")) + + makelocalrc_args = [ + "-gcc", + self.compiler.cc, + "-gpp", + self.compiler.cxx, + "-g77", + self.compiler.f77, + "-x", + compilers_bin, + ] + if self.spec.variants["install_type"].value == "network": + local_dir = join_path(self._version_prefix(), "share_objects") + makelocalrc_args.extend(["-net", local_dir]) + + # Run install script + install() + + # Update localrc to use Spack gcc + makelocalrc(*makelocalrc_args) + + def setup_run_environment(self, env): + prefix = Prefix( + join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version, "compilers") + ) + + env.set("CC", join_path(prefix.bin, "nvc")) + env.set("CXX", join_path(prefix.bin, "nvc++")) + env.set("F77", join_path(prefix.bin, "nvfortran")) + env.set("FC", join_path(prefix.bin, "nvfortran")) + + env.prepend_path("PATH", prefix.bin) + env.prepend_path("LIBRARY_PATH", prefix.lib) + env.prepend_path("LD_LIBRARY_PATH", prefix.lib) + env.prepend_path("MANPATH", prefix.man) + + if "+mpi" in self.spec: + mpi_prefix = Prefix( + join_path( + self.prefix, + "Linux_%s" % self.spec.target.family, + self.version, + "comm_libs", + "mpi", + ) + ) + env.prepend_path("PATH", mpi_prefix.bin) + env.prepend_path("LD_LIBRARY_PATH", mpi_prefix.lib) + + def setup_dependent_build_environment(self, env, dependent_spec): + prefix = Prefix( + join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version, "compilers") + ) + + env.prepend_path("LIBRARY_PATH", prefix.lib) + env.prepend_path("LD_LIBRARY_PATH", prefix.lib) + + if "+mpi" in self.spec: + mpi_prefix = Prefix( + join_path( + self.prefix, + "Linux_%s" % self.spec.target.family, + self.version, + "comm_libs", + "mpi", + ) + ) + + env.prepend_path("LD_LIBRARY_PATH", mpi_prefix.lib) + + def setup_dependent_package(self, module, dependent_spec): + if "+mpi" in self.spec or self.provides("mpi"): + mpi_prefix = Prefix( + join_path( + self.prefix, + "Linux_%s" % self.spec.target.family, + self.version, + "comm_libs", + "mpi", + ) + ) + + self.spec.mpicc = join_path(mpi_prefix.bin, "mpicc") + self.spec.mpicxx = join_path(mpi_prefix.bin, "mpicxx") + self.spec.mpif77 = join_path(mpi_prefix.bin, "mpif77") + self.spec.mpifc = join_path(mpi_prefix.bin, "mpif90") + + @property + def libs(self): + prefix = Prefix( + join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version, "compilers") + ) + libs = [] + + if "+blas" in self.spec: + libs.append("libblas") + + if "+lapack" in self.spec: + libs.append("liblapack") + libs.append("libnvf") + + return find_libraries(libs, root=prefix, recursive=True) + + # Avoid binding stub libraries by absolute path + non_bindable_shared_objects = ["stubs"] diff --git a/recipes/mch/v6/compilers.yaml b/recipes/mch/v6/compilers.yaml new file mode 100644 index 0000000..6ed5956 --- /dev/null +++ b/recipes/mch/v6/compilers.yaml @@ -0,0 +1,9 @@ +bootstrap: + spec: gcc@11 +gcc: + specs: + - gcc@11.3 +llvm: + requires: gcc@11.3 + specs: + - nvhpc@24.1 diff --git a/recipes/mch/v6/config.yaml b/recipes/mch/v6/config.yaml new file mode 100644 index 0000000..7d09e55 --- /dev/null +++ b/recipes/mch/v6/config.yaml @@ -0,0 +1,6 @@ +name: mch +store: /mch-environment/v6 +spack: + commit: releases/v0.19 + repo: https://github.com/spack/spack.git +description: The compiler toolchains, libraries and tools required for the MCH production software stack. diff --git a/recipes/mch/v6/environments.yaml b/recipes/mch/v6/environments.yaml new file mode 100644 index 0000000..c5d6aba --- /dev/null +++ b/recipes/mch/v6/environments.yaml @@ -0,0 +1,109 @@ +tools: + compiler: + - toolchain: gcc + spec: gcc + unify: when_possible + specs: + - cmake@3.24 + - python@3.7 + - python@3.10 + - libtree + - tree + - ruby@3.1.0 + - r@4.0.5 + packages: + - perl + views: + tools: + exclude: ['python@3.7'] +prgenv-nvidia: + compiler: + - toolchain: gcc + spec: gcc + - toolchain: llvm + spec: nvhpc + unify: when_possible + mpi: + spec: cray-mpich@8.1.26%nvhpc + gpu: cuda + packages: + - perl + - curl + - gmake + - autoconf + - automake + specs: + - osu-micro-benchmarks@5.9%nvhpc + - cuda@11.8 + - eccodes@2.25.0%nvhpc +tools +fortran +aec +openmp jp2k=jasper + - eccodes@2.19.1%nvhpc +tools +fortran +aec +openmp jp2k=jasper + - netcdf-c@4.8.1%nvhpc + - netcdf-fortran@4.5.4%nvhpc + - hdf5@1.12.2%nvhpc +szip +hl +fortran +mpi + - openblas@0.3.21%nvhpc + - libfyaml@0.7.12%nvhpc + # Explicitly concretise the packages below with gcc as they shouldn't be + # built with nvhpc. + - ca-certificates-mozilla%gcc + - jasper%gcc + - libaec%gcc + - libiconv%gcc + - libjpeg-turbo%gcc + - libtool%gcc + - libxml2%gcc + - m4%gcc + - nasm%gcc + - ncurses%gcc + - openssl%gcc + - patchelf%gcc + - pkgconf%gcc + - xz%gcc + - zlib%gcc + - nco@5.0.1%gcc + - cdo@2.0.5%gcc + variants: + - cuda_arch=80 + - +mpi + - +cuda + views: + prgenv-icon: + exclude: ['eccodes@2.19.1'] + link: roots +prgenv-gcc: + compiler: + - toolchain: gcc + spec: gcc + unify: when_possible + mpi: + spec: cray-mpich@8.1.26 + gpu: cuda + packages: + - perl + - curl + - libx11 + specs: + - cuda@11.8 + - osu-micro-benchmarks@5.9 + - openblas@0.3.21 + - libfyaml@0.7.12 + - hdf5@1.12.2 +fortran +threadsafe ~mpi + - hdf5@1.12.2 +fortran +threadsafe +mpi + - netlib-scalapack@2.2.0 + - eccodes@2.25.0 +tools +fortran +aec +openmp jp2k=jasper + - eccodes@2.19.1 +tools +fortran +aec +openmp jp2k=jasper + - netcdf-c@4.8.1+mpi ^hdf5+mpi api=v18 + - netcdf-c@4.8.1~mpi ^hdf5~mpi api=v18 + - netcdf-fortran@4.5.4 ^netcdf-c+mpi + - netcdf-fortran@4.5.4 ^netcdf-c~mpi + variants: + - cuda_arch=80 + - +mpi + - +cuda + views: + prgenv-gcc-serial: + exclude: + - hdf5+mpi + - netcdf-c+mpi + - netcdf-fortran ^netcdf-c+mpi + - eccodes@2.25.0 + link: roots diff --git a/recipes/mch/v6/modules.yaml b/recipes/mch/v6/modules.yaml new file mode 100644 index 0000000..6b82de3 --- /dev/null +++ b/recipes/mch/v6/modules.yaml @@ -0,0 +1,75 @@ +modules: + # Paths to check when creating modules for all module sets + prefix_inspections: + bin: + - PATH + lib: + - LD_LIBRARY_PATH + lib64: + - LD_LIBRARY_PATH + lib/pkgconfig: + - PKG_CONFIG_PATH + lib64/pkgconfig: + - PKG_CONFIG_PATH + + default: + arch_folder: false + # Where to install modules + roots: + tcl: /user-environment/modules + tcl: + all: + autoload: none + eccodes: + environment: + set: + ECCODES_DIR: '{prefix}' + ECCODES_INCLUDE: '{prefix}/include' + ECCODES_VERSION: '{version}' + netlib-scalapack: + environment: + set: + NETLIB_SCALAPACK_ROOT: '{prefix}' + openblas: + environment: + set: + OPENBLAS_ROOT: '{prefix}' + netcdf-c: + environment: + set: + NETCDF_C_ROOT: '{prefix}' + hash_length: 0 + exclude_implicits: true + include: + - cuda + - hdf5 + - zlib+shared + exclude: + - '%gcc@7.5.0' + - 'gcc %gcc@7.5.0' + - 'autoconf' + - 'automake' + - 'c-blosc' + - 'ca-certificates-mozilla' + - 'diffutils' + - 'gnuconfig' + - 'jasper' + - 'libaec' + - 'libiconv' + - 'libtool' + - 'libxcrypt' + - 'patchelf' + - 'pkgconf' + - 'm4' + - 'ncurses' + - 'openssl' + - 'xz' + projections: + all: '{name}/{version}-{compiler.name}' + nvhpc: '{name}/{version}' + gcc: '{name}/{version}' + cray-mpich: 'cray-mpich-{compiler.name}/{version}' + python: '{name}/{version}' + hdf5%gcc~mpi: '{name}/{version}-serial-{compiler.name}' + netcdf-c~mpi: '{name}/{version}-serial-{compiler.name}' + netcdf-fortran^netcdf-c~mpi: '{name}/{version}-serial-{compiler.name}' diff --git a/recipes/mch/v6/readme.md b/recipes/mch/v6/readme.md new file mode 100644 index 0000000..15e567d --- /dev/null +++ b/recipes/mch/v6/readme.md @@ -0,0 +1,4 @@ +This software stack uses spack v0.19, which requires a specially patched version of stackinator. + +* use the `mch-v6-v0.19` branch of stackinator. +* use a separate build cache, because v0.19 caches are not compatible with v0.20 or later diff --git a/recipes/mch/v6/repo/packages/aws-ofi-nccl/package.py b/recipes/mch/v6/repo/packages/aws-ofi-nccl/package.py new file mode 100644 index 0000000..51347b6 --- /dev/null +++ b/recipes/mch/v6/repo/packages/aws-ofi-nccl/package.py @@ -0,0 +1,66 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class AwsOfiNccl(AutotoolsPackage): + """AWS OFI NCCL is a plug-in which enables EC2 developers to use + libfabric as a network provider while running NVIDIA's NCCL based + applications.""" + + homepage = "https://github.com/aws/aws-ofi-nccl" + git = "https://github.com/aws/aws-ofi-nccl.git" + url = "https://github.com/aws/aws-ofi-nccl.git" + + #maintainers("bvanessen") + + version("master", branch="master") + version("v1.7.4", + sha256="cca529da330d3155ae1502c21365d62159254bca6bfc0482afd35e7eaa927090", + url="https://github.com/aws/aws-ofi-nccl/releases/download/v1.7.4-aws/aws-ofi-nccl-1.7.4-aws.tar.gz", + ) + + variant("trace", default=False, description="Enable printing trace messages") + variant("tests", default=False, description="Build tests") + + depends_on("libfabric") + depends_on("cuda") + depends_on("nccl") + depends_on("mpi") + depends_on("hwloc") + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + + # To enable this plug-in to work with NCCL add it to the LD_LIBRARY_PATH + def setup_run_environment(self, env): + aws_ofi_nccl_home = self.spec.prefix + env.append_path("LD_LIBRARY_PATH", aws_ofi_nccl_home.lib) + + # To enable this plug-in to work with NCCL add it to the LD_LIBRARY_PATH + def setup_dependent_run_environment(self, env, dependent_spec): + aws_ofi_nccl_home = self.spec["aws-ofi-nccl"].prefix + env.append_path("LD_LIBRARY_PATH", aws_ofi_nccl_home.lib) + + def configure_args(self): + spec = self.spec + args = [] + + # Always set configure's external paths to use the Spack + # provided dependencies + args.extend( + [ + "--with-libfabric={0}".format(spec["libfabric"].prefix), + "--with-cuda={0}".format(spec["cuda"].prefix), + "--with-nccl={0}".format(spec["nccl"].prefix), + "--with-mpi={0}".format(spec["mpi"].prefix), + ] + ) + + args.extend(self.enable_or_disable("trace")) + args.extend(self.enable_or_disable("tests")) + + return args diff --git a/recipes/mch/v6/repo/packages/cray-gtl/package.py b/recipes/mch/v6/repo/packages/cray-gtl/package.py new file mode 100644 index 0000000..37dc967 --- /dev/null +++ b/recipes/mch/v6/repo/packages/cray-gtl/package.py @@ -0,0 +1,123 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import platform + +import spack.compilers +from spack.package import * + +_versions = { + "8.1.29": { + "Linux-aarch64": "321bc3bc3c17f38d199e0ccae87cc931f69ca58238385f1e6a6165a2fbe94a71", + }, + "8.1.28": { + "Linux-aarch64": "0bb881cba502b199dadce7875bba62e7403e1c55abc6669c76a7cba7c05fa5ad", + "Linux-x86_64": "2e82c618648e79bdc4b8bf9394be8fd59c34ccd77f172afd11fce38beca1ecab", + }, + "8.1.27": { + "Linux-x86_64": "80c7e94d30b5a3573ac6b2cc5fb0373046760a0acdff44a178e723ab3c8fdfb9" + }, + "8.1.26": { + "Linux-x86_64": "37d9626cb5f851f63c9799c18a419354c6f21c77f90558472552156df9eef311" + }, + "8.1.25": { + "Linux-x86_64": "a2e2af2037e63b64ef74d870c0bab91a8109e75eef82a30250b81b0d785ff6ae" + }, + "8.1.24": { + "Linux-x86_64": "2fa8635f829e67844e7b30dffb092a336d257e0e769d2225030f2ccf4c1d302f" + }, + "8.1.23": { + "Linux-x86_64": "034667c2ea49eec76ef8f79494231bad94884b99683edabf781beed01ec681e4" + }, + "8.1.21": { + "Linux-x86_64": "78072edfcb6cc24cfefab06e824111b5b2b839551235ece68cd154bec7936a24" + }, + "8.1.18": { + "Linux-x86_64": "79c24203a27b67d3aa15ebaab6121e7e72e8a2be61622876179f694a7fb4399c" + }, +} + + +class CrayGtl(Package): + """Install cray-gtl""" + + homepage = "https://www.hpe.com/us/en/compute/hpc/hpc-software.html" + url = "https://jfrog.svc.cscs.ch/artifactory/cray-mpich/cray-gtl-8.1.26.tar.gz" + #maintainers = ["bcumming", "simonpintarelli"] + + for ver, packages in _versions.items(): + key = "{0}-{1}".format(platform.system(), platform.machine()) + sha = packages.get(key) + if sha: + version( + ver, + sha256=sha, + url=f"https://jfrog.svc.cscs.ch/artifactory/cray-mpich/cray-gtl-{ver}.{platform.machine()}.tar.gz", + ) + + variant("cuda", default=False) + variant("rocm", default=False) + conflicts("+cuda", when="+rocm", msg="Pick either CUDA or ROCM") + + # Fix up binaries with patchelf. + depends_on("patchelf", type="build") + + conflicts("+cuda", when="+rocm", msg="Pick either CUDA or ROCM") + + with when("+cuda"): + depends_on("cuda@11.0:11", type="link", when="@:8.1.26") + depends_on("cuda@12.0:12", type="link", when="@8.1.27:") + + with when("+rocm"): + # libamdhip64.so.5 + depends_on("hip@5:", type="link") + # libhsa-runtime64.so.1 + depends_on("hsa-rocr-dev", type="link") + + def get_rpaths(self): + # Those rpaths are already set in the build environment, so + # let's just retrieve them. + pkgs = os.getenv("SPACK_RPATH_DIRS", "").split(":") + compilers = os.getenv("SPACK_COMPILER_IMPLICIT_RPATHS", "").split(":") + return ":".join([p for p in pkgs + compilers if p]) + + def should_patch(self, file): + # Returns true if non-symlink ELF file. + if os.path.islink(file): + return False + try: + with open(file, "rb") as f: + return f.read(4) == b"\x7fELF" + except OSError: + return False + + def install(self, spec, prefix): + install_tree(".", prefix) + + @property + def libs(self): + if "+cuda" in self.spec: + return find_libraries("libmpi_gtl_cuda", root=self.prefix, shared=True) + if "+rocm" in self.spec: + return find_libraries("libmpi_gtl_hsa", root=self.prefix, shared=True) + + @run_after("install") + def fixup_binaries(self): + patchelf = which("patchelf") + rpath = self.get_rpaths() + for root, _, files in os.walk(self.prefix): + for name in files: + f = os.path.join(root, name) + if not self.should_patch(f): + continue + patchelf("--force-rpath", "--set-rpath", rpath, f, fail_on_error=False) + # The C compiler wrapper can fail because libmpi_gtl_cuda refers to the symbol + # __gxx_personality_v0 but wasn't linked against libstdc++. + if "libmpi_gtl_cuda.so" in str(f): + patchelf("--add-needed", "libstdc++.so", f, fail_on_error=False) + if "@8.1.27+cuda" in self.spec: + patchelf("--add-needed", "libcudart.so", f, fail_on_error=False) + patchelf("--add-needed", "libcuda.so", f, fail_on_error=False) diff --git a/recipes/mch/v6/repo/packages/cray-mpich/package.py b/recipes/mch/v6/repo/packages/cray-mpich/package.py new file mode 100644 index 0000000..57ca977 --- /dev/null +++ b/recipes/mch/v6/repo/packages/cray-mpich/package.py @@ -0,0 +1,210 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import platform + +import spack.compilers +from spack.package import * + +_versions = { + "8.1.29": { + "Linux-aarch64": "2fc5d1f5743f9cecc0b5dbf13355c25014f96db2386b5c2c2d8495a57b279381", + }, + "8.1.28": { + "Linux-aarch64": "dfd6c685adfbf070fe9d546d95b31e108ee7089a738447fa7326973a3e696e8d", + "Linux-x86_64": "55a0a068bd8bff14f302c5371d7e2b4cf732d5c1ec875bb03e375644e1a6beab", + }, + "8.1.27": { + "Linux-x86_64": "5d59cc69b7ae2ef692ae49843bb2c7a44b5a8478d72eaf2ab1f1f6c5983eee0b" + }, + "8.1.26": { + "Linux-x86_64": "d308cf3e254ce5873af6caee5ec683a397fed5ce92975f57e5c9215a98d8edad" + }, + "8.1.25": { + "Linux-x86_64": "024ab0c4526670a37df7e2995172ba264454fd69c05d8ffe140c9e519397a65c" + }, + "8.1.24": { + "Linux-x86_64": "2c3fa339511ed822892e112d3e4d5a39a634d00a31cf22e02ce843f0efcc5ae8" + }, + "8.1.23": { + "Linux-x86_64": "ed7ff286ede30ea96dede4c53aa2ef98e8090c988a0bea764cd505ba5fcc0520" + }, + "8.1.21": { + "Linux-x86_64": "5fda115f356c26e5d9f8cc68fe578e954a70edd10ebf007182d945345886b61a" + }, + "8.1.18": { + "Linux-x86_64": "f7feafd204502d0dab449ff22da138c933ec22d7de3d5e30fbb9a62fc9cdf237" + }, +} + + +class CrayMpich(Package): + """Install cray-mpich as a binary package""" + + """Intended to override the main cray-mpich""" + + homepage = "https://www.hpe.com/us/en/compute/hpc/hpc-software.html" + url = "https://jfrog.svc.cscs.ch/artifactory/cray-mpich/cray-mpich-8.1.26.tar.gz" + #maintainers = ["bcumming"] + for ver, packages in _versions.items(): + key = "{0}-{1}".format(platform.system(), platform.machine()) + sha = packages.get(key) + if sha: + version( + ver, + sha256=sha, + url=f"https://jfrog.svc.cscs.ch/artifactory/cray-mpich/cray-mpich-{ver}.{platform.machine()}.tar.gz", + ) + + variant("cuda", default=False) + variant("rocm", default=False) + + conflicts("+cuda", when="+rocm", msg="Pick either CUDA or ROCM") + + provides("mpi") + + # Fix up binaries with patchelf. + depends_on("patchelf", type="build") + + for ver in [ + "8.1.18", + "8.1.21", + "8.1.23", + "8.1.24", + "8.1.25", + "8.1.26", + "8.1.27", + "8.1.28", + "8.1.29", + ]: + with when("+cuda"): + depends_on(f"cray-gtl@{ver} +cuda", type="link", when="@" + ver) + with when("+rocm"): + depends_on(f"cray-gtl@{ver} +rocm", type="link", when="@" + ver) + + depends_on("libfabric@1:", type="link") + + depends_on("cray-pmi", type="link") + depends_on("xpmem", type="link") + + conflicts("%gcc@:7") + conflicts("%gcc@:11", when="@8.1.28:") + + def setup_run_environment(self, env): + env.set("MPICC", join_path(self.prefix.bin, "mpicc")) + env.set("MPICXX", join_path(self.prefix.bin, "mpic++")) + env.set("MPIF77", join_path(self.prefix.bin, "mpif77")) + env.set("MPIF90", join_path(self.prefix.bin, "mpif90")) + + def setup_dependent_build_environment(self, env, dependent_spec): + self.setup_run_environment(env) + env.set("MPICH_CC", dependent_spec.package.module.spack_cc) + env.set("MPICH_CXX", dependent_spec.package.module.spack_cxx) + env.set("MPICH_FC", dependent_spec.package.module.spack_fc) + + def setup_dependent_package(self, module, dependent_spec): + self.spec.mpicc = join_path(self.prefix.bin, "mpicc") + self.spec.mpicxx = join_path(self.prefix.bin, "mpic++") + self.spec.mpifc = join_path(self.prefix.bin, "mpif90") + self.spec.mpif77 = join_path(self.prefix.bin, "mpif77") + + def get_rpaths(self): + # Those rpaths are already set in the build environment, so + # let's just retrieve them. + pkgs = os.getenv("SPACK_RPATH_DIRS", "").split(":") + compilers = os.getenv("SPACK_COMPILER_IMPLICIT_RPATHS", "").split(":") + return ":".join([p for p in pkgs + compilers if p]) + + def should_patch(self, file): + # Returns true if non-symlink ELF file. + if os.path.islink(file): + return False + try: + with open(file, "rb") as f: + return f.read(4) == b"\x7fELF" + except OSError: + return False + + def install(self, spec, prefix): + if "%nvhpc" in self.spec: + install_tree("mpich-nvhpc", prefix) + elif "%gcc" in self.spec: + install_tree("mpich-gcc", prefix) + + @run_after("install") + def fixup_binaries(self): + patchelf = which("patchelf") + rpath = self.get_rpaths() + for root, _, files in os.walk(self.prefix): + for name in files: + f = os.path.join(root, name) + if not self.should_patch(f): + continue + patchelf("--force-rpath", "--set-rpath", rpath, f, fail_on_error=False) + patchelf("--add-needed", "libxpmem.so", f, fail_on_error=False) + if "+cuda" in self.spec: + patchelf("--add-needed", "libmpi_gtl_cuda.so", f, fail_on_error=False) + if "+rocm" in self.spec: + patchelf("--add-needed", "libmpi_gtl_hsa.so", f, fail_on_error=False) + + @run_after("install") + def fixup_compiler_paths(self): + filter_file("@@CC@@", self.compiler.cc, self.prefix.bin.mpicc, string=True) + filter_file("@@CXX@@", self.compiler.cxx, self.prefix.bin.mpicxx, string=True) + filter_file("@@FC@@", self.compiler.fc, self.prefix.bin.mpifort, string=True) + + filter_file("@@PREFIX@@", self.prefix, self.prefix.bin.mpicc, string=True) + filter_file("@@PREFIX@@", self.prefix, self.prefix.bin.mpicxx, string=True) + filter_file("@@PREFIX@@", self.prefix, self.prefix.bin.mpifort, string=True) + + # link with the relevant gtl lib + if "+cuda" in self.spec: + lpath = self.spec["cray-gtl"].prefix.lib + gtl_library = f"-L{lpath} -Wl,-rpath,{lpath} -lmpi_gtl_cuda" + elif "+rocm" in self.spec: + lpath = self.spec["cray-gtl"].prefix.lib + gtl_library = f"-L{lpath} -Wl,-rpath,{lpath} -lmpi_gtl_hsa" + else: + gtl_library = "" + print("==== GTL_LIBRARY", gtl_library) + filter_file("@@GTL_LIBRARY@@", gtl_library, self.prefix.bin.mpicc, string=True) + filter_file("@@GTL_LIBRARY@@", gtl_library, self.prefix.bin.mpicxx, string=True) + filter_file( + "@@GTL_LIBRARY@@", gtl_library, self.prefix.bin.mpifort, string=True + ) + + @property + def headers(self): + hdrs = find_headers("mpi", self.prefix.include, recursive=True) + hdrs += find_headers( + "cray_version", self.prefix.include, recursive=True + ) # cray_version.h + # cray-mpich depends on cray-pmi + # hdrs += find_headers("pmi", self.prefix.include, recursive=True) # See cray-pmi package + hdrs.directories = os.path.dirname(hdrs[0]) + return hdrs + + @property + def libs(self): + query_parameters = self.spec.last_query.extra_parameters + + libraries = ["libmpi", "libmpich"] + + if "f77" in query_parameters: + libraries.extend(["libmpifort", "libmpichfort", "libfmpi", "libfmpich"]) + + if "f90" in query_parameters: + libraries.extend(["libmpif90", "libmpichf90"]) + + libs = [] + for lib_folder in [self.prefix.lib, self.prefix.lib64]: + libs += find_libraries(libraries, root=lib_folder, recursive=True) + # cray-mpich depends on cray-pmi + # libs += find_libraries("libpmi", root=lib_folder, recursive=True) + libs += find_libraries("libopa", root=lib_folder, recursive=True) + libs += find_libraries("libmpl", root=lib_folder, recursive=True) + + return libs diff --git a/recipes/mch/v6/repo/packages/cray-pals/package.py b/recipes/mch/v6/repo/packages/cray-pals/package.py new file mode 100644 index 0000000..6d307c9 --- /dev/null +++ b/recipes/mch/v6/repo/packages/cray-pals/package.py @@ -0,0 +1,89 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import platform + +import spack.compilers +from spack.package import * + +_versions = { + "1.3.2": { + "Linux-aarch64": "f7b97a10cc8dde17e804f79235ab1aa98f83e0c7c178e58d6ca3e9170f89c6da", + "Linux-x86_64": "deea749476de0f545b31fcd0912f133d7ba60b84f673e47d8b4b15d5a117254c", + }, + "1.2.12": { + "Linux-x86_64": "c94d29c09ed650c4e98a236df7ced77f027bdf987919a91a1a1382f704a85bb9" + }, + "1.2.11": { + "Linux-x86_64": "e1af09e39d70e28381de806548c6cb29c23abf891a078f46eb71c301a3f0994c" + }, + "1.2.9": { + "Linux-x86_64": "ceec6f99bea9df3f7f657a7df499445e62976064dda3f3e437d61e895ec31601" + }, + "1.2.5": { + "Linux-x86_64": "d7269ed8f4deab816e3d4006090ec68b25ccc585200d16728ed9a914baf4d9bf" + }, + "1.2.4": { + "Linux-x86_64": "a253939585bad2bb9061b98be6e517f18bda0602ecfd38f75c734a01d12003f2" + }, + "1.2.0": { + "Linux-x86_64": "6f5c71aa4dd2f591b899ea693cae7a5319d859f69d8c46b7ee244fed8c094d10" + }, +} + + +class CrayPals(Package): + """Install cray-pals""" + + """Intended to override the main cray-pals""" + + homepage = "https://www.hpe.com/us/en/compute/hpc/hpc-software.html" + url = "https://jfrog.svc.cscs.ch/artifactory/cray-mpich/cray-pals-1.2.12.tar.gz" + #maintainers = ["simonpintarelli"] + + for ver, packages in _versions.items(): + key = "{0}-{1}".format(platform.system(), platform.machine()) + sha = packages.get(key) + if sha: + version( + ver, + sha256=sha, + url=f"https://jfrog.svc.cscs.ch/artifactory/cray-mpich/cray-pals-{ver}.{platform.machine()}.tar.gz", + ) + + # Fix up binaries with patchelf. + depends_on("patchelf", type="build") + + def get_rpaths(self): + # Those rpaths are already set in the build environment, so + # let's just retrieve them. + pkgs = os.getenv("SPACK_RPATH_DIRS", "").split(":") + compilers = os.getenv("SPACK_COMPILER_IMPLICIT_RPATHS", "").split(":") + return ":".join([p for p in pkgs + compilers if p]) + + def should_patch(self, file): + # Returns true if non-symlink ELF file. + if os.path.islink(file): + return False + try: + with open(file, "rb") as f: + return f.read(4) == b"\x7fELF" + except OSError: + return False + + def install(self, spec, prefix): + install_tree(".", prefix) + + @run_after("install") + def fixup_binaries(self): + patchelf = which("patchelf") + rpath = self.get_rpaths() + for root, _, files in os.walk(self.prefix): + for name in files: + f = os.path.join(root, name) + if not self.should_patch(f): + continue + patchelf("--force-rpath", "--set-rpath", rpath, f, fail_on_error=False) diff --git a/recipes/mch/v6/repo/packages/cray-pmi/package.py b/recipes/mch/v6/repo/packages/cray-pmi/package.py new file mode 100644 index 0000000..1949121 --- /dev/null +++ b/recipes/mch/v6/repo/packages/cray-pmi/package.py @@ -0,0 +1,107 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import platform + +import spack.compilers +from spack.package import * + +_versions = { + "6.1.14": { + "Linux-aarch64": "763933310db675c3e690c9a121778c2ddc3a0b8672cb718542888e31099e25c7", + }, + "6.1.13": { + "Linux-aarch64": "f865f410145a66bb05520c32ee5b64b6dfcb9ae33aace6d3db5f870e4f4714bc", + "Linux-x86_64": "217ac554cf84a4c7f08cd149c6a18428e1e3533d73e350fa291b6800895b632e", + }, + "6.1.12": { + "Linux-x86_64": "d1a4bd929b73197823dd9b4bcb3c8ef06d80326297a07291b24e5996b60330a8" + }, + "6.1.11": { + "Linux-x86_64": "5ebcece6a610da02cd41a9a386fd7463ee909bd55e3370d6d372603f90be9afe" + }, + "6.1.10": { + "Linux-x86_64": "f4fbe75c201a171dcfe6ada773a4bf0c606767a0b7a8a76fd19d10852abe1290" + }, + "6.1.9": { + "Linux-x86_64": "8fd4194c6c5167f8b81b1cf9b76341669e40d647d0caecef287be6f0f5d95290" + }, + "6.1.8": { + "Linux-x86_64": "6c7e5d3038e26b9d0e82428b25b570d00401a6fc9f2fd3c008f15a253a8e2305" + }, + "6.1.7": { + "Linux-x86_64": "574b21bd6f8970521c2bc4f096aced896fec8b749f854272cc7bbb7130ae92d8" + }, + "6.0.17": { + "Linux-x86_64": "5f15cd577c6c082888fcf0f76f0f5a898ddfa32370e1c32ffe926912d4d4dad0" + }, +} + + +class CrayPmi(Package): + """Install cray-pmi""" + + """Intended to override the main cray-pmi""" + + homepage = "https://www.hpe.com/us/en/compute/hpc/hpc-software.html" + url = "https://jfrog.svc.cscs.ch/artifactory/cray-mpich/cray-pmi-6.1.11.tar.gz" + #maintainers = ["bcumming", "simonpintarelli"] + + for ver, packages in _versions.items(): + key = "{0}-{1}".format(platform.system(), platform.machine()) + sha = packages.get(key) + if sha: + version( + ver, + sha256=sha, + url=f"https://jfrog.svc.cscs.ch/artifactory/cray-mpich/cray-pmi-{ver}.{platform.machine()}.tar.gz", + ) + + # Fix up binaries with patchelf. + depends_on("patchelf", type="build") + + depends_on("cray-pals@1.3.2", type="link", when="@6.1.13:") + depends_on("cray-pals@1.2.12", type="link", when="@6.1.11:6.1.12") + depends_on("cray-pals@1.2.11", type="link", when="@6.1.10") + depends_on("cray-pals@1.2.9", type="link", when="@6.1.9") + depends_on("cray-pals@1.2.5", type="link", when="@6.1.8") + depends_on("cray-pals@1.2.4", type="link", when="@6.1.7") + depends_on("cray-pals@1.2.0", type="link", when="@6.0.17") + + def get_rpaths(self): + # Those rpaths are already set in the build environment, so + # let's just retrieve them. + pkgs = os.getenv("SPACK_RPATH_DIRS", "").split(":") + compilers = os.getenv("SPACK_COMPILER_IMPLICIT_RPATHS", "").split(":") + return ":".join([p for p in pkgs + compilers if p]) + + def should_patch(self, file): + # Returns true if non-symlink ELF file. + if os.path.islink(file): + return False + try: + with open(file, "rb") as f: + return f.read(4) == b"\x7fELF" + except OSError: + return False + + def install(self, spec, prefix): + install_tree(".", prefix) + + @property + def libs(self): + return find_libraries(["libmpi", "libpmi2"], root=self.prefix, shared=True) + + @run_after("install") + def fixup_binaries(self): + patchelf = which("patchelf") + rpath = self.get_rpaths() + for root, _, files in os.walk(self.prefix): + for name in files: + f = os.path.join(root, name) + if not self.should_patch(f): + continue + patchelf("--force-rpath", "--set-rpath", rpath, f, fail_on_error=False) diff --git a/recipes/mch/v6/repo/packages/cuda/package.py b/recipes/mch/v6/repo/packages/cuda/package.py new file mode 100644 index 0000000..bcb1c03 --- /dev/null +++ b/recipes/mch/v6/repo/packages/cuda/package.py @@ -0,0 +1,705 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import platform +import re +from glob import glob + +import llnl.util.tty as tty + +from spack.package import * + +# FIXME Remove hack for polymorphic versions +# This package uses a ugly hack to be able to dispatch, given the same +# version, to different binary packages based on the platform that is +# running spack. See #13827 for context. +# If you need to add a new version, please be aware that: +# - versions in the following dict are automatically added to the package +# - version tuple must be in the form (checksum, url) +# - checksum must be sha256 +# - package key must be in the form '{os}-{arch}' where 'os' is in the +# format returned by platform.system() and 'arch' by platform.machine() + +preferred_ver = "11.8.0" +_versions = { + "12.4.0": { + "Linux-aarch64": ( + "b12bfe6c36d32ecf009a6efb0024325c5fc389fca1143f5f377ae2555936e803", + "https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux_sbsa.run", + ), + "Linux-x86_64": ( + "e6a842f4eca9490575cdb68b6b1bb78d47b95a897de48dee292c431892e57d17", + "https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run", + ), + }, + "12.3.0": { + "Linux-aarch64": ( + "9a8fb8acf46b88faf0d711bda3149e1706efbbae02fcb40ab72addfd0e9ce5df", + "https://developer.download.nvidia.com/compute/cuda/12.3.0/local_installers/cuda_12.3.0_545.23.06_linux_sbsa.run", + ), + "Linux-x86_64": ( + "7c13face3af64d6e1648d6e3101d31c8111e747143acb0077d973c1690820422", + "https://developer.download.nvidia.com/compute/cuda/12.3.0/local_installers/cuda_12.3.0_545.23.06_linux.run", + ), + "Linux-ppc64le": ( + "de15c04380ec35b194c07503bf434837bac5b427cf77b19a63962b1653d195d5", + "https://developer.download.nvidia.com/compute/cuda/12.3.0/local_installers/cuda_12.3.0_545.23.06_linux_ppc64le.run", + ), + }, + "12.2.1": { + "Linux-aarch64": ( + "a9ae6bd02684c7acfb229484368bf2691d592767ce1aed10ae9aed92c81b9f09", + "https://developer.download.nvidia.com/compute/cuda/12.2.1/local_installers/cuda_12.2.1_535.86.10_linux_sbsa.run", + ), + "Linux-x86_64": ( + "c51e814eaa756160a73289b1f35880cc38c18e1ddedc87f46f7ff0d1696bdb95", + "https://developer.download.nvidia.com/compute/cuda/12.2.1/local_installers/cuda_12.2.1_535.86.10_linux.run", + ), + "Linux-ppc64le": ( + "8f1aa60cc1e14fd7853eeecd53a78b7dfb2b2da0512a312cc35e4f5b79454f94", + "https://developer.download.nvidia.com/compute/cuda/12.2.1/local_installers/cuda_12.2.1_535.86.10_linux_ppc64le.run", + ), + }, + "12.2.0": { + "Linux-aarch64": ( + "9c90d79bb63952cd30f1f57f9f8fe11e7a8967bba6f824df45d3464b5d37e5d8", + "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux_sbsa.run", + ), + "Linux-x86_64": ( + "ecf3d2afadcbac029f0f4505785810d52d006e4b87ba79ff3f984336a2bbf518", + "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run", + ), + "Linux-ppc64le": ( + "f7b5fde5f727b51c380c6199200d0525e8585475944ff8ad2791d06734f54230", + "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux_ppc64le.run", + ), + }, + "12.1.1": { + "Linux-aarch64": ( + "45ea4cd860f0a26d3db8ce032530f2ee0b55abdd587545213d395a73623b4278", + "https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda_12.1.1_530.30.02_linux_sbsa.run", + ), + "Linux-x86_64": ( + "d74022d41d80105319dfa21beea39b77a5b9919539c0487a05caaf2446d6a70e", + "https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda_12.1.1_530.30.02_linux.run", + ), + "Linux-ppc64le": ( + "c5950381f2c01fd52692372fc8e51d599e940ada2af2c82c3cc854ecff933eae", + "https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda_12.1.1_530.30.02_linux_ppc64le.run", + ), + }, + "12.1.0": { + "Linux-aarch64": ( + "1d0dd884f5257c12471dc455dc1a4aee8d620191737c0b2e40f016d8adc9d009", + "https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux_sbsa.run", + ), + "Linux-x86_64": ( + "68699036c12d71adb9ad2799dce2ff070270fab4488b90920b9756ab3f52c41c", + "https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run", + ), + "Linux-ppc64le": ( + "8d75bd9da953a51062b89b8c752cffcf02b02c85cb461291d354ac2cffb2da48", + "https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux_ppc64le.run", + ), + }, + "12.0.1": { + "Linux-aarch64": ( + "835270a8db419b9dbaefc1bab8fe5caf6f2caf381975c4b0d35cc0718c26074a", + "https://developer.download.nvidia.com/compute/cuda/12.0.1/local_installers/cuda_12.0.1_525.85.12_linux_sbsa.run", + ), + "Linux-x86_64": ( + "1b205a06272f1463f477276fdab903f3f666917c068e520738001e69c7a1875b", + "https://developer.download.nvidia.com/compute/cuda/12.0.1/local_installers/cuda_12.0.1_525.85.12_linux.run", + ), + "Linux-ppc64le": ( + "1e81040223c25fd72895a1348e32463d7d0f5a7e74b5d2ace897220cb6d4d849", + "https://developer.download.nvidia.com/compute/cuda/12.0.1/local_installers/cuda_12.0.1_525.85.12_linux_ppc64le.run", + ), + }, + "12.0.0": { + "Linux-aarch64": ( + "cd13e9c65d4c8f895a968706f46064d536be09f9706bce081cc864b7e4fa4544", + "https://developer.download.nvidia.com/compute/cuda/12.0.0/local_installers/cuda_12.0.0_525.60.13_linux_sbsa.run", + ), + "Linux-x86_64": ( + "905e9b9516900839fb76064719db752439f38b8cb730b49335d8bd53ddfad392", + "https://developer.download.nvidia.com/compute/cuda/12.0.0/local_installers/cuda_12.0.0_525.60.13_linux.run", + ), + "Linux-ppc64le": ( + "117fe045c71668e45d41c6119b6f27875370c78e33fc56795b6fe014c796ec60", + "https://developer.download.nvidia.com/compute/cuda/12.0.0/local_installers/cuda_12.0.0_525.60.13_linux_ppc64le.run", + ), + }, + "11.8.0": { + "Linux-aarch64": ( + "e6e9a8d31163c9776b5e313fd7590877c5684e1ecddee741154f95704d4ed27c", + "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux_sbsa.run", + ), + "Linux-x86_64": ( + "9223c4af3aebe4a7bbed9abd9b163b03a1b34b855fbc2b4a0d1b706ac09a5a16", + "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run", + ), + "Linux-ppc64le": ( + "f917fb7617033223938543ad3ae923190d99507acc08a399d752a2868e87349d", + "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux_ppc64le.run", + ), + }, + "11.7.1": { + "Linux-aarch64": ( + "1607b98c30cb8efa52b9c8f564ec92d26ee1922cb677740aafacce313e544ecd", + "https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda_11.7.1_515.65.01_linux_sbsa.run", + ), + "Linux-x86_64": ( + "52286a29706549b7d0feeb0e7e3eca1b15287c436a69fa880ad385b1be3e04db", + "https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda_11.7.1_515.65.01_linux.run", + ), + "Linux-ppc64le": ( + "f59fc381cbd903da55bfea9f81534bd4d20e3db716c332be3d2c4804efc2ec6b", + "https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda_11.7.1_515.65.01_linux_ppc64le.run", + ), + }, + "11.7.0": { + "Linux-aarch64": ( + "e777839a618ca9a3d5ad42ded43a1b6392af2321a7327635a4afcc986876a21b", + "https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux_sbsa.run", + ), + "Linux-x86_64": ( + "087fdfcbba1f79543b1f78e43a8dfdac5f6db242d042dde820e16dc185892f26", + "https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run", + ), + "Linux-ppc64le": ( + "74a507ac54067c258e6b7c9063c98d411116ecc5c5397b1f6e6a999e86dff08a", + "https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux_ppc64le.run", + ), + }, + "11.6.2": { + "Linux-aarch64": ( + "b20c014c6bba36b13c50da167ad42e9bd1cea24f3b6297b495ea129c0889f36e", + "https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux_sbsa.run", + ), + "Linux-x86_64": ( + "99b7a73dcc52a52cef4c1fceb4a60c3015ac9b6404082c1677d9efdaba1d4593", + "https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux.run", + ), + "Linux-ppc64le": ( + "869232ff8dbf295a71609738ac9e1b0079ca75597b427f1c026f42b36896afe8", + "https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux_ppc64le.run", + ), + }, + "11.6.1": { + "Linux-aarch64": ( + "80586b003d58030004d465f5331dc69ee26c95a29516fb2488ff10f034139cb2", + "https://developer.download.nvidia.com/compute/cuda/11.6.1/local_installers/cuda_11.6.1_510.47.03_linux_sbsa.run", + ), + "Linux-x86_64": ( + "ab219afce00b74200113269866fbff75ead037bcfc23551a8338c2684c984d7e", + "https://developer.download.nvidia.com/compute/cuda/11.6.1/local_installers/cuda_11.6.1_510.47.03_linux.run", + ), + "Linux-ppc64le": ( + "ef762efbc00b67d572823c6ec338cc2c0cf0c096f41e6bce18e8d4501f260956", + "https://developer.download.nvidia.com/compute/cuda/11.6.1/local_installers/cuda_11.6.1_510.47.03_linux_ppc64le.run", + ), + }, + "11.6.0": { + "Linux-aarch64": ( + "5898579f5e59b708520883cb161089f5e4f3426158d1e9f973c49d224085d1d2", + "https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda_11.6.0_510.39.01_linux_sbsa.run", + ), + "Linux-x86_64": ( + "1783da6d63970786040980b57fa3cb6420142159fc7d0e66f8f05c4905d98c83", + "https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda_11.6.0_510.39.01_linux.run", + ), + "Linux-ppc64le": ( + "c86b866a42baf59ddc6f1f4a79e6d77213c90749e77e574f0e0d796a749ab7d0", + "https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda_11.6.0_510.39.01_linux_ppc64le.run", + ), + }, + "11.5.2": { + "Linux-aarch64": ( + "31337c8bdc224fa1bd07bc4b6a745798392428118cc8ea0fa4446ee4ad47dd30", + "https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installers/cuda_11.5.2_495.29.05_linux_sbsa.run", + ), + "Linux-x86_64": ( + "74959abf02bcba526f0a3aae322c7641b25da040ccd6236d07038f81997b73a6", + "https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installers/cuda_11.5.2_495.29.05_linux.run", + ), + "Linux-ppc64le": ( + "45c468f430436b3e95d5e485a6ba0ec1fa2b23dc6c551c1307b79996ecf0a7ed", + "https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installers/cuda_11.5.2_495.29.05_linux_ppc64le.run", + ), + }, + "11.5.1": { + "Linux-aarch64": ( + "73e1d0e97c7fa686efe7e00fb1e5f179372c4eec8e14d4f44ab58d5f6cf57f63", + "https://developer.download.nvidia.com/compute/cuda/11.5.1/local_installers/cuda_11.5.1_495.29.05_linux_sbsa.run", + ), + "Linux-x86_64": ( + "60bea2fc0fac95574015f865355afbf599422ec2c85554f5f052b292711a4bca", + "https://developer.download.nvidia.com/compute/cuda/11.5.1/local_installers/cuda_11.5.1_495.29.05_linux.run", + ), + "Linux-ppc64le": ( + "9e0e494d945634fe8ad3e12d7b91806aa4220ed27487bb211030d651b27c67a9", + "https://developer.download.nvidia.com/compute/cuda/11.5.1/local_installers/cuda_11.5.1_495.29.05_linux_ppc64le.run", + ), + }, + "11.5.0": { + "Linux-aarch64": ( + "6ea9d520cc956cc751a5ac54f4acc39109627f4e614dd0b1a82cc86f2aa7d8c4", + "https://developer.download.nvidia.com/compute/cuda/11.5.0/local_installers/cuda_11.5.0_495.29.05_linux_sbsa.run", + ), + "Linux-x86_64": ( + "ae0a1693d9497cf3d81e6948943e3794636900db71c98d58eefdacaf7f1a1e4c", + "https://developer.download.nvidia.com/compute/cuda/11.5.0/local_installers/cuda_11.5.0_495.29.05_linux.run", + ), + "Linux-ppc64le": ( + "95baefdc5adf165189407b119861ffb2e9800fd94d7fc81d10fb81ed36dc12db", + "https://developer.download.nvidia.com/compute/cuda/11.5.0/local_installers/cuda_11.5.0_495.29.05_linux_ppc64le.run", + ), + }, + "11.4.4": { + "Linux-aarch64": ( + "c5c08531e48e8fdc2704fa1c1f7195f2c7edd2ee10a466d0e24d05b77d109435", + "https://developer.download.nvidia.com/compute/cuda/11.4.4/local_installers/cuda_11.4.4_470.82.01_linux_sbsa.run", + ), + "Linux-x86_64": ( + "44545a7abb4b66dfc201dcad787b5e8352e5b7ddf3e3cc5b2e9177af419c25c8", + "https://developer.download.nvidia.com/compute/cuda/11.4.4/local_installers/cuda_11.4.4_470.82.01_linux.run", + ), + "Linux-ppc64le": ( + "c71cd4e6c05fde11c0485369a73e7f356080e7a18f0e3ad7244e8fc03a9dd3e2", + "https://developer.download.nvidia.com/compute/cuda/11.4.4/local_installers/cuda_11.4.4_470.82.01_linux_ppc64le.run", + ), + }, + "11.4.3": { + "Linux-aarch64": ( + "e02db34a487ea3de3eec9db80efd09f12eb69d55aca686cecaeae96a9747b1d4", + "https://developer.download.nvidia.com/compute/cuda/11.4.3/local_installers/cuda_11.4.3_470.82.01_linux_sbsa.run", + ), + "Linux-x86_64": ( + "749183821ffc051e123f12ebdeb171b263d55b86f0dd7c8f23611db1802d6c37", + "https://developer.download.nvidia.com/compute/cuda/11.4.3/local_installers/cuda_11.4.3_470.82.01_linux.run", + ), + "Linux-ppc64le": ( + "08f29cc3ed0b3b82dd9b007186237be2352bb552f99230c450a25e768f5754ee", + "https://developer.download.nvidia.com/compute/cuda/11.4.3/local_installers/cuda_11.4.3_470.82.01_linux_ppc64le.run", + ), + }, + "11.4.2": { + "Linux-aarch64": ( + "f2c4a52e06329606c8dfb7c5ea3f4cb4c0b28f9d3fdffeeb734fcc98daf580d8", + "https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux_sbsa.run", + ), + "Linux-x86_64": ( + "bbd87ca0e913f837454a796367473513cddef555082e4d86ed9a38659cc81f0a", + "https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run", + ), + "Linux-ppc64le": ( + "a917c2e53dc13fdda7def71fd40920bf3809d5a2caa3e9acfe377fb9fb22f12d", + "https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux_ppc64le.run", + ), + }, + "11.4.1": { + "Linux-aarch64": ( + "8efa725a41dfd3c0c0f453c2dd535d149154102bf2b791718859417b4f84f922", + "https://developer.download.nvidia.com/compute/cuda/11.4.1/local_installers/cuda_11.4.1_470.57.02_linux_sbsa.run", + ), + "Linux-x86_64": ( + "dd6c339a719989d2518f5d54eeac1ed707d0673f8664ba0c4d4b2af7c3ba0005", + "https://developer.download.nvidia.com/compute/cuda/11.4.1/local_installers/cuda_11.4.1_470.57.02_linux.run", + ), + "Linux-ppc64le": ( + "dd92ca04f76ad938da3480e2901c0e52dbff6028ada63c09071ed9e3055dc361", + "https://developer.download.nvidia.com/compute/cuda/11.4.1/local_installers/cuda_11.4.1_470.57.02_linux_ppc64le.run", + ), + }, + "11.4.0": { + "Linux-aarch64": ( + "f0c8e80d98a601ddca031b6764459984366008c7d3847e7c7f99b36bd4438e3c", + "https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda_11.4.0_470.42.01_linux_sbsa.run", + ), + "Linux-x86_64": ( + "d219db30f7415a115a4ea22bdbb5984b0a18f7f891cad6074c5da45d223aaa4b", + "https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda_11.4.0_470.42.01_linux.run", + ), + "Linux-ppc64le": ( + "6eb2fd0d9d5bc39fb243b5e1789ff827f325d098cd1fbb828a0499552b9544cc", + "https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda_11.4.0_470.42.01_linux_ppc64le.run", + ), + }, + "11.3.1": { + "Linux-aarch64": ( + "39990d3da88b21289ac20850bc183f0b66275f32e1f562b551c05843bf506e4c", + "https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.19.01_linux_sbsa.run", + ), + "Linux-x86_64": ( + "ad93ea98efced35855c58d3a0fc326377c60917cb3e8c017d3e6d88819bf2934", + "https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.19.01_linux.run", + ), + "Linux-ppc64le": ( + "220f2c10a21500d62b03c6848c1659ebb3a8e10dc0915ab87b86b397058407c5", + "https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.19.01_linux_ppc64le.run", + ), + }, + "11.3.0": { + "Linux-aarch64": ( + "f7b284cf055fcf18be9a9aa216e3c7968d3e011446eb0c7200a3353c223ce718", + "https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux_sbsa.run", + ), + "Linux-x86_64": ( + "262da7f77db177b153a6b70b5812210f3f72f00eb608ab9cf2a4582328c4bf5c", + "https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux.run", + ), + "Linux-ppc64le": ( + "c0010107933b575a87e27b1293e5dc32b74201486f4ae2f4c8695ea727d22857", + "https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux_ppc64le.run", + ), + }, + "11.2.2": { + "Linux-aarch64": ( + "2f915ad631331eebdafaabd971723a60290ae8bb090d771075b9e6a0b28cbae6", + "https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda_11.2.2_460.32.03_linux_sbsa.run", + ), + "Linux-x86_64": ( + "0a2e477224af7f6003b49edfd2bfee07667a8148fe3627cfd2765f6ad72fa19d", + "https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda_11.2.2_460.32.03_linux.run", + ), + "Linux-ppc64le": ( + "2304ec235fe5d1f8bf75f00dc2c2d11473759dc23428dbbd5fb5040bc8c757e3", + "https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda_11.2.2_460.32.03_linux_ppc64le.run", + ), + }, + "11.2.1": { + "Linux-aarch64": ( + "4b322fa6477d1a2cd2f2f526fa520c0f90bef2c264ef8435cb016bebb5456c5e", + "https://developer.download.nvidia.com/compute/cuda/11.2.1/local_installers/cuda_11.2.1_460.32.03_linux_sbsa.run", + ), + "Linux-x86_64": ( + "1da98cb897cc5f58a7445a4a66ca4f6926867706cb3af58a669cdcd8dc3d17c8", + "https://developer.download.nvidia.com/compute/cuda/11.2.1/local_installers/cuda_11.2.1_460.32.03_linux.run", + ), + "Linux-ppc64le": ( + "b3e8b6cd76872deb3acd050d32e197bc1c655e142b169070f0f9753680461a3f", + "https://developer.download.nvidia.com/compute/cuda/11.2.1/local_installers/cuda_11.2.1_460.32.03_linux_ppc64le.run", + ), + }, + "11.2.0": { + "Linux-aarch64": ( + "c11dc274660e9b47b0f25ca66861a7406246a7191f1b04d0710515fcac0fa6cd", + "https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda_11.2.0_460.27.04_linux_sbsa.run", + ), + "Linux-x86_64": ( + "9c50283241ac325d3085289ed9b9c170531369de41165ce271352d4a898cbdce", + "https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda_11.2.0_460.27.04_linux.run", + ), + "Linux-ppc64le": ( + "adc3267df5dbfdaf51cb4c9b227ba6bfd979a39d9b4136bba0eba6b1dd2a2731", + "https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda_11.2.0_460.27.04_linux_ppc64le.run", + ), + }, + "11.1.1": { + "Linux-aarch64": ( + "9ab1dbafba205c06bea8c88e38cdadb3038af19cb56e7b3ba734d3d7a84b8f02", + "https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux_sbsa.run", + ), + "Linux-x86_64": ( + "3eae6727086024925ebbcef3e9a45ad379d8490768fd00f9c2d8b6fd9cd8dd8f", + "https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux.run", + ), + "Linux-ppc64le": ( + "023e571fe26ee829c98138dfc305a92279854aac7d184d255fd58c06c6af3c17", + "https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux_ppc64le.run", + ), + }, + "11.1.0": { + "Linux-aarch64": ( + "878cbd36c5897468ef28f02da50b2f546af0434a8a89d1c724a4d2013d6aa993", + "https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux_sbsa.run", + ), + "Linux-x86_64": ( + "858cbab091fde94556a249b9580fadff55a46eafbcb4d4a741d2dcd358ab94a5", + "https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run", + ), + "Linux-ppc64le": ( + "a561e6f7f659bc4100e4713523b0b8aad6b36aa77fac847f6423e7780c750064", + "https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux_ppc64le.run", + ), + }, + "11.0.3": { + "Linux-aarch64": ( + "1e24f61f79c1043aa3d1d126ff6158daa03a62a51b5195a2ed5fbe75c3b718f3", + "https://developer.download.nvidia.com/compute/cuda/11.0.3/local_installers/cuda_11.0.3_450.51.06_linux_sbsa.run", + ), + "Linux-x86_64": ( + "b079c4e408adf88c3f1ffb8418a97dc4227c37935676b4bf4ca0beec6c328cc0", + "https://developer.download.nvidia.com/compute/cuda/11.0.3/local_installers/cuda_11.0.3_450.51.06_linux.run", + ), + "Linux-ppc64le": ( + "4775b21df004b1433bafff9b48a324075c008509f4c0fe28cd060d042d2e0794", + "https://developer.download.nvidia.com/compute/cuda/11.0.3/local_installers/cuda_11.0.3_450.51.06_linux_ppc64le.run", + ), + }, + "11.0.2": { + "Linux-aarch64": ( + "23851e30f7c47a1baad92891abde0adbc783de5962c7480b9725198ceacda4a0", + "https://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux_sbsa.run", + ), + "Linux-x86_64": ( + "48247ada0e3f106051029ae8f70fbd0c238040f58b0880e55026374a959a69c1", + "https://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux.run", + ), + "Linux-ppc64le": ( + "db06d0f3fbf6f7aa1f106fc921ad1c86162210a26e8cb65b171c5240a3bf75da", + "https://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda_11.0.2_450.51.05_linux_ppc64le.run", + ), + }, + "10.2.89": { + "Linux-x86_64": ( + "560d07fdcf4a46717f2242948cd4f92c5f9b6fc7eae10dd996614da913d5ca11", + "https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run", + ), + "Linux-ppc64le": ( + "5227774fcb8b10bd2d8714f0a716a75d7a2df240a9f2a49beb76710b1c0fc619", + "https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux_ppc64le.run", + ), + }, + "10.1.243": { + "Linux-x86_64": ( + "e7c22dc21278eb1b82f34a60ad7640b41ad3943d929bebda3008b72536855d31", + "https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run", + ), + "Linux-ppc64le": ( + "b198002eef010bab9e745ae98e47567c955d00cf34cc8f8d2f0a6feb810523bf", + "https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux_ppc64le.run", + ), + }, + "10.0.130": { + "Linux-x86_64": ( + "92351f0e4346694d0fcb4ea1539856c9eb82060c25654463bfd8574ec35ee39a", + "https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux", + ) + }, + "9.2.88": { + "Linux-x86_64": ( + "8d02cc2a82f35b456d447df463148ac4cc823891be8820948109ad6186f2667c", + "https://developer.nvidia.com/compute/cuda/9.2/Prod/local_installers/cuda_9.2.88_396.26_linux", + ) + }, + "9.1.85": { + "Linux-x86_64": ( + "8496c72b16fee61889f9281449b5d633d0b358b46579175c275d85c9205fe953", + "https://developer.nvidia.com/compute/cuda/9.1/Prod/local_installers/cuda_9.1.85_387.26_linux", + ) + }, + "9.0.176": { + "Linux-x86_64": ( + "96863423feaa50b5c1c5e1b9ec537ef7ba77576a3986652351ae43e66bcd080c", + "https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run", + ) + }, + "8.0.61": { + "Linux-x86_64": ( + "9ceca9c2397f841024e03410bfd6eabfd72b384256fbed1c1e4834b5b0ce9dc4", + "https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run", + ) + }, + "8.0.44": { + "Linux-x86_64": ( + "64dc4ab867261a0d690735c46d7cc9fc60d989da0d69dc04d1714e409cacbdf0", + "https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda_8.0.44_linux-run", + ) + }, + "7.5.18": { + "Linux-x86_64": ( + "08411d536741075131a1858a68615b8b73c51988e616e83b835e4632eea75eec", + "https://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run", + ) + }, + "6.5.14": { + "Linux-x86_64": ( + "f3e527f34f317314fe8fcd8c85f10560729069298c0f73105ba89225db69da48", + "https://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda_6.5.14_linux_64.run", + ) + }, + "6.0.37": { + "Linux-x86_64": ( + "991e436c7a6c94ec67cf44204d136adfef87baa3ded270544fa211179779bc40", + "https://developer.download.nvidia.com/compute/cuda/6_0/rel/installers/cuda_6.0.37_linux_64.run", + ) + }, +} + + +class Cuda(Package): + """CUDA is a parallel computing platform and programming model invented + by NVIDIA. It enables dramatic increases in computing performance by + harnessing the power of the graphics processing unit (GPU). + + Note: This package does not currently install the drivers necessary + to run CUDA. These will need to be installed manually. See: + https://docs.nvidia.com/cuda/ for details.""" + + homepage = "https://developer.nvidia.com/cuda-zone" + + #maintainers("ax3l", "Rombur") + executables = ["^nvcc$"] + + skip_version_audit = ["platform=darwin"] + + for ver, packages in _versions.items(): + key = "{0}-{1}".format(platform.system(), platform.machine()) + pkg = packages.get(key) + if pkg: + if ver == preferred_ver: + version(ver, sha256=pkg[0], url=pkg[1], expand=False, preferred=True) + else: + version(ver, sha256=pkg[0], url=pkg[1], expand=False) + + # macOS Mojave drops NVIDIA graphics card support -- official NVIDIA + # drivers do not exist for Mojave. See + # https://devtalk.nvidia.com/default/topic/1043070/announcements/faq-about-macos-10-14-mojave-nvidia-drivers/ + # Note that a CUDA Toolkit installer does exist for macOS Mojave at + # https://developer.nvidia.com/compute/cuda/10.1/Prod1/local_installers/cuda_10.1.168_mac.dmg, + # but support for Mojave is dropped in later versions, and none of the + # macOS NVIDIA drivers at + # https://www.nvidia.com/en-us/drivers/cuda/mac-driver-archive/ mention + # Mojave support -- only macOS High Sierra 10.13 is supported. + conflicts("arch=darwin-mojave-x86_64") + + variant( + "dev", default=False, description="Enable development dependencies, i.e to use cuda-gdb" + ) + variant( + "allow-unsupported-compilers", + default=False, + sticky=True, + description="Allow unsupported host compiler and CUDA version combinations", + ) + + depends_on("libxml2", when="@10.1.243:") + # cuda-gdb needed libncurses.so.5 before 11.4.0 + # see https://docs.nvidia.com/cuda/archive/11.3.1/cuda-gdb/index.html#common-issues-oss + # see https://docs.nvidia.com/cuda/archive/11.4.0/cuda-gdb/index.html#release-notes + depends_on("ncurses abi=5", type="run", when="@:11.3.99+dev") + + provides("opencl@:1.2", when="@7:") + provides("opencl@:1.1", when="@:6") + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)("--version", output=str, error=str) + match = re.search(r"Cuda compilation tools, release .*?, V(\S+)", output) + return match.group(1) if match else None + + def setup_build_environment(self, env): + if self.spec.satisfies("@:8.0.61"): + # Perl 5.26 removed current directory from module search path, + # CUDA 9 has a fix for this, but CUDA 8 and lower don't. + env.append_path("PERL5LIB", self.stage.source_path) + + if self.spec.satisfies("@10.1.243:"): + libxml2_home = self.spec["libxml2"].prefix + env.set("LIBXML2HOME", libxml2_home) + env.append_path("LD_LIBRARY_PATH", libxml2_home.lib) + + def setup_dependent_build_environment(self, env, dependent_spec): + env.set("CUDAHOSTCXX", dependent_spec.package.compiler.cxx) + env.set("CUDA_HOME", self.prefix) + env.set("NVHPC_CUDA_HOME", self.prefix) + + @property + def cmake_prefix_paths(self): + cmake_prefix_paths = [self.prefix] + if self.spec.satisfies("target=x86_64:"): + cub_path = self.prefix.targets + "/x86_64-linux/lib/cmake" + cmake_prefix_paths.append(cub_path) + return cmake_prefix_paths + + def setup_run_environment(self, env): + env.set("CUDA_HOME", self.prefix) + env.set("NVHPC_CUDA_HOME", self.prefix) + + def install(self, spec, prefix): + if os.path.exists("/tmp/cuda-installer.log"): + try: + os.remove("/tmp/cuda-installer.log") + except OSError: + if spec.satisfies("@10.1:"): + tty.die( + "The cuda installer will segfault due to the " + "presence of /tmp/cuda-installer.log " + "please remove the file and try again " + ) + runfile = glob(join_path(self.stage.source_path, "cuda*_linux*"))[0] + + # Note: NVIDIA does not officially support many newer versions of + # compilers. For example, on CentOS 6, you must use GCC 4.4.7 or + # older. See: + # http://docs.nvidia.com/cuda/cuda-installation-guide-linux/#system-requirements + # https://gist.github.com/ax3l/9489132 + # for details. + + # CUDA 10.1 on ppc64le fails to copy some files, the workaround is adapted from + # https://forums.developer.nvidia.com/t/cuda-10-1-243-10-1-update-2-ppc64le-run-file-installation-issue/82433 + # See also #21170 + if spec.satisfies("@10.1.243") and platform.machine() == "ppc64le": + includedir = "targets/ppc64le-linux/include" + os.makedirs(os.path.join(prefix, includedir)) + os.makedirs(os.path.join(prefix, "src")) + os.symlink(includedir, os.path.join(prefix, "include")) + + install_shell = which("sh") + + if self.spec.satisfies("@:8.0.61"): + # Perl 5.26 removed current directory from module search path. + # We are addressing this by exporting `PERL5LIB` earlier, but for some + # reason, it is not enough. One more file needs to be extracted before + # running the actual installer. This solution is one of the commonly + # found on the Internet, when people try to install CUDA <= 8 manually. + # For example: https://askubuntu.com/a/1087842 + arguments = [runfile, "--tar", "mxvf", "./InstallUtils.pm"] + install_shell(*arguments) + + # CUDA 10.1+ has different cmdline options for the installer + arguments = [ + runfile, # the install script + "--silent", # disable interactive prompts + "--override", # override compiler version checks + "--toolkit", # install CUDA Toolkit + ] + + if spec.satisfies("@7:"): + # use stage dir instead of /tmp + mkdir(join_path(self.stage.path, "tmp")) + arguments.append("--tmpdir=%s" % join_path(self.stage.path, "tmp")) + + if spec.satisfies("@10.1:"): + arguments.append("--installpath=%s" % prefix) # Where to install + else: + arguments.append("--verbose") # Verbose log file + arguments.append("--toolkitpath=%s" % prefix) # Where to install + + install_shell(*arguments) + + try: + os.remove("/tmp/cuda-installer.log") + except OSError: + pass + + @property + def libs(self): + libs = find_libraries("libcudart", root=self.prefix, shared=True, recursive=True) + + filtered_libs = [] + # CUDA 10.0 provides Compatability libraries for running newer versions + # of CUDA with older drivers. These do not work with newer drivers. + for lib in libs: + parts = lib.split(os.sep) + if "compat" not in parts and "stubs" not in parts: + filtered_libs.append(lib) + return LibraryList(filtered_libs) + + # Avoid binding stub libraries by absolute path + non_bindable_shared_objects = ["stubs"] diff --git a/recipes/mch/v6/repo/packages/nvhpc/package.py b/recipes/mch/v6/repo/packages/nvhpc/package.py new file mode 100644 index 0000000..c2f1d1d --- /dev/null +++ b/recipes/mch/v6/repo/packages/nvhpc/package.py @@ -0,0 +1,541 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +# +# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + +import platform + +from spack.package import * +from spack.util.prefix import Prefix + +# FIXME Remove hack for polymorphic versions +# This package uses a ugly hack to be able to dispatch, given the same +# version, to different binary packages based on the platform that is +# running spack. See #13827 for context. +# If you need to add a new version, please be aware that: +# - versions in the following dict are automatically added to the package +# - version tuple must be in the form (checksum, url) +# - checksum must be sha256 +# - package key must be in the form '{os}-{arch}' where 'os' is in the +# format returned by platform.system() and 'arch' by platform.machine() +_versions = { + "24.3": { + "Linux-aarch64": ( + "6b9edc34b798ccaae39d4af36ff73465ee318ac49e5f96f5c5a2a0d7919fff15", + "https://developer.download.nvidia.com/hpc-sdk/24.3/nvhpc_2024_243_Linux_aarch64_cuda_12.3.tar.gz", + ), + "Linux-x86_64": ( + "4fb8949ba8cef73b28818bd9375c9420ec48fab1c64e71315a7c1984f5329d6b", + "https://developer.download.nvidia.com/hpc-sdk/24.3/nvhpc_2024_243_Linux_x86_64_cuda_12.3.tar.gz", + ), + }, + "24.1": { + "Linux-aarch64": ( + "8d2aafa8769115191708e41e63c647e1c975c241ce4bf6a0badf805f0f5edf1c", + "https://developer.download.nvidia.com/hpc-sdk/24.1/nvhpc_2024_241_Linux_aarch64_cuda_12.3.tar.gz", + ), + "Linux-x86_64": ( + "91cdc6f327881f14119e8b6e884d544aafab01c3d569b61831e259c91b4530fc", + "https://developer.download.nvidia.com/hpc-sdk/24.1/nvhpc_2024_241_Linux_x86_64_cuda_12.3.tar.gz", + ), + }, + "23.11": { + "Linux-aarch64": ( + "cf744498d1d74ba0af4294388706644ad3669eb0cacea3b69e23739afa2806a0", + "https://developer.download.nvidia.com/hpc-sdk/23.11/nvhpc_2023_2311_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "b08591438bd0802d4c7c78e7c5bc36383a59591b8c2fa8aed5c4b87b24f7bfbb", + "https://developer.download.nvidia.com/hpc-sdk/23.11/nvhpc_2023_2311_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "33483a069a911f9309cd53859ab90d2778fb176df906e9e8d2bd55f45eeec400", + "https://developer.download.nvidia.com/hpc-sdk/23.11/nvhpc_2023_2311_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "23.9": { + "Linux-aarch64": ( + "dd32ae4233438adb71b2b4f8891f04802fdf90f67036ecf18bfde1b6043a03c3", + "https://developer.download.nvidia.com/hpc-sdk/23.9/nvhpc_2023_239_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "984d61695499db098fd32be8345c1f7d7c637ea3bdb29cef17aad656f16b000f", + "https://developer.download.nvidia.com/hpc-sdk/23.9/nvhpc_2023_239_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "ecf343ecad2398e21c8d7f24a580b2932348017dfd8ea38c1ef31b37114b2d4b", + "https://developer.download.nvidia.com/hpc-sdk/23.9/nvhpc_2023_239_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "23.7": { + "Linux-aarch64": ( + "d3b9b674045e6e17156b298941be4e1e1e7dea6a3c1938f14ad653b180860ff2", + "https://developer.download.nvidia.com/hpc-sdk/23.7/nvhpc_2023_237_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "67b137cf67e2c8556ef3952d1ee35f4966c9d1968626825924fb8e4b198a532b", + "https://developer.download.nvidia.com/hpc-sdk/23.7/nvhpc_2023_237_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "fea91d95ff18bca1ce7afde50371caa02001ade8bed6ddfc5ff70862ccbebece", + "https://developer.download.nvidia.com/hpc-sdk/23.7/nvhpc_2023_237_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "23.5": { + "Linux-aarch64": ( + "3af202ad36bbf205b2af56aabe63b971c01b5ec0e82a02effb3c4928f63bc657", + "https://developer.download.nvidia.com/hpc-sdk/23.5/nvhpc_2023_235_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "65b1f1780175096fa58e98e80fc897c0d563cacce43b3e87ba157f40a8e34877", + "https://developer.download.nvidia.com/hpc-sdk/23.5/nvhpc_2023_235_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "071d7119006cb1d7ac22cb91338c20133a02d394efe14931dfa6f5d7dfa54c81", + "https://developer.download.nvidia.com/hpc-sdk/23.5/nvhpc_2023_235_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "23.3": { + "Linux-aarch64": ( + "48c837de0b1d2dc31c313b19da752d27527e706cb4150c7a6185a4218fc24ef3", + "https://developer.download.nvidia.com/hpc-sdk/23.3/nvhpc_2023_233_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "0f2b5b2fff8ffed13428c55809841b4abd3dfe61e2b1a866bbe959e4bcd50223", + "https://developer.download.nvidia.com/hpc-sdk/23.3/nvhpc_2023_233_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "b94d2b4ae5a23c1a0af7d5b07c785f5057850fe3a6ee5ba0aacdde1019af5d12", + "https://developer.download.nvidia.com/hpc-sdk/23.3/nvhpc_2023_233_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "23.1": { + "Linux-aarch64": ( + "5b430e03752954ea62ac1c745b1735cfdaa43b2e981a9412c1465ecb0412fff6", + "https://developer.download.nvidia.com/hpc-sdk/23.1/nvhpc_2023_231_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "81759e7c747bf4f552b75e7657301f76ecc0828b94fe860f81108c6e83e6ad2b", + "https://developer.download.nvidia.com/hpc-sdk/23.1/nvhpc_2023_231_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "55a064415f6d4ce6a01823ee27ebd266f4fb579679871e7c1a7c054bdc18e9f5", + "https://developer.download.nvidia.com/hpc-sdk/23.1/nvhpc_2023_231_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.11": { + "Linux-aarch64": ( + "e60e798657c33b06754d33dfd5ab3bea2882d4a9b9476102303edf2bbe3b7a95", + "https://developer.download.nvidia.com/hpc-sdk/22.11/nvhpc_2022_2211_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "ef800203cf6040b3a5df24f19944b272f62caee8362875bcb394e86dc1de2353", + "https://developer.download.nvidia.com/hpc-sdk/22.11/nvhpc_2022_2211_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "cb91b3a04368457d5cfe3c0e9c0611591fdc8076b01ea977343fe7db7fdcfa3c", + "https://developer.download.nvidia.com/hpc-sdk/22.11/nvhpc_2022_2211_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.9": { + "Linux-aarch64": ( + "bc4473f04b49bc9a26f08c17a72360650ddf48a3b6eefacdc525d79c8d730f30", + "https://developer.download.nvidia.com/hpc-sdk/22.9/nvhpc_2022_229_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "9aac31d36bb09f6653544978021f5b78c272112e7748871566f7e930f5e7475b", + "https://developer.download.nvidia.com/hpc-sdk/22.9/nvhpc_2022_229_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "aebfeb826ace3dabf9699f72390ca0340f8789a8ef6fe4032e3c7b794f073ea3", + "https://developer.download.nvidia.com/hpc-sdk/22.9/nvhpc_2022_229_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.7": { + "Linux-aarch64": ( + "2aae3fbfd2d0d2d09448a36166c42311368f5600c7c346f159c280b412fe924a", + "https://developer.download.nvidia.com/hpc-sdk/22.7/nvhpc_2022_227_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "6dd4fd382c22769e4fa9508714119abd7d1df3dc58c69414a14b0b0dbc34564f", + "https://developer.download.nvidia.com/hpc-sdk/22.7/nvhpc_2022_227_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "3ce1c346f8bc7e50defb41c545c8907fdc012ff60b27eb8985cf3213f19d863a", + "https://developer.download.nvidia.com/hpc-sdk/22.7/nvhpc_2022_227_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.5": { + "Linux-aarch64": ( + "ceeee84e6227e973ad1beded6008d330e3790f7c4598b948fa530fedfa830a16", + "https://developer.download.nvidia.com/hpc-sdk/22.5/nvhpc_2022_225_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "54d1e45664352d0f9f85ab476dd39496dd1b290e0e1221d3bf63afb940dbe16d", + "https://developer.download.nvidia.com/hpc-sdk/22.5/nvhpc_2022_225_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "7674bcf7a77570fafee5b8299959c9e998a9a10bb27904335cf1a58b71766137", + "https://developer.download.nvidia.com/hpc-sdk/22.5/nvhpc_2022_225_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.3": { + "Linux-aarch64": ( + "e0ea1cbb726556f6879f4b5dfe17238f8e7680c772368577945a85c0e08328f0", + "https://developer.download.nvidia.com/hpc-sdk/22.3/nvhpc_2022_223_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "5e80db6010adc85fe799dac961ae69e43fdf18d35243666c96a70ecdb80bd280", + "https://developer.download.nvidia.com/hpc-sdk/22.3/nvhpc_2022_223_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "bc60a6faf2237bf20550718f71079a714563fa85df62c341cb833f70eb2fe7bb", + "https://developer.download.nvidia.com/hpc-sdk/22.3/nvhpc_2022_223_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.2": { + "Linux-aarch64": ( + "a8241d1139a768d9a0066d1853748160e4098253024e17e997983884d0d33a19", + "https://developer.download.nvidia.com/hpc-sdk/22.2/nvhpc_2022_222_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "f84f72423452968d5bbe02e297f188682c4759864a736a72b32acb3433db3a26", + "https://developer.download.nvidia.com/hpc-sdk/22.2/nvhpc_2022_222_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "8dfb4007d6912b2722946358ac69409592c1f03426d81971ffbcb6fc5fea2cb8", + "https://developer.download.nvidia.com/hpc-sdk/22.2/nvhpc_2022_222_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "22.1": { + "Linux-aarch64": ( + "05cfa8c520a34eab01272a261b157d421a9ff7129fca7d859b944ce6a16d2255", + "https://developer.download.nvidia.com/hpc-sdk/22.1/nvhpc_2022_221_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "9fa9b64fba2c9b287b5800693417d8065c695d18cab0526bad41d9aecc8be2b3", + "https://developer.download.nvidia.com/hpc-sdk/22.1/nvhpc_2022_221_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "7e4366509ed9031ff271e73327dd3121909902a81ac436307801a5373efaff5e", + "https://developer.download.nvidia.com/hpc-sdk/22.1/nvhpc_2022_221_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.11": { + "Linux-aarch64": ( + "3b11bcd9cca862fabfce1e7bcaa2050ea12130c7e897f4e7859ba4c155d20720", + "https://developer.download.nvidia.com/hpc-sdk/21.11/nvhpc_2021_2111_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "ac51ed92de4eb5e1bdb064ada5bbace5b89ac732ad6c6473778edfb8d29a6527", + "https://developer.download.nvidia.com/hpc-sdk/21.11/nvhpc_2021_2111_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "d8d8ccd0e558d22bcddd955f2233219c96f7de56aa8e09e7be833e384d32d6aa", + "https://developer.download.nvidia.com/hpc-sdk/21.11/nvhpc_2021_2111_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.9": { + "Linux-aarch64": ( + "52c2c66e30043add4afccedf0ba77daa0000bf42e0db844baa630bb635b91a7d", + "https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2021_219_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "cff0b55fb782be1982bfeec1d9763b674ddbf84ff2c16b364495299266320289", + "https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2021_219_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "7de6a6880fd7e59afe0dee51f1fae4d3bff1ca0fb8ee234b24e1f2fdff23ffc9", + "https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2021_219_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.7": { + "Linux-aarch64": ( + "73eb3513845b59645f118b1e313472f54519dc252d5f5c32a05df2a2a8a19878", + "https://developer.download.nvidia.com/hpc-sdk/21.7/nvhpc_2021_217_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "37ea23b5a9c696fb3fdb82855643afc4e02aea618102ec801206441f10fc9fba", + "https://developer.download.nvidia.com/hpc-sdk/21.7/nvhpc_2021_217_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "49d6e23492d131474698cf12971722d42e13a54a4eddec382e66e1053b4ac902", + "https://developer.download.nvidia.com/hpc-sdk/21.7/nvhpc_2021_217_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.5": { + "Linux-aarch64": ( + "1a1748cd7cf538199d92ab3b1208935fa4a62708ba21125aeadb328ddc7380d4", + "https://developer.download.nvidia.com/hpc-sdk/21.5/nvhpc_2021_215_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "4674931a5ce28724308cb9cebd546eefa3f0646d3d08adbea28ba5ad27f0c163", + "https://developer.download.nvidia.com/hpc-sdk/21.5/nvhpc_2021_215_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "21989e52c58a6914743631c8200de1fec7e10b3449c6c1833f3032ee74b85f8e", + "https://developer.download.nvidia.com/hpc-sdk/21.5/nvhpc_2021_215_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.3": { + "Linux-aarch64": ( + "88e0dbf8fcdd06a2ba06aacf65ae1625b8683688f6593ed3bf8ce129ce1b17b7", + "https://developer.download.nvidia.com/hpc-sdk/21.3/nvhpc_2021_213_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "08cd0cd6c80d633f107b44f88685ada7f014fbf6eac19ef5ae4a7952cabe4037", + "https://developer.download.nvidia.com/hpc-sdk/21.3/nvhpc_2021_213_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "391d5604a70f61bdd4ca6a3e4692f6f2391948990c8a35c395b6867341890031", + "https://developer.download.nvidia.com/hpc-sdk/21.3/nvhpc_2021_213_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.2": { + "Linux-aarch64": ( + "fe19c0232f7c9534f8699b7432483c9cc649f1e92e7f0961d1aa7c54d83297ff", + "https://developer.download.nvidia.com/hpc-sdk/21.2/nvhpc_2021_212_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "6b69b6e4ebec6a91b9f1627384c50adad79ebdd25dfb20a5f64cf01c3a07f11a", + "https://developer.download.nvidia.com/hpc-sdk/21.2/nvhpc_2021_212_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "a3e3393040185ae844002fbc6c8eb4ffdfb97ce8b2ce29d796fe7e9a521fdc59", + "https://developer.download.nvidia.com/hpc-sdk/21.2/nvhpc_2021_212_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "21.1": { + "Linux-aarch64": ( + "b276e7c0ff78cee837a597d9136cd1d8ded27a9d1fdae1e7d674e2a072a9a6aa", + "https://developer.download.nvidia.com/hpc-sdk/21.1/nvhpc_2021_211_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "bc236c212097bac6b7d04d627d9cc6b75bb6cd473a0b6a1bf010559ce328a2b0", + "https://developer.download.nvidia.com/hpc-sdk/21.1/nvhpc_2021_211_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "d529daf46404724ac3f005be4239f2c30e53f5220bb9453f367dccc3a74d6b41", + "https://developer.download.nvidia.com/hpc-sdk/21.1/nvhpc_2021_211_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "20.11": { + "Linux-aarch64": ( + "2f26ca45b07b694b8669e4f761760d4f7faa8d032b21e430adee1af0a27032c1", + "https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc_2020_2011_Linux_aarch64_cuda_multi.tar.gz", + ), + "Linux-ppc64le": ( + "99e5a5437e82f3914e0fe81feb761a5b599a3fe8b31f3c2cac8ae47e8cdc7b0f", + "https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc_2020_2011_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "c80fc26e5ba586696f7030f03054c1aaca0752a891c7923faf47eb23b66857ec", + "https://developer.download.nvidia.com/hpc-sdk/20.11/nvhpc_2020_2011_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "20.9": { + "Linux-aarch64": ( + "3bfb3d17f5ee99998bcc30d738e818d3b94b828e2d8da7db48bf152a01e22023", + "https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc_2020_209_Linux_aarch64_cuda_11.0.tar.gz", + ), + "Linux-ppc64le": ( + "b2966d4047e1dfd981ce63b333ab9c0acbdc2a6a505fa217456ac9fa3b8e7474", + "https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc_2020_209_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "fe665ab611b03846a90bd70ca4e08c1e59ab527364b971ed0304e0ae73c778d8", + "https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc_2020_209_Linux_x86_64_cuda_multi.tar.gz", + ), + }, + "20.7": { + "Linux-aarch64": ( + "5b83ca1919199ac0aa609309b31c345c5a6453dd3131fddeef9e3ee9059a0e9b", + "https://developer.download.nvidia.com/hpc-sdk/20.7/nvhpc_2020_207_Linux_aarch64_cuda_11.0.tar.gz", + ), + "Linux-ppc64le": ( + "800ead240bdf61611910b2f6df24ee1d7359377ff3767c923738dd81fcea9312", + "https://developer.download.nvidia.com/hpc-sdk/20.7/nvhpc_2020_207_Linux_ppc64le_cuda_multi.tar.gz", + ), + "Linux-x86_64": ( + "a5c5c8726d2210f2310a852c6d6e03c9ef8c75e3643e9c94e24909f5e9c2ea7a", + "https://developer.download.nvidia.com/hpc-sdk/20.7/nvhpc_2020_207_Linux_x86_64_cuda_multi.tar.gz", + ), + }, +} + + +class Nvhpc(Package): + """The NVIDIA HPC SDK is a comprehensive suite of compilers, libraries + and tools essential to maximizing developer productivity and the + performance and portability of HPC applications. The NVIDIA HPC + SDK C, C++, and Fortran compilers support GPU acceleration of HPC + modeling and simulation applications with standard C++ and + Fortran, OpenACC directives, and CUDA. GPU-accelerated math + libraries maximize performance on common HPC algorithms, and + optimized communications libraries enable standards-based + multi-GPU and scalable systems programming. Performance profiling + and debugging tools simplify porting and optimization of HPC + applications.""" + + homepage = "https://developer.nvidia.com/hpc-sdk" + + #maintainers("samcmill") + tags = ["e4s"] + + skip_version_audit = ["platform=darwin"] + + for ver, packages in _versions.items(): + key = "{0}-{1}".format(platform.system(), platform.machine()) + pkg = packages.get(key) + if pkg: + version(ver, sha256=pkg[0], url=pkg[1]) + + variant("blas", default=True, description="Enable BLAS") + variant( + "install_type", + default="single", + values=("single", "network"), + multi=False, + description="Network installs are for installations shared " + "by different operating systems", + ) + variant("lapack", default=True, description="Enable LAPACK") + variant("mpi", default=False, description="Enable MPI") + variant( + "default_cuda", default="default", description="Default CUDA version, for example 11.8" + ) + + provides("blas", when="+blas") + provides("lapack", when="+lapack") + provides("mpi", when="+mpi") + + #requires("%gcc", msg="nvhpc must be installed with %gcc") + + def _version_prefix(self): + return join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version) + + def setup_build_environment(self, env): + env.set("NVHPC_SILENT", "true") + env.set("NVHPC_ACCEPT_EULA", "accept") + env.set("NVHPC_INSTALL_DIR", self.prefix) + if self.spec.variants["default_cuda"].value != "default": + env.set("NVHPC_DEFAULT_CUDA", self.spec.variants["default_cuda"].value) + + if self.spec.variants["install_type"].value == "network": + local_dir = join_path(self._version_prefix(), "share_objects") + env.set("NVHPC_INSTALL_TYPE", "network") + env.set("NVHPC_INSTALL_LOCAL_DIR", local_dir) + else: + env.set("NVHPC_INSTALL_TYPE", "single") + + def install(self, spec, prefix): + compilers_bin = join_path(self._version_prefix(), "compilers", "bin") + install = Executable("./install") + makelocalrc = Executable(join_path(compilers_bin, "makelocalrc")) + + makelocalrc_args = [ + "-gcc", + self.compiler.cc, + "-gpp", + self.compiler.cxx, + "-g77", + self.compiler.f77, + "-x", + compilers_bin, + ] + if self.spec.variants["install_type"].value == "network": + local_dir = join_path(self._version_prefix(), "share_objects") + makelocalrc_args.extend(["-net", local_dir]) + + # Run install script + install() + + # Update localrc to use Spack gcc + makelocalrc(*makelocalrc_args) + + def setup_run_environment(self, env): + prefix = Prefix( + join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version, "compilers") + ) + + env.set("CC", join_path(prefix.bin, "nvc")) + env.set("CXX", join_path(prefix.bin, "nvc++")) + env.set("F77", join_path(prefix.bin, "nvfortran")) + env.set("FC", join_path(prefix.bin, "nvfortran")) + + env.prepend_path("PATH", prefix.bin) + env.prepend_path("LIBRARY_PATH", prefix.lib) + env.prepend_path("LD_LIBRARY_PATH", prefix.lib) + env.prepend_path("MANPATH", prefix.man) + + if "+mpi" in self.spec: + mpi_prefix = Prefix( + join_path( + self.prefix, + "Linux_%s" % self.spec.target.family, + self.version, + "comm_libs", + "mpi", + ) + ) + env.prepend_path("PATH", mpi_prefix.bin) + env.prepend_path("LD_LIBRARY_PATH", mpi_prefix.lib) + + def setup_dependent_build_environment(self, env, dependent_spec): + prefix = Prefix( + join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version, "compilers") + ) + + env.prepend_path("LIBRARY_PATH", prefix.lib) + env.prepend_path("LD_LIBRARY_PATH", prefix.lib) + + if "+mpi" in self.spec: + mpi_prefix = Prefix( + join_path( + self.prefix, + "Linux_%s" % self.spec.target.family, + self.version, + "comm_libs", + "mpi", + ) + ) + + env.prepend_path("LD_LIBRARY_PATH", mpi_prefix.lib) + + def setup_dependent_package(self, module, dependent_spec): + if "+mpi" in self.spec or self.provides("mpi"): + mpi_prefix = Prefix( + join_path( + self.prefix, + "Linux_%s" % self.spec.target.family, + self.version, + "comm_libs", + "mpi", + ) + ) + + self.spec.mpicc = join_path(mpi_prefix.bin, "mpicc") + self.spec.mpicxx = join_path(mpi_prefix.bin, "mpicxx") + self.spec.mpif77 = join_path(mpi_prefix.bin, "mpif77") + self.spec.mpifc = join_path(mpi_prefix.bin, "mpif90") + + @property + def libs(self): + prefix = Prefix( + join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version, "compilers") + ) + libs = [] + + if "+blas" in self.spec: + libs.append("libblas") + + if "+lapack" in self.spec: + libs.append("liblapack") + libs.append("libnvf") + + return find_libraries(libs, root=prefix, recursive=True) + + # Avoid binding stub libraries by absolute path + non_bindable_shared_objects = ["stubs"] diff --git a/recipes/mch/v7/compilers.yaml b/recipes/mch/v7/compilers.yaml new file mode 100644 index 0000000..1bc30c6 --- /dev/null +++ b/recipes/mch/v7/compilers.yaml @@ -0,0 +1,9 @@ +bootstrap: + spec: gcc@11.3 +gcc: + specs: + - gcc@12.3 +llvm: + requires: gcc@12.3 + specs: + - nvhpc@24.5 diff --git a/recipes/mch/v7/config.yaml b/recipes/mch/v7/config.yaml new file mode 100644 index 0000000..3104b32 --- /dev/null +++ b/recipes/mch/v7/config.yaml @@ -0,0 +1,6 @@ +name: mch +store: /mch-environment/v7 +spack: + commit: releases/v0.21 + repo: https://github.com/spack/spack.git +description: The compiler toolchains, libraries and tools required for the MCH production software stack. diff --git a/recipes/mch/v7/environments.yaml b/recipes/mch/v7/environments.yaml new file mode 100644 index 0000000..418f9be --- /dev/null +++ b/recipes/mch/v7/environments.yaml @@ -0,0 +1,88 @@ +tools: + compiler: + - toolchain: gcc + spec: gcc + unify: when_possible + specs: + - cmake@3.24 + # removed because it requires deprecated curl@7.79.1 + #- python@3.7 + - python@3.10 + - libtree + - tree + - ruby@3.1.0 + #- r@4.0.5 + packages: + - perl + views: + tools: + exclude: ['python@3.7'] +prgenv-nvidia: + compiler: + - toolchain: gcc + spec: gcc + - toolchain: llvm + spec: nvhpc + unify: true + mpi: + spec: cray-mpich@8.1.30%nvhpc + gpu: cuda + packages: + - perl + - curl + - gmake + - autoconf + - automake + specs: + - osu-micro-benchmarks@5.9%nvhpc + - cuda@12.3 + - eccodes@2.25.0%nvhpc +tools +fortran +aec +openmp jp2k=jasper + - netcdf-c@4.9.2 + - netcdf-fortran@4.6.1%nvhpc + - hdf5%nvhpc +szip +hl +fortran +mpi + - openblas@0.3.21%nvhpc + - libfyaml + - nco@5.0.1 + - cdo@2.0.5 + # the following are explicitly set for backwards compatibility + - cray-pals@1.2.12 + variants: + - cuda_arch=80 + - +mpi + - +cuda + views: + prgenv-icon: + exclude: ['eccodes@2.19.1'] + link: roots +prgenv-gcc: + compiler: + - toolchain: gcc + spec: gcc + unify: when_possible + mpi: + spec: cray-mpich@8.1.30%gcc + packages: + - perl + - curl + - libx11 + specs: + - osu-micro-benchmarks@5.9 + - openblas@0.3.21 + - libfyaml@0.7.12 + - hdf5@1.12.2 +fortran +threadsafe ~mpi + - hdf5@1.12.2 +fortran +threadsafe +mpi + - netlib-scalapack@2.2.0 + - eccodes@2.25.0 +tools +fortran +aec +openmp jp2k=jasper + - netcdf-c@4.8.1+mpi ^hdf5+mpi api=v18 + - netcdf-c@4.8.1~mpi ^hdf5~mpi api=v18 + - netcdf-fortran@4.5.4 ^netcdf-c+mpi + - netcdf-fortran@4.5.4 ^netcdf-c~mpi + variants: + - +mpi + views: + prgenv-gcc-serial: + exclude: + - hdf5+mpi + - netcdf-c+mpi + - netcdf-fortran ^netcdf-c+mpi + link: roots diff --git a/recipes/mch/v7/modules.yaml b/recipes/mch/v7/modules.yaml new file mode 100644 index 0000000..d4f14f5 --- /dev/null +++ b/recipes/mch/v7/modules.yaml @@ -0,0 +1,58 @@ +modules: + # Paths to check when creating modules for all module sets + prefix_inspections: + bin: + - PATH + lib: + - LD_LIBRARY_PATH + lib64: + - LD_LIBRARY_PATH + lib/pkgconfig: + - PKG_CONFIG_PATH + lib64/pkgconfig: + - PKG_CONFIG_PATH + + default: + arch_folder: false + # Where to install modules + roots: + tcl: /user-environment/modules + tcl: + all: + autoload: none + eccodes: + environment: + set: + ECCODES_DIR: '{prefix}' + ECCODES_INCLUDE: '{prefix}/include' + ECCODES_VERSION: '{version}' + netlib-scalapack: + environment: + set: + NETLIB_SCALAPACK_ROOT: '{prefix}' + openblas: + environment: + set: + OPENBLAS_ROOT: '{prefix}' + netcdf-c: + environment: + set: + NETCDF_C_ROOT: '{prefix}' + hash_length: 0 + exclude_implicits: true + include: + - cuda + - hdf5 + - zlib+shared + exclude: + - '%gcc@7.5.0' + - 'gcc %gcc@7.5.0' + projections: + all: '{name}/{version}-{compiler.name}' + nvhpc: '{name}/{version}' + gcc: '{name}/{version}' + cray-mpich: 'cray-mpich-{compiler.name}/{version}' + python: '{name}/{version}' + hdf5%gcc~mpi: '{name}/{version}-serial-{compiler.name}' + netcdf-c~mpi: '{name}/{version}-serial-{compiler.name}' + netcdf-fortran^netcdf-c~mpi: '{name}/{version}-serial-{compiler.name}' diff --git a/recipes/mch/v7/readme.md b/recipes/mch/v7/readme.md new file mode 100644 index 0000000..8eb9c09 --- /dev/null +++ b/recipes/mch/v7/readme.md @@ -0,0 +1 @@ +This software stack uses spack v0.21, to macth the spack-c2sm distribution diff --git a/recipes/mch/v8/compilers.yaml b/recipes/mch/v8/compilers.yaml new file mode 100644 index 0000000..1bc30c6 --- /dev/null +++ b/recipes/mch/v8/compilers.yaml @@ -0,0 +1,9 @@ +bootstrap: + spec: gcc@11.3 +gcc: + specs: + - gcc@12.3 +llvm: + requires: gcc@12.3 + specs: + - nvhpc@24.5 diff --git a/recipes/mch/v8/config.yaml b/recipes/mch/v8/config.yaml new file mode 100644 index 0000000..efb8eeb --- /dev/null +++ b/recipes/mch/v8/config.yaml @@ -0,0 +1,6 @@ +name: mch +store: /mch-environment/v8 +spack: + commit: releases/v0.22 + repo: https://github.com/spack/spack.git +description: The compiler toolchains, libraries and tools required for the MCH production software stack. diff --git a/recipes/mch/v8/environments.yaml b/recipes/mch/v8/environments.yaml new file mode 100644 index 0000000..40134c0 --- /dev/null +++ b/recipes/mch/v8/environments.yaml @@ -0,0 +1,82 @@ +tools: + compiler: + - toolchain: gcc + spec: gcc + unify: when_possible + # don't use system packages, in order to avoid concretization issues + specs: + - cmake@3.24 + - python@3.10 + - libtree + - tree + - ruby@3.1.0 + packages: [] + views: + tools: + exclude: [] +prgenv-nvidia: + compiler: + - toolchain: gcc + spec: gcc + - toolchain: llvm + spec: nvhpc + unify: true + mpi: + spec: cray-mpich@8.1.30%nvhpc + gpu: cuda + # don't use system packages, in order to avoid concretization issues + packages: [] + specs: + - osu-micro-benchmarks@5.9%nvhpc + - cuda@12.3 + - eccodes@2.36.4%nvhpc +tools +fortran +aec +openmp jp2k=jasper + - netcdf-c@4.9.2%nvhpc +mpi + - netcdf-fortran@4.6.1%nvhpc + - hdf5%nvhpc +szip +hl +fortran +mpi + - openblas@0.3.21%nvhpc + - libfyaml + # the following are explicitly set for backwards compatibility + - cray-pals@1.2.12 + # explicitly add these for icon concretization + - python@3.11.7 + - cmake@3.24 + - zlib-ng + variants: + - cuda_arch=80 + - +mpi + - +cuda +prgenv-gcc: + compiler: + - toolchain: gcc + spec: gcc + unify: when_possible + mpi: + spec: cray-mpich@8.1.30%gcc + # only use libx11 from the system, in order to avoid concretization issues + packages: [] + packages: + - libx11 + specs: + - osu-micro-benchmarks@5.9 + - cmake@3.24 + - openblas@0.3.26 + - libfyaml@0.7.12 + - hdf5@1.12.2 +fortran +threadsafe ~mpi + - hdf5@1.12.2 +fortran +threadsafe +mpi + - netlib-scalapack@2.2.0 + - eccodes@2.36.4 +tools +fortran +aec +openmp jp2k=jasper + - netcdf-c@4.8.1+mpi ^hdf5+mpi api=v18 + - netcdf-c@4.8.1~mpi ^hdf5~mpi api=v18 + - netcdf-fortran@4.5.4 ^netcdf-c+mpi + - netcdf-fortran@4.5.4 ^netcdf-c~mpi + - nco@5.0.1 + - cdo@2.0.5 + variants: + - +mpi + views: + prgenv-gcc-serial: + exclude: + - hdf5+mpi + - netcdf-c+mpi + - netcdf-fortran ^netcdf-c+mpi + link: roots diff --git a/recipes/mch/v8/modules.yaml b/recipes/mch/v8/modules.yaml new file mode 100644 index 0000000..5dbc749 --- /dev/null +++ b/recipes/mch/v8/modules.yaml @@ -0,0 +1,62 @@ +modules: + # Paths to check when creating modules for all module sets + prefix_inspections: + bin: + - PATH + lib: + - LD_LIBRARY_PATH + lib64: + - LD_LIBRARY_PATH + lib/pkgconfig: + - PKG_CONFIG_PATH + lib64/pkgconfig: + - PKG_CONFIG_PATH + + default: + arch_folder: false + # Where to install modules + roots: + tcl: /user-environment/modules + tcl: + all: + autoload: none + eccodes: + environment: + set: + ECCODES_DIR: '{prefix}' + ECCODES_INCLUDE: '{prefix}/include' + ECCODES_VERSION: '{version}' + netlib-scalapack: + environment: + set: + NETLIB_SCALAPACK_ROOT: '{prefix}' + openblas: + environment: + set: + OPENBLAS_ROOT: '{prefix}' + netcdf-c: + environment: + set: + NETCDF_C_ROOT: '{prefix}' + hash_length: 0 + hide_implicits: true + exclude_implicits: true + include: + - cuda + - hdf5 + - zlib+shared + - gcc@12.3.0 + exclude: + - '%gcc@7.5.0' + - 'gcc %gcc@7.5.0' + - '%gcc@11.3.0' + - zstd + projections: + all: '{name}/{version}-{compiler.name}' + nvhpc: '{name}/{version}' + gcc: '{name}/{version}' + cray-mpich: 'cray-mpich-{compiler.name}/{version}' + python: '{name}/{version}' + hdf5%gcc~mpi: '{name}/{version}-serial-{compiler.name}' + netcdf-c~mpi: '{name}/{version}-serial-{compiler.name}' + netcdf-fortran^netcdf-c~mpi: '{name}/{version}-serial-{compiler.name}' diff --git a/recipes/mch/v8/readme.md b/recipes/mch/v8/readme.md new file mode 100644 index 0000000..8eb9c09 --- /dev/null +++ b/recipes/mch/v8/readme.md @@ -0,0 +1 @@ +This software stack uses spack v0.21, to macth the spack-c2sm distribution diff --git a/recipes/mch/v8/repo/packages/eccodes/cmake_install_rpath.patch b/recipes/mch/v8/repo/packages/eccodes/cmake_install_rpath.patch new file mode 100644 index 0000000..7e2b250 --- /dev/null +++ b/recipes/mch/v8/repo/packages/eccodes/cmake_install_rpath.patch @@ -0,0 +1,11 @@ +--- a/cmake/ecbuild_append_to_rpath.cmake ++++ b/cmake/ecbuild_append_to_rpath.cmake +@@ -31,7 +31,7 @@ function( _path_append var path ) + else() + list( FIND ${var} ${path} _found ) + if( _found EQUAL "-1" ) +- set( ${var} "${${var}}:${path}" PARENT_SCOPE ) ++ set( ${var} "${${var}};${path}" PARENT_SCOPE ) + endif() + endif() + endfunction() diff --git a/recipes/mch/v8/repo/packages/eccodes/openjpeg_jasper.patch b/recipes/mch/v8/repo/packages/eccodes/openjpeg_jasper.patch new file mode 100644 index 0000000..5793f56 --- /dev/null +++ b/recipes/mch/v8/repo/packages/eccodes/openjpeg_jasper.patch @@ -0,0 +1,39 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -43,6 +43,18 @@ ecbuild_add_option( FEATURE JPG + DESCRIPTION "support for JPG decoding/encoding" + DEFAULT ON + ) ++# Options related to JPG. The Jasper and OpenJPEG libraries ++ecbuild_add_option( FEATURE JPG_LIBJASPER ++ DESCRIPTION "Support for JPG decoding/encoding with the Jasper library" ++ CONDITION ENABLE_JPG ++ DEFAULT ON ++) ++ecbuild_add_option( FEATURE JPG_LIBOPENJPEG ++ DESCRIPTION "Support for JPG decoding/encoding with the OpenJPEG library" ++ CONDITION ENABLE_JPG ++ DEFAULT ON ++) ++ + + ecbuild_add_option( FEATURE PNG + DESCRIPTION "support for PNG decoding/encoding" +@@ -144,7 +156,7 @@ if( ENABLE_JPG ) + + find_package( OpenJPEG ) + +- if( JASPER_FOUND ) ++ if( JASPER_FOUND AND ENABLE_JPG_LIBJASPER ) + list( APPEND ECCODES_TPLS Jasper ) + set( HAVE_JPEG 1 ) + set( HAVE_LIBJASPER 1 ) +@@ -152,7 +164,7 @@ if( ENABLE_JPG ) + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" JASPER_VERSION_MAJOR "${JASPER_VERSION_STRING}") + endif() + +- if( OPENJPEG_FOUND ) ++ if( OPENJPEG_FOUND AND ENABLE_JPG_LIBOPENJPEG ) + list( APPEND ECCODES_TPLS OpenJPEG ) + set( HAVE_JPEG 1 ) + set( HAVE_LIBOPENJPEG 1 ) diff --git a/recipes/mch/v8/repo/packages/eccodes/package.py b/recipes/mch/v8/repo/packages/eccodes/package.py new file mode 100644 index 0000000..aeb4692 --- /dev/null +++ b/recipes/mch/v8/repo/packages/eccodes/package.py @@ -0,0 +1,385 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack.package import * + +_definitions = { + # German Meteorological Service (Deutscher Wetterdienst, DWD): + "edzw": { + "conflicts": {"when": "@:2.19.1,2.22.0,2.24.0:"}, + "resources": [ + { + "when": "@2.20.0", + "url": "http://opendata.dwd.de/weather/lib/grib/eccodes_definitions.edzw-2.20.0-1.tar.gz", + "sha256": "a92932f8a13c33cba65d3a33aa06c7fb4a37ed12a78e9abe2c5e966402b99af4", + }, + { + "when": "@2.21.0", + "url": "http://opendata.dwd.de/weather/lib/grib/eccodes_definitions.edzw-2.21.0-3.tar.bz2", + "sha256": "046f1f6450abb3b44c31dee6229f4aab06ca0d3576e27e93e05ccb7cd6e2d9d9", + }, + { + "when": "@2.22.1", + "url": "http://opendata.dwd.de/weather/lib/grib/eccodes_definitions.edzw-2.22.1-1.tar.bz2", + "sha256": "be73102a0dcabb236bacd2a70c7b5475f673fda91b49e34df61bef0fa5ad3389", + }, + { + "when": "@2.23.0", + "url": "http://opendata.dwd.de/weather/lib/grib/eccodes_definitions.edzw-2.23.0-4.tar.bz2", + "sha256": "c5db32861c7d23410aed466ffef3ca661410d252870a3949442d3ecb176aa338", + }, + ], + } +} + + +class Eccodes(CMakePackage): + """ecCodes is a package developed by ECMWF for processing meteorological + data in GRIB (1/2), BUFR (3/4) and GTS header formats.""" + + homepage = "https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home" + url = "https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.2.0-Source.tar.gz?api=v2" + git = "https://github.com/ecmwf/eccodes.git" + list_url = "https://confluence.ecmwf.int/display/ECC/Releases" + + maintainers("skosukhin", "victoria-cherkas", "dominichofer", "climbfuji") + + license("Apache-2.0") + + version("develop", branch="develop") + version("2.36.4", + sha256="198ccb26e8df96544c668ea6853ea153535ab78b10c43339a678f271337aa0da", + url="https://github.com/ecmwf/eccodes/archive/refs/tags/2.36.4.tar.gz" + ) + version("2.34.0", sha256="3cd208c8ddad132789662cf8f67a9405514bfefcacac403c0d8c84507f303aba") + version("2.33.0", sha256="bdcec8ce63654ec6803400c507f01220a9aa403a45fa6b5bdff7fdcc44fd7daf") + version("2.32.1", sha256="ad2ac1bf36577b1d35c4a771b4d174a06f522a1e5ef6c1f5e53a795fb624863e") + version("2.32.0", sha256="b57e8eeb0eba0c05d66fda5527c4ffa84b5ab35c46bcbc9a2227142973ccb8e6") + version("2.31.0", sha256="808ecd2c11fbf2c3f9fc7a36f8c2965b343f3151011b58a1d6e7cc2e6b3cac5d") + version("2.25.0", sha256="8975131aac54d406e5457706fd4e6ba46a8cc9c7dd817a41f2aa64ce1193c04e") + version("2.24.2", sha256="c60ad0fd89e11918ace0d84c01489f21222b11d6cad3ff7495856a0add610403") + version("2.23.0", sha256="cbdc8532537e9682f1a93ddb03440416b66906a4cc25dec3cbd73940d194bf0c") + version("2.22.1", sha256="75c7ee96469bb30b0c8f7edbdc4429ece4415897969f75c36173545242bc9e85") + version("2.21.0", sha256="da0a0bf184bb436052e3eae582defafecdb7c08cdaab7216780476e49b509755") + version("2.20.0", sha256="207a3d7966e75d85920569b55a19824673e8cd0b50db4c4dac2d3d52eacd7985") + version("2.19.1", sha256="9964bed5058e873d514bd4920951122a95963128b12f55aa199d9afbafdd5d4b") + version("2.18.0", sha256="d88943df0f246843a1a062796edbf709ef911de7269648eef864be259e9704e3") + version("2.13.0", sha256="c5ce1183b5257929fc1f1c8496239e52650707cfab24f4e0e1f1a471135b8272") + version("2.5.0", sha256="18ab44bc444168fd324d07f7dea94f89e056f5c5cd973e818c8783f952702e4e") + version("2.2.0", sha256="1a4112196497b8421480e2a0a1164071221e467853486577c4f07627a702f4c3") + + # we are still using spack v0.21 v0.22, so comment these out for now + #depends_on("c", type="build") # generated + #depends_on("cxx", type="build") # generated + #depends_on("fortran", type="build") # generated + + variant("tools", default=False, description="Build the command line tools") + variant("netcdf", default=False, description="Enable GRIB to NetCDF conversion tool") + variant( + "jp2k", + default="openjpeg", + values=("openjpeg", "jasper", "none"), + description="Specify JPEG2000 decoding/encoding backend", + ) + variant("png", default=False, description="Enable PNG support for decoding/encoding") + variant( + "aec", default=True, description="Enable Adaptive Entropy Coding for decoding/encoding" + ) + variant("pthreads", default=False, description="Enable POSIX threads") + variant("openmp", default=False, description="Enable OpenMP threads") + variant( + "memfs", default=False, description="Enable memory based access to definitions/samples" + ) + variant("fortran", default=False, description="Enable the Fortran support") + variant("shared", default=True, description="Build shared versions of the libraries") + + variant( + "extra_definitions", + values=any_combination_of(*_definitions.keys()), + description="List of extra definitions to install", + ) + + depends_on("netcdf-c", when="+netcdf") + # Cannot be built with openjpeg@2.0.x. + depends_on("openjpeg@1.5.0:1.5,2.1.0:2.3", when="jp2k=openjpeg") + # Additional constraint for older versions. + depends_on("openjpeg@:2.1", when="@:2.16 jp2k=openjpeg") + + with when("jp2k=jasper"): + depends_on("jasper") + # jasper 3.x compat from commit 86f0b35f1a8492cb16f82fb976a0a5acd2986ac2 + depends_on("jasper@:2", when="@:2.25.0") + + depends_on("libpng", when="+png") + depends_on("libaec", when="+aec") + # Can be built with Python 2 or Python 3. + depends_on("python", when="+memfs", type="build") + + depends_on("cmake@3.6:", type="build") + depends_on("cmake@3.12:", when="@2.19:", type="build") + + # TODO: ecbuild was only used for the @develop branch + # however, testing 2.36.4, it appears to be a requirement. + # this might be because they package the software differently in GitHub + # (they normally provide releases as tar balls on Confluence) + depends_on("ecbuild", type="build") + #depends_on("ecbuild", type="build", when="@develop") + + conflicts("+openmp", when="+pthreads", msg="Cannot enable both POSIX threads and OMP") + + conflicts( + "+netcdf", + when="~tools", + msg="Cannot enable the NetCDF conversion tool " "when the command line tools are disabled", + ) + + conflicts( + "~tools", + when="@:2.18.0", + msg="The command line tools can be disabled " "only starting version 2.19.0", + ) + + for center, definitions in _definitions.items(): + kwargs = definitions.get("conflicts", None) + if kwargs: + conflicts("extra_definitions={0}".format(center), **kwargs) + for kwargs in definitions.get("resources", []): + resource( + name=center, + destination="spack-definitions", + placement="definitions.{0}".format(center), + **kwargs, + ) + + # Enforce linking against the specified JPEG2000 backend, see also + # https://github.com/ecmwf/eccodes/commit/2c10828495900ff3d80d1e570fe96c1df16d97fb + patch("openjpeg_jasper.patch", when="@:2.16") + + # CMAKE_INSTALL_RPATH must be a semicolon-separated list. + patch("cmake_install_rpath.patch", when="@:2.10") + + # Fix a bug preventing cmake from finding NetCDF: + patch( + "https://github.com/ecmwf/ecbuild/commit/3916c7d22575c45166fcc89edcbe02a6e9b81aa2.patch?full_index=1", + sha256="9dcc4affaaa850d4b7247baa939d0f9ffedea132369f1afc3f248dbf720386c9", + when="@:2.4.0+netcdf", + ) + + @when("%nag+fortran") + def patch(self): + # A number of Fortran source files assume that the kinds of integer and + # real variables are specified in bytes. However, the NAG compiler + # accepts such code only with an additional compiler flag -kind=byte. + # We do not simply add the flag because all user applications would + # have to be compiled with this flag too, which goes against one of the + # purposes of using the NAG compiler: make sure the code does not + # contradict the Fortran standards. The following logic could have been + # implemented as regular patch files, which would, however, be quite + # large. We would also have to introduce several versions of each patch + # file to support different versions of the package. + + patch_kind_files = [ + "fortran/eccodes_f90_head.f90", + "fortran/eccodes_f90_tail.f90", + "fortran/grib_f90_head.f90", + "fortran/grib_f90_tail.f90", + "fortran/grib_types.f90", + ] + + patch_unix_ext_files = [] + + if self.run_tests: + patch_kind_files.extend( + [ + "examples/F90/grib_print_data.f90", + "examples/F90/grib_print_data_static.f90", + # Files that need patching only when the extended regression + # tests are enabled, which we disable unconditionally: + # 'examples/F90/bufr_attributes.f90', + # 'examples/F90/bufr_expanded.f90', + # 'examples/F90/bufr_get_keys.f90', + # 'examples/F90/bufr_read_scatterometer.f90', + # 'examples/F90/bufr_read_synop.f90', + # 'examples/F90/bufr_read_temp.f90', + # 'examples/F90/bufr_read_tempf.f90', + # 'examples/F90/bufr_read_tropical_cyclone.f90', + # 'examples/F90/grib_clone.f90', + # 'examples/F90/grib_get_data.f90', + # 'examples/F90/grib_nearest.f90', + # 'examples/F90/grib_precision.f90', + # 'examples/F90/grib_read_from_file.f90', + # 'examples/F90/grib_samples.f90', + # 'examples/F90/grib_set_keys.f90' + ] + ) + + patch_unix_ext_files.extend( + [ + "examples/F90/bufr_ecc-1284.f90", + "examples/F90/grib_set_data.f90", + "examples/F90/grib_set_packing.f90", + # Files that need patching only when the extended regression + # tests are enabled, which we disable unconditionally: + # 'examples/F90/bufr_copy_data.f90', + # 'examples/F90/bufr_get_string_array.f90', + # 'examples/F90/bufr_keys_iterator.f90', + # 'examples/F90/get_product_kind.f90', + # 'examples/F90/grib_count_messages_multi.f90' + ] + ) + + kwargs = {"string": False, "backup": False, "ignore_absent": True} + + # Return the kind and not the size: + filter_file( + r"(^\s*kind_of_double\s*=\s*)(\d{1,2})(\s*$)", + "\\1kind(real\\2)\\3", + "fortran/grib_types.f90", + **kwargs, + ) + filter_file( + r"(^\s*kind_of_\w+\s*=\s*)(\d{1,2})(\s*$)", + "\\1kind(x\\2)\\3", + "fortran/grib_types.f90", + **kwargs, + ) + + # Replace integer kinds: + for size, r in [(2, 4), (4, 9), (8, 18)]: + filter_file( + r"(^\s*integer\((?:kind=)?){0}(\).*)".format(size), + "\\1selected_int_kind({0})\\2".format(r), + *patch_kind_files, + **kwargs, + ) + + # Replace real kinds: + for size, p, r in [(4, 6, 37), (8, 15, 307)]: + filter_file( + r"(^\s*real\((?:kind=)?){0}(\).*)".format(size), + "\\1selected_real_kind({0}, {1})\\2".format(p, r), + *patch_kind_files, + **kwargs, + ) + + # Enable getarg and exit subroutines: + filter_file( + r"(^\s*program\s+\w+)(\s*$)", + "\\1; use f90_unix_env; use f90_unix_proc\\2", + *patch_unix_ext_files, + **kwargs, + ) + + @property + def libs(self): + libraries = [] + + query_parameters = self.spec.last_query.extra_parameters + + if "shared" in query_parameters: + shared = True + elif "static" in query_parameters: + shared = False + else: + shared = "+shared" in self.spec + + # Return Fortran library if requested: + return_fortran = "fortran" in query_parameters + # Return C library if either requested or the Fortran library is not + # requested (to avoid overlinking) or the static libraries are + # requested: + return_c = "c" in query_parameters or not (return_fortran and shared) + # Return MEMFS library only if enabled and the static libraries are + # requested: + return_memfs = "+memfs" in self.spec and not shared + + if return_fortran: + libraries.append("libeccodes_f90") + + if return_c: + libraries.append("libeccodes") + + if return_memfs: + libraries.append("libeccodes_memfs") + + libs = find_libraries(libraries, root=self.prefix, shared=shared, recursive=True) + + if libs and len(libs) == len(libraries): + return libs + + msg = "Unable to recursively locate {0} {1} libraries in {2}" + raise spack.error.NoLibrariesError( + msg.format("shared" if shared else "static", self.spec.name, self.spec.prefix) + ) + + @run_before("cmake") + def check_fortran(self): + if "+fortran" in self.spec and self.compiler.fc is None: + raise InstallError("Fortran interface requires a Fortran compiler!") + + def cmake_args(self): + jp2k = self.spec.variants["jp2k"].value + + args = [ + self.define_from_variant("ENABLE_BUILD_TOOLS", "tools"), + self.define_from_variant("ENABLE_NETCDF", "netcdf"), + self.define("ENABLE_JPG", jp2k != "none"), + self.define("ENABLE_JPG_LIBJASPER", jp2k == "jasper"), + self.define("ENABLE_JPG_LIBOPENJPEG", jp2k == "openjpeg"), + self.define_from_variant("ENABLE_PNG", "png"), + self.define_from_variant("ENABLE_AEC", "aec"), + self.define_from_variant("ENABLE_ECCODES_THREADS", "pthreads"), + self.define_from_variant("ENABLE_ECCODES_OMP_THREADS", "openmp"), + self.define_from_variant("ENABLE_MEMFS", "memfs"), + self.define( + "ENABLE_PYTHON{0}".format("2" if self.spec.satisfies("@2.20.0:") else ""), False + ), + self.define_from_variant("ENABLE_FORTRAN", "fortran"), + self.define("BUILD_SHARED_LIBS", "BOTH" if "+shared" in self.spec else "OFF"), + self.define("ENABLE_TESTS", self.run_tests), + # Examples are not installed and are just part of the test suite: + self.define("ENABLE_EXAMPLES", self.run_tests), + # Unconditionally disable the extended regression tests, since they + # download additional data (~134MB): + self.define("ENABLE_EXTRA_TESTS", False), + ] + + if self.spec.satisfies("+netcdf"): + # Prevent possible overriding by environment variables NETCDF_ROOT, NETCDF_DIR, and + # NETCDF_PATH: + args.append(self.define("NETCDF_PATH", self.spec["netcdf-c"].prefix)) + # Prevent overriding by environment variable HDF5_ROOT (starting version 2.14.0, + # ecCodes is shipped with ecBuild 3.1.0+, which does not seem to rely on the HDF5_ROOT + # variable): + if self.spec.satisfies("@:2.13"): + args.append(self.define("HDF5_ROOT", self.spec["hdf5"].prefix)) + + if jp2k == "openjpeg": + args.append(self.define("OPENJPEG_PATH", self.spec["openjpeg"].prefix)) + + if self.spec.satisfies("+png"): + args.append(self.define("ZLIB_ROOT", self.spec["zlib-api"].prefix)) + + if self.spec.satisfies("+aec"): + # Prevent overriding by environment variables AEC_DIR and AEC_PATH: + args.append(self.define("AEC_DIR", self.spec["libaec"].prefix)) + + return args + + @run_after("install") + def install_extra_definitions(self): + for center in self.spec.variants["extra_definitions"].value: + if center != "none": + center_dir = "definitions.{0}".format(center) + install_tree( + join_path(self.stage.source_path, "spack-definitions", center_dir), + join_path(self.prefix.share.eccodes, center_dir), + ) + + def check(self): + # https://confluence.ecmwf.int/display/ECC/ecCodes+installation + with working_dir(self.build_directory): + ctest() diff --git a/recipes/mch/v8/repo/packages/eccodes/readme.md b/recipes/mch/v8/repo/packages/eccodes/readme.md new file mode 100644 index 0000000..9678342 --- /dev/null +++ b/recipes/mch/v8/repo/packages/eccodes/readme.md @@ -0,0 +1 @@ +copied from mainline spack November 5 2024 so that we can add eccodes 2.36.0 for mch production diff --git a/recipes/validation/compilers.yaml b/recipes/validation/compilers.yaml new file mode 100644 index 0000000..73a18ff --- /dev/null +++ b/recipes/validation/compilers.yaml @@ -0,0 +1,5 @@ +bootstrap: + spec: gcc@11 +gcc: + specs: + - gcc@12 diff --git a/recipes/validation/config.yaml b/recipes/validation/config.yaml new file mode 100644 index 0000000..79240f7 --- /dev/null +++ b/recipes/validation/config.yaml @@ -0,0 +1,6 @@ +name: mch +store: /user-environment +spack: + commit: releases/v0.20 + repo: https://github.com/spack/spack.git +description: Tools for MCH validation. diff --git a/recipes/validation/environments.yaml b/recipes/validation/environments.yaml new file mode 100644 index 0000000..2214548 --- /dev/null +++ b/recipes/validation/environments.yaml @@ -0,0 +1,29 @@ +prgenv-gcc: + compiler: + - toolchain: gcc + spec: gcc@12 + unify: when_possible + mpi: + spec: cray-mpich@8.1.28 + packages: + - perl + - curl + - ncurses + - autoconf + - m4 + - automake + - texinfo + - libtool + - gawk + specs: + - osu-micro-benchmarks@5.9 + - hdf5@1.12.2 +fortran +threadsafe ~mpi + - netcdf-c@4.8.1~mpi ^hdf5~mpi api=v18 + - python@3.11 + - r@4.2.2 + - udunits + - geos + - r-rgeos + views: + ffv2: + link: roots diff --git a/recipes/validation/modules.yaml b/recipes/validation/modules.yaml new file mode 100644 index 0000000..80dce73 --- /dev/null +++ b/recipes/validation/modules.yaml @@ -0,0 +1,36 @@ +modules: + # Paths to check when creating modules for all module sets + prefix_inspections: + bin: + - PATH + lib: + - LD_LIBRARY_PATH + lib64: + - LD_LIBRARY_PATH + lib/pkgconfig: + - PKG_CONFIG_PATH + lib64/pkgconfig: + - PKG_CONFIG_PATH + + default: + arch_folder: false + # Where to install modules + roots: + tcl: /user-environment/modules + tcl: + all: + autoload: none + netcdf-c: + environment: + set: + NETCDF_C_ROOT: '{prefix}' + hash_length: 0 + exclude_implicits: true + include: + - hdf5 + - zlib+shared + exclude: + - '%gcc@7.5.0' + - 'gcc %gcc@7.5.0' + projections: + all: '{name}/{version}' diff --git a/recipes/validation/repo/packages/r/change_optflags_tmp.patch b/recipes/validation/repo/packages/r/change_optflags_tmp.patch new file mode 100644 index 0000000..4e39b02 --- /dev/null +++ b/recipes/validation/repo/packages/r/change_optflags_tmp.patch @@ -0,0 +1,67 @@ +diff -ur R-3.6.3.org/configure R-3.6.3/configure +--- R-3.6.3.org/configure 2020-03-09 11:09:16.060825352 +0900 ++++ R-3.6.3/configure 2020-03-09 11:10:47.011280195 +0900 +@@ -6470,13 +6470,13 @@ + CFLAGS=$ac_save_CFLAGS + elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then +- CFLAGS="-g -O2" ++ CFLAGS="-g -O1" + else + CFLAGS="-g" + fi + else + if test "$GCC" = yes; then +- CFLAGS="-O2" ++ CFLAGS="-O1" + else + CFLAGS= + fi +@@ -7445,13 +7445,13 @@ + FCFLAGS=$ac_save_FCFLAGS + elif test $ac_cv_prog_fc_g = yes; then + if test "x$ac_cv_fc_compiler_gnu" = xyes; then +- FCFLAGS="-g -O2" ++ FCFLAGS="-g -O1" + else + FCFLAGS="-g" + fi + else + if test "x$ac_cv_fc_compiler_gnu" = xyes; then +- FCFLAGS="-O2" ++ FCFLAGS="-O1" + else + FCFLAGS= + fi +@@ -7717,13 +7717,13 @@ + CXXFLAGS=$ac_save_CXXFLAGS + elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then +- CXXFLAGS="-g -O2" ++ CXXFLAGS="-g -O1" + else + CXXFLAGS="-g" + fi + else + if test "$GXX" = yes; then +- CXXFLAGS="-O2" ++ CXXFLAGS="-O1" + else + CXXFLAGS= + fi +@@ -8336,13 +8336,13 @@ + OBJCFLAGS=$ac_save_OBJCFLAGS + elif test $ac_cv_prog_objc_g = yes; then + if test "$GOBJC" = yes; then +- OBJCFLAGS="-g -O2" ++ OBJCFLAGS="-g -O1" + else + OBJCFLAGS="-g" + fi + else + if test "$GOBJC" = yes; then +- OBJCFLAGS="-O2" ++ OBJCFLAGS="-O1" + else + OBJCFLAGS= + fi diff --git a/recipes/validation/repo/packages/r/package.py b/recipes/validation/repo/packages/r/package.py new file mode 100644 index 0000000..df61847 --- /dev/null +++ b/recipes/validation/repo/packages/r/package.py @@ -0,0 +1,262 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import re + +from spack.package import * + + +class R(AutotoolsPackage): + """R is 'GNU S', a freely available language and environment for + statistical computing and graphics which provides a wide variety of + statistical and graphical techniques: linear and nonlinear modelling, + statistical tests, time series analysis, classification, clustering, etc. + Please consult the R project homepage for further information.""" + + homepage = "https://www.r-project.org" + url = "https://cloud.r-project.org/src/base/R-3/R-3.4.3.tar.gz" + + extendable = True + + maintainers("glennpj") + + version("4.2.2", sha256="0ff62b42ec51afa5713caee7c4fde7a0c45940ba39bef8c5c9487fef0c953df5") + version("4.2.1", sha256="4d52db486d27848e54613d4ee977ad952ec08ce17807e1b525b10cd4436c643f") + version("4.2.0", sha256="38eab7719b7ad095388f06aa090c5a2b202791945de60d3e2bb0eab1f5097488") + version("4.1.3", sha256="15ff5b333c61094060b2a52e9c1d8ec55cc42dd029e39ca22abdaa909526fed6") + version("4.1.2", sha256="2036225e9f7207d4ce097e54972aecdaa8b40d7d9911cd26491fac5a0fab38af") + version("4.1.1", sha256="515e03265752257d0b7036f380f82e42b46ed8473f54f25c7b67ed25bbbdd364") + version("4.1.0", sha256="e8e68959d7282ca147360fc9644ada9bd161bab781bab14d33b8999a95182781") + version("4.0.5", sha256="0a3ee079aa772e131fe5435311ab627fcbccb5a50cabc54292e6f62046f1ffef") + version("4.0.4", sha256="523f27d69744a08c8f0bd5e1e6c3d89a4db29ed983388ba70963a3cd3a4a802e") + version("4.0.3", sha256="09983a8a78d5fb6bc45d27b1c55f9ba5265f78fa54a55c13ae691f87c5bb9e0d") + version("4.0.2", sha256="d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75") + version("4.0.1", sha256="95fe24a4d8d8f8f888460c8f5fe4311cec656e7a1722d233218bc03861bc6f32") + version("4.0.0", sha256="06beb0291b569978484eb0dcb5d2339665ec745737bdfb4e873e7a5a75492940") + version("3.6.3", sha256="89302990d8e8add536e12125ec591d6951022cf8475861b3690bc8bf1cefaa8f") + version("3.6.2", sha256="bd65a45cddfb88f37370fbcee4ac8dd3f1aebeebe47c2f968fd9770ba2bbc954") + version("3.6.1", sha256="5baa9ebd3e71acecdcc3da31d9042fb174d55a42829f8315f2457080978b1389") + version("3.6.0", sha256="36fcac3e452666158e62459c6fc810adc247c7109ed71c5b6c3ad5fc2bf57509") + version("3.5.3", sha256="2bfa37b7bd709f003d6b8a172ddfb6d03ddd2d672d6096439523039f7a8e678c") + version("3.5.2", sha256="e53d8c3cf20f2b8d7a9c1631b6f6a22874506fb392034758b3bb341c586c5b62") + version("3.5.1", sha256="0463bff5eea0f3d93fa071f79c18d0993878fd4f2e18ae6cf22c1639d11457ed") + version("3.5.0", sha256="fd1725535e21797d3d9fea8963d99be0ba4c3aecadcf081b43e261458b416870") + version("3.4.4", sha256="b3e97d2fab7256d1c655c4075934725ba1cd7cb9237240a11bb22ccdad960337") + version("3.4.3", sha256="7a3cb831de5b4151e1f890113ed207527b7d4b16df9ec6b35e0964170007f426") + version("3.4.2", sha256="971e30c2436cf645f58552905105d75788bd9733bddbcb7c4fbff4c1a6d80c64") + version("3.4.1", sha256="02b1135d15ea969a3582caeb95594a05e830a6debcdb5b85ed2d5836a6a3fc78") + version("3.4.0", sha256="288e9ed42457c47720780433b3d5c3c20983048b789291cc6a7baa11f9428b91") + version("3.3.3", sha256="5ab768053a275084618fb669b4fbaadcc39158998a87e8465323829590bcfc6c") + version("3.3.2", sha256="d294ad21e9f574fb4828ebb3a94b8cb34f4f304a41687a994be00dd41a4e514c") + version("3.3.1", sha256="3dc59ae5831f5380f83c169bac2103ad052efe0ecec4ffa74bde4d85a0fda9e2") + version("3.3.0", sha256="9256b154b1a5993d844bee7b1955cd49c99ad72cef03cce3cd1bdca1310311e4") + version("3.2.5", sha256="60745672dce5ddc201806fa59f6d4e0ba6554d8ed78d0f9f0d79a629978f80b5") + version("3.2.3", sha256="b93b7d878138279234160f007cb9b7f81b8a72c012a15566e9ec5395cfd9b6c1") + version("3.2.2", sha256="9c9152e74134b68b0f3a1c7083764adc1cb56fd8336bec003fd0ca550cd2461d") + version("3.2.1", sha256="d59dbc3f04f4604a5cf0fb210b8ea703ef2438b3ee65fd5ab536ec5234f4c982") + version("3.2.0", sha256="f5ae953f18ba6f3d55b46556bbbf73441350f9fd22625402b723a2b81ff64f35") + version("3.1.3", sha256="07e98323935baa38079204bfb9414a029704bb9c0ca5ab317020ae521a377312") + version("3.1.2", sha256="bcd150afcae0e02f6efb5f35a6ab72432be82e849ec52ce0bb89d8c342a8fa7a") + + variant( + "external-lapack", default=False, description="Links to externally installed BLAS/LAPACK" + ) + variant("X", default=False, description="Enable X11 support (TCLTK, PNG, JPEG, TIFF, CAIRO)") + variant("memory_profiling", default=False, description="Enable memory profiling") + variant("rmath", default=False, description="Build standalone Rmath library") + + depends_on("blas", when="+external-lapack") + depends_on("lapack", when="+external-lapack") + depends_on("bzip2") + # R didn't anticipate the celebratory + # non-breaking major version bump of curl 8. + depends_on("curl+libidn2@:7") + depends_on("icu4c") + depends_on("java") + depends_on("ncurses") + depends_on("pcre", when="@:3.6.3") + depends_on("pcre2", when="@4:") + depends_on("readline") + depends_on("xz") + depends_on("which", type=("build", "run")) + depends_on("zlib@1.2.5:") + depends_on("texinfo", type="build") + depends_on("cairo+X+gobject+pdf", when="+X") + depends_on("pango+X", when="+X") + depends_on("harfbuzz+graphite2", when="+X") + depends_on("jpeg", when="+X") + depends_on("libpng", when="+X") + depends_on("libtiff", when="+X") + depends_on("libx11", when="+X") + depends_on("libxmu", when="+X") + depends_on("libxt", when="+X") + depends_on("tk", when="+X") + + patch("zlib.patch", when="@:3.3.2") + + # R cannot be built with '-O2' optimization + # with Fujitsu Compiler @4.1.0 now. + # Until the Fujitsu compiler resolves this problem, + # temporary fix to lower the optimization level. + patch("change_optflags_tmp.patch", when="%fj@4.1.0") + + # R custom URL version + def url_for_version(self, version): + """Handle R's customed URL versions""" + url = "https://cloud.r-project.org/src/base" + return url + "/R-%s/R-%s.tar.gz" % (version.up_to(1), version) + + @property + def etcdir(self): + return join_path(prefix, "rlib", "R", "etc") + + @run_after("install") + def install_rmath(self): + if "+rmath" in self.spec: + with working_dir("src/nmath/standalone"): + make() + make("install", parallel=False) + + def configure_args(self): + spec = self.spec + prefix = self.prefix + + config_args = [ + "--libdir={0}".format(join_path(prefix, "rlib")), + "--enable-R-shlib", + "--enable-BLAS-shlib", + "--enable-R-framework=no", + "--without-recommended-packages", + "LDFLAGS=-L{0} -Wl,-rpath,{0}".format(join_path(prefix, "rlib", "R", "lib")), + # cannot disable docs with a normal configure option + "ac_cv_path_PDFLATEX=", + "ac_cv_path_PDFTEX=", + "ac_cv_path_TEX=", + "ac_cv_path_TEXI2DVI=", + ] + + if "+external-lapack" in spec: + if "^mkl" in spec and "gfortran" in self.compiler.fc: + mkl_re = re.compile(r"(mkl_)intel(_i?lp64\b)") + config_args.extend( + [ + mkl_re.sub( + r"\g<1>gf\g<2>", "--with-blas={0}".format(spec["blas"].libs.ld_flags) + ), + "--with-lapack", + ] + ) + else: + config_args.extend( + ["--with-blas={0}".format(spec["blas"].libs.ld_flags), "--with-lapack"] + ) + + if "+X" in spec: + config_args.append("--with-cairo") + config_args.append("--with-jpeglib") + config_args.append("--with-libpng") + config_args.append("--with-libtiff") + config_args.append("--with-tcltk") + config_args.append("--with-x") + + tcl_config_path = join_path(spec["tcl"].libs.directories[0], "tclConfig.sh") + config_args.append("--with-tcl-config={0}".format(tcl_config_path)) + + tk_config_path = join_path(spec["tk"].libs.directories[0], "tkConfig.sh") + config_args.append("--with-tk-config={0}".format(tk_config_path)) + else: + config_args.append("--without-cairo") + config_args.append("--without-jpeglib") + config_args.append("--without-libpng") + config_args.append("--without-libtiff") + config_args.append("--without-tcltk") + config_args.append("--without-x") + + if "+memory_profiling" in spec: + config_args.append("--enable-memory-profiling") + + # Set FPICFLAGS for compilers except 'gcc'. + if self.compiler.name != "gcc": + config_args.append("FPICFLAGS={0}".format(self.compiler.cc_pic_flag)) + + if self.spec.satisfies("@:3.6.1 %gcc@10:"): + config_args.append("CFLAGS=-fcommon") + config_args.append("FFLAGS=-fallow-argument-mismatch") + + return config_args + + @run_after("install") + def copy_makeconf(self): + # Make a copy of Makeconf because it will be needed to properly build R + # dependencies in Spack. + src_makeconf = join_path(self.etcdir, "Makeconf") + dst_makeconf = join_path(self.etcdir, "Makeconf.spack") + install(src_makeconf, dst_makeconf) + + # To respect order of execution, we should filter after we made the copy above + filter_compiler_wrappers("Makeconf", relative_root=os.path.join("rlib", "R", "etc")) + + # ======================================================================== + # Set up environment to make install easy for R extensions. + # ======================================================================== + + @property + def r_lib_dir(self): + return join_path("rlib", "R", "library") + + def setup_dependent_build_environment(self, env, dependent_spec): + # Set R_LIBS to include the library dir for the + # extension and any other R extensions it depends on. + r_libs_path = [] + for d in dependent_spec.traverse(deptype=("build", "run")): + if d.package.extends(self.spec): + r_libs_path.append(join_path(d.prefix, self.r_lib_dir)) + + r_libs_path = ":".join(r_libs_path) + env.set("R_LIBS", r_libs_path) + # R_LIBS_USER gets set to a directory in HOME/R if it is not set, such as + # during package installation with the --vanilla flag. Set it to null + # to ensure that it does not point to a directory that may contain R + # packages. + env.set("R_LIBS_USER", "") + env.set("R_MAKEVARS_SITE", join_path(self.etcdir, "Makeconf.spack")) + + # Use the number of make_jobs set in spack. The make program will + # determine how many jobs can actually be started. + env.set("MAKEFLAGS", "-j{0}".format(make_jobs)) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + def setup_dependent_run_environment(self, env, dependent_spec): + # For run time environment set only the path for dependent_spec and + # prepend it to R_LIBS + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + if dependent_spec.package.extends(self.spec): + env.prepend_path("R_LIBS", join_path(dependent_spec.prefix, self.r_lib_dir)) + + def setup_run_environment(self, env): + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib", "R", "lib")) + env.prepend_path("PKG_CONFIG_PATH", join_path(self.prefix, "rlib", "pkgconfig")) + env.set("R_HOME", join_path(self.prefix, "rlib", "R")) + + if "+rmath" in self.spec: + env.prepend_path("LD_LIBRARY_PATH", join_path(self.prefix, "rlib")) + + def setup_dependent_package(self, module, dependent_spec): + """Called before R modules' install() methods. In most cases, + extensions will only need to have one line: + R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir), + self.stage.source_path)""" + + # R extension builds can have a global R executable function + module.R = Executable(join_path(self.spec.prefix.bin, "R")) + + # Add variable for library directry + module.r_lib_dir = join_path(dependent_spec.prefix, self.r_lib_dir) + + # Make the site packages directory for extensions, if it does not exist + # already. + if dependent_spec.package.is_extension: + mkdirp(module.r_lib_dir) diff --git a/recipes/validation/repo/packages/r/zlib.patch b/recipes/validation/repo/packages/r/zlib.patch new file mode 100644 index 0000000..673d535 --- /dev/null +++ b/recipes/validation/repo/packages/r/zlib.patch @@ -0,0 +1,29 @@ +*** a/configure 2017-01-21 21:48:35.077000000 +0000 +--- b/configure 2017-01-21 21:50:50.700000000 +0000 +*************** +*** 35496,35505 **** + #include + #include + int main() { +! #ifdef ZLIB_VERSION +! /* Work around Debian bug: it uses 1.2.3.4 even though there was no such +! version on the master site zlib.net */ +! exit(strncmp(ZLIB_VERSION, "1.2.5", 5) < 0); + #else + exit(1); + #endif +--- 35496,35509 ---- + #include + #include + int main() { +! /* Checking ZLIB_VERNUM trick learned here: +! * https://github.com/TransitApp/protobuf/blob/master/configure.ac#L95 +! */ +! #ifdef ZLIB_VERNUM +! if (ZLIB_VERNUM < 0x1250) { +! exit(1); +! } +! exit(0); + #else + exit(1); + #endif From 5e96f169206d68d9e0fcbb0c89a281391938f171 Mon Sep 17 00:00:00 2001 From: bcumming Date: Tue, 4 Feb 2025 14:44:18 +0100 Subject: [PATCH 2/6] use correct f7t api for santis --- config.yaml | 2 +- recipes/validation/readme.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 recipes/validation/readme.md diff --git a/config.yaml b/config.yaml index 8bdd692..ea6eb69 100644 --- a/config.yaml +++ b/config.yaml @@ -18,7 +18,7 @@ clusters: uarch: 'gh200' partition: 'normal' variables: - F7T_URL: "https://api.cscs.ch/hpc/firecrest/v1" + F7T_URL: "https://api.cscs.ch/cw/firecrest/v1" runner: f7t uenvs: climana: diff --git a/recipes/validation/readme.md b/recipes/validation/readme.md new file mode 100644 index 0000000..afc2ee2 --- /dev/null +++ b/recipes/validation/readme.md @@ -0,0 +1 @@ +A uenv recipe that was built for an MCH user on Balfrin, From e31c36fa73578347981a645278b04608ccdd2cc5 Mon Sep 17 00:00:00 2001 From: bcumming Date: Tue, 4 Feb 2025 15:04:30 +0100 Subject: [PATCH 3/6] fix typo in python spec in icon/25.2 recipe --- recipes/icon/25.2/gh200/environments.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/icon/25.2/gh200/environments.yaml b/recipes/icon/25.2/gh200/environments.yaml index 24b3ace..6e481db 100644 --- a/recipes/icon/25.2/gh200/environments.yaml +++ b/recipes/icon/25.2/gh200/environments.yaml @@ -10,7 +10,7 @@ nvidia: gpu: cuda specs: - boost%gcc ~mpi - - python@3.10% + - python@3.10 - cuda@12.6 - eccodes@2.25.0%nvhpc +tools +fortran +aec +openmp jp2k=jasper - hdf5%nvhpc +szip +hl +fortran +mpi From 31e2c6c67e3627306abb0b4b6ce05f8eaaabd0df Mon Sep 17 00:00:00 2001 From: bcumming Date: Tue, 4 Feb 2025 15:45:28 +0100 Subject: [PATCH 4/6] add eccodes 2.36 to icon recipe, use more recent gcc --- recipes/icon/25.2/gh200/compilers.yaml | 4 +- recipes/icon/25.2/gh200/environments.yaml | 10 +- .../eccodes/cmake_install_rpath.patch | 11 + .../packages/eccodes/openjpeg_jasper.patch | 39 ++ .../gh200/repo/packages/eccodes/package.py | 385 ++++++++++++++++++ .../gh200/repo/packages/eccodes/readme.md | 1 + 6 files changed, 443 insertions(+), 7 deletions(-) create mode 100644 recipes/icon/25.2/gh200/repo/packages/eccodes/cmake_install_rpath.patch create mode 100644 recipes/icon/25.2/gh200/repo/packages/eccodes/openjpeg_jasper.patch create mode 100644 recipes/icon/25.2/gh200/repo/packages/eccodes/package.py create mode 100644 recipes/icon/25.2/gh200/repo/packages/eccodes/readme.md diff --git a/recipes/icon/25.2/gh200/compilers.yaml b/recipes/icon/25.2/gh200/compilers.yaml index 34698b6..f456b5a 100644 --- a/recipes/icon/25.2/gh200/compilers.yaml +++ b/recipes/icon/25.2/gh200/compilers.yaml @@ -2,8 +2,8 @@ bootstrap: spec: gcc@12.3 gcc: specs: - - gcc@12.3 + - gcc@13 llvm: - requires: gcc@13.3 + requires: gcc@13 specs: - nvhpc@25.1 diff --git a/recipes/icon/25.2/gh200/environments.yaml b/recipes/icon/25.2/gh200/environments.yaml index 6e481db..bf84bd8 100644 --- a/recipes/icon/25.2/gh200/environments.yaml +++ b/recipes/icon/25.2/gh200/environments.yaml @@ -1,10 +1,10 @@ nvidia: compiler: - - toolchain: gcc - spec: gcc + - toolchain: gcc@13 + spec: gcc@13 - toolchain: llvm spec: nvhpc - unify: when_possible + unify: true mpi: spec: cray-mpich@8.1.30%nvhpc gpu: cuda @@ -12,13 +12,13 @@ nvidia: - boost%gcc ~mpi - python@3.10 - cuda@12.6 - - eccodes@2.25.0%nvhpc +tools +fortran +aec +openmp jp2k=jasper + - eccodes@2.36.4%nvhpc +tools +fortran +aec +openmp jp2k=jasper - hdf5%nvhpc +szip +hl +fortran +mpi - netcdf-c%nvhpc - netcdf-cxx4%nvhpc - netcdf-fortran%nvhpc - osu-micro-benchmarks@5.9%nvhpc - - openblas@0.3.21%nvhpc + - openblas%nvhpc # everything needed for nccl on SS11 - nccl%gcc - nccl-tests%gcc diff --git a/recipes/icon/25.2/gh200/repo/packages/eccodes/cmake_install_rpath.patch b/recipes/icon/25.2/gh200/repo/packages/eccodes/cmake_install_rpath.patch new file mode 100644 index 0000000..7e2b250 --- /dev/null +++ b/recipes/icon/25.2/gh200/repo/packages/eccodes/cmake_install_rpath.patch @@ -0,0 +1,11 @@ +--- a/cmake/ecbuild_append_to_rpath.cmake ++++ b/cmake/ecbuild_append_to_rpath.cmake +@@ -31,7 +31,7 @@ function( _path_append var path ) + else() + list( FIND ${var} ${path} _found ) + if( _found EQUAL "-1" ) +- set( ${var} "${${var}}:${path}" PARENT_SCOPE ) ++ set( ${var} "${${var}};${path}" PARENT_SCOPE ) + endif() + endif() + endfunction() diff --git a/recipes/icon/25.2/gh200/repo/packages/eccodes/openjpeg_jasper.patch b/recipes/icon/25.2/gh200/repo/packages/eccodes/openjpeg_jasper.patch new file mode 100644 index 0000000..5793f56 --- /dev/null +++ b/recipes/icon/25.2/gh200/repo/packages/eccodes/openjpeg_jasper.patch @@ -0,0 +1,39 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -43,6 +43,18 @@ ecbuild_add_option( FEATURE JPG + DESCRIPTION "support for JPG decoding/encoding" + DEFAULT ON + ) ++# Options related to JPG. The Jasper and OpenJPEG libraries ++ecbuild_add_option( FEATURE JPG_LIBJASPER ++ DESCRIPTION "Support for JPG decoding/encoding with the Jasper library" ++ CONDITION ENABLE_JPG ++ DEFAULT ON ++) ++ecbuild_add_option( FEATURE JPG_LIBOPENJPEG ++ DESCRIPTION "Support for JPG decoding/encoding with the OpenJPEG library" ++ CONDITION ENABLE_JPG ++ DEFAULT ON ++) ++ + + ecbuild_add_option( FEATURE PNG + DESCRIPTION "support for PNG decoding/encoding" +@@ -144,7 +156,7 @@ if( ENABLE_JPG ) + + find_package( OpenJPEG ) + +- if( JASPER_FOUND ) ++ if( JASPER_FOUND AND ENABLE_JPG_LIBJASPER ) + list( APPEND ECCODES_TPLS Jasper ) + set( HAVE_JPEG 1 ) + set( HAVE_LIBJASPER 1 ) +@@ -152,7 +164,7 @@ if( ENABLE_JPG ) + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" JASPER_VERSION_MAJOR "${JASPER_VERSION_STRING}") + endif() + +- if( OPENJPEG_FOUND ) ++ if( OPENJPEG_FOUND AND ENABLE_JPG_LIBOPENJPEG ) + list( APPEND ECCODES_TPLS OpenJPEG ) + set( HAVE_JPEG 1 ) + set( HAVE_LIBOPENJPEG 1 ) diff --git a/recipes/icon/25.2/gh200/repo/packages/eccodes/package.py b/recipes/icon/25.2/gh200/repo/packages/eccodes/package.py new file mode 100644 index 0000000..aeb4692 --- /dev/null +++ b/recipes/icon/25.2/gh200/repo/packages/eccodes/package.py @@ -0,0 +1,385 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack.package import * + +_definitions = { + # German Meteorological Service (Deutscher Wetterdienst, DWD): + "edzw": { + "conflicts": {"when": "@:2.19.1,2.22.0,2.24.0:"}, + "resources": [ + { + "when": "@2.20.0", + "url": "http://opendata.dwd.de/weather/lib/grib/eccodes_definitions.edzw-2.20.0-1.tar.gz", + "sha256": "a92932f8a13c33cba65d3a33aa06c7fb4a37ed12a78e9abe2c5e966402b99af4", + }, + { + "when": "@2.21.0", + "url": "http://opendata.dwd.de/weather/lib/grib/eccodes_definitions.edzw-2.21.0-3.tar.bz2", + "sha256": "046f1f6450abb3b44c31dee6229f4aab06ca0d3576e27e93e05ccb7cd6e2d9d9", + }, + { + "when": "@2.22.1", + "url": "http://opendata.dwd.de/weather/lib/grib/eccodes_definitions.edzw-2.22.1-1.tar.bz2", + "sha256": "be73102a0dcabb236bacd2a70c7b5475f673fda91b49e34df61bef0fa5ad3389", + }, + { + "when": "@2.23.0", + "url": "http://opendata.dwd.de/weather/lib/grib/eccodes_definitions.edzw-2.23.0-4.tar.bz2", + "sha256": "c5db32861c7d23410aed466ffef3ca661410d252870a3949442d3ecb176aa338", + }, + ], + } +} + + +class Eccodes(CMakePackage): + """ecCodes is a package developed by ECMWF for processing meteorological + data in GRIB (1/2), BUFR (3/4) and GTS header formats.""" + + homepage = "https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home" + url = "https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.2.0-Source.tar.gz?api=v2" + git = "https://github.com/ecmwf/eccodes.git" + list_url = "https://confluence.ecmwf.int/display/ECC/Releases" + + maintainers("skosukhin", "victoria-cherkas", "dominichofer", "climbfuji") + + license("Apache-2.0") + + version("develop", branch="develop") + version("2.36.4", + sha256="198ccb26e8df96544c668ea6853ea153535ab78b10c43339a678f271337aa0da", + url="https://github.com/ecmwf/eccodes/archive/refs/tags/2.36.4.tar.gz" + ) + version("2.34.0", sha256="3cd208c8ddad132789662cf8f67a9405514bfefcacac403c0d8c84507f303aba") + version("2.33.0", sha256="bdcec8ce63654ec6803400c507f01220a9aa403a45fa6b5bdff7fdcc44fd7daf") + version("2.32.1", sha256="ad2ac1bf36577b1d35c4a771b4d174a06f522a1e5ef6c1f5e53a795fb624863e") + version("2.32.0", sha256="b57e8eeb0eba0c05d66fda5527c4ffa84b5ab35c46bcbc9a2227142973ccb8e6") + version("2.31.0", sha256="808ecd2c11fbf2c3f9fc7a36f8c2965b343f3151011b58a1d6e7cc2e6b3cac5d") + version("2.25.0", sha256="8975131aac54d406e5457706fd4e6ba46a8cc9c7dd817a41f2aa64ce1193c04e") + version("2.24.2", sha256="c60ad0fd89e11918ace0d84c01489f21222b11d6cad3ff7495856a0add610403") + version("2.23.0", sha256="cbdc8532537e9682f1a93ddb03440416b66906a4cc25dec3cbd73940d194bf0c") + version("2.22.1", sha256="75c7ee96469bb30b0c8f7edbdc4429ece4415897969f75c36173545242bc9e85") + version("2.21.0", sha256="da0a0bf184bb436052e3eae582defafecdb7c08cdaab7216780476e49b509755") + version("2.20.0", sha256="207a3d7966e75d85920569b55a19824673e8cd0b50db4c4dac2d3d52eacd7985") + version("2.19.1", sha256="9964bed5058e873d514bd4920951122a95963128b12f55aa199d9afbafdd5d4b") + version("2.18.0", sha256="d88943df0f246843a1a062796edbf709ef911de7269648eef864be259e9704e3") + version("2.13.0", sha256="c5ce1183b5257929fc1f1c8496239e52650707cfab24f4e0e1f1a471135b8272") + version("2.5.0", sha256="18ab44bc444168fd324d07f7dea94f89e056f5c5cd973e818c8783f952702e4e") + version("2.2.0", sha256="1a4112196497b8421480e2a0a1164071221e467853486577c4f07627a702f4c3") + + # we are still using spack v0.21 v0.22, so comment these out for now + #depends_on("c", type="build") # generated + #depends_on("cxx", type="build") # generated + #depends_on("fortran", type="build") # generated + + variant("tools", default=False, description="Build the command line tools") + variant("netcdf", default=False, description="Enable GRIB to NetCDF conversion tool") + variant( + "jp2k", + default="openjpeg", + values=("openjpeg", "jasper", "none"), + description="Specify JPEG2000 decoding/encoding backend", + ) + variant("png", default=False, description="Enable PNG support for decoding/encoding") + variant( + "aec", default=True, description="Enable Adaptive Entropy Coding for decoding/encoding" + ) + variant("pthreads", default=False, description="Enable POSIX threads") + variant("openmp", default=False, description="Enable OpenMP threads") + variant( + "memfs", default=False, description="Enable memory based access to definitions/samples" + ) + variant("fortran", default=False, description="Enable the Fortran support") + variant("shared", default=True, description="Build shared versions of the libraries") + + variant( + "extra_definitions", + values=any_combination_of(*_definitions.keys()), + description="List of extra definitions to install", + ) + + depends_on("netcdf-c", when="+netcdf") + # Cannot be built with openjpeg@2.0.x. + depends_on("openjpeg@1.5.0:1.5,2.1.0:2.3", when="jp2k=openjpeg") + # Additional constraint for older versions. + depends_on("openjpeg@:2.1", when="@:2.16 jp2k=openjpeg") + + with when("jp2k=jasper"): + depends_on("jasper") + # jasper 3.x compat from commit 86f0b35f1a8492cb16f82fb976a0a5acd2986ac2 + depends_on("jasper@:2", when="@:2.25.0") + + depends_on("libpng", when="+png") + depends_on("libaec", when="+aec") + # Can be built with Python 2 or Python 3. + depends_on("python", when="+memfs", type="build") + + depends_on("cmake@3.6:", type="build") + depends_on("cmake@3.12:", when="@2.19:", type="build") + + # TODO: ecbuild was only used for the @develop branch + # however, testing 2.36.4, it appears to be a requirement. + # this might be because they package the software differently in GitHub + # (they normally provide releases as tar balls on Confluence) + depends_on("ecbuild", type="build") + #depends_on("ecbuild", type="build", when="@develop") + + conflicts("+openmp", when="+pthreads", msg="Cannot enable both POSIX threads and OMP") + + conflicts( + "+netcdf", + when="~tools", + msg="Cannot enable the NetCDF conversion tool " "when the command line tools are disabled", + ) + + conflicts( + "~tools", + when="@:2.18.0", + msg="The command line tools can be disabled " "only starting version 2.19.0", + ) + + for center, definitions in _definitions.items(): + kwargs = definitions.get("conflicts", None) + if kwargs: + conflicts("extra_definitions={0}".format(center), **kwargs) + for kwargs in definitions.get("resources", []): + resource( + name=center, + destination="spack-definitions", + placement="definitions.{0}".format(center), + **kwargs, + ) + + # Enforce linking against the specified JPEG2000 backend, see also + # https://github.com/ecmwf/eccodes/commit/2c10828495900ff3d80d1e570fe96c1df16d97fb + patch("openjpeg_jasper.patch", when="@:2.16") + + # CMAKE_INSTALL_RPATH must be a semicolon-separated list. + patch("cmake_install_rpath.patch", when="@:2.10") + + # Fix a bug preventing cmake from finding NetCDF: + patch( + "https://github.com/ecmwf/ecbuild/commit/3916c7d22575c45166fcc89edcbe02a6e9b81aa2.patch?full_index=1", + sha256="9dcc4affaaa850d4b7247baa939d0f9ffedea132369f1afc3f248dbf720386c9", + when="@:2.4.0+netcdf", + ) + + @when("%nag+fortran") + def patch(self): + # A number of Fortran source files assume that the kinds of integer and + # real variables are specified in bytes. However, the NAG compiler + # accepts such code only with an additional compiler flag -kind=byte. + # We do not simply add the flag because all user applications would + # have to be compiled with this flag too, which goes against one of the + # purposes of using the NAG compiler: make sure the code does not + # contradict the Fortran standards. The following logic could have been + # implemented as regular patch files, which would, however, be quite + # large. We would also have to introduce several versions of each patch + # file to support different versions of the package. + + patch_kind_files = [ + "fortran/eccodes_f90_head.f90", + "fortran/eccodes_f90_tail.f90", + "fortran/grib_f90_head.f90", + "fortran/grib_f90_tail.f90", + "fortran/grib_types.f90", + ] + + patch_unix_ext_files = [] + + if self.run_tests: + patch_kind_files.extend( + [ + "examples/F90/grib_print_data.f90", + "examples/F90/grib_print_data_static.f90", + # Files that need patching only when the extended regression + # tests are enabled, which we disable unconditionally: + # 'examples/F90/bufr_attributes.f90', + # 'examples/F90/bufr_expanded.f90', + # 'examples/F90/bufr_get_keys.f90', + # 'examples/F90/bufr_read_scatterometer.f90', + # 'examples/F90/bufr_read_synop.f90', + # 'examples/F90/bufr_read_temp.f90', + # 'examples/F90/bufr_read_tempf.f90', + # 'examples/F90/bufr_read_tropical_cyclone.f90', + # 'examples/F90/grib_clone.f90', + # 'examples/F90/grib_get_data.f90', + # 'examples/F90/grib_nearest.f90', + # 'examples/F90/grib_precision.f90', + # 'examples/F90/grib_read_from_file.f90', + # 'examples/F90/grib_samples.f90', + # 'examples/F90/grib_set_keys.f90' + ] + ) + + patch_unix_ext_files.extend( + [ + "examples/F90/bufr_ecc-1284.f90", + "examples/F90/grib_set_data.f90", + "examples/F90/grib_set_packing.f90", + # Files that need patching only when the extended regression + # tests are enabled, which we disable unconditionally: + # 'examples/F90/bufr_copy_data.f90', + # 'examples/F90/bufr_get_string_array.f90', + # 'examples/F90/bufr_keys_iterator.f90', + # 'examples/F90/get_product_kind.f90', + # 'examples/F90/grib_count_messages_multi.f90' + ] + ) + + kwargs = {"string": False, "backup": False, "ignore_absent": True} + + # Return the kind and not the size: + filter_file( + r"(^\s*kind_of_double\s*=\s*)(\d{1,2})(\s*$)", + "\\1kind(real\\2)\\3", + "fortran/grib_types.f90", + **kwargs, + ) + filter_file( + r"(^\s*kind_of_\w+\s*=\s*)(\d{1,2})(\s*$)", + "\\1kind(x\\2)\\3", + "fortran/grib_types.f90", + **kwargs, + ) + + # Replace integer kinds: + for size, r in [(2, 4), (4, 9), (8, 18)]: + filter_file( + r"(^\s*integer\((?:kind=)?){0}(\).*)".format(size), + "\\1selected_int_kind({0})\\2".format(r), + *patch_kind_files, + **kwargs, + ) + + # Replace real kinds: + for size, p, r in [(4, 6, 37), (8, 15, 307)]: + filter_file( + r"(^\s*real\((?:kind=)?){0}(\).*)".format(size), + "\\1selected_real_kind({0}, {1})\\2".format(p, r), + *patch_kind_files, + **kwargs, + ) + + # Enable getarg and exit subroutines: + filter_file( + r"(^\s*program\s+\w+)(\s*$)", + "\\1; use f90_unix_env; use f90_unix_proc\\2", + *patch_unix_ext_files, + **kwargs, + ) + + @property + def libs(self): + libraries = [] + + query_parameters = self.spec.last_query.extra_parameters + + if "shared" in query_parameters: + shared = True + elif "static" in query_parameters: + shared = False + else: + shared = "+shared" in self.spec + + # Return Fortran library if requested: + return_fortran = "fortran" in query_parameters + # Return C library if either requested or the Fortran library is not + # requested (to avoid overlinking) or the static libraries are + # requested: + return_c = "c" in query_parameters or not (return_fortran and shared) + # Return MEMFS library only if enabled and the static libraries are + # requested: + return_memfs = "+memfs" in self.spec and not shared + + if return_fortran: + libraries.append("libeccodes_f90") + + if return_c: + libraries.append("libeccodes") + + if return_memfs: + libraries.append("libeccodes_memfs") + + libs = find_libraries(libraries, root=self.prefix, shared=shared, recursive=True) + + if libs and len(libs) == len(libraries): + return libs + + msg = "Unable to recursively locate {0} {1} libraries in {2}" + raise spack.error.NoLibrariesError( + msg.format("shared" if shared else "static", self.spec.name, self.spec.prefix) + ) + + @run_before("cmake") + def check_fortran(self): + if "+fortran" in self.spec and self.compiler.fc is None: + raise InstallError("Fortran interface requires a Fortran compiler!") + + def cmake_args(self): + jp2k = self.spec.variants["jp2k"].value + + args = [ + self.define_from_variant("ENABLE_BUILD_TOOLS", "tools"), + self.define_from_variant("ENABLE_NETCDF", "netcdf"), + self.define("ENABLE_JPG", jp2k != "none"), + self.define("ENABLE_JPG_LIBJASPER", jp2k == "jasper"), + self.define("ENABLE_JPG_LIBOPENJPEG", jp2k == "openjpeg"), + self.define_from_variant("ENABLE_PNG", "png"), + self.define_from_variant("ENABLE_AEC", "aec"), + self.define_from_variant("ENABLE_ECCODES_THREADS", "pthreads"), + self.define_from_variant("ENABLE_ECCODES_OMP_THREADS", "openmp"), + self.define_from_variant("ENABLE_MEMFS", "memfs"), + self.define( + "ENABLE_PYTHON{0}".format("2" if self.spec.satisfies("@2.20.0:") else ""), False + ), + self.define_from_variant("ENABLE_FORTRAN", "fortran"), + self.define("BUILD_SHARED_LIBS", "BOTH" if "+shared" in self.spec else "OFF"), + self.define("ENABLE_TESTS", self.run_tests), + # Examples are not installed and are just part of the test suite: + self.define("ENABLE_EXAMPLES", self.run_tests), + # Unconditionally disable the extended regression tests, since they + # download additional data (~134MB): + self.define("ENABLE_EXTRA_TESTS", False), + ] + + if self.spec.satisfies("+netcdf"): + # Prevent possible overriding by environment variables NETCDF_ROOT, NETCDF_DIR, and + # NETCDF_PATH: + args.append(self.define("NETCDF_PATH", self.spec["netcdf-c"].prefix)) + # Prevent overriding by environment variable HDF5_ROOT (starting version 2.14.0, + # ecCodes is shipped with ecBuild 3.1.0+, which does not seem to rely on the HDF5_ROOT + # variable): + if self.spec.satisfies("@:2.13"): + args.append(self.define("HDF5_ROOT", self.spec["hdf5"].prefix)) + + if jp2k == "openjpeg": + args.append(self.define("OPENJPEG_PATH", self.spec["openjpeg"].prefix)) + + if self.spec.satisfies("+png"): + args.append(self.define("ZLIB_ROOT", self.spec["zlib-api"].prefix)) + + if self.spec.satisfies("+aec"): + # Prevent overriding by environment variables AEC_DIR and AEC_PATH: + args.append(self.define("AEC_DIR", self.spec["libaec"].prefix)) + + return args + + @run_after("install") + def install_extra_definitions(self): + for center in self.spec.variants["extra_definitions"].value: + if center != "none": + center_dir = "definitions.{0}".format(center) + install_tree( + join_path(self.stage.source_path, "spack-definitions", center_dir), + join_path(self.prefix.share.eccodes, center_dir), + ) + + def check(self): + # https://confluence.ecmwf.int/display/ECC/ecCodes+installation + with working_dir(self.build_directory): + ctest() diff --git a/recipes/icon/25.2/gh200/repo/packages/eccodes/readme.md b/recipes/icon/25.2/gh200/repo/packages/eccodes/readme.md new file mode 100644 index 0000000..9678342 --- /dev/null +++ b/recipes/icon/25.2/gh200/repo/packages/eccodes/readme.md @@ -0,0 +1 @@ +copied from mainline spack November 5 2024 so that we can add eccodes 2.36.0 for mch production From 9012764a910225a193d00c6f097fbe49c5ca308c Mon Sep 17 00:00:00 2001 From: bcumming Date: Wed, 5 Feb 2025 11:25:17 +0100 Subject: [PATCH 5/6] fix icon environments to concretize properly --- recipes/icon/25.2/gh200/environments.yaml | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/recipes/icon/25.2/gh200/environments.yaml b/recipes/icon/25.2/gh200/environments.yaml index bf84bd8..4e0b515 100644 --- a/recipes/icon/25.2/gh200/environments.yaml +++ b/recipes/icon/25.2/gh200/environments.yaml @@ -1,15 +1,15 @@ -nvidia: +gcc-env: compiler: - - toolchain: gcc@13 - spec: gcc@13 + - toolchain: gcc + spec: gcc - toolchain: llvm spec: nvhpc - unify: true mpi: spec: cray-mpich@8.1.30%nvhpc gpu: cuda + unify: true specs: - - boost%gcc ~mpi + - boost ~mpi - python@3.10 - cuda@12.6 - eccodes@2.36.4%nvhpc +tools +fortran +aec +openmp jp2k=jasper @@ -18,19 +18,21 @@ nvidia: - netcdf-cxx4%nvhpc - netcdf-fortran%nvhpc - osu-micro-benchmarks@5.9%nvhpc - - openblas%nvhpc + - openblas # everything needed for nccl on SS11 - - nccl%gcc - - nccl-tests%gcc + - nccl + - nccl-tests # extras - libfyaml - zlib-ng - cmake variants: - - cuda_arch=90 - +mpi - +cuda - packages: [] + - cuda_arch=90 views: - default: + nvfort: link: roots + uenv: + prefix_paths: + LD_LIBRARY_PATH: [lib, lib64] From 1b622d11098bd4300bb06675440f909de53e49d0 Mon Sep 17 00:00:00 2001 From: bcumming Date: Wed, 5 Feb 2025 11:27:23 +0100 Subject: [PATCH 6/6] wip --- recipes/icon/25.2/gh200/environments.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/icon/25.2/gh200/environments.yaml b/recipes/icon/25.2/gh200/environments.yaml index 4e0b515..b626358 100644 --- a/recipes/icon/25.2/gh200/environments.yaml +++ b/recipes/icon/25.2/gh200/environments.yaml @@ -1,4 +1,4 @@ -gcc-env: +icon: compiler: - toolchain: gcc spec: gcc @@ -31,7 +31,7 @@ gcc-env: - +cuda - cuda_arch=90 views: - nvfort: + default: link: roots uenv: prefix_paths: