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.
This commit is contained in:
jdomke 2024-05-14 03:15:45 +09:00 committed by GitHub
parent 4f111659ec
commit d276f9700f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,6 +53,16 @@ def setup_dependent_package(self, module, dependent_spec):
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