From d276f9700f2a8a16873e8bb46191ed7f20d16541 Mon Sep 17 00:00:00 2001 From: jdomke <28772296+jdomke@users.noreply.github.com> Date: Tue, 14 May 2024 03:15:45 +0900 Subject: fujitsu-mpi package: help CMake find wrappers (#43979) Set MPI_C_COMPILER etc. env vars when building with fujitsu-mpi, which override CMake logic. Without using these variables to explicitly request the Fujitsu MPI wrappers, the builtin CMake logic is unwilling to use these wrappers unless the Fujitsu compiler is used, but they should be used for %clang as well. This avoids patching CMake module files like in #16864, primarily to avoid the possibility of altering behavior for specs that do not use %fj or ^fujitsu-mpi. --- var/spack/repos/builtin/packages/fujitsu-mpi/package.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/var/spack/repos/builtin/packages/fujitsu-mpi/package.py b/var/spack/repos/builtin/packages/fujitsu-mpi/package.py index 91ba765750..475cec6ce7 100644 --- a/var/spack/repos/builtin/packages/fujitsu-mpi/package.py +++ b/var/spack/repos/builtin/packages/fujitsu-mpi/package.py @@ -53,6 +53,16 @@ class FujitsuMpi(Package): self.spec.mpif77 = self.prefix.bin.mpifrt self.spec.mpifc = self.prefix.bin.mpifrt + def setup_dependent_build_environment(self, env, dependent_spec): + if self.spec.satisfies("%gcc"): + env.set("MPI_C_COMPILER", self.prefix.bin.mpicc) + env.set("MPI_CXX_COMPILER", self.prefix.bin.mpicxx) + env.set("MPI_Fortran_COMPILER", self.prefix.bin.mpifort) + else: + env.set("MPI_C_COMPILER", self.prefix.bin.mpifcc) + env.set("MPI_CXX_COMPILER", self.prefix.bin.mpiFCC) + env.set("MPI_Fortran_COMPILER", self.prefix.bin.mpifrt) + def setup_run_environment(self, env): # Because MPI are both compilers and runtimes, we set up the compilers # as part of run environment -- cgit v1.2.3-70-g09d2