Bugfix: Support old installations using Cray MPICH (#20663)

#20076 moved Cray-specific MPICH support from the Spack MPICH package
to a new cray-mpich Package. This broke existing package installs
using external mpich on Cray systems. This PR keeps the cray-mpich
package but restores the Cray-specific MPICH support for older
installations.

In the future this support should be removed from the Spack mpich
package and users should be directed to use cray-mpich on Cray.
This commit is contained in:
Peter Scheibel 2021-01-04 17:19:08 -08:00 committed by GitHub
parent f4acf74091
commit 22a45e010a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -301,6 +301,19 @@ def setup_build_environment(self, env):
def setup_run_environment(self, env):
# Because MPI implementations provide compilers, they have to add to
# their run environments the code to make the compilers available.
# For Cray MPIs, the regular compiler wrappers *are* the MPI wrappers.
# Cray MPIs always have cray in the module name, e.g. "cray-mpich"
external_modules = self.spec.external_modules
if external_modules and 'cray' in external_modules[0]:
# This is intended to support external MPICH instances registered
# by Spack on Cray machines prior to a879c87; users defining an
# external MPICH entry for Cray should generally refer to the
# "cray-mpich" package
env.set('MPICC', spack_cc)
env.set('MPICXX', spack_cxx)
env.set('MPIF77', spack_fc)
env.set('MPIF90', spack_fc)
else:
env.set('MPICC', join_path(self.prefix.bin, 'mpicc'))
env.set('MPICXX', join_path(self.prefix.bin, 'mpic++'))
env.set('MPIF77', join_path(self.prefix.bin, 'mpif77'))
@ -318,6 +331,15 @@ def setup_dependent_build_environment(self, env, dependent_spec):
def setup_dependent_package(self, module, dependent_spec):
spec = self.spec
# For Cray MPIs, the regular compiler wrappers *are* the MPI wrappers.
# Cray MPIs always have cray in the module name, e.g. "cray-mpich"
external_modules = spec.external_modules
if external_modules and 'cray' in external_modules[0]:
spec.mpicc = spack_cc
spec.mpicxx = spack_cxx
spec.mpifc = spack_fc
spec.mpif77 = spack_f77
else:
spec.mpicc = join_path(self.prefix.bin, 'mpicc')
spec.mpicxx = join_path(self.prefix.bin, 'mpic++')