summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/cp2k/package.py3
-rw-r--r--var/spack/repos/builtin/packages/cray-fftw/package.py41
-rwxr-xr-xvar/spack/repos/builtin/packages/cray-libsci/package.py3
-rw-r--r--var/spack/repos/builtin/packages/cray-mpich/package.py55
4 files changed, 96 insertions, 6 deletions
diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py
index 0b2462c6ca..b9c8e57dac 100644
--- a/var/spack/repos/builtin/packages/cp2k/package.py
+++ b/var/spack/repos/builtin/packages/cp2k/package.py
@@ -221,6 +221,9 @@ class Cp2k(MakefilePackage, CudaPackage):
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': [
diff --git a/var/spack/repos/builtin/packages/cray-fftw/package.py b/var/spack/repos/builtin/packages/cray-fftw/package.py
index a2f913f827..ffc713d3a0 100644
--- a/var/spack/repos/builtin/packages/cray-fftw/package.py
+++ b/var/spack/repos/builtin/packages/cray-fftw/package.py
@@ -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)
diff --git a/var/spack/repos/builtin/packages/cray-libsci/package.py b/var/spack/repos/builtin/packages/cray-libsci/package.py
index 3e4821a64d..8fcdb2da61 100755
--- a/var/spack/repos/builtin/packages/cray-libsci/package.py
+++ b/var/spack/repos/builtin/packages/cray-libsci/package.py
@@ -36,7 +36,8 @@ class CrayLibsci(Package):
'gcc': 'GNU',
'cce': 'CRAY',
'intel': 'INTEL',
- 'clang': 'ALLINEA'
+ 'clang': 'ALLINEA',
+ 'aocc': 'AOCC'
}
@property
diff --git a/var/spack/repos/builtin/packages/cray-mpich/package.py b/var/spack/repos/builtin/packages/cray-mpich/package.py
index 1728340d8a..4bfb5b1ca2 100644
--- a/var/spack/repos/builtin/packages/cray-mpich/package.py
+++ b/var/spack/repos/builtin/packages/cray-mpich/package.py
@@ -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 @@ class CrayMpich(Package):
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