add compilers to mpi setup_run_environment methods forall mpi implementations (#17015)

This commit is contained in:
Greg Becker 2020-06-12 14:05:12 -07:00 committed by GitHub
parent 67b86623a2
commit ea8a0be465
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 73 additions and 11 deletions

View file

@ -34,6 +34,11 @@ def setup_dependent_package(self, module, dependent_spec):
self.spec.mpifc = self.prefix.bin.mpifrt
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
def setup_run_environment(self, env):
# Because MPI are both compilers and runtimes, we set up the compilers
# as part of run environment
env.set('MPICC', self.prefix.bin.mpifcc)
env.set('MPICXX', self.prefix.bin.mpiFCC)
env.set('MPIF77', self.prefix.bin.mpifrt)

View file

@ -63,3 +63,9 @@ def setup_dependent_build_environment(self, *args):
'F90': spack_fc,
'FC': spack_fc,
})
def setup_run_environment(self, env):
super(self, IntelMpi).setup_run_environment(env)
for name, value in self.mpi_compiler.wrappers.items():
env.set(name, value)

View file

@ -225,3 +225,9 @@ def setup_dependent_build_environment(self, *args):
'F90': spack_fc,
'FC': spack_fc,
})
def setup_run_environment(self, env):
super(self, IntelParallelStudio).setup_run_environment(env)
for name, value in self.mpi_compiler_wrappers.items():
env.set(name, value)

View file

@ -160,7 +160,9 @@ def setup_build_environment(self, env):
if self.spec.satisfies('%gcc@10:'):
env.set('FFLAGS', '-fallow-argument-mismatch')
def setup_dependent_build_environment(self, env, dependent_spec):
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"
if self.spec.external_module and 'cray' in self.spec.external_module:
@ -174,6 +176,9 @@ def setup_dependent_build_environment(self, env, dependent_spec):
env.set('MPIF77', join_path(self.prefix.bin, 'mpif77'))
env.set('MPIF90', join_path(self.prefix.bin, 'mpif90'))
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
env.set('MPICH_CC', spack_cc)
env.set('MPICH_CXX', spack_cxx)
env.set('MPICH_F77', spack_f77)

View file

@ -39,13 +39,20 @@ def libs(self):
)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
# use the Spack compiler wrappers under MPI
env.set('MPICC_CC', spack_cc)
env.set('MPICXX_CXX', spack_cxx)
env.set('MPIF90_F90', spack_fc)
def setup_run_environment(self, env):
# Because MPI is both runtime and compiler, we have to setup the mpi
# compilers as part of the run environment.
env.set('MPICC', self.prefix.bin.mpicc)
env.set('MPICXX', self.prefix.bin.mpicxx)
env.set('MPIF77', self.prefix.bin.mpif77)
env.set('MPIF90', self.prefix.bin.mpif90)
env.set('MPICC_CC', spack_cc)
env.set('MPICXX_CXX', spack_cxx)
env.set('MPIF90_F90', spack_fc)
def setup_dependent_package(self, module, dependent_spec):
if 'platform=cray' in self.spec:

View file

@ -208,7 +208,21 @@ def setup_run_environment(self, env):
if 'process_managers=slurm' in self.spec:
env.set('SLURM_MPI_TYPE', 'pmi2')
# Because MPI functions as a compiler, we need to treat it as one and
# add its compiler paths to the run environment.
self.setup_compiler_environment(env)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_compiler_environment(env)
# use the Spack compiler wrappers under MPI
env.set('MPICH_CC', spack_cc)
env.set('MPICH_CXX', spack_cxx)
env.set('MPICH_F77', spack_f77)
env.set('MPICH_F90', spack_fc)
env.set('MPICH_FC', spack_fc)
def setup_compiler_environment(self, env):
# For Cray MPIs, the regular compiler wrappers *are* the MPI wrappers.
# Cray MPIs always have cray in the module name, e.g. "cray-mvapich"
if self.spec.external_module and 'cray' in self.spec.external_module:
@ -222,12 +236,6 @@ def setup_dependent_build_environment(self, env, dependent_spec):
env.set('MPIF77', join_path(self.prefix.bin, 'mpif77'))
env.set('MPIF90', join_path(self.prefix.bin, 'mpif90'))
env.set('MPICH_CC', spack_cc)
env.set('MPICH_CXX', spack_cxx)
env.set('MPICH_F77', spack_f77)
env.set('MPICH_F90', spack_fc)
env.set('MPICH_FC', spack_fc)
def setup_dependent_package(self, module, dependent_spec):
# For Cray MPIs, the regular compiler wrappers *are* the MPI wrappers.
# Cray MPIs always have cray in the module name, e.g. "cray-mvapich"

View file

@ -297,12 +297,18 @@ def libs(self):
libraries, root=self.prefix, shared=True, recursive=True
)
def setup_dependent_build_environment(self, env, dependent_spec):
def setup_run_environment(self, env):
# Because MPI is both a runtime and a compiler, we have to setup the
# compiler components as part of the run environment.
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'))
env.set('MPIF90', join_path(self.prefix.bin, 'mpif90'))
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
# Use the spack compiler wrappers under MPI
env.set('OMPI_CC', spack_cc)
env.set('OMPI_CXX', spack_cxx)
env.set('OMPI_FC', spack_fc)

View file

@ -56,3 +56,22 @@ def setup_dependent_build_environment(self, env, dependent_spec):
env.set('OMPI_F77', spack_f77)
env.prepend_path('LD_LIBRARY_PATH', self.prefix.lib)
def setup_run_environment(self, env):
# Because MPI functions as a compiler we need to setup the compilers
# in the run environment, like any compiler
if '%xl' in self.spec or '%xl_r' in self.spec:
env.set('MPICC', os.path.join(self.prefix.bin, 'mpixlc'))
env.set('MPICXX', os.path.join(self.prefix.bin, 'mpixlC'))
env.set('MPIF77', os.path.join(self.prefix.bin, 'mpixlf'))
env.set('MPIF90', os.path.join(self.prefix.bin, 'mpixlf'))
elif '%pgi' in self.spec:
env.set('MPICC', os.path.join(self.prefix.bin, 'mpipgicc'))
env.set('MPICXX', os.path.join(self.prefix.bin, 'mpipgic++'))
env.set('MPIF77', os.path.join(self.prefix.bin, 'mpipgifort'))
env.set('MPIF90', os.path.join(self.prefix.bin, 'mpipgifort'))
else:
env.set('MPICC', os.path.join(self.prefix.bin, 'mpicc'))
env.set('MPICXX', os.path.join(self.prefix.bin, 'mpic++'))
env.set('MPIF77', os.path.join(self.prefix.bin, 'mpif77'))
env.set('MPIF90', os.path.join(self.prefix.bin, 'mpif90'))