openmpi, mvapich2, mpich : filtered out "--Wl,--enable-new-dtag" in wrappers, as it turns RPATH into RUNPATH
Apart from that turned `os.path.join` into `join_path` and `os.environ` into `env` in the packages
This commit is contained in:
parent
1b28991e0a
commit
b59d4f243b
@ -23,7 +23,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from spack import *
|
from spack import *
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class Mpich(Package):
|
class Mpich(Package):
|
||||||
@ -102,18 +101,25 @@ def filter_compilers(self):
|
|||||||
be bound to whatever compiler they were built with.
|
be bound to whatever compiler they were built with.
|
||||||
"""
|
"""
|
||||||
bin = self.prefix.bin
|
bin = self.prefix.bin
|
||||||
mpicc = os.path.join(bin, 'mpicc')
|
mpicc = join_path(bin, 'mpicc')
|
||||||
mpicxx = os.path.join(bin, 'mpicxx')
|
mpicxx = join_path(bin, 'mpicxx')
|
||||||
mpif77 = os.path.join(bin, 'mpif77')
|
mpif77 = join_path(bin, 'mpif77')
|
||||||
mpif90 = os.path.join(bin, 'mpif90')
|
mpif90 = join_path(bin, 'mpif90')
|
||||||
|
|
||||||
spack_cc = os.environ['CC']
|
spack_cc = env['CC']
|
||||||
spack_cxx = os.environ['CXX']
|
spack_cxx = env['CXX']
|
||||||
spack_f77 = os.environ['F77']
|
spack_f77 = env['F77']
|
||||||
spack_fc = os.environ['FC']
|
spack_fc = env['FC']
|
||||||
|
|
||||||
|
# Substitute Spack compile wrappers for the real
|
||||||
|
# underlying compiler
|
||||||
kwargs = { 'ignore_absent' : True, 'backup' : False, 'string' : True }
|
kwargs = { 'ignore_absent' : True, 'backup' : False, 'string' : True }
|
||||||
filter_file('CC="%s"' % spack_cc , 'CC="%s"' % self.compiler.cc, mpicc, **kwargs)
|
filter_file('CC="%s"' % spack_cc , 'CC="%s"' % self.compiler.cc, mpicc, **kwargs)
|
||||||
filter_file('CXX="%s"'% spack_cxx, 'CXX="%s"' % self.compiler.cxx, mpicxx, **kwargs)
|
filter_file('CXX="%s"'% spack_cxx, 'CXX="%s"' % self.compiler.cxx, mpicxx, **kwargs)
|
||||||
filter_file('F77="%s"'% spack_f77, 'F77="%s"' % self.compiler.f77, mpif77, **kwargs)
|
filter_file('F77="%s"'% spack_f77, 'F77="%s"' % self.compiler.f77, mpif77, **kwargs)
|
||||||
filter_file('FC="%s"' % spack_fc , 'FC="%s"' % self.compiler.fc, mpif90, **kwargs)
|
filter_file('FC="%s"' % spack_fc , 'FC="%s"' % 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)
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from spack import *
|
from spack import *
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class Mvapich2(Package):
|
class Mvapich2(Package):
|
||||||
@ -245,15 +244,15 @@ def filter_compilers(self):
|
|||||||
be bound to whatever compiler they were built with.
|
be bound to whatever compiler they were built with.
|
||||||
"""
|
"""
|
||||||
bin = self.prefix.bin
|
bin = self.prefix.bin
|
||||||
mpicc = os.path.join(bin, 'mpicc')
|
mpicc = join_path(bin, 'mpicc')
|
||||||
mpicxx = os.path.join(bin, 'mpicxx')
|
mpicxx = join_path(bin, 'mpicxx')
|
||||||
mpif77 = os.path.join(bin, 'mpif77')
|
mpif77 = join_path(bin, 'mpif77')
|
||||||
mpif90 = os.path.join(bin, 'mpif90')
|
mpif90 = join_path(bin, 'mpif90')
|
||||||
|
|
||||||
spack_cc = os.environ['CC']
|
spack_cc = env['CC']
|
||||||
spack_cxx = os.environ['CXX']
|
spack_cxx = env['CXX']
|
||||||
spack_f77 = os.environ['F77']
|
spack_f77 = env['F77']
|
||||||
spack_fc = os.environ['FC']
|
spack_fc = env['FC']
|
||||||
|
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'ignore_absent': True,
|
'ignore_absent': True,
|
||||||
@ -261,6 +260,8 @@ def filter_compilers(self):
|
|||||||
'string': True
|
'string': True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Substitute Spack compile wrappers for the real
|
||||||
|
# underlying compiler
|
||||||
filter_file('CC="%s"' % spack_cc,
|
filter_file('CC="%s"' % spack_cc,
|
||||||
'CC="%s"' % self.compiler.cc, mpicc, **kwargs)
|
'CC="%s"' % self.compiler.cc, mpicc, **kwargs)
|
||||||
filter_file('CXX="%s"' % spack_cxx,
|
filter_file('CXX="%s"' % spack_cxx,
|
||||||
@ -269,3 +270,8 @@ def filter_compilers(self):
|
|||||||
'F77="%s"' % self.compiler.f77, mpif77, **kwargs)
|
'F77="%s"' % self.compiler.f77, mpif77, **kwargs)
|
||||||
filter_file('FC="%s"' % spack_fc,
|
filter_file('FC="%s"' % spack_fc,
|
||||||
'FC="%s"' % self.compiler.fc, mpif90, **kwargs)
|
'FC="%s"' % 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)
|
||||||
|
@ -173,40 +173,33 @@ def filter_compilers(self):
|
|||||||
be bound to whatever compiler they were built with.
|
be bound to whatever compiler they were built with.
|
||||||
"""
|
"""
|
||||||
kwargs = {'ignore_absent': True, 'backup': False, 'string': False}
|
kwargs = {'ignore_absent': True, 'backup': False, 'string': False}
|
||||||
dir = os.path.join(self.prefix, 'share/openmpi/')
|
wrapper_basepath = join_path(self.prefix, 'share', 'openmpi')
|
||||||
|
|
||||||
cc_wrappers = ['mpicc-vt-wrapper-data.txt', 'mpicc-wrapper-data.txt',
|
wrappers = [
|
||||||
'ortecc-wrapper-data.txt', 'shmemcc-wrapper-data.txt']
|
('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)
|
||||||
|
]
|
||||||
|
|
||||||
cxx_wrappers = ['mpic++-vt-wrapper-data.txt', 'mpic++-wrapper-data.txt',
|
for wrapper_name, compiler in wrappers:
|
||||||
'ortec++-wrapper-data.txt']
|
wrapper = join_path(wrapper_basepath, wrapper_name)
|
||||||
|
if not os.path.islink(wrapper):
|
||||||
fc_wrappers = ['mpifort-vt-wrapper-data.txt',
|
# Substitute Spack compile wrappers for the real
|
||||||
'mpifort-wrapper-data.txt', 'shmemfort-wrapper-data.txt']
|
# underlying compiler
|
||||||
|
match = 'compiler=.*'
|
||||||
for wrapper in cc_wrappers:
|
substitute = 'compiler={compiler}'.format(compiler=compiler)
|
||||||
filter_file('compiler=.*', 'compiler=%s' % self.compiler.cc,
|
filter_file(match, substitute, wrapper, **kwargs)
|
||||||
os.path.join(dir, wrapper), **kwargs)
|
# Remove this linking flag if present
|
||||||
|
# (it turns RPATH into RUNPATH)
|
||||||
for wrapper in cxx_wrappers:
|
filter_file('-Wl,--enable-new-dtags', '', wrapper, **kwargs)
|
||||||
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)
|
|
||||||
|
|
||||||
# These are symlinks in newer versions, so check that here
|
|
||||||
f77_wrappers = ['mpif77-vt-wrapper-data.txt', 'mpif77-wrapper-data.txt']
|
|
||||||
f90_wrappers = ['mpif90-vt-wrapper-data.txt', 'mpif90-wrapper-data.txt']
|
|
||||||
|
|
||||||
for wrapper in f77_wrappers:
|
|
||||||
path = os.path.join(dir, wrapper)
|
|
||||||
if not os.path.islink(path):
|
|
||||||
filter_file('compiler=.*', 'compiler=%s' % self.compiler.f77,
|
|
||||||
path, **kwargs)
|
|
||||||
for wrapper in f90_wrappers:
|
|
||||||
path = os.path.join(dir, wrapper)
|
|
||||||
if not os.path.islink(path):
|
|
||||||
filter_file('compiler=.*', 'compiler=%s' % self.compiler.fc,
|
|
||||||
path, **kwargs)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user