athena, mvapich2, spectrum-mpi: use new API to setup environment (#13677)

* athena: updated api call to setup build environment

* mvapich2: updated api call to setup build and run environment

* spectrum-mpi: updated api call to setup build and run environment
This commit is contained in:
Massimiliano Culpo 2019-11-12 18:44:12 +01:00 committed by Adam J. Stewart
parent b1965fa913
commit 826e8c6394
3 changed files with 65 additions and 66 deletions

View file

@ -146,23 +146,23 @@ class Athena(AutotoolsPackage):
patch('missing-separator.patch')
def setup_environment(self, spack_env, run_env):
def setup_build_environment(self, env):
spec = self.spec
spack_env.set('OPT', '-O3')
env.set('OPT', '-O3')
if '+mpi' in spec:
spack_env.set('CC', spec['mpi'].mpicc)
spack_env.set('LDR', spec['mpi'].mpicc)
spack_env.set('MPILIB', spec['mpi'].libs.ld_flags)
spack_env.set('MPIINC', spec['mpi'].headers.include_flags)
env.set('CC', spec['mpi'].mpicc)
env.set('LDR', spec['mpi'].mpicc)
env.set('MPILIB', spec['mpi'].libs.ld_flags)
env.set('MPIINC', spec['mpi'].headers.include_flags)
else:
spack_env.set('CC', spack_cc)
spack_env.set('LDR', spack_cc)
env.set('CC', spack_cc)
env.set('LDR', spack_cc)
if '+fft' in spec:
spack_env.set('FFTWLIB', spec['fftw'].libs.ld_flags)
spack_env.set('FFTWINC', spec['fftw'].headers.include_flags)
env.set('FFTWLIB', spec['fftw'].libs.ld_flags)
env.set('FFTWINC', spec['fftw'].headers.include_flags)
def configure_args(self):
spec = self.spec

View file

@ -3,10 +3,9 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
import sys
from spack import *
class Mvapich2(AutotoolsPackage):
"""MVAPICH2 is an MPI implementation for Infiniband networks."""
@ -195,34 +194,35 @@ def file_system_options(self):
return opts
def setup_environment(self, spack_env, run_env):
spec = self.spec
def setup_build_environment(self, env):
# mvapich2 configure fails when F90 and F90FLAGS are set
spack_env.unset('F90')
spack_env.unset('F90FLAGS')
if 'process_managers=slurm' in spec:
run_env.set('SLURM_MPI_TYPE', 'pmi2')
env.unset('F90')
env.unset('F90FLAGS')
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
spack_env.set('MPICC', join_path(self.prefix.bin, 'mpicc'))
spack_env.set('MPICXX', join_path(self.prefix.bin, 'mpicxx'))
spack_env.set('MPIF77', join_path(self.prefix.bin, 'mpif77'))
spack_env.set('MPIF90', join_path(self.prefix.bin, 'mpif90'))
def setup_run_environment(self, env):
if 'process_managers=slurm' in self.spec:
env.set('SLURM_MPI_TYPE', 'pmi2')
spack_env.set('MPICH_CC', spack_cc)
spack_env.set('MPICH_CXX', spack_cxx)
spack_env.set('MPICH_F77', spack_f77)
spack_env.set('MPICH_F90', spack_fc)
spack_env.set('MPICH_FC', spack_fc)
def setup_dependent_build_environment(self, env, dependent_spec):
env.set('MPICC', os.path.join(self.prefix.bin, 'mpicc'))
env.set('MPICXX', os.path.join(self.prefix.bin, 'mpicxx'))
env.set('MPIF77', os.path.join(self.prefix.bin, 'mpif77'))
env.set('MPIF90', os.path.join(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):
self.spec.mpicc = join_path(self.prefix.bin, 'mpicc')
self.spec.mpicxx = join_path(self.prefix.bin, 'mpicxx')
self.spec.mpifc = join_path(self.prefix.bin, 'mpif90')
self.spec.mpif77 = join_path(self.prefix.bin, 'mpif77')
self.spec.mpicc = os.path.join(self.prefix.bin, 'mpicc')
self.spec.mpicxx = os.path.join(self.prefix.bin, 'mpicxx')
self.spec.mpifc = os.path.join(self.prefix.bin, 'mpif90')
self.spec.mpif77 = os.path.join(self.prefix.bin, 'mpif77')
self.spec.mpicxx_shared_libs = [
join_path(self.prefix.lib, 'libmpicxx.{0}'.format(dso_suffix)),
join_path(self.prefix.lib, 'libmpi.{0}'.format(dso_suffix))
os.path.join(self.prefix.lib, 'libmpicxx.{0}'.format(dso_suffix)),
os.path.join(self.prefix.lib, 'libmpi.{0}'.format(dso_suffix))
]
@run_before('configure')

View file

@ -2,8 +2,7 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os.path
class SpectrumMpi(Package):
@ -19,41 +18,41 @@ def install(self, spec, prefix):
def setup_dependent_package(self, module, dependent_spec):
# get the compiler names
if '%xl' in dependent_spec or '%xl_r' in dependent_spec:
self.spec.mpicc = join_path(self.prefix.bin, 'mpixlc')
self.spec.mpicxx = join_path(self.prefix.bin, 'mpixlC')
self.spec.mpif77 = join_path(self.prefix.bin, 'mpixlf')
self.spec.mpifc = join_path(self.prefix.bin, 'mpixlf')
self.spec.mpicc = os.path.join(self.prefix.bin, 'mpixlc')
self.spec.mpicxx = os.path.join(self.prefix.bin, 'mpixlC')
self.spec.mpif77 = os.path.join(self.prefix.bin, 'mpixlf')
self.spec.mpifc = os.path.join(self.prefix.bin, 'mpixlf')
elif '%pgi' in dependent_spec:
self.spec.mpicc = join_path(self.prefix.bin, 'mpipgicc')
self.spec.mpicxx = join_path(self.prefix.bin, 'mpipgic++')
self.spec.mpif77 = join_path(self.prefix.bin, 'mpipgifort')
self.spec.mpifc = join_path(self.prefix.bin, 'mpipgifort')
self.spec.mpicc = os.path.join(self.prefix.bin, 'mpipgicc')
self.spec.mpicxx = os.path.join(self.prefix.bin, 'mpipgic++')
self.spec.mpif77 = os.path.join(self.prefix.bin, 'mpipgifort')
self.spec.mpifc = os.path.join(self.prefix.bin, 'mpipgifort')
else:
self.spec.mpicc = join_path(self.prefix.bin, 'mpicc')
self.spec.mpicxx = join_path(self.prefix.bin, 'mpicxx')
self.spec.mpif77 = join_path(self.prefix.bin, 'mpif77')
self.spec.mpifc = join_path(self.prefix.bin, 'mpif90')
self.spec.mpicc = os.path.join(self.prefix.bin, 'mpicc')
self.spec.mpicxx = os.path.join(self.prefix.bin, 'mpicxx')
self.spec.mpif77 = os.path.join(self.prefix.bin, 'mpif77')
self.spec.mpifc = os.path.join(self.prefix.bin, 'mpif90')
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
def setup_dependent_build_environment(self, env, dependent_spec):
if '%xl' in dependent_spec or '%xl_r' in dependent_spec:
spack_env.set('MPICC', join_path(self.prefix.bin, 'mpixlc'))
spack_env.set('MPICXX', join_path(self.prefix.bin, 'mpixlC'))
spack_env.set('MPIF77', join_path(self.prefix.bin, 'mpixlf'))
spack_env.set('MPIF90', join_path(self.prefix.bin, 'mpixlf'))
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 dependent_spec:
spack_env.set('MPICC', join_path(self.prefix.bin, 'mpipgicc'))
spack_env.set('MPICXX', join_path(self.prefix.bin, 'mpipgic++'))
spack_env.set('MPIF77', join_path(self.prefix.bin, 'mpipgifort'))
spack_env.set('MPIF90', join_path(self.prefix.bin, 'mpipgifort'))
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:
spack_env.set('MPICC', join_path(self.prefix.bin, 'mpicc'))
spack_env.set('MPICXX', join_path(self.prefix.bin, 'mpic++'))
spack_env.set('MPIF77', join_path(self.prefix.bin, 'mpif77'))
spack_env.set('MPIF90', join_path(self.prefix.bin, 'mpif90'))
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'))
spack_env.set('OMPI_CC', spack_cc)
spack_env.set('OMPI_CXX', spack_cxx)
spack_env.set('OMPI_FC', spack_fc)
spack_env.set('OMPI_F77', spack_f77)
env.set('OMPI_CC', spack_cc)
env.set('OMPI_CXX', spack_cxx)
env.set('OMPI_FC', spack_fc)
env.set('OMPI_F77', spack_f77)
spack_env.prepend_path('LD_LIBRARY_PATH', self.prefix.lib)
env.prepend_path('LD_LIBRARY_PATH', self.prefix.lib)