From 1480065874b246cc768db2e9b93866de1e70001f Mon Sep 17 00:00:00 2001
From: Nicolas Richart <nicolas.richart@epfl.ch>
Date: Thu, 25 Jul 2024 15:37:36 +0200
Subject: [PATCH] Manage to get 1 cuda 1 ucx 1 openmpi

---
 stacks/pinot-noir/config.json             |  1 -
 stacks/pinot-noir/definitions_cuda.yaml   |  8 +++++---
 stacks/pinot-noir/packages.yaml           | 12 ++++++++----
 stacks/pinot-noir/packages_kuma_h100.yaml | 14 +++++++++++---
 stacks/pinot-noir/packages_stack.yaml     | 20 +++++++++-----------
 stacks/pinot-noir/spack.yaml              | 14 +++++++++++---
 6 files changed, 44 insertions(+), 25 deletions(-)

diff --git a/stacks/pinot-noir/config.json b/stacks/pinot-noir/config.json
index d3a4ec3..6ce0f2c 100644
--- a/stacks/pinot-noir/config.json
+++ b/stacks/pinot-noir/config.json
@@ -75,7 +75,6 @@
             "ca-certificates-mozilla",
             "check",
             "cmake",
-            "cuda",
             "curl",
             "diffutils",
             "expat",
diff --git a/stacks/pinot-noir/definitions_cuda.yaml b/stacks/pinot-noir/definitions_cuda.yaml
index 4710276..6cbc7ee 100644
--- a/stacks/pinot-noir/definitions_cuda.yaml
+++ b/stacks/pinot-noir/definitions_cuda.yaml
@@ -1,8 +1,10 @@
 definitions:
-  - cuda_system_codes:
-      - cuda
-      - cudnn
+  - cuda_system_codes: []
 
   - cuda_serial_codes:
+      - cuda
+      - cudnn
       - nccl
+
+  - cuda_mpi_codes:
       - nvshmem
diff --git a/stacks/pinot-noir/packages.yaml b/stacks/pinot-noir/packages.yaml
index 59dbb44..fbb8505 100644
--- a/stacks/pinot-noir/packages.yaml
+++ b/stacks/pinot-noir/packages.yaml
@@ -1,13 +1,17 @@
 packages:
   all:
+    compiler:
+      - gcc
+      - aocc
+      - nvhpc
+
     providers:
       mpi: [openmpi, intel-oneapi-mpi]
-      # iconv: [libiconv]
       jpeg: [libjpeg]
       zlib-api: [zlib-ng]
-    # require:
-    #   - spec: "^libiconv"
-    #     when: "^iconv"
+
+  glibc:
+    prefer: ['%gcc@11.2.1']
 
   zlib-ng:
     require: ['build_system=autotools']
diff --git a/stacks/pinot-noir/packages_kuma_h100.yaml b/stacks/pinot-noir/packages_kuma_h100.yaml
index 281c152..1e12d55 100644
--- a/stacks/pinot-noir/packages_kuma_h100.yaml
+++ b/stacks/pinot-noir/packages_kuma_h100.yaml
@@ -1,16 +1,24 @@
 packages:
   all:
     target: ["zen4"]
+    prefer: ['target=zen4']
     require:
       - "~rocm"
 
-      - spec: cuda_arch=90 target=zen4
+      - spec: cuda_arch=90
         when: '+cuda'
 
       - spec: '+cuda'
         when: '%gcc'
 
   # ---------------------------------------------------------------------------
+  cuda:
+    prefer:
+    - spec: "^gcc-runtime@12.3.0"
+      when: "%gcc"
+    - spec: "%gcc@12.3.0 target=zen4"
+      when: "%gcc"
+
   hypre:
     require:
     - spec: '+cuda cuda_arch=90 +unified-memory'
@@ -27,7 +35,7 @@ packages:
 
   openmpi:
     require:
-      - spec: '+cuda cuda_arch=90 target=zen4'
+      - spec: '+cuda cuda_arch=90'
 
   petsc:
     require:
@@ -52,7 +60,7 @@ packages:
 
   ucx:
     require:
-      - spec: '+xpmem +cma +rdmacm +rc +ud +dc +verbs +ib_hw_tm +gdrcopy +cuda cuda_arch=90 ~rocm target=zen4'
+      - spec: '+xpmem +cma +rdmacm +rc +ud +dc +verbs +ib_hw_tm +gdrcopy +cuda cuda_arch=90 ~rocm'
 
   # ---------------------------------------------------------------------------
   # Externals
diff --git a/stacks/pinot-noir/packages_stack.yaml b/stacks/pinot-noir/packages_stack.yaml
index 960e78f..fca8c85 100644
--- a/stacks/pinot-noir/packages_stack.yaml
+++ b/stacks/pinot-noir/packages_stack.yaml
@@ -1,14 +1,5 @@
 packages:
   all:
-    compiler:
-      - gcc
-      - aocc
-      - nvhpc
-    providers:
-      mpi: [openmpi, intel-oneapi-mpi]
-      iconv: [libiconv]
-      jpeg: [libjpeg]
-      zlib-api: [zlib-ng]
     require:
       - spec: '+ipo'
         when: '%gcc'
@@ -19,6 +10,9 @@ packages:
   adios2:
     require: ['+kokkos']
 
+  arpack-ng:
+    prefer: ['+mpi']
+
   boost:
     prefer: ['~mpi']
     require: ['cxxstd=14', '+icu', '+python', '+numpy', '+atomic', '+chrono',
@@ -61,11 +55,11 @@ packages:
     prefer: ['~cluster']
 
   kokkos:
-    prefer: ['+openmp', '+numactl', '+memkind', '+threads',
+    prefer: ['+openmp', '+numactl', '+memkind', '~threads',
     '+aggressive_vectorization']
 
   kokkos-kernel:
-    prefer: ['+openmp', '+threads']
+    prefer: ['+openmp', '~threads']
 
   lammps:
     require: ['build_type=Release', '+asphere', '+atc', '+body', '+class2',
@@ -123,6 +117,10 @@ packages:
   scotch:
     prefer: ['~mpi']
 
+  slepc:
+    require:
+    - spec: '^arpack-ng +mpi'
+
   suite-sparse:
     require:
     - spec: '+graphblas'
diff --git a/stacks/pinot-noir/spack.yaml b/stacks/pinot-noir/spack.yaml
index 4450501..c3146e1 100644
--- a/stacks/pinot-noir/spack.yaml
+++ b/stacks/pinot-noir/spack.yaml
@@ -80,10 +80,8 @@ spack:
     # Serial codes
     # -------------------------------------------------------------------------
     - serial_codes:
-        - bwa
         - fftw +openmp ~mpi
         - fftw ~openmp ~mpi
-        - eigen
         - gsl
         - hdf5@1.14.1 ~mpi
         - hisat2
@@ -107,8 +105,10 @@ spack:
         - voropp
 
     - gcc_serial_codes:
+        - bwa
         - cistem  ^fftw~mpi
         - ctffind ^fftw ~mpi
+        - eigen
         - ffmpeg +libx264
         - glpk+gmp
         - hwloc
@@ -129,6 +129,8 @@ spack:
 
     - cuda_serial_codes: []
 
+    - cuda_mpi_codes: []
+
     # -------------------------------------------------------------------------
     # Blas dependent codes
     # -------------------------------------------------------------------------
@@ -256,6 +258,7 @@ spack:
         #- quantum-espresso +mpi +scalapack +gipaw hdf5=parallel
 
     - gcc_mpi_blas_codes:
+        - armadillo +hdf5 ^arpack-ng +mpi ^hdf5 +mpi
         - gmsh +mpi +eigen +openmp +hdf5 ~fltk ~opencascade ~med ^mmg ~vtk
         - cpmd ~openmp
         - elmerfem +mumps +openmp +hypre
@@ -282,7 +285,7 @@ spack:
         - lammps
         - opencv
         - openfoam +metis
-        - paraview +shared +python +hdf5 ~osmesa +opengl2 +egl
+        - paraview +shared +python +hdf5  +opengl2
         - py-fenics-dolfinx
         - py-h5py +mpi
         - py-horovod
@@ -397,6 +400,11 @@ spack:
         - [$^mpi_gcc]
         - [$%compiler_gcc]
 
+    - matrix:
+        - [$cuda_mpi_codes]
+        - [$^mpi_gcc]
+        - [$%compiler_gcc]
+
     - matrix:
         - [$mpi_blas_codes]
         - [$^blas_gcc]
-- 
GitLab