packages: use "requires" to allow only selected compilers (#40567)
A few packages have encoded an idiom that pre-dates the introduction of the 'requires' directive, and they cycle over all compilers to conflict with the ones that are not supported. Here instead we reverse the logic, and require the ones that are supported.
This commit is contained in:
parent
7cc17f208c
commit
348e5cb522
@ -72,15 +72,7 @@ class Blaspp(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
conflicts("+cuda", when="+sycl", msg=backend_msg)
|
conflicts("+cuda", when="+sycl", msg=backend_msg)
|
||||||
conflicts("+sycl", when="@:2023.06.00", msg="SYCL support requires BLAS++ version 2023.08.25")
|
conflicts("+sycl", when="@:2023.06.00", msg="SYCL support requires BLAS++ version 2023.08.25")
|
||||||
|
|
||||||
# TODO: +sycl requires use of the intel-oneapi compiler, but we cannot express that directly.
|
requires("%oneapi", when="+sycl", msg="blaspp+sycl must be compiled with %oneapi")
|
||||||
# For now, add conflicts for other compilers instead.
|
|
||||||
for __compiler in spack.compilers.supported_compilers():
|
|
||||||
if __compiler != "oneapi":
|
|
||||||
conflicts(
|
|
||||||
"%{0}".format(__compiler),
|
|
||||||
when="+sycl",
|
|
||||||
msg="blaspp+sycl must be compiled with %oneapi",
|
|
||||||
)
|
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import spack.compilers
|
|
||||||
import spack.paths
|
import spack.paths
|
||||||
import spack.user_environment
|
import spack.user_environment
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
@ -53,28 +52,26 @@ class ClingoBootstrap(Clingo):
|
|||||||
depends_on("cmake@3.16.0:", type="build")
|
depends_on("cmake@3.16.0:", type="build")
|
||||||
|
|
||||||
# On Linux we bootstrap with GCC or clang
|
# On Linux we bootstrap with GCC or clang
|
||||||
for compiler_spec in [
|
requires(
|
||||||
c for c in spack.compilers.supported_compilers() if c not in ("gcc", "clang")
|
"%gcc",
|
||||||
]:
|
"%clang",
|
||||||
conflicts(
|
when="platform=linux",
|
||||||
"%{0}".format(compiler_spec),
|
msg="GCC or clang are required to bootstrap clingo on Linux",
|
||||||
when="platform=linux",
|
)
|
||||||
msg="GCC or clang are required to bootstrap clingo on Linux",
|
requires(
|
||||||
)
|
"%gcc",
|
||||||
conflicts(
|
"%clang",
|
||||||
"%{0}".format(compiler_spec),
|
when="platform=cray",
|
||||||
when="platform=cray",
|
msg="GCC or clang are required to bootstrap clingo on Cray",
|
||||||
msg="GCC or clang are required to bootstrap clingo on Cray",
|
)
|
||||||
)
|
|
||||||
conflicts("%gcc@:5", msg="C++14 support is required to bootstrap clingo")
|
conflicts("%gcc@:5", msg="C++14 support is required to bootstrap clingo")
|
||||||
|
|
||||||
# On Darwin we bootstrap with Apple Clang
|
# On Darwin we bootstrap with Apple Clang
|
||||||
for compiler_spec in [c for c in spack.compilers.supported_compilers() if c != "apple-clang"]:
|
requires(
|
||||||
conflicts(
|
"%apple-clang",
|
||||||
"%{0}".format(compiler_spec),
|
when="platform=darwin",
|
||||||
when="platform=darwin",
|
msg="Apple-clang is required to bootstrap clingo on MacOS",
|
||||||
msg="Apple-clang is required to bootstrap clingo on MacOS",
|
)
|
||||||
)
|
|
||||||
|
|
||||||
# Clingo needs the Python module to be usable by Spack
|
# Clingo needs the Python module to be usable by Spack
|
||||||
conflicts("~python", msg="Python support is required to bootstrap Spack")
|
conflicts("~python", msg="Python support is required to bootstrap Spack")
|
||||||
|
@ -39,23 +39,9 @@ class Exciting(MakefilePackage):
|
|||||||
depends_on("scalapack", when="+scalapack")
|
depends_on("scalapack", when="+scalapack")
|
||||||
# conflicts('%gcc@10:', msg='exciting cannot be built with GCC 10')
|
# conflicts('%gcc@10:', msg='exciting cannot be built with GCC 10')
|
||||||
|
|
||||||
for __compiler in spack.compilers.supported_compilers():
|
requires("%intel", when="^mkl", msg="Intel MKL only works with the Intel compiler")
|
||||||
if __compiler != "intel":
|
requires("%intel", when="^intel-mkl", msg="Intel MKL only works with the Intel compiler")
|
||||||
conflicts(
|
requires("%intel", when="^intel-mpi", msg="Intel MPI only works with the Intel compiler")
|
||||||
"%{0}".format(__compiler),
|
|
||||||
when="^mkl",
|
|
||||||
msg="Intel MKL only works with the Intel compiler",
|
|
||||||
)
|
|
||||||
conflicts(
|
|
||||||
"%{0}".format(__compiler),
|
|
||||||
when="^intel-mkl",
|
|
||||||
msg="Intel MKL only works with the Intel compiler",
|
|
||||||
)
|
|
||||||
conflicts(
|
|
||||||
"%{0}".format(__compiler),
|
|
||||||
when="^intel-mpi",
|
|
||||||
msg="Intel MPI only works with the Intel compiler",
|
|
||||||
)
|
|
||||||
|
|
||||||
def patch(self):
|
def patch(self):
|
||||||
"""Fix bad logic in m_makespectrum.f90 for the Oxygen release"""
|
"""Fix bad logic in m_makespectrum.f90 for the Oxygen release"""
|
||||||
|
@ -28,11 +28,7 @@ class GaussianSrc(Package):
|
|||||||
depends_on("tcsh", type="build")
|
depends_on("tcsh", type="build")
|
||||||
|
|
||||||
# All compilers except for pgi are in conflict:
|
# All compilers except for pgi are in conflict:
|
||||||
for __compiler in spack.compilers.supported_compilers():
|
requires("%pgi", msg="Gaussian can only be built with the PGI compiler")
|
||||||
if __compiler != "pgi":
|
|
||||||
conflicts(
|
|
||||||
"%{0}".format(__compiler), msg="Gaussian can only be built with the PGI compiler"
|
|
||||||
)
|
|
||||||
|
|
||||||
patch("16-C.01-replace-deprecated-pgf77-with-pgfortran.patch", when="@16-C.01")
|
patch("16-C.01-replace-deprecated-pgf77-with-pgfortran.patch", when="@16-C.01")
|
||||||
patch("16-C.01-fix-building-c-code-with-pgcc.patch", when="@16-C.01")
|
patch("16-C.01-fix-building-c-code-with-pgcc.patch", when="@16-C.01")
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
import spack.compilers
|
|
||||||
from spack.build_environment import dso_suffix
|
from spack.build_environment import dso_suffix
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
@ -171,11 +170,7 @@ class IntelOneapiCompilers(IntelOneApiPackage):
|
|||||||
# TODO: effectively gcc is a direct dependency of intel-oneapi-compilers, but we
|
# TODO: effectively gcc is a direct dependency of intel-oneapi-compilers, but we
|
||||||
# cannot express that properly. For now, add conflicts for non-gcc compilers
|
# cannot express that properly. For now, add conflicts for non-gcc compilers
|
||||||
# instead.
|
# instead.
|
||||||
for __compiler in spack.compilers.supported_compilers():
|
requires("%gcc", msg="intel-oneapi-compilers must be installed with %gcc")
|
||||||
if __compiler != "gcc":
|
|
||||||
conflicts(
|
|
||||||
"%{0}".format(__compiler), msg="intel-oneapi-compilers must be installed with %gcc"
|
|
||||||
)
|
|
||||||
|
|
||||||
for v in versions:
|
for v in versions:
|
||||||
version(v["version"], expand=False, **v["cpp"])
|
version(v["version"], expand=False, **v["cpp"])
|
||||||
|
@ -49,12 +49,7 @@ class Knem(AutotoolsPackage):
|
|||||||
# Ideally, we should list all non-Linux-based platforms here:
|
# Ideally, we should list all non-Linux-based platforms here:
|
||||||
conflicts("platform=darwin")
|
conflicts("platform=darwin")
|
||||||
|
|
||||||
# All compilers except for gcc are in conflict:
|
requires("%gcc", msg="Linux kernel module must be compiled with gcc")
|
||||||
for __compiler in spack.compilers.supported_compilers():
|
|
||||||
if __compiler != "gcc":
|
|
||||||
conflicts(
|
|
||||||
"%{0}".format(__compiler), msg="Linux kernel module must be compiled with gcc"
|
|
||||||
)
|
|
||||||
|
|
||||||
@run_before("build")
|
@run_before("build")
|
||||||
def override_kernel_compiler(self):
|
def override_kernel_compiler(self):
|
||||||
|
@ -85,15 +85,7 @@ class Lapackpp(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
conflicts("+cuda", when="+sycl", msg=backend_msg)
|
conflicts("+cuda", when="+sycl", msg=backend_msg)
|
||||||
conflicts("+sycl", when="@:2023.06.00", msg="+sycl requires LAPACK++ version 2023.08.25")
|
conflicts("+sycl", when="@:2023.06.00", msg="+sycl requires LAPACK++ version 2023.08.25")
|
||||||
|
|
||||||
# TODO: +sycl requires use of the intel-oneapi compiler, but we cannot express that directly.
|
requires("%oneapi", when="+sycl", msg="lapackpp+sycl must be compiled with %oneapi")
|
||||||
# For now, add conflicts for other compilers instead.
|
|
||||||
for __compiler in spack.compilers.supported_compilers():
|
|
||||||
if __compiler != "oneapi":
|
|
||||||
conflicts(
|
|
||||||
"%{0}".format(__compiler),
|
|
||||||
when="+sycl",
|
|
||||||
msg="lapackpp+sycl must be compiled with %oneapi",
|
|
||||||
)
|
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
|
@ -179,9 +179,7 @@ class Lbann(CachedCMakePackage, CudaPackage, ROCmPackage):
|
|||||||
conflicts("~python", when="@0.91:0.101")
|
conflicts("~python", when="@0.91:0.101")
|
||||||
conflicts("~pfe", when="@0.91:0.101")
|
conflicts("~pfe", when="@0.91:0.101")
|
||||||
|
|
||||||
for comp in spack.compilers.supported_compilers():
|
requires("%clang", when="+lld")
|
||||||
if comp != "clang":
|
|
||||||
conflicts("+lld", when="%" + comp)
|
|
||||||
|
|
||||||
conflicts("+lld", when="+gold")
|
conflicts("+lld", when="+gold")
|
||||||
conflicts("+gold", when="platform=darwin", msg="gold does not work on Darwin")
|
conflicts("+gold", when="platform=darwin", msg="gold does not work on Darwin")
|
||||||
|
@ -377,11 +377,7 @@ class Nvhpc(Package):
|
|||||||
provides("lapack", when="+lapack")
|
provides("lapack", when="+lapack")
|
||||||
provides("mpi", when="+mpi")
|
provides("mpi", when="+mpi")
|
||||||
|
|
||||||
# TODO: effectively gcc is a direct dependency of nvhpc, but we cannot express that
|
requires("%gcc", msg="nvhpc must be installed with %gcc")
|
||||||
# properly. For now, add conflicts for non-gcc compilers instead.
|
|
||||||
for __compiler in spack.compilers.supported_compilers():
|
|
||||||
if __compiler != "gcc":
|
|
||||||
conflicts("%{0}".format(__compiler), msg="nvhpc must be installed with %gcc")
|
|
||||||
|
|
||||||
def _version_prefix(self):
|
def _version_prefix(self):
|
||||||
return join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version)
|
return join_path(self.prefix, "Linux_%s" % self.spec.target.family, self.version)
|
||||||
|
@ -84,15 +84,7 @@ class Slate(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
depends_on("scalapack", type="test")
|
depends_on("scalapack", type="test")
|
||||||
depends_on("hipify-clang", when="@:2021.05.02 +rocm ^hip@5:")
|
depends_on("hipify-clang", when="@:2021.05.02 +rocm ^hip@5:")
|
||||||
|
|
||||||
# TODO: +sycl requires use of the intel-oneapi compiler, but we cannot express that directly.
|
requires("%oneapi", when="+sycl", msg="slate+sycl must be compiled with %oneapi")
|
||||||
# For now, add conflicts for other compilers instead.
|
|
||||||
for __compiler in spack.compilers.supported_compilers():
|
|
||||||
if __compiler != "oneapi":
|
|
||||||
conflicts(
|
|
||||||
"%{0}".format(__compiler),
|
|
||||||
when="+sycl",
|
|
||||||
msg="slate+sycl must be compiled with %oneapi",
|
|
||||||
)
|
|
||||||
|
|
||||||
cpp_17_msg = "Requires C++17 compiler support"
|
cpp_17_msg = "Requires C++17 compiler support"
|
||||||
conflicts("%gcc@:5", msg=cpp_17_msg)
|
conflicts("%gcc@:5", msg=cpp_17_msg)
|
||||||
|
@ -344,13 +344,11 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
conflicts("gotype=all", when="@12.15:")
|
conflicts("gotype=all", when="@12.15:")
|
||||||
|
|
||||||
# CUDA without wrapper requires clang
|
# CUDA without wrapper requires clang
|
||||||
for _compiler in spack.compilers.supported_compilers():
|
requires(
|
||||||
if _compiler != "clang":
|
"%clang",
|
||||||
conflicts(
|
when="+cuda~wrapper",
|
||||||
"+cuda",
|
msg="trilinos~wrapper+cuda can only be built with the Clang compiler",
|
||||||
when="~wrapper %" + _compiler,
|
)
|
||||||
msg="trilinos~wrapper+cuda can only be built with the " "Clang compiler",
|
|
||||||
)
|
|
||||||
conflicts("+cuda_rdc", when="~cuda")
|
conflicts("+cuda_rdc", when="~cuda")
|
||||||
conflicts("+rocm_rdc", when="~rocm")
|
conflicts("+rocm_rdc", when="~rocm")
|
||||||
conflicts("+wrapper", when="~cuda")
|
conflicts("+wrapper", when="~cuda")
|
||||||
|
@ -64,13 +64,7 @@ class Xpmem(AutotoolsPackage):
|
|||||||
conflicts("+kernel-module", when="platform=darwin")
|
conflicts("+kernel-module", when="platform=darwin")
|
||||||
|
|
||||||
# All compilers except for gcc are in conflict with +kernel-module:
|
# All compilers except for gcc are in conflict with +kernel-module:
|
||||||
for __compiler in spack.compilers.supported_compilers():
|
requires("%gcc", when="+kernel-module", msg="Linux kernel module must be compiled with gcc")
|
||||||
if __compiler != "gcc":
|
|
||||||
conflicts(
|
|
||||||
"+kernel-module",
|
|
||||||
when="%{0}".format(__compiler),
|
|
||||||
msg="Linux kernel module must be compiled with gcc",
|
|
||||||
)
|
|
||||||
|
|
||||||
def autoreconf(self, spec, prefix):
|
def autoreconf(self, spec, prefix):
|
||||||
Executable("./autogen.sh")()
|
Executable("./autogen.sh")()
|
||||||
|
Loading…
Reference in New Issue
Block a user