cray: fix builds on Alps/Eiger (CSCS) (#23470)
Co-authored-by: Tiziano Müller <tiziano.mueller@chem.uzh.ch>
This commit is contained in:
parent
4cd53cadb0
commit
e3c59264d8
@ -221,6 +221,9 @@ def edit(self, spec, prefix):
|
||||
if os.path.exists(incdir):
|
||||
fftw_header_dir = incdir
|
||||
break
|
||||
elif '^cray-fftw' in spec:
|
||||
fftw = spec['cray-fftw']
|
||||
fftw_header_dir = fftw.headers.directories[0]
|
||||
|
||||
optimization_flags = {
|
||||
'gcc': [
|
||||
|
@ -28,7 +28,48 @@ class CrayFftw(Package):
|
||||
|
||||
provides('fftw-api@3')
|
||||
|
||||
variant(
|
||||
'precision', values=any_combination_of(
|
||||
'float', 'double'
|
||||
).prohibit_empty_set().with_default('float,double'),
|
||||
description='Build the selected floating-point precision libraries'
|
||||
)
|
||||
|
||||
variant('openmp', default=False, description="Enable OpenMP support.")
|
||||
variant('mpi', default=True, description='Activate MPI support')
|
||||
depends_on('mpi', when='+mpi')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
raise InstallError(
|
||||
self.spec.format('{name} is not installable, you need to specify '
|
||||
'it as an external package in packages.yaml'))
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
|
||||
# Reduce repetitions of entries
|
||||
query_parameters = list(llnl.util.lang.dedupe(
|
||||
self.spec.last_query.extra_parameters
|
||||
))
|
||||
|
||||
# List of all the suffixes associated with float precisions
|
||||
precisions = [
|
||||
('float', 'f'),
|
||||
('double', ''),
|
||||
]
|
||||
|
||||
# Retrieve the correct suffixes, or use double as a default
|
||||
suffixes = [v for k, v in precisions if k in query_parameters] or ['']
|
||||
|
||||
# Construct the list of libraries that needs to be found
|
||||
libraries = []
|
||||
for sfx in suffixes:
|
||||
if 'mpi' in query_parameters and '+mpi' in self.spec:
|
||||
libraries.append('libfftw3' + sfx + '_mpi')
|
||||
|
||||
if 'openmp' in query_parameters and '+openmp' in self.spec:
|
||||
libraries.append('libfftw3' + sfx + '_omp')
|
||||
|
||||
libraries.append('libfftw3' + sfx)
|
||||
|
||||
return find_libraries(libraries, root=self.prefix, recursive=True)
|
||||
|
@ -36,7 +36,8 @@ class CrayLibsci(Package):
|
||||
'gcc': 'GNU',
|
||||
'cce': 'CRAY',
|
||||
'intel': 'INTEL',
|
||||
'clang': 'ALLINEA'
|
||||
'clang': 'ALLINEA',
|
||||
'aocc': 'AOCC'
|
||||
}
|
||||
|
||||
@property
|
||||
|
@ -4,6 +4,9 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack import *
|
||||
from spack.util.module_cmd import module
|
||||
from spack.util.module_cmd import get_path_args_from_module_line
|
||||
import os
|
||||
|
||||
|
||||
class CrayMpich(Package):
|
||||
@ -27,6 +30,26 @@ class CrayMpich(Package):
|
||||
|
||||
provides('mpi@3')
|
||||
|
||||
canonical_names = {
|
||||
'gcc': 'GNU',
|
||||
'cce': 'CRAY',
|
||||
'intel': 'INTEL',
|
||||
'clang': 'ALLINEA',
|
||||
'aocc': 'AOCC'
|
||||
}
|
||||
|
||||
@property
|
||||
def modname(self):
|
||||
return "cray-mpich/{0}".format(self.version)
|
||||
|
||||
@property
|
||||
def external_prefix(self):
|
||||
mpich_module = module("show", self.modname).splitlines()
|
||||
|
||||
for line in mpich_module:
|
||||
if "CRAY_MPICH_DIR" in line:
|
||||
return get_path_args_from_module_line(line)[0]
|
||||
|
||||
def setup_run_environment(self, env):
|
||||
env.set('MPICC', spack_cc)
|
||||
env.set('MPICXX', spack_cxx)
|
||||
@ -49,12 +72,34 @@ def setup_dependent_package(self, module, dependent_spec):
|
||||
spec.mpifc = spack_fc
|
||||
spec.mpif77 = spack_f77
|
||||
|
||||
spec.mpicxx_shared_libs = [
|
||||
join_path(self.prefix.lib, 'libmpicxx.{0}'.format(dso_suffix)),
|
||||
join_path(self.prefix.lib, 'libmpi.{0}'.format(dso_suffix))
|
||||
]
|
||||
|
||||
def install(self, spec, prefix):
|
||||
raise InstallError(
|
||||
self.spec.format('{name} is not installable, you need to specify '
|
||||
'it as an external package in packages.yaml'))
|
||||
|
||||
@property
|
||||
def headers(self):
|
||||
hdrs = find_headers('mpi', self.prefix.include, recursive=True)
|
||||
hdrs.directories = os.path.dirname(hdrs[0])
|
||||
return hdrs
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
query_parameters = self.spec.last_query.extra_parameters
|
||||
|
||||
libraries = ['libmpich']
|
||||
|
||||
if 'cxx' in query_parameters:
|
||||
libraries.extend(['libmpicxx', 'libmpichcxx'])
|
||||
|
||||
if 'f77' in query_parameters:
|
||||
libraries.extend(['libmpifort', 'libmpichfort',
|
||||
'libfmpi', 'libfmpich'])
|
||||
|
||||
if 'f90' in query_parameters:
|
||||
libraries.extend(['libmpif90', 'libmpichf90'])
|
||||
|
||||
libs = find_libraries(libraries, root=self.prefix.lib, recursive=True)
|
||||
libs += find_libraries(libraries, root=self.prefix.lib64, recursive=True)
|
||||
|
||||
return libs
|
||||
|
Loading…
Reference in New Issue
Block a user