From af65b3c4666ed46344ae31c2990176ad07da63f7 Mon Sep 17 00:00:00 2001
From: Nicolas Richart <nicolas.richart@epfl.ch>
Date: Tue, 13 Aug 2024 15:00:46 +0200
Subject: [PATCH] Adding nvhpc

---
 stacks/pinot-noir/config.json            |  9 ++++++++
 stacks/pinot-noir/packages_acc_cuda.yaml |  3 +++
 stacks/pinot-noir/packages_stack.yaml    |  3 +++
 stacks/pinot-noir/spack.yaml             | 29 +++++++++++++++++++++++-
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/stacks/pinot-noir/config.json b/stacks/pinot-noir/config.json
index c18d658..30c1e4c 100644
--- a/stacks/pinot-noir/config.json
+++ b/stacks/pinot-noir/config.json
@@ -76,6 +76,12 @@
                 "compiler": "gcc",
                 "spec": "gcc@13.2.0 %gcc@11.2.1",
                 "version": "13.2.0"
+            },
+            "nvhpc": {
+                "compiler": "nvhpc",
+                "spec": "nvhpc+mpi+lapack+blas@24.3 %gcc@11.2.1",
+                "version": "24.3",
+                "constraint": "env['environment'] in ['kuma-h100', 'kuma-l40s', 'izar']"
             }
         },
         "system_packages": [
@@ -116,6 +122,7 @@
             "libpng",
             "libsigsegv",
             "libssh2",
+            "libszip",
             "libtiff",
             "libtool",
             "libunistring",
@@ -137,6 +144,7 @@
             "perl",
             "pigz",
             "pkgconf",
+            "pkg-conf",
             "pmix",
             "rdma-core",
             "readline",
@@ -151,6 +159,7 @@
             "xpmem",
             "xxd-standalon",
             "xz",
+            "zlib",
             "zlib-ng",
             "zstd"
         ]
diff --git a/stacks/pinot-noir/packages_acc_cuda.yaml b/stacks/pinot-noir/packages_acc_cuda.yaml
index 4d632b9..fcff7ec 100644
--- a/stacks/pinot-noir/packages_acc_cuda.yaml
+++ b/stacks/pinot-noir/packages_acc_cuda.yaml
@@ -9,6 +9,9 @@ packages:
       - spec: '+cuda'
         when: '%gcc'
 
+      - spec: '+cuda'
+        when: '%nvhpc'
+
   # ---------------------------------------------------------------------------
   cuda:
     prefer:
diff --git a/stacks/pinot-noir/packages_stack.yaml b/stacks/pinot-noir/packages_stack.yaml
index cc7f0d9..e7ae64c 100644
--- a/stacks/pinot-noir/packages_stack.yaml
+++ b/stacks/pinot-noir/packages_stack.yaml
@@ -186,6 +186,9 @@ packages:
   netcdf-c:
     prefer: ['+mpi']
 
+  nvhpc:
+    require: ['%gcc@11.2.1']
+
   openblas:
     require: ['build_system=makefile']
     prefer: ['threads=openmp', 'symbol_suffix=none', '~ilp64']
diff --git a/stacks/pinot-noir/spack.yaml b/stacks/pinot-noir/spack.yaml
index 2578d74..2e60d51 100644
--- a/stacks/pinot-noir/spack.yaml
+++ b/stacks/pinot-noir/spack.yaml
@@ -24,18 +24,27 @@ spack:
     - mpi_oneapi:
         - intel-oneapi-mpi@2021.12.1
 
+    - mpi_nvhpc:
+        - "[virtuals=mpi] nvhpc+mpi+blas+lapack"
+
     - blas_gcc:
         - openblas@0.3.27
 
     - blas_oneapi:
         - intel-oneapi-mkl@2024.1.0
 
+    - blas_nvhpc:
+        - "[virtuals=blas,lapack] nvhpc+mpi+blas+lapack"
+
     - python_gcc:
         - python@3.11.7
 
     - python_oneapi:
         - python@3.11.7
 
+    - python_nvhpc:
+        - python@3.11.7 %gcc@11.2.1
+
     # -------------------------------------------------------------------------
     # Core packages
     # -------------------------------------------------------------------------
@@ -101,7 +110,6 @@ spack:
         - netcdf-c ~~mpi
         - netcdf-fortran ^netcdf-c ~~mpi
         - nfft ^fftw~~mpi~~openmp
-        - python
         - scotch ~~mpi
         - star
         - subread
@@ -118,6 +126,7 @@ spack:
         - libxc
         - qperf
         - ncview ^netcdf-c ~~mpi ~parallel-netcdf
+        - python
         - sox
         - stacks
         - xgboost
@@ -434,6 +443,24 @@ spack:
         - [$^mpi_gcc]
         - [$%compiler_gcc]
 
+    # --------------------------------------------------------------------------
+    - matrix:
+        - [$serial_codes]
+        - [$%compiler_nvhpc]
+
+    - matrix:
+        - [$mpi_blas_codes]
+        - [$^blas_nvhpc]
+        - [$^mpi_nvhpc]
+        - [$%compiler_nvhpc]
+
+    - matrix:
+        - [$mpi_blas_python_codes]
+        - [$^python_nvhpc]
+        - [$^blas_nvhpc]
+        - [$^mpi_nvhpc]
+        - [$%compiler_nvhpc]
+
     # --------------------------------------------------------------------------
     - matrix:
         - [$serial_codes]
-- 
GitLab