diff options
author | David Beckingsale <davidbeckingsale@gmail.com> | 2015-10-22 09:13:20 -0700 |
---|---|---|
committer | David Beckingsale <davidbeckingsale@gmail.com> | 2015-10-22 09:13:20 -0700 |
commit | 41c01b523f2af4e60ed38e7a097991b55647be9f (patch) | |
tree | 7ea0abfb858872fa37f691dd6be35559a6d9dc1d /var | |
parent | d16095c8560cbaae1020a8e84494b8877bfe36f5 (diff) | |
download | spack-41c01b523f2af4e60ed38e7a097991b55647be9f.tar.gz spack-41c01b523f2af4e60ed38e7a097991b55647be9f.tar.bz2 spack-41c01b523f2af4e60ed38e7a097991b55647be9f.tar.xz spack-41c01b523f2af4e60ed38e7a097991b55647be9f.zip |
Filter wrapper data to use correct compilers in OpenMPI
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/packages/openmpi/package.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/var/spack/packages/openmpi/package.py b/var/spack/packages/openmpi/package.py index 7e84cbaf65..d2d095979e 100644 --- a/var/spack/packages/openmpi/package.py +++ b/var/spack/packages/openmpi/package.py @@ -1,5 +1,8 @@ +import os + from spack import * + class Openmpi(Package): """Open MPI is a project combining technologies and resources from several other projects (FT-MPI, LA-MPI, LAM/MPI, and PACX-MPI) @@ -21,6 +24,14 @@ class Openmpi(Package): provides('mpi@:2') + + def setup_dependent_environment(self, module, spec, dep_spec): + """For dependencies, make mpicc's use spack wrapper.""" + os.environ['OMPI_CC'] = 'cc' + os.environ['OMPI_CXX'] = 'c++' + os.environ['OMPI_FC'] = 'f90' + + def install(self, spec, prefix): config_args = ["--prefix=%s" % prefix] @@ -39,3 +50,37 @@ class Openmpi(Package): configure(*config_args) make() make("install") + + self.filter_compilers() + + + def filter_compilers(self): + """Run after install to make the MPI compilers use the + compilers that Spack built the package with. + + If this isn't done, they'll have CC, CXX, F77, and FC set + to Spack's generic cc, c++, f77, and f90. We want them to + be bound to whatever compiler they were built with. + """ + kwargs = { 'ignore_absent' : True, 'backup' : False, 'string' : False } + dir = os.path.join(self.prefix, 'share/openmpi/') + + cc_wrappers = ['mpicc-vt-wrapper-data.txt', 'mpicc-wrapper-data.txt', + 'ortecc-wrapper-data.txt', 'shmemcc-wrapper-data.txt'] + + cxx_wrappers = ['mpic++-vt-wrapper-data.txt', 'mpic++-wrapper-data.txt'] + + fc_wrappers = ['mpifort-vt-wrapper-data.txt', + 'mpifort-wrapper-data.txt', 'shmemfort-wrapper-data.txt'] + + for wrapper in cc_wrappers: + filter_file('compiler=.*', 'compiler=%s' % self.compiler.cc, + os.path.join(dir, wrapper), **kwargs) + + for wrapper in cxx_wrappers: + filter_file('compiler=.*', 'compiler=%s' % self.compiler.cxx, + os.path.join(dir, wrapper), **kwargs) + + for wrapper in fc_wrappers: + filter_file('compiler=.*', 'compiler=%s' % self.compiler.fc, + os.path.join(dir, wrapper), **kwargs) |