summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2017-06-09 21:07:20 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2018-02-13 02:18:28 -0800
commit28e129b087145e6a6cf4be40c25e76f8d69290e3 (patch)
tree82f9882b7b986c86fe901d42de1ca7d598a7131c /var
parent4d97b540a8c268735f4ac730bcd96c7a366b6ee4 (diff)
downloadspack-28e129b087145e6a6cf4be40c25e76f8d69290e3.tar.gz
spack-28e129b087145e6a6cf4be40c25e76f8d69290e3.tar.bz2
spack-28e129b087145e6a6cf4be40c25e76f8d69290e3.tar.xz
spack-28e129b087145e6a6cf4be40c25e76f8d69290e3.zip
Added mixins to modularize common behaviors across build-systems.
Modifications: * added a mixin to filter compiler wrappers from files * modified hdf5, openmpi, mpich, mvapich2 to use it
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/hdf5/package.py13
-rw-r--r--var/spack/repos/builtin/packages/mpich/package.py40
-rw-r--r--var/spack/repos/builtin/packages/mvapich2/package.py39
-rw-r--r--var/spack/repos/builtin/packages/openmpi/package.py57
-rw-r--r--var/spack/repos/builtin/packages/r/package.py24
5 files changed, 54 insertions, 119 deletions
diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py
index 6477d9cee2..471326aac7 100644
--- a/var/spack/repos/builtin/packages/hdf5/package.py
+++ b/var/spack/repos/builtin/packages/hdf5/package.py
@@ -22,12 +22,13 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
-from spack import *
import shutil
import sys
+from spack import *
+
-class Hdf5(AutotoolsPackage):
+class Hdf5(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
"""HDF5 is a data model, library, and file format for storing and managing
data. It supports an unlimited variety of datatypes, and is designed for
flexible and efficient I/O and for high volume and complex data.
@@ -294,3 +295,11 @@ HDF5 version {version} {version}
print('-' * 80)
raise RuntimeError("HDF5 install check failed")
shutil.rmtree(checkdir)
+
+ @property
+ def compiler_wrappers(self):
+ return [
+ join_path(self.prefix.bin, 'h5c++'),
+ join_path(self.prefix.bin, 'h5cc'),
+ join_path(self.prefix.bin, 'h5fc'),
+ ]
diff --git a/var/spack/repos/builtin/packages/mpich/package.py b/var/spack/repos/builtin/packages/mpich/package.py
index 74234f46ae..0efca4f325 100644
--- a/var/spack/repos/builtin/packages/mpich/package.py
+++ b/var/spack/repos/builtin/packages/mpich/package.py
@@ -26,7 +26,7 @@ from spack import *
import os
-class Mpich(AutotoolsPackage):
+class Mpich(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
"""MPICH is a high performance and widely portable implementation of
the Message Passing Interface (MPI) standard."""
@@ -170,33 +170,11 @@ spack package at this time.''',
return config_args
- @run_after('install')
- 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."""
-
- mpicc = join_path(self.prefix.bin, 'mpicc')
- mpicxx = join_path(self.prefix.bin, 'mpicxx')
- mpif77 = join_path(self.prefix.bin, 'mpif77')
- mpif90 = join_path(self.prefix.bin, 'mpif90')
-
- # Substitute Spack compile wrappers for the real
- # underlying compiler
- kwargs = {
- 'ignore_absent': True,
- 'backup': False,
- 'string': True
- }
- filter_file(env['CC'], self.compiler.cc, mpicc, **kwargs)
- filter_file(env['CXX'], self.compiler.cxx, mpicxx, **kwargs)
- filter_file(env['F77'], self.compiler.f77, mpif77, **kwargs)
- filter_file(env['FC'], self.compiler.fc, mpif90, **kwargs)
-
- # Remove this linking flag if present
- # (it turns RPATH into RUNPATH)
- for wrapper in (mpicc, mpicxx, mpif77, mpif90):
- filter_file('-Wl,--enable-new-dtags', '', wrapper, **kwargs)
+ @property
+ def compiler_wrappers(self):
+ return [
+ join_path(self.prefix.bin, 'mpicc'),
+ join_path(self.prefix.bin, 'mpicxx'),
+ join_path(self.prefix.bin, 'mpif77'),
+ join_path(self.prefix.bin, 'mpif90')
+ ]
diff --git a/var/spack/repos/builtin/packages/mvapich2/package.py b/var/spack/repos/builtin/packages/mvapich2/package.py
index 4454907b74..1f90981fda 100644
--- a/var/spack/repos/builtin/packages/mvapich2/package.py
+++ b/var/spack/repos/builtin/packages/mvapich2/package.py
@@ -35,7 +35,7 @@ def _process_manager_validator(values):
)
-class Mvapich2(AutotoolsPackage):
+class Mvapich2(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
"""MVAPICH2 is an MPI implementation for Infiniband networks."""
homepage = "http://mvapich.cse.ohio-state.edu/"
url = "http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.2.tar.gz"
@@ -232,32 +232,11 @@ class Mvapich2(AutotoolsPackage):
args.extend(self.network_options)
return args
- @run_after('install')
- 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.
- """
- bin = self.prefix.bin
- mpicc = join_path(bin, 'mpicc')
- mpicxx = join_path(bin, 'mpicxx')
- mpif77 = join_path(bin, 'mpif77')
- mpif90 = join_path(bin, 'mpif90')
- mpifort = join_path(bin, 'mpifort')
-
- # Substitute Spack compile wrappers for the real
- # underlying compiler
- kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
- filter_file(env['CC'], self.compiler.cc, mpicc, **kwargs)
- filter_file(env['CXX'], self.compiler.cxx, mpicxx, **kwargs)
- filter_file(env['F77'], self.compiler.f77, mpif77, **kwargs)
- filter_file(env['FC'], self.compiler.fc, mpif90, **kwargs)
- filter_file(env['FC'], self.compiler.fc, mpifort, **kwargs)
-
- # Remove this linking flag if present
- # (it turns RPATH into RUNPATH)
- for wrapper in (mpicc, mpicxx, mpif77, mpif90, mpifort):
- filter_file('-Wl,--enable-new-dtags', '', wrapper, **kwargs)
+ @property
+ def compiler_wrappers(self):
+ return [
+ join_path(self.prefix.bin, 'mpicc'),
+ join_path(self.prefix.bin, 'mpicxx'),
+ join_path(self.prefix.bin, 'mpif77'),
+ join_path(self.prefix.bin, 'mpif90')
+ ]
diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py
index 880566af2b..7362b9be7f 100644
--- a/var/spack/repos/builtin/packages/openmpi/package.py
+++ b/var/spack/repos/builtin/packages/openmpi/package.py
@@ -64,7 +64,7 @@ def _mxm_dir():
return None
-class Openmpi(AutotoolsPackage):
+class Openmpi(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
"""The Open MPI Project is an open source Message Passing Interface
implementation that is developed and maintained by a consortium
of academic, research, and industry partners. Open MPI is
@@ -375,43 +375,28 @@ class Openmpi(AutotoolsPackage):
return config_args
- @run_after('install')
- def filter_compilers(self):
- """Run after install to make the MPI compilers use the
- compilers that Spack built the package with.
+ @property
+ def compiler_wrappers(self):
- If this isn't done, they'll have CC, CXX and FC set
- to Spack's generic cc, c++ and f90. We want them to
- be bound to whatever compiler they were built with.
- """
- kwargs = {'ignore_absent': True, 'backup': False, 'string': False}
- wrapper_basepath = join_path(self.prefix, 'share', 'openmpi')
+ basepath = join_path(self.prefix, 'share', 'openmpi')
wrappers = [
- ('mpicc-vt-wrapper-data.txt', self.compiler.cc),
- ('mpicc-wrapper-data.txt', self.compiler.cc),
- ('ortecc-wrapper-data.txt', self.compiler.cc),
- ('shmemcc-wrapper-data.txt', self.compiler.cc),
- ('mpic++-vt-wrapper-data.txt', self.compiler.cxx),
- ('mpic++-wrapper-data.txt', self.compiler.cxx),
- ('ortec++-wrapper-data.txt', self.compiler.cxx),
- ('mpifort-vt-wrapper-data.txt', self.compiler.fc),
- ('mpifort-wrapper-data.txt', self.compiler.fc),
- ('shmemfort-wrapper-data.txt', self.compiler.fc),
- ('mpif90-vt-wrapper-data.txt', self.compiler.fc),
- ('mpif90-wrapper-data.txt', self.compiler.fc),
- ('mpif77-vt-wrapper-data.txt', self.compiler.f77),
- ('mpif77-wrapper-data.txt', self.compiler.f77)
+ 'mpicc-vt-wrapper-data.txt',
+ 'mpicc-wrapper-data.txt',
+ 'ortecc-wrapper-data.txt',
+ 'shmemcc-wrapper-data.txt',
+ 'mpic++-vt-wrapper-data.txt',
+ 'mpic++-wrapper-data.txt',
+ 'ortec++-wrapper-data.txt',
+ 'mpifort-vt-wrapper-data.txt',
+ 'mpifort-wrapper-data.txt',
+ 'shmemfort-wrapper-data.txt',
+ 'mpif90-vt-wrapper-data.txt',
+ 'mpif90-wrapper-data.txt',
+ 'mpif77-vt-wrapper-data.txt',
+ 'mpif77-wrapper-data.txt'
]
- for wrapper_name, compiler in wrappers:
- wrapper = join_path(wrapper_basepath, wrapper_name)
- if not os.path.islink(wrapper):
- # Substitute Spack compile wrappers for the real
- # underlying compiler
- match = 'compiler=.*'
- substitute = 'compiler={compiler}'.format(compiler=compiler)
- filter_file(match, substitute, wrapper, **kwargs)
- # Remove this linking flag if present
- # (it turns RPATH into RUNPATH)
- filter_file('-Wl,--enable-new-dtags', '', wrapper, **kwargs)
+ abs_wrappers = [join_path(basepath, x) for x in wrappers]
+
+ return [x for x in abs_wrappers if not os.path.islink(x)]
diff --git a/var/spack/repos/builtin/packages/r/package.py b/var/spack/repos/builtin/packages/r/package.py
index ebd83ec9a8..514fcd9d8b 100644
--- a/var/spack/repos/builtin/packages/r/package.py
+++ b/var/spack/repos/builtin/packages/r/package.py
@@ -26,7 +26,7 @@ import shutil
from spack import *
-class R(AutotoolsPackage):
+class R(AutotoolsPackage, FilterCompilerWrappersPackageMixin):
"""R is 'GNU S', a freely available language and environment for
statistical computing and graphics which provides a wide variety of
statistical and graphical techniques: linear and nonlinear modelling,
@@ -129,25 +129,9 @@ class R(AutotoolsPackage):
dst_makeconf = join_path(self.etcdir, 'Makeconf.spack')
shutil.copy(src_makeconf, dst_makeconf)
- @run_after('install')
- def filter_compilers(self):
- """Run after install to tell the configuration files and Makefiles
- to use the compilers that Spack built the package with.
-
- If this isn't done, they'll have CC and CXX set to Spack's generic
- cc and c++. We want them to be bound to whatever compiler
- they were built with."""
-
- kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
-
- filter_file(env['CC'], self.compiler.cc,
- join_path(self.etcdir, 'Makeconf'), **kwargs)
- filter_file(env['CXX'], self.compiler.cxx,
- join_path(self.etcdir, 'Makeconf'), **kwargs)
- filter_file(env['F77'], self.compiler.f77,
- join_path(self.etcdir, 'Makeconf'), **kwargs)
- filter_file(env['FC'], self.compiler.fc,
- join_path(self.etcdir, 'Makeconf'), **kwargs)
+ @property
+ def compiler_wrappers(self):
+ return [join_path(self.etcdir, 'Makeconf')]
# ========================================================================
# Set up environment to make install easy for R extensions.