ACCESS-NRI / spack-config

Shared spack configuration
Apache License 2.0
1 stars 0 forks source link

common/gadi/packages.yaml: add extra_attributes to openmpi spec #45

Closed harshula closed 20 hours ago

harshula commented 21 hours ago

Set $CMAKE_PREFIX_PATH to workaround Gadi's openmpi directory layout. This means MPI compiler wrappers being explicitly passed to CMake are not required in SPDs, anymore.

Without this change, the upstream Spack's FMS package will not build: https://github.com/spack/spack/issues/45358

harshula commented 21 hours ago

Testing

1) Removed MPI wrappers:

$ git -C spack-packages diff
diff --git a/packages/libaccessom2/package.py b/packages/libaccessom2/package.py
index 2ba019d..91b344b 100644
--- a/packages/libaccessom2/package.py
+++ b/packages/libaccessom2/package.py
@@ -49,10 +49,3 @@ class Libaccessom2(CMakePackage):
                         "",
                         "CMakeLists.txt"
             )
-
-    def cmake_args(self):
-        return [
-            self.define("CMAKE_C_COMPILER", self.spec["mpi"].mpicc),
-            self.define("CMAKE_CXX_COMPILER", self.spec["mpi"].mpicxx),
-            self.define("CMAKE_Fortran_COMPILER", self.spec["mpi"].mpifc),
-        ]

2) The following commands succeeded:

spack install libaccessom2 ^netcdf-c@4.7.4 ^netcdf-fortran@4.5.2 ^openmpi@4.0.2 %intel@19.0.5.281 target=x86_64 spack install libaccessom2 ^netcdf-c@4.7.4 ^netcdf-fortran@4.5.2 ^openmpi@4.1.5 %intel@2021.10.0 target=x86_64 spack install cable@git.gcc_compilation_and_warnings+mpi ^netcdf-c@4.7.4 ^netcdf-fortran@4.5.2 ^openmpi@4.1.4 %gcc@13.2.0 target=x86_64