diff options
author | Greg Becker <becker33@llnl.gov> | 2020-06-12 14:05:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 14:05:12 -0700 |
commit | ea8a0be465b0329cfb4a6b29e02da0dbb4650f6e (patch) | |
tree | d398d9c68fdc5a77e7761a0b29fb72ddde5f6fe5 /var | |
parent | 67b86623a229f4bc379dfc6d0ae773445eaf8d7c (diff) | |
download | spack-ea8a0be465b0329cfb4a6b29e02da0dbb4650f6e.tar.gz spack-ea8a0be465b0329cfb4a6b29e02da0dbb4650f6e.tar.bz2 spack-ea8a0be465b0329cfb4a6b29e02da0dbb4650f6e.tar.xz spack-ea8a0be465b0329cfb4a6b29e02da0dbb4650f6e.zip |
add compilers to mpi setup_run_environment methods forall mpi implementations (#17015)
Diffstat (limited to 'var')
8 files changed, 73 insertions, 11 deletions
diff --git a/var/spack/repos/builtin/packages/fujitsu-mpi/package.py b/var/spack/repos/builtin/packages/fujitsu-mpi/package.py index 62da3aab01..c0a882ec4c 100644 --- a/var/spack/repos/builtin/packages/fujitsu-mpi/package.py +++ b/var/spack/repos/builtin/packages/fujitsu-mpi/package.py @@ -34,6 +34,11 @@ class FujitsuMpi(Package): 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) diff --git a/var/spack/repos/builtin/packages/intel-mpi/package.py b/var/spack/repos/builtin/packages/intel-mpi/package.py index 15cb84150e..52e93e6672 100644 --- a/var/spack/repos/builtin/packages/intel-mpi/package.py +++ b/var/spack/repos/builtin/packages/intel-mpi/package.py @@ -63,3 +63,9 @@ class IntelMpi(IntelPackage): '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) diff --git a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py index 410cd4045e..f59aa2b7ea 100644 --- a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py +++ b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py @@ -225,3 +225,9 @@ class IntelParallelStudio(IntelPackage): '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) diff --git a/var/spack/repos/builtin/packages/mpich/package.py b/var/spack/repos/builtin/packages/mpich/package.py index 042c2c5b12..c9c7886a08 100644 --- a/var/spack/repos/builtin/packages/mpich/package.py +++ b/var/spack/repos/builtin/packages/mpich/package.py @@ -160,7 +160,9 @@ spack package at this time.''', 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 @@ spack package at this time.''', 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) diff --git a/var/spack/repos/builtin/packages/mpt/package.py b/var/spack/repos/builtin/packages/mpt/package.py index 12f7202ebc..45dfce6ba5 100644 --- a/var/spack/repos/builtin/packages/mpt/package.py +++ b/var/spack/repos/builtin/packages/mpt/package.py @@ -39,13 +39,20 @@ class Mpt(Package): ) 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: diff --git a/var/spack/repos/builtin/packages/mvapich2/package.py b/var/spack/repos/builtin/packages/mvapich2/package.py index 0fb3c36b28..dac9b69c49 100644 --- a/var/spack/repos/builtin/packages/mvapich2/package.py +++ b/var/spack/repos/builtin/packages/mvapich2/package.py @@ -208,7 +208,21 @@ class Mvapich2(AutotoolsPackage): 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 @@ class Mvapich2(AutotoolsPackage): 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" diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index abe7b1d3ee..b3dcac253e 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -297,12 +297,18 @@ class Openmpi(AutotoolsPackage): 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) diff --git a/var/spack/repos/builtin/packages/spectrum-mpi/package.py b/var/spack/repos/builtin/packages/spectrum-mpi/package.py index 8cdd82e2ae..8ec206adae 100644 --- a/var/spack/repos/builtin/packages/spectrum-mpi/package.py +++ b/var/spack/repos/builtin/packages/spectrum-mpi/package.py @@ -56,3 +56,22 @@ class SpectrumMpi(Package): 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')) |