summaryrefslogtreecommitdiff
path: root/var/spack
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2023-11-10 14:56:04 +0100
committerGitHub <noreply@github.com>2023-11-10 13:56:04 +0000
commitfbf02b561ae628ea14302d4b55a02e3ee2f4ec2c (patch)
treeac3b0571112da8e1578ce140b84b6417c458288e /var/spack
parent4027a2139b053251dafc2de38d24eac4d69d42a0 (diff)
downloadspack-fbf02b561ae628ea14302d4b55a02e3ee2f4ec2c.tar.gz
spack-fbf02b561ae628ea14302d4b55a02e3ee2f4ec2c.tar.bz2
spack-fbf02b561ae628ea14302d4b55a02e3ee2f4ec2c.tar.xz
spack-fbf02b561ae628ea14302d4b55a02e3ee2f4ec2c.zip
gromacs et al: fix ^mkl pattern (#41002)
The ^mkl pattern was used to refer to three packages even though none of software using it was depending on "mkl". This pattern, which follows Hyrum's law, is now being removed in favor of a more explicit one. In this PR gromacs, abinit, lammps, and quantum-espresso are modified. Intel packages are also modified to provide "lapack" and "blas" together.
Diffstat (limited to 'var/spack')
-rw-r--r--var/spack/repos/builtin/packages/abinit/package.py14
-rw-r--r--var/spack/repos/builtin/packages/gromacs/package.py7
-rw-r--r--var/spack/repos/builtin/packages/intel-mkl/package.py3
-rw-r--r--var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py3
-rw-r--r--var/spack/repos/builtin/packages/intel-parallel-studio/package.py3
-rw-r--r--var/spack/repos/builtin/packages/lammps/package.py2
-rw-r--r--var/spack/repos/builtin/packages/quantum-espresso/package.py12
-rw-r--r--var/spack/repos/builtin/packages/r/package.py2
8 files changed, 30 insertions, 16 deletions
diff --git a/var/spack/repos/builtin/packages/abinit/package.py b/var/spack/repos/builtin/packages/abinit/package.py
index 282c673bcc..07a7065904 100644
--- a/var/spack/repos/builtin/packages/abinit/package.py
+++ b/var/spack/repos/builtin/packages/abinit/package.py
@@ -87,6 +87,11 @@ class Abinit(AutotoolsPackage):
# libxml2
depends_on("libxml2", when="@9:+libxml2")
+ # If the Intel suite is used for Lapack, it must be used for fftw and vice-versa
+ for _intel_pkg in INTEL_MATH_LIBRARIES:
+ requires(f"^[virtuals=fftw-api] {_intel_pkg}", when=f"^[virtuals=lapack] {_intel_pkg}")
+ requires(f"^[virtuals=lapack] {_intel_pkg}", when=f"^[virtuals=fftw-api] {_intel_pkg}")
+
# Cannot ask for +scalapack if it does not depend on MPI
conflicts("+scalapack", when="~mpi")
@@ -199,7 +204,8 @@ class Abinit(AutotoolsPackage):
# BLAS/LAPACK/SCALAPACK-ELPA
linalg = spec["lapack"].libs + spec["blas"].libs
- if "^mkl" in spec:
+ is_using_intel_libraries = spec["lapack"].name in INTEL_MATH_LIBRARIES
+ if is_using_intel_libraries:
linalg_flavor = "mkl"
elif "@9:" in spec and "^openblas" in spec:
linalg_flavor = "openblas"
@@ -220,7 +226,7 @@ class Abinit(AutotoolsPackage):
oapp(f"--with-linalg-flavor={linalg_flavor}")
- if "^mkl" in spec:
+ if is_using_intel_libraries:
fftflavor = "dfti"
else:
if "+openmp" in spec:
@@ -231,7 +237,7 @@ class Abinit(AutotoolsPackage):
oapp(f"--with-fft-flavor={fftflavor}")
if "@:8" in spec:
- if "^mkl" in spec:
+ if is_using_intel_libraries:
oapp(f"--with-fft-incs={spec['fftw-api'].headers.cpp_flags}")
oapp(f"--with-fft-libs={spec['fftw-api'].libs.ld_flags}")
else:
@@ -242,7 +248,7 @@ class Abinit(AutotoolsPackage):
]
)
else:
- if "^mkl" in spec:
+ if is_using_intel_libraries:
options.extend(
[
f"FFT_CPPFLAGS={spec['fftw-api'].headers.cpp_flags}",
diff --git a/var/spack/repos/builtin/packages/gromacs/package.py b/var/spack/repos/builtin/packages/gromacs/package.py
index 7a4147a6ee..66c594c71e 100644
--- a/var/spack/repos/builtin/packages/gromacs/package.py
+++ b/var/spack/repos/builtin/packages/gromacs/package.py
@@ -263,6 +263,11 @@ class Gromacs(CMakePackage, CudaPackage):
msg="Only attempt to find gcc libs for Intel compiler if Intel compiler is used.",
)
+ # If the Intel suite is used for Lapack, it must be used for fftw and vice-versa
+ for _intel_pkg in INTEL_MATH_LIBRARIES:
+ requires(f"^[virtuals=fftw-api] {_intel_pkg}", when=f"^[virtuals=lapack] {_intel_pkg}")
+ requires(f"^[virtuals=lapack] {_intel_pkg}", when=f"^[virtuals=fftw-api] {_intel_pkg}")
+
patch("gmxDetectCpu-cmake-3.14.patch", when="@2018:2019.3^cmake@3.14.0:")
patch("gmxDetectSimd-cmake-3.14.patch", when="@5.0:2017^cmake@3.14.0:")
# 2021.2 will always try to build tests (see https://gromacs.bioexcel.eu/t/compilation-failure-for-gromacs-2021-1-and-2021-2-with-cmake-3-20-2/2129)
@@ -594,7 +599,7 @@ class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder):
"-DGMX_OPENMP_MAX_THREADS=%s" % self.spec.variants["openmp_max_threads"].value
)
- if "^mkl" in self.spec:
+ if self.spec["lapack"].name in INTEL_MATH_LIBRARIES:
# fftw-api@3 is provided by intel-mkl or intel-parllel-studio
# we use the mkl interface of gromacs
options.append("-DGMX_FFT_LIBRARY=mkl")
diff --git a/var/spack/repos/builtin/packages/intel-mkl/package.py b/var/spack/repos/builtin/packages/intel-mkl/package.py
index 7dd8ab4122..c66235f382 100644
--- a/var/spack/repos/builtin/packages/intel-mkl/package.py
+++ b/var/spack/repos/builtin/packages/intel-mkl/package.py
@@ -153,8 +153,7 @@ class IntelMkl(IntelPackage):
multi=False,
)
- provides("blas")
- provides("lapack")
+ provides("blas", "lapack")
provides("lapack@3.9.0", when="@2020.4")
provides("lapack@3.7.0", when="@11.3")
provides("scalapack")
diff --git a/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py b/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py
index 1d80c52f62..db3fdd6d7e 100644
--- a/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py
+++ b/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py
@@ -126,8 +126,7 @@ class IntelOneapiMkl(IntelOneApiLibraryPackage):
provides("fftw-api@3")
provides("scalapack", when="+cluster")
provides("mkl")
- provides("lapack")
- provides("blas")
+ provides("lapack", "blas")
@property
def component_dir(self):
diff --git a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py
index 84810bacfa..50e7021de8 100644
--- a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py
+++ b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py
@@ -536,8 +536,7 @@ class IntelParallelStudio(IntelPackage):
provides("ipp", when="+ipp")
provides("mkl", when="+mkl")
- provides("blas", when="+mkl")
- provides("lapack", when="+mkl")
+ provides("blas", "lapack", when="+mkl")
provides("scalapack", when="+mkl")
provides("fftw-api@3", when="+mkl@professional.2017:")
diff --git a/var/spack/repos/builtin/packages/lammps/package.py b/var/spack/repos/builtin/packages/lammps/package.py
index a44c7bd603..b2d3d11133 100644
--- a/var/spack/repos/builtin/packages/lammps/package.py
+++ b/var/spack/repos/builtin/packages/lammps/package.py
@@ -791,7 +791,7 @@ class Lammps(CMakePackage, CudaPackage, ROCmPackage):
# FFTW libraries are available and enable them by default.
if "^fftw" in spec or "^cray-fftw" in spec or "^amdfftw" in spec:
args.append(self.define("FFT", "FFTW3"))
- elif "^mkl" in spec:
+ elif spec["fftw-api"].name in INTEL_MATH_LIBRARIES:
args.append(self.define("FFT", "MKL"))
elif "^armpl-gcc" in spec or "^acfl" in spec:
args.append(self.define("FFT", "FFTW3"))
diff --git a/var/spack/repos/builtin/packages/quantum-espresso/package.py b/var/spack/repos/builtin/packages/quantum-espresso/package.py
index 4d41903cd6..40c036320d 100644
--- a/var/spack/repos/builtin/packages/quantum-espresso/package.py
+++ b/var/spack/repos/builtin/packages/quantum-espresso/package.py
@@ -242,6 +242,11 @@ class QuantumEspresso(CMakePackage, Package):
depends_on("git@2.13:", type="build")
depends_on("m4", type="build")
+ # If the Intel suite is used for Lapack, it must be used for fftw and vice-versa
+ for _intel_pkg in INTEL_MATH_LIBRARIES:
+ requires(f"^[virtuals=fftw-api] {_intel_pkg}", when=f"^[virtuals=lapack] {_intel_pkg}")
+ requires(f"^[virtuals=lapack] {_intel_pkg}", when=f"^[virtuals=fftw-api] {_intel_pkg}")
+
# CONFLICTS SECTION
# Omitted for now due to concretizer bug
# MKL with 64-bit integers not supported.
@@ -489,7 +494,8 @@ class GenericBuilder(spack.build_systems.generic.GenericBuilder):
# you need to pass it in the FFTW_INCLUDE and FFT_LIBS directory.
# QE supports an internal FFTW2, but only an external FFTW3 interface.
- if "^mkl" in spec:
+ is_using_intel_libraries = spec["lapack"].name in INTEL_MATH_LIBRARIES
+ if is_using_intel_libraries:
# A seperate FFT library is not needed when linking against MKL
options.append("FFTW_INCLUDE={0}".format(join_path(env["MKLROOT"], "include/fftw")))
if "^fftw@3:" in spec:
@@ -531,11 +537,11 @@ class GenericBuilder(spack.build_systems.generic.GenericBuilder):
if spec.satisfies("@:6.4"): # set even if MKL is selected
options.append("BLAS_LIBS={0}".format(lapack_blas.ld_flags))
else: # behavior changed at 6.5 and later
- if not spec.satisfies("^mkl"):
+ if not is_using_intel_libraries:
options.append("BLAS_LIBS={0}".format(lapack_blas.ld_flags))
if "+scalapack" in spec:
- if "^mkl" in spec:
+ if is_using_intel_libraries:
if "^openmpi" in spec:
scalapack_option = "yes"
else: # mpich, intel-mpi
diff --git a/var/spack/repos/builtin/packages/r/package.py b/var/spack/repos/builtin/packages/r/package.py
index dfe397ca2c..7232a7e6c1 100644
--- a/var/spack/repos/builtin/packages/r/package.py
+++ b/var/spack/repos/builtin/packages/r/package.py
@@ -137,7 +137,7 @@ class R(AutotoolsPackage):
]
if "+external-lapack" in spec:
- if "^mkl" in spec and "gfortran" in self.compiler.fc:
+ if spec["lapack"].name in INTEL_MATH_LIBRARIES and "gfortran" in self.compiler.fc:
mkl_re = re.compile(r"(mkl_)intel(_i?lp64\b)")
config_args.extend(
[