Use satisfies instead of if ... in spec in b* and c* directories (#45555)

This commit is contained in:
Auriane R. 2024-08-04 19:59:13 +02:00 committed by GitHub
parent c8695f2ba6
commit 530639e15f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
88 changed files with 370 additions and 370 deletions

View File

@ -253,7 +253,7 @@ def cmake_args(self):
# SYCL
# ===================================
if "+sycl" in self.spec:
if self.spec.satisfies("+sycl"):
args.append("-DSYCL_COMPILER=" + self.spec.variants["implementation"].value.upper())
if self.spec.variants["implementation"].value.upper() != "ONEAPI-DPCPP":
args.append(
@ -266,7 +266,7 @@ def cmake_args(self):
# SYCL 2020
# ===================================
if "+sycl2020" in self.spec:
if self.spec.satisfies("+sycl2020"):
if self.spec.satisfies("%oneapi"):
# -fsycl flag is required for setting up sycl/sycl.hpp seems like
# it doesn't get it from the CMake file
@ -288,7 +288,7 @@ def cmake_args(self):
# HIP(ROCM)
# ===================================
if "+rocm" in self.spec:
if self.spec.satisfies("+rocm"):
hip_comp = self.spec["rocm"].prefix + "/bin/hipcc"
args.append("-DCMAKE_CXX_COMPILER=" + hip_comp)
args.append(
@ -303,14 +303,14 @@ def cmake_args(self):
# TBB
# ===================================
if "+tbb" in self.spec:
if self.spec.satisfies("+tbb"):
args.append("-DONE_TBB_DIR=" + self.spec["tbb"].prefix + "/tbb/latest/")
args.append("-DPARTITIONER=" + self.spec.variants["partitioner"].value.upper())
# ===================================
# OpenCL (ocl)
# ===================================
if "+ocl" in self.spec:
if self.spec.satisfies("+ocl"):
if "backend" in self.spec.variants:
if "cuda" in self.spec.variants["backend"].value:
cuda_dir = self.spec["cuda"].prefix
@ -333,7 +333,7 @@ def cmake_args(self):
# ===================================
# RAJA
# ===================================
if "+raja" in self.spec:
if self.spec.satisfies("+raja"):
args.append("-DCMAKE_CXX_COMPILER=" + self.compiler.cxx)
args.append("-DRAJA_IN_TREE=" + self.spec.variants["dir"].value)
if "offload" in self.spec.variants:
@ -360,7 +360,7 @@ def cmake_args(self):
# ===================================
# THRUST
# ===================================
if "+thrust" in self.spec:
if self.spec.satisfies("+thrust"):
if "cuda" in self.spec.variants["implementation"].value:
args.append("-DTHRUST_IMPL=" + self.spec.variants["implementation"].value.upper())
args.append("-SDK_DIR=" + self.spec["thrust"].prefix + "/include")
@ -385,7 +385,7 @@ def cmake_args(self):
# ===================================
# kokkos implementation is versatile and it could use cuda or omp architectures as backend
# The usage should be spack install babelstream +kokkos +cuda [or +omp]
if "+kokkos" in self.spec:
if self.spec.satisfies("+kokkos"):
args.append("-DCMAKE_CXX_COMPILER=" + self.compiler.cxx)
args.append("-DKOKKOS_IN_TREE=" + self.spec.variants["dir"].value)
# args.append("-DKOKKOS_IN_PACKAGE=" + self.spec["kokkos"].prefix)

View File

@ -62,7 +62,7 @@ def edit(self, spec, prefix):
if "^netlib-lapack+lapacke" not in spec:
env["NOLAPACKE"] = "1"
if "+cuda" in spec:
if spec.satisfies("+cuda"):
cuda_arch = self.spec.variants["cuda_arch"].value
env["CUDA"] = "1"
env["CUDA_BASE"] = spec["cuda"].prefix
@ -79,7 +79,7 @@ def install(self, spec, prefix):
install("python/cfl.py", python_platlib)
install("python/wslsupport.py", python_platlib)
if "^python@3:" in spec:
if spec.satisfies("^python@3:"):
install("python/bartview3.py", join_path(prefix.bin, "bartview"))
filter_file(r"#!/usr/bin/python3", "#!/usr/bin/env python", prefix.bin.bartview)
else:

View File

@ -33,6 +33,6 @@ def configure_args(self):
spec = self.spec
args = ["--with-gmp-prefix={0}".format(self.spec["gmp"].prefix)]
if "+pet" in spec:
if spec.satisfies("+pet"):
args.append("--with-pet=bundled")
return args

View File

@ -100,7 +100,7 @@ def set_make_options(self):
options.append("prefix={0}".format(self.prefix))
options.append("HTSDIR={0}".format(self.spec["htslib"].prefix))
if "+libgsl" in self.spec:
if self.spec.satisfies("+libgsl"):
options.append("USE_GPL=1")
return options

View File

@ -84,7 +84,7 @@ def cmake_args(self):
# Use hipcc as the c compiler if we are compiling for rocm. Doing it this way
# keeps the wrapper insted of changeing CMAKE_CXX_COMPILER keeps the spack wrapper
# and the rpaths it sets for us from the underlying spec.
if "+rocm" in self.spec:
if self.spec.satisfies("+rocm"):
env["SPACK_CXX"] = self.spec["hip"].hipcc
# If we're building with cray mpich, we need to make sure we get the GTL library for

View File

@ -122,7 +122,7 @@ def edit(self, spec, prefix):
tar("-x", "-f", self.stage.archive_file, "--strip-components=1")
# get generic arch.mk template
if "+mpi" in spec:
if spec.satisfies("+mpi"):
copy(join_path(self.stage.source_path, "config", "generic.mpi.linux.mk"), "arch.mk")
else:
copy(join_path(self.stage.source_path, "config", "generic.serial.linux.mk"), "arch.mk")
@ -189,27 +189,27 @@ def build(self, spec, prefix):
buildopts = []
paraflags = []
if "+mpi" in spec:
if spec.satisfies("+mpi"):
paraflags.append("-DMPI")
# We need to copy fflags in case we append to it (#34019):
fflags = spec.compiler_flags["fflags"][:]
if "+openmp" in spec:
if spec.satisfies("+openmp"):
paraflags.append("-DOMP")
fflags.append(self.compiler.openmp_flag)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
buildopts.append("C_PARAFLAG=-DPARA")
buildopts.append("PARAFLAG=%s" % " ".join(paraflags))
debugflag = ""
if "+debug" in spec:
if spec.satisfies("+debug"):
debugflag += "-DDEBUG "
if "+verbose" in spec:
if spec.satisfies("+verbose"):
debugflag += "-DVERBOSE "
buildopts.append("DEBUGFLAG=%s" % debugflag)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
buildopts.append("LINK=%s" % spec["mpi"].mpifc)
buildopts.append("C_LINK=%s" % spec["mpi"].mpicxx)
else:
@ -228,7 +228,7 @@ def build(self, spec, prefix):
buildopts.append("LAPACKLIB=%s" % spec["lapack"].libs.ld_flags)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
mathflags.append("-DUSESCALAPACK")
buildopts.append("SCALAPACKLIB=%s" % spec["scalapack"].libs.ld_flags)
@ -236,7 +236,7 @@ def build(self, spec, prefix):
buildopts.append("COMPFLAG=-DINTEL")
buildopts.append("MOD_OPT=-module ")
buildopts.append("FCPP=cpp -C -P -ffreestanding")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
buildopts.append("F90free=%s -free" % spec["mpi"].mpifc)
buildopts.append("C_COMP=%s" % spec["mpi"].mpicc)
buildopts.append("CC_COMP=%s" % spec["mpi"].mpicxx)
@ -262,7 +262,7 @@ def build(self, spec, prefix):
buildopts.append(
"FCPP=%s -C -nostdinc -std=c11" % join_path(self.compiler.prefix, "bin", "cpp")
)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
buildopts.append("F90free=%s %s" % (spec["mpi"].mpifc, f90_flags))
buildopts.append("C_COMP=%s %s" % (spec["mpi"].mpicc, c_flags))
buildopts.append("CC_COMP=%s %s" % (spec["mpi"].mpicxx, cxx_flags))
@ -278,7 +278,7 @@ def build(self, spec, prefix):
buildopts.append("COMPFLAG=")
buildopts.append("MOD_OPT=-module ")
buildopts.append("FCPP=cpp -C -nostdinc")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
buildopts.append("F90free=%s %s" % (spec["mpi"].mpifc, f90_flags))
buildopts.append("C_COMP=%s %s" % (spec["mpi"].mpicc, c_flags))
buildopts.append("CC_COMP=%s %s" % (spec["mpi"].mpicxx, cxx_flags))
@ -293,16 +293,16 @@ def build(self, spec, prefix):
"BerkeleyGW with compiler %s" % spec.compiler
)
if "+hdf5" in spec:
if spec.satisfies("+hdf5"):
mathflags.append("-DHDF5")
buildopts.append("HDF5INCLUDE=%s" % spec["hdf5"].prefix.include)
buildopts.append("HDF5LIB=%s" % spec["hdf5:hl,fortran"].libs.ld_flags)
if "+elpa" in spec:
if spec.satisfies("+elpa"):
mathflags.append("-DUSEELPA")
elpa = spec["elpa"]
if "+openmp" in spec:
if spec.satisfies("+openmp"):
elpa_suffix = "_openmp"
else:
elpa_suffix = ""

View File

@ -51,7 +51,7 @@ def configure_args(self):
cflags = []
cxxflags = []
if "+openmp" in spec:
if spec.satisfies("+openmp"):
fcflags.append(self.compiler.openmp_flag)
if spec.satisfies("+shared"):
@ -74,7 +74,7 @@ def configure_args(self):
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
@ -83,12 +83,12 @@ def configure_args(self):
else:
args.append("--disable-mpi")
if "+openmp" in spec:
if spec.satisfies("+openmp"):
args.append("--with-openmp")
else:
args.append("--without-openmp")
if "+openbabel" in spec:
if spec.satisfies("+openbabel"):
args.append("--enable-openbabel")
args.append(f"--with-openbabel-libs={spec['openbabel'].prefix.lib}")
args.append(f"--with-openbabel-incs={spec['openbabel'].prefix.include}")

View File

@ -60,11 +60,11 @@ def configure_args(self):
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
if spec.satisfies("+openmp"):
openmp_flag.append(self.compiler.openmp_flag)
linalg = []
if "+scalapack" in spec:
if spec.satisfies("+scalapack"):
linalg.append(spec["scalapack"].libs.ld_flags)
linalg.append(spec["lapack"].libs.ld_flags)
linalg.append(spec["blas"].libs.ld_flags)
@ -83,7 +83,7 @@ def configure_args(self):
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
@ -92,22 +92,22 @@ def configure_args(self):
else:
args.append("--disable-mpi")
if "+openmp" in spec:
if spec.satisfies("+openmp"):
args.append("--with-openmp")
else:
args.append("--without-openmp")
args.append(f"--with-atlab-libs={spec['bigdft-atlab'].prefix.lib}")
if "+cuda" in spec:
if spec.satisfies("+cuda"):
args.append("--enable-cuda-gpu")
args.append(f"--with-cuda-path={spec['cuda'].prefix}")
args.append(f"--with-cuda-libs={spec['cuda'].libs.link_flags}")
if "+minpack" in spec:
if spec.satisfies("+minpack"):
args.append("--with-minpack")
if "+ntpoly" in spec:
if spec.satisfies("+ntpoly"):
args.append("--enable-ntpoly")
return args

View File

@ -64,11 +64,11 @@ def configure_args(self):
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
if spec.satisfies("+openmp"):
openmp_flag.append(self.compiler.openmp_flag)
linalg = []
if "+scalapack" in spec:
if spec.satisfies("+scalapack"):
linalg.append(spec["scalapack"].libs.ld_flags)
linalg.append(spec["lapack"].libs.ld_flags)
linalg.append(spec["blas"].libs.ld_flags)
@ -96,7 +96,7 @@ def configure_args(self):
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
@ -105,19 +105,19 @@ def configure_args(self):
else:
args.append("--disable-mpi")
if "+openmp" in spec:
if spec.satisfies("+openmp"):
args.append("--with-openmp")
else:
args.append("--without-openmp")
if "+cuda" in spec:
if spec.satisfies("+cuda"):
args.append("--enable-opencl")
args.append(f"--with-ocl-path={spec['cuda'].prefix}")
args.append("--enable-cuda-gpu")
args.append(f"--with-cuda-path={spec['cuda'].prefix}")
args.append(f"--with-cuda-libs={spec['cuda'].libs.link_flags}")
if "+openbabel" in spec:
if spec.satisfies("+openbabel"):
args.append("--enable-openbabel")
args.append(f"--with-openbabel-libs={spec['openbabel'].prefix.lib}")
args.append(f"--with-openbabel-incs={spec['openbabel'].prefix.include}")

View File

@ -58,7 +58,7 @@ def configure_args(self):
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
if spec.satisfies("+openmp"):
openmp_flag.append(self.compiler.openmp_flag)
args = [
@ -71,12 +71,12 @@ def configure_args(self):
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+openmp" in spec:
if spec.satisfies("+openmp"):
args.append("--with-openmp")
else:
args.append("--without-openmp")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
@ -85,7 +85,7 @@ def configure_args(self):
else:
args.append("--disable-mpi")
if "+cuda" in spec:
if spec.satisfies("+cuda"):
args.append("--enable-opencl")
args.append(f"--with-ocl-path={spec['cuda'].prefix}")
args.append("--enable-cuda-gpu")

View File

@ -66,7 +66,7 @@ def configure_args(self):
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.extend(
[
f"CC={spec['mpi'].mpicc}",

View File

@ -59,11 +59,11 @@ def configure_args(self):
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
if spec.satisfies("+openmp"):
openmp_flag.append(self.compiler.openmp_flag)
linalg = []
if "+scalapack" in spec:
if spec.satisfies("+scalapack"):
linalg.append(spec["scalapack"].libs.ld_flags)
linalg.append(spec["lapack"].libs.ld_flags)
linalg.append(spec["blas"].libs.ld_flags)
@ -81,7 +81,7 @@ def configure_args(self):
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
@ -90,14 +90,14 @@ def configure_args(self):
else:
args.append("--disable-mpi")
if "+openmp" in spec:
if spec.satisfies("+openmp"):
args.append("--with-openmp")
else:
args.append("--without-openmp")
args.append(f"--with-atlab-libs={spec['bigdft-atlab'].prefix.lib}")
if "+cuda" in spec:
if spec.satisfies("+cuda"):
args.append("--enable-cuda-gpu")
args.append(f"--with-cuda-path={spec['cuda'].prefix}")
args.append(f"--with-cuda-libs={spec['cuda'].libs.link_flags}")

View File

@ -57,11 +57,11 @@ def configure_args(self):
pyyaml = join_path(spec["py-pyyaml"].prefix.lib, f"python{python_version}")
openmp_flag = []
if "+openmp" in spec:
if spec.satisfies("+openmp"):
openmp_flag.append(self.compiler.openmp_flag)
linalg = []
if "+scalapack" in spec:
if spec.satisfies("+scalapack"):
linalg.append(spec["scalapack"].libs.ld_flags)
linalg.append(spec["lapack"].libs.ld_flags)
linalg.append(spec["blas"].libs.ld_flags)
@ -82,7 +82,7 @@ def configure_args(self):
if spec.satisfies("+shared"):
args.append("--enable-dynamic-libraries")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.append(f"CC={spec['mpi'].mpicc}")
args.append(f"CXX={spec['mpi'].mpicxx}")
args.append(f"FC={spec['mpi'].mpifc}")
@ -91,7 +91,7 @@ def configure_args(self):
else:
args.append("--disable-mpi")
if "+openmp" in spec:
if spec.satisfies("+openmp"):
args.append("--with-openmp")
else:
args.append("--without-openmp")

View File

@ -286,7 +286,7 @@ def configure_args(self):
args += self.enable_or_disable("lto")
args += self.enable_or_disable("nls")
args += self.enable_or_disable("plugins")
if "+pgo" in self.spec:
if self.spec.satisfies("+pgo"):
args.append("--enable-pgo-build=lto")
else:
args.append("--disable-pgo-build")

View File

@ -25,7 +25,7 @@ class Bitgroomingz(CMakePackage):
def cmake_args(self):
args = []
if "+shared" in self.spec:
if self.spec.satisfies("+shared"):
args.append("-DBUILD_SHARED_LIBS=ON")
else:
args.append("-DBUILD_SHARED_LIBS=OFF")

View File

@ -91,11 +91,11 @@ def cmake_args(self):
backend_config = "-Duse_cuda=%s" % ("+cuda" in spec)
if self.version >= Version("2021.04.01"):
backend = "none"
if "+cuda" in spec:
if spec.satisfies("+cuda"):
backend = "cuda"
if "+rocm" in spec:
if spec.satisfies("+rocm"):
backend = "hip"
if "+sycl" in spec:
if spec.satisfies("+sycl"):
backend = "sycl"
backend_config = "-Dgpu_backend=%s" % backend

View File

@ -94,7 +94,7 @@ def configure_args(self):
if spec.target.family != "aarch64":
config_args.append("--with-64")
if "+static" in spec:
if spec.satisfies("+static"):
config_args.append("--with-static")
# FIXME
# args << "--with-static-exe" unless OS.linux?
@ -102,17 +102,17 @@ def configure_args(self):
else:
config_args.extend(["--with-dll", "--without-static", "--without-static-exe"])
if "+jpeg" in spec:
if spec.satisfies("+jpeg"):
config_args.append("--with-jpeg={0}".format(self.spec["jpeg"].prefix))
else:
config_args.append("--without-jpeg")
if "+png" in spec:
if spec.satisfies("+png"):
config_args.append("--with-png={0}".format(self.spec["libpng"].prefix))
else:
config_args.append("--without-png")
if "+freetype" in spec:
if spec.satisfies("+freetype"):
config_args.append("--with-freetype={0}".format(self.spec["freetype"].prefix))
else:
config_args.append("--without-freetype")
@ -126,42 +126,42 @@ def configure_args(self):
# else:
# config_args.append('--without-hdf5')
if "+zlib" in spec:
if spec.satisfies("+zlib"):
config_args.append("--with-z={0}".format(self.spec["zlib-api"].prefix))
else:
config_args.append("--without-z")
if "+bzip2" in spec:
if spec.satisfies("+bzip2"):
config_args.append("--with-bz2={0}".format(self.spec["bzip2"].prefix))
else:
config_args.append("--without-bz2")
if "+lzo" in spec:
if spec.satisfies("+lzo"):
config_args.append("--with-lzo={0}".format(self.spec["lzo"].prefix))
else:
config_args.append("--without-lzo")
if "+gnutls" in spec:
if spec.satisfies("+gnutls"):
config_args.append("--with-gnutls={0}".format(self.spec["gnutls"].prefix))
else:
config_args.append("--without-gnutls")
if "+openssl" in spec:
if spec.satisfies("+openssl"):
config_args.append("--with-openssl={0}".format(self.spec["openssl"].prefix))
else:
config_args.append("--without-openssl")
if "+pcre" in spec:
if spec.satisfies("+pcre"):
config_args.append("--with-pcre={0}".format(self.spec["pcre"].prefix))
else:
config_args.append("--without-pcre")
if "+python" in spec:
if spec.satisfies("+python"):
config_args.append("--with-python={0}".format(self.spec["python"].home))
else:
config_args.append("--without-python")
if "+perl" in spec:
if spec.satisfies("+perl"):
config_args.append("--with-perl={0}".format(self.spec["perl"].prefix))
else:
config_args.append("--without-python")

View File

@ -55,17 +55,17 @@ def configure_args(self):
spec = self.spec
config_args = ["--enable-threading={0}".format(spec.variants["threads"].value)]
if "+ilp64" in spec:
if spec.satisfies("+ilp64"):
config_args.append("--blas-int-size=64")
else:
config_args.append("--blas-int-size=32")
if "+cblas" in spec:
if spec.satisfies("+cblas"):
config_args.append("--enable-cblas")
else:
config_args.append("--disable-cblas")
if "+blas" in spec:
if spec.satisfies("+blas"):
config_args.append("--enable-blas")
else:
config_args.append("--disable-blas")

View File

@ -49,7 +49,7 @@ class Bml(CMakePackage):
def cmake_args(self):
args = [self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
spec = self.spec
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.append("-DBML_MPI=True")
args.append("-DCMAKE_C_COMPILER=%s" % spec["mpi"].mpicc)
args.append("-DCMAKE_CXX_COMPILER=%s" % spec["mpi"].mpicxx)

View File

@ -148,7 +148,7 @@ def cmake_args(self):
#
args += ["-DVE_OPENCL=" + str("+opencl" in spec), "-DVE_CUDA=" + str("+cuda" in spec)]
if "+openmp" in spec:
if spec.satisfies("+openmp"):
args += [
"-DVE_OPENMP=ON",
"-DOPENMP_FOUND=True",
@ -160,7 +160,7 @@ def cmake_args(self):
#
# Extension methods
#
if "+blas" in spec:
if spec.satisfies("+blas"):
args += [
"-DEXT_BLAS=ON",
"-DCBLAS_FOUND=True",
@ -170,7 +170,7 @@ def cmake_args(self):
else:
args += ["-DEXT_BLAS=OFF", "-DDCBLAS_FOUND=False"]
if "+lapack" in spec:
if spec.satisfies("+lapack"):
args += [
"-DEXT_LAPACK=ON",
"-DLAPACKE_FOUND=True",
@ -180,7 +180,7 @@ def cmake_args(self):
else:
args += ["-DEXT_LAPACK=OFF", "-DLAPACKE_FOUND=False"]
if "+opencv" in spec:
if spec.satisfies("+opencv"):
args += [
"-DEXT_OPENCV=ON",
"-DOpenCV_FOUND=True",
@ -234,11 +234,11 @@ def check_install(self):
# Collect the stacks which should be available:
stacks = ["default"]
if "+openmp" in spec:
if spec.satisfies("+openmp"):
stacks.append("openmp")
if "+cuda" in spec:
if spec.satisfies("+cuda"):
stacks.append("cuda")
if "+opencl" in spec:
if spec.satisfies("+opencl"):
stacks.append("opencl")
# C++ compiler and compiler flags
@ -268,7 +268,7 @@ def check_install(self):
compare_output(cpp_output, "Success!\n")
# Python test (if +python)
if "+python" in spec:
if spec.satisfies("+python"):
file_pyadd = join_path(os.path.dirname(self.module.__file__), "pyadd.py")
py_output = python(file_pyadd, output=str, env=test_env)
compare_output(py_output, "Success!\n")

View File

@ -60,7 +60,7 @@ def configure_args(self):
args.append("--disable-server")
args.append("--enable-client")
if "+manager" in spec:
if spec.satisfies("+manager"):
args.append("--enable-manager")
else:
args.append("--disable-manager")

View File

@ -39,16 +39,16 @@ def cmake_args(self):
spec = self.spec
cmake_args = []
if "+typhon" in spec:
if spec.satisfies("+typhon"):
cmake_args.append("-DENABLE_TYPHON=ON")
if "+parmetis" in spec:
if spec.satisfies("+parmetis"):
cmake_args.append("-DENABLE_PARMETIS=ON")
if "+silo" in spec:
if spec.satisfies("+silo"):
cmake_args.append("-DENABLE_SILO=ON")
if "+caliper" in spec:
if spec.satisfies("+caliper"):
cmake_args.append("-DENABLE_CALIPER=ON")
return cmake_args

View File

@ -507,10 +507,10 @@ def determine_bootstrap_options(self, spec, with_libs, options):
options.append("--with-toolset=%s" % boost_toolset_id)
options.append("--with-libraries=%s" % ",".join(with_libs))
if "+python" in spec:
if spec.satisfies("+python"):
options.append("--with-python=%s" % spec["python"].command.path)
if "+icu" in spec:
if spec.satisfies("+icu"):
options.append("--with-icu")
else:
options.append("--without-icu")
@ -522,7 +522,7 @@ def determine_bootstrap_options(self, spec, with_libs, options):
# Skip this on Windows since we don't have a cl.exe wrapper in spack
f.write("using {0} : : {1} ;\n".format(boost_toolset_id, spack_cxx))
if "+mpi" in spec:
if spec.satisfies("+mpi"):
# Use the correct mpi compiler. If the compiler options are
# empty or undefined, Boost will attempt to figure out the
# correct options by running "${mpicxx} -show" or something
@ -532,21 +532,21 @@ def determine_bootstrap_options(self, spec, with_libs, options):
mpi_line = "using mpi : %s" % spec["mpi"].mpicxx
f.write(mpi_line + " ;\n")
if "+python" in spec:
if spec.satisfies("+python"):
f.write(self.bjam_python_line(spec))
def determine_b2_options(self, spec, options):
if "+debug" in spec:
if spec.satisfies("+debug"):
options.append("variant=debug")
else:
options.append("variant=release")
if "+icu" in spec:
if spec.satisfies("+icu"):
options.extend(["-s", "ICU_PATH=%s" % spec["icu4c"].prefix])
else:
options.append("--disable-icu")
if "+iostreams" in spec:
if spec.satisfies("+iostreams"):
options.extend(
[
"-s",
@ -568,17 +568,17 @@ def determine_b2_options(self, spec, options):
]
)
# At least with older Xcode, _lzma_cputhreads is missing (#33998)
if "platform=darwin" in self.spec:
if self.spec.satisfies("platform=darwin"):
options.extend(["-s", "NO_LZMA=1"])
link_types = ["static"]
if "+shared" in spec:
if spec.satisfies("+shared"):
link_types.append("shared")
threading_opts = []
if "+multithreaded" in spec:
if spec.satisfies("+multithreaded"):
threading_opts.append("multi")
if "+singlethreaded" in spec:
if spec.satisfies("+singlethreaded"):
threading_opts.append("single")
if not threading_opts:
raise RuntimeError(
@ -589,9 +589,9 @@ def determine_b2_options(self, spec, options):
if "+context" in spec and "context-impl" in spec.variants:
options.extend(["context-impl=%s" % spec.variants["context-impl"].value])
if "+taggedlayout" in spec:
if spec.satisfies("+taggedlayout"):
layout = "tagged"
elif "+versionedlayout" in spec:
elif spec.satisfies("+versionedlayout"):
layout = "versioned"
else:
if len(threading_opts) > 1:
@ -623,7 +623,7 @@ def determine_b2_options(self, spec, options):
if flag:
cxxflags.append(flag)
if "+pic" in self.spec:
if self.spec.satisfies("+pic"):
cxxflags.append(self.compiler.cxx_pic_flag)
# clang is not officially supported for pre-compiled headers
@ -632,7 +632,7 @@ def determine_b2_options(self, spec, options):
# https://svn.boost.org/trac/boost/ticket/12496
if spec.satisfies("%apple-clang") or spec.satisfies("%clang") or spec.satisfies("%fj"):
options.extend(["pch=off"])
if "+clanglibcpp" in spec:
if spec.satisfies("+clanglibcpp"):
cxxflags.append("-stdlib=libc++")
options.extend(["toolset=clang", 'linkflags="-stdlib=libc++"'])
elif spec.satisfies("%xl") or spec.satisfies("%xl_r"):
@ -696,7 +696,7 @@ def install(self, spec, prefix):
with_libs.remove("random")
if not spec.satisfies("@1.39.0:") and "exception" in with_libs:
with_libs.remove("exception")
if "+graph" in spec and "+mpi" in spec:
if spec.satisfies("+graph") and spec.satisfies("+mpi"):
with_libs.append("graph_parallel")
if not with_libs:
@ -753,7 +753,7 @@ def install(self, spec, prefix):
threading_opts = self.determine_b2_options(spec, b2_options)
# Create headers if building from a git checkout
if "@develop" in spec:
if spec.satisfies("@develop"):
b2("headers", *b2_options)
b2("--clean", *b2_options)
@ -766,7 +766,7 @@ def install(self, spec, prefix):
else:
b2("install", *b2_options)
if "+multithreaded" in spec and "~taggedlayout" in spec:
if spec.satisfies("+multithreaded") and spec.satisfies("~taggedlayout"):
self.add_buildopt_symlinks(prefix)
# The shared libraries are not installed correctly

View File

@ -60,7 +60,7 @@ def edit(self, spec, prefix):
def configure_args(self):
spec = self.spec
args = ["--prefix={0}".format(self.prefix)]
if "+doc" in spec:
if spec.satisfies("+doc"):
args.append("--with-documentation")
else:
args.append("--without-documentation")

View File

@ -74,7 +74,7 @@ def edit(self, spec, prefix):
makefile.filter("CXX = .*", "CPP = " + env["CXX"])
def build(self, spec, prefix):
if "+tbb" in spec:
if spec.satisfies("+tbb"):
make()
else:
make("NO_TBB=1")

View File

@ -47,7 +47,7 @@ class Bricks(CMakePackage):
def cmake_args(self):
"""CMake arguments for configure stage"""
args = [self.define_from_variant("BRICK_USE_OPENCL", "cuda")]
if "+cuda" in self.spec:
if self.spec.satisfies("+cuda"):
args.append(f"-DOCL_ROOT:STRING={self.spec['opencl-clhpp'].prefix}")
return args

View File

@ -79,7 +79,7 @@ def cmake_args(self):
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
]
args.append("-Denable_openmp=%s" % ("ON" if "+openmp" in spec else "OFF"))
if "%cce" in spec:
if spec.satisfies("%cce"):
# Assume the proper Cray CCE module (cce) is loaded:
craylibs_var = "CRAYLIBS_" + str(spec.target.family).upper()
craylibs_path = env.get(craylibs_var, None)

View File

@ -65,9 +65,9 @@ def libs(self):
def flag_handler(self, name, flags):
if name == "cflags":
if "+pic" in self.spec:
if self.spec.satisfies("+pic"):
flags.append(self.compiler.cc_pic_flag)
if "+debug" in self.spec:
if self.spec.satisfies("+debug"):
flags.append("-g")
return (flags, None, None)
@ -123,7 +123,7 @@ def patch(self):
def install(self, spec, prefix):
# Build the dynamic library first
if "+shared" in spec:
if spec.satisfies("+shared"):
make("-f", "Makefile-libbz2_so")
# Build the static library and everything else
@ -145,7 +145,7 @@ def install(self, spec, prefix):
make()
make("install", "PREFIX={0}".format(prefix))
if "+shared" in spec:
if spec.satisfies("+shared"):
install("bzip2-shared", join_path(prefix.bin, "bzip2"))
v1, v2, v3 = (self.spec.version.up_to(i) for i in (1, 2, 3))

View File

@ -54,7 +54,7 @@ def libs(self):
def cmake_args(self):
args = []
if "+avx2" in self.spec:
if self.spec.satisfies("+avx2"):
args.append("-DDEACTIVATE_AVX2=OFF")
else:
args.append("-DDEACTIVATE_AVX2=ON")

View File

@ -144,7 +144,7 @@ def cmake_args(self):
options.append(self.define(cbn_disable, "ON"))
# Use hipcc for HIP.
if "+rocm" in self.spec:
if self.spec.satisfies("+rocm"):
options.append(self.define("CMAKE_CXX_COMPILER", self.spec["hip"].hipcc))
return options

View File

@ -92,7 +92,7 @@ def cmake_args(self):
]
)
if "+cuda" in spec:
if spec.satisfies("+cuda"):
if spec.variants["cuda_arch"].value[0] != "none":
cuda_arch = spec.variants["cuda_arch"].value
args.append(self.define("CUDA_ARCH_NAME", "Manual"))

View File

@ -83,7 +83,7 @@ def autoreconf(self, spec, prefix):
def configure_args(self):
args = ["--disable-trace", "--enable-tee"] # can cause problems with libiberty
if "+X" in self.spec:
if self.spec.satisfies("+X"):
args.extend(["--enable-xlib", "--enable-xcb"])
else:
args.extend(["--disable-xlib", "--disable-xcb"])

View File

@ -159,40 +159,40 @@ def cmake_args(self):
self.define_from_variant("WITH_KOKKOS", "kokkos"),
]
if "+papi" in spec:
if spec.satisfies("+papi"):
args.append("-DPAPI_PREFIX=%s" % spec["papi"].prefix)
if "+libdw" in spec:
if spec.satisfies("+libdw"):
args.append("-DLIBDW_PREFIX=%s" % spec["elfutils"].prefix)
if "+libpfm" in spec:
if spec.satisfies("+libpfm"):
args.append("-DLIBPFM_INSTALL=%s" % spec["libpfm4"].prefix)
if "+sosflow" in spec:
if spec.satisfies("+sosflow"):
args.append("-DSOS_PREFIX=%s" % spec["sosflow"].prefix)
if "+variorum" in spec:
if spec.satisfies("+variorum"):
args.append("-DVARIORUM_PREFIX=%s" % spec["variorum"].prefix)
# -DWITH_CALLPATH was renamed -DWITH_LIBUNWIND in 2.5
callpath_flag = "LIBUNWIND" if spec.satisfies("@2.5:") else "CALLPATH"
if "+libunwind" in spec:
if spec.satisfies("+libunwind"):
args.append("-DLIBUNWIND_PREFIX=%s" % spec["unwind"].prefix)
args.append("-DWITH_%s=On" % callpath_flag)
else:
args.append("-DWITH_%s=Off" % callpath_flag)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.append("-DMPI_C_COMPILER=%s" % spec["mpi"].mpicc)
args.append("-DMPI_CXX_COMPILER=%s" % spec["mpi"].mpicxx)
if "+cuda" in spec:
if spec.satisfies("+cuda"):
args.append("-DCUDA_TOOLKIT_ROOT_DIR=%s" % spec["cuda"].prefix)
# technically only works with cuda 10.2+, otherwise cupti is in
# ${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI
args.append("-DCUPTI_PREFIX=%s" % spec["cuda"].prefix)
if "+vtune" in spec:
if spec.satisfies("+vtune"):
itt_dir = join_path(spec["intel-oneapi-vtune"].prefix, "vtune", "latest")
args.append("-DITT_PREFIX=%s" % itt_dir)
if "+rocm" in spec:
if spec.satisfies("+rocm"):
args.append("-DCMAKE_CXX_COMPILER={0}".format(spec["hip"].hipcc))
args.append("-DROCM_PREFIX=%s" % spec["hsa-rocr-dev"].prefix)

View File

@ -49,7 +49,7 @@ def cmake_args(self):
"-DBUILD_FOR_INSTALL:BOOL=ON",
]
if "+moab" in spec:
if spec.satisfies("+moab"):
options.extend(["-DENABLE_MOAB:BOOL=ON", "-DMOAB_PATH:PATH=%s" % spec["moab"].prefix])
else:
options.append("-DENABLE_MOAB:BOOL=OFF")

View File

@ -75,7 +75,7 @@ def cmake_args(self):
options.append("-DBLT_SOURCE_DIR={0}".format(spec["blt"].prefix))
options.append(self.define_from_variant("ENABLE_CUDA", "cuda"))
if "+cuda" in spec:
if spec.satisfies("+cuda"):
options.append("-DCUDA_TOOLKIT_ROOT_DIR={0}".format(spec["cuda"].prefix))
if not spec.satisfies("cuda_arch=none"):
@ -86,7 +86,7 @@ def cmake_args(self):
options.append("-DCMAKE_CUDA_FLAGS:STRING={0}".format(flag))
options.append(self.define_from_variant("ENABLE_HIP", "rocm"))
if "+rocm" in spec:
if spec.satisfies("+rocm"):
options.append("-DHIP_ROOT_DIR={0}".format(spec["hip"].prefix))
archs = self.spec.variants["amdgpu_target"].value

View File

@ -92,7 +92,7 @@ def edit(self, spec, prefix):
)
makefile.filter("OPENMPI MVAPICH", "OPENMPI MVAPICH IntelMPI", string=True)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
# Substitute CC, FC.
makefile.filter("CC = .*", "CC = " + spec["mpi"].mpicc)
makefile.filter("FC = .*", "FC = " + spec["mpi"].mpifc)
@ -122,7 +122,7 @@ def build_targets(self):
compiler = os.path.basename(env["FC"]) + omp
args = ["COMPILER={0}".format(compiler)]
# Set MPI.
if "+mpi" in self.spec:
if self.spec.satisfies("+mpi"):
mpi = self.spec["mpi"]
args += ["MPI={0}".format(mpi.name), "MPI_INST={0}".format(mpi.prefix)]
return args

View File

@ -118,7 +118,7 @@ def build_args(self, spec, prefix):
)
# Sundials support
if "+sundials" in spec:
if spec.satisfies("+sundials"):
if spec.satisfies("@2.3.0:"):
args.append("system_sundials=y")
else:
@ -137,7 +137,7 @@ def build_args(self, spec, prefix):
)
# Python module
if "+python" in spec:
if spec.satisfies("+python"):
args.extend(["python_package=full", "python_cmd={0}".format(python.path)])
if spec["python"].satisfies("@3:"):
args.extend(["python3_package=y", "python3_cmd={0}".format(python.path)])
@ -148,7 +148,7 @@ def build_args(self, spec, prefix):
args.append("python3_package=n")
# Matlab toolbox
if "+matlab" in spec:
if spec.satisfies("+matlab"):
args.extend(["matlab_toolbox=y", "matlab_path={0}".format(spec["matlab"].prefix)])
else:
args.append("matlab_toolbox=n")
@ -156,7 +156,7 @@ def build_args(self, spec, prefix):
return args
def build_test(self):
if "+python" in self.spec:
if self.spec.satisfies("+python"):
# Tests will always fail if Python dependencies aren't built
# In addition, 3 of the tests fail when run in parallel
scons("test", parallel=False)

View File

@ -53,12 +53,12 @@ class Capnproto(AutotoolsPackage):
def configure_args(self):
args = []
if "+tls" in self.spec:
if self.spec.satisfies("+tls"):
args.append("--with-openssl")
else:
args.append("--without-openssl")
if "+zlib" in self.spec:
if self.spec.satisfies("+zlib"):
args.append("--with-zlib")
else:
args.append("--without-zlib")

View File

@ -48,12 +48,12 @@ def cmake_args(self):
"-DCMAKE_CXX_COMPILER:STRING=" + spec["mpi"].mpicxx,
]
if "+cuda" in self.spec:
if self.spec.satisfies("+cuda"):
args.append("-DENABLE_CUDA:BOOL=ON")
args.append("-DCUDA_TOOLKIT_ROOT:PATH=" + spec["cuda"].prefix)
else:
args.append("-DENABLE_CUDA:BOOL=OFF")
if "+mfem" in self.spec:
if self.spec.satisfies("+mfem"):
args.append("-DMFEM_DIR:PATH=" + spec["mfem"].prefix)
return args

View File

@ -123,7 +123,7 @@ def cmake_args(self):
options = []
options.append("-DBLT_SOURCE_DIR={0}".format(spec["blt"].prefix))
if "+cuda" in spec:
if spec.satisfies("+cuda"):
options.extend(
[
"-DENABLE_CUDA=ON",
@ -143,7 +143,7 @@ def cmake_args(self):
else:
options.append("-DENABLE_CUDA=OFF")
if "+rocm" in spec:
if spec.satisfies("+rocm"):
options.extend(["-DENABLE_HIP=ON", "-DHIP_ROOT_DIR={0}".format(spec["hip"].prefix)])
archs = self.spec.variants["amdgpu_target"].value

View File

@ -59,13 +59,13 @@ def build_targets(self):
spec = self.spec
targetlist = [f"PWD={self.stage.source_path}"]
if "+mpi" in spec:
if spec.satisfies("+mpi"):
targetlist.append("COMMS_ARCH=mpi")
targetlist.append(f"FFTLIBDIR={spec['fftw-api'].prefix.lib}")
targetlist.append(f"MATHLIBDIR={spec['blas'].prefix.lib}")
if "^mkl" in spec:
if spec.satisfies("^mkl"):
targetlist.append("FFT=mkl")
if self.spec.satisfies("@20:"):
targetlist.append("MATHLIBS=mkl")

View File

@ -69,7 +69,7 @@ def edit(self, spec, prefix):
chgopt,
join_path(self.stage.source_path, "src", "make.gfortran.inc"),
)
if "%fj" in spec:
if spec.satisfies("%fj"):
filter_file(
"mpifrtpx",
spec["mpi"].mpifc,
@ -95,7 +95,7 @@ def edit(self, spec, prefix):
def build(self, spec, prefix):
ccs_class = "CLASS=" + spec.variants["class"].value
with working_dir("src"):
if "%fj" in spec:
if spec.satisfies("%fj"):
make("MAKE_INC=make.fx10.inc", ccs_class)
else:
make("MAKE_INC=make.gfortran.inc", ccs_class)

View File

@ -38,9 +38,9 @@ def patch(self):
def build(self, spec, prefix):
mkdirp(prefix.bin)
make_args = []
if "~openmp" in spec:
if spec.satisfies("~openmp"):
make_args.append("openmp=no")
if "~zlib" in spec:
if spec.satisfies("~zlib"):
make_args.append("zlib=no")
make(*make_args)

View File

@ -218,7 +218,7 @@ def yes_or_prefix(spec_name):
prefix = self.spec[spec_name].prefix
return "yes" if is_system_path(prefix) else prefix
if "+netcdf" in self.spec:
if self.spec.satisfies("+netcdf"):
config_args.append("--with-netcdf=" + yes_or_prefix("netcdf-c"))
# We need to make sure that the libtool script of libcdi - the
# internal library of CDO - finds the correct version of hdf5.
@ -251,12 +251,12 @@ def yes_or_prefix(spec_name):
if self.spec.satisfies("@1.9:"):
config_args.append("--without-eccodes")
if "+external-grib1" in self.spec:
if self.spec.satisfies("+external-grib1"):
config_args.append("--disable-cgribex")
else:
config_args.append("--enable-cgribex")
if "+szip" in self.spec:
if self.spec.satisfies("+szip"):
config_args.append("--with-szlib=" + yes_or_prefix("szip"))
else:
config_args.append("--without-szlib")
@ -267,7 +267,7 @@ def yes_or_prefix(spec_name):
"udunits2", activation_value=lambda x: yes_or_prefix("udunits")
)
if "+libxml2" in self.spec:
if self.spec.satisfies("+libxml2"):
libxml2_spec = self.spec["libxml2"]
if is_system_path(libxml2_spec.prefix):
config_args.append("--with-libxml2=yes")

View File

@ -52,17 +52,17 @@ def cmake_args(self):
]
)
if "+suitesparse" in self.spec:
if self.spec.satisfies("+suitesparse"):
args.append("-DSUITESPARSE=ON")
else:
args.append("-DSUITESPARSE=OFF")
if "+shared" in self.spec:
if self.spec.satisfies("+shared"):
args.append("-DBUILD_SHARED_LIBS=ON")
else:
args.append("-DBUILD_SHARED_LIBS=OFF")
if "+examples" in self.spec:
if self.spec.satisfies("+examples"):
args.append("-DBUILD_EXAMPLES=ON")
else:
args.append("-DBUILD_EXAMPLES=OFF")

View File

@ -48,7 +48,7 @@ def url_for_version(self, version):
def configure_args(self):
spec = self.spec
extra_args = []
if "+bzip2" in spec:
if spec.satisfies("+bzip2"):
extra_args.append(f"--with-bzip2={spec['bzip2'].prefix}"),
return extra_args
@ -57,7 +57,7 @@ def build_targets(self):
targets = ["all"]
# Build shared if variant is set.
if "+shared" in self.spec:
if self.spec.satisfies("+shared"):
targets += ["shared"]
return targets

View File

@ -104,7 +104,7 @@ def setup_build_environment(self, env):
env.set("BOOST_INCLUDEDIR", spec["boost"].headers.directories[0])
env.set("BOOST_LIBRARYDIR", spec["boost"].libs.directories[0])
if "+eigen" in spec:
if spec.satisfies("+eigen"):
env.set("EIGEN3_INC_DIR", spec["eigen"].headers.directories[0])
def cmake_args(self):

View File

@ -33,7 +33,7 @@ def configure_args(self):
spec = self.spec
args = []
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.extend(
[
"--with-mpi",
@ -44,15 +44,15 @@ def configure_args(self):
else:
args.append("--without-mpi")
if "+oce" in spec:
if spec.satisfies("+oce"):
args.append("--with-occ={0}".format(spec["oce"].prefix))
else:
args.append("--without-occ")
if "+debug" in spec:
if spec.satisfies("+debug"):
args.append("--enable-debug")
if "+shared" in spec:
if spec.satisfies("+shared"):
args.append("--enable-shared")
return args

View File

@ -110,10 +110,10 @@ def cmake_args(self):
"-DCMAKE_CXX_COMPILER=%s" % spec["mpi"].mpicxx,
]
)
if "+fortran" in spec:
if spec.satisfies("+fortran"):
options.append(self.define("CMAKE_Fortran_COMPILER", spec["mpi"].mpifc))
if "+hdf5" in spec:
if spec.satisfies("+hdf5"):
options.extend(
[
"-DCGNS_ENABLE_HDF5:BOOL=ON",
@ -122,7 +122,7 @@ def cmake_args(self):
"-DHDF5_LIBRARY_DIR:PATH=%s" % spec["hdf5"].prefix.lib,
]
)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
options.extend(["-DHDF5_NEED_MPI:BOOL=ON", "-DHDF5_ENABLE_PARALLEL:BOOL=ON"])
else:
options.extend(["-DCGNS_ENABLE_HDF5=OFF"])

View File

@ -209,7 +209,7 @@ def initconfig_compiler_entries(self):
# Default entries are already defined in CachedCMakePackage, inherit them:
entries = super().initconfig_compiler_entries()
if "+rocm" in spec:
if spec.satisfies("+rocm"):
entries.insert(0, cmake_cache_path("CMAKE_CXX_COMPILER", spec["hip"].hipcc))
llnl_link_helpers(entries, spec, compiler)
@ -224,16 +224,16 @@ def initconfig_hardware_entries(self):
entries.append("# Package custom hardware settings")
entries.append("#------------------{0}\n".format("-" * 30))
if "+cuda" in spec:
if spec.satisfies("+cuda"):
entries.append(cmake_cache_option("ENABLE_CUDA", True))
if "+separable_compilation" in spec:
if spec.satisfies("+separable_compilation"):
entries.append(cmake_cache_option("CMAKE_CUDA_SEPARABLE_COMPILATION", True))
entries.append(cmake_cache_option("CUDA_SEPARABLE_COMPILATION", True))
else:
entries.append(cmake_cache_option("ENABLE_CUDA", False))
if "+rocm" in spec:
if spec.satisfies("+rocm"):
entries.append(cmake_cache_option("ENABLE_HIP", True))
else:
entries.append(cmake_cache_option("ENABLE_HIP", False))
@ -260,7 +260,7 @@ def initconfig_package_entries(self):
entries.append("#------------------{0}\n".format("-" * 60))
entries.append(cmake_cache_path("BLT_SOURCE_DIR", spec["blt"].prefix))
if "+raja" in spec:
if spec.satisfies("+raja"):
entries.append(cmake_cache_option("{}ENABLE_RAJA_PLUGIN".format(option_prefix), True))
entries.append(cmake_cache_path("RAJA_DIR", spec["raja"].prefix))
entries.append(cmake_cache_path("umpire_DIR", spec["umpire"].prefix))
@ -278,7 +278,7 @@ def initconfig_package_entries(self):
entries.append(cmake_cache_option("ENABLE_OPENMP", "+openmp" in spec))
entries.append(cmake_cache_option("ENABLE_EXAMPLES", "+examples" in spec))
entries.append(cmake_cache_option("ENABLE_DOCS", False))
if "tests=benchmarks" in spec:
if spec.satisfies("tests=benchmarks"):
# BLT requires ENABLE_TESTS=True to enable benchmarks
entries.append(cmake_cache_option("ENABLE_BENCHMARKS", True))
entries.append(cmake_cache_option("ENABLE_TESTS", True))

View File

@ -114,14 +114,14 @@ def cmake_args(self):
)
if spec.satisfies("~simgrid"):
if "^intel-mkl" in spec or "^intel-parallel-studio+mkl" in spec:
if "threads=none" in spec:
if spec.satisfies("^intel-mkl") or spec.satisfies("^intel-parallel-studio+mkl"):
if spec.satisfies("threads=none"):
args.extend([self.define("BLA_VENDOR", "Intel10_64lp_seq")])
else:
args.extend([self.define("BLA_VENDOR", "Intel10_64lp")])
elif "^netlib-lapack" in spec:
elif spec.satisfies("^netlib-lapack"):
args.extend([self.define("BLA_VENDOR", "Generic")])
elif "^openblas" in spec:
elif spec.satisfies("^openblas"):
args.extend([self.define("BLA_VENDOR", "OpenBLAS")])
return args

View File

@ -76,7 +76,7 @@ def cmake_args(self):
args.append("-DWITH_NETCDF:STRING={0}".format(netcdf_str[spec.variants["netcdf"].value]))
# Set an MPI compiler for parallel builds
if "+mpi" in spec:
if spec.satisfies("+mpi"):
args.append("-DCMAKE_CXX_COMPILER:PATH={0}".format(spec["mpi"].mpicxx))
return args

View File

@ -161,14 +161,14 @@ def configure_args(self):
py_path = self.spec["python"].command.path
args.append("--with-python={0}".format(py_path))
if "+docs" in self.spec:
if self.spec.satisfies("+docs"):
sphinx_bin = "{0}".format(self.spec["py-sphinx"].prefix.bin)
args.append("--enable-html")
args.append("--with-sphinx-build={0}".format(sphinx_bin.join("sphinx-build")))
else:
args.append("--disable-html")
if "+squashfuse" in self.spec:
if self.spec.satisfies("+squashfuse"):
squashfuse_prefix = "{0}".format(self.spec["squashfuse"].prefix)
args.append("--with-libsquashfuse={0}".format(squashfuse_prefix))

View File

@ -277,7 +277,7 @@ def charmarch(self):
def install(self, spec, prefix):
if not ("backend=mpi" in self.spec) or not ("backend=netlrts" in self.spec):
if "+pthreads" in self.spec:
if self.spec.satisfies("+pthreads"):
raise InstallError(
"The pthreads option is only\
available on the Netlrts and MPI \
@ -289,7 +289,7 @@ def install(self, spec, prefix):
or ("backend=ofi" in self.spec)
or ("backend=gni" in self.spec)
):
if "pmi=none" in self.spec:
if self.spec.satisfies("pmi=none"):
raise InstallError(
"The UCX/OFI/GNI backends need \
PMI to run. Please add pmi=... \
@ -302,7 +302,7 @@ def install(self, spec, prefix):
or ("pmi=slurmpmi" in self.spec)
or ("pmi=slurmpmi2" in self.spec)
):
if "^openmpi" in self.spec:
if self.spec.satisfies("^openmpi"):
raise InstallError(
"To use any process management \
interface other than PMIx, \
@ -324,15 +324,15 @@ def install(self, spec, prefix):
options.append("-j%d" % make_jobs)
options.append("--destination=%s" % builddir)
if "pmi=slurmpmi" in spec:
if spec.satisfies("pmi=slurmpmi"):
options.append("slurmpmi")
if "pmi=slurmpmi2" in spec:
if spec.satisfies("pmi=slurmpmi2"):
options.append("slurmpmi2")
if "pmi=pmix" in spec:
if spec.satisfies("pmi=pmix"):
options.append("ompipmix")
options.extend(["--basedir=%s" % spec["openmpi"].prefix])
if "backend=mpi" in spec:
if spec.satisfies("backend=mpi"):
# in intelmpi <prefix>/include and <prefix>/lib fails so --basedir
# cannot be used
options.extend(
@ -342,9 +342,9 @@ def install(self, spec, prefix):
["--libdir={0}".format(libdir) for libdir in spec["mpi"].libs.directories]
)
if "backend=ucx" in spec:
if spec.satisfies("backend=ucx"):
options.extend(["--basedir=%s" % spec["ucx"].prefix])
if "+papi" in spec:
if spec.satisfies("+papi"):
options.extend(["papi", "--basedir=%s" % spec["papi"].prefix])
if "+smp" in spec and "backend=multicore" not in spec:
# The 'multicore' backend always uses SMP, so we don't have to
@ -352,7 +352,7 @@ def install(self, spec, prefix):
# of Charm++ v7.0.0 it is actually a build error to append 'smp'
# with the 'multicore' backend.
options.append("smp")
if "+tcp" in spec:
if spec.satisfies("+tcp"):
if "backend=netlrts" not in spec:
# This is a Charm++ limitation; it would lead to a
# build error
@ -360,18 +360,18 @@ def install(self, spec, prefix):
"The +tcp variant requires " "the backend=netlrts communication mechanism"
)
options.append("tcp")
if "+omp" in spec:
if spec.satisfies("+omp"):
options.append("omp")
if "+pthreads" in spec:
if spec.satisfies("+pthreads"):
options.append("pthreads")
if "+cuda" in spec:
if spec.satisfies("+cuda"):
options.append("cuda")
if "+shared" in spec:
if spec.satisfies("+shared"):
options.append("--build-shared")
if "+production" in spec:
if spec.satisfies("+production"):
options.append("--with-production")
if "+tracing" in spec:
if spec.satisfies("+tracing"):
options.append("--enable-tracing")
# Call "make" via the build script

View File

@ -39,13 +39,13 @@ def build_targets(self):
return targets
def build(self, spec, prefix):
if "+scorep" in spec:
if spec.satisfies("+scorep"):
make("WITH_OTF2=YES")
else:
make()
def install(self, spec, prefix):
if "+scorep" in spec:
if spec.satisfies("+scorep"):
make("WITH_OTF2=YES", "PREFIX=" + spec.prefix, "install")
else:
make("PREFIX=" + spec.prefix, "install")

View File

@ -84,7 +84,7 @@ def edit(self, spec, prefix):
# Compilers and Compiler flags
defs_file.filter(r"^#\s*CXX\s*=.*", "CXX = %s" % spack_cxx)
defs_file.filter(r"^#\s*FC\s*=.*", "FC = %s" % spack_fc)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
defs_file.filter(r"^#\s*MPICXX\s*=.*", "MPICXX = %s" % self.spec["mpi"].mpicxx)
# Conditionally determined settings
@ -92,7 +92,7 @@ def edit(self, spec, prefix):
defs_file.filter(r"^#\s*DIM\s*=.*", "DIM = %s" % spec.variants["dims"].value)
# HDF5 settings
if "+hdf5" in spec:
if spec.satisfies("+hdf5"):
defs_file.filter(r"^#\s*USE_HDF5\s*=.*", "USE_HDF5 = TRUE")
defs_file.filter(
r"^#\s*HDFINCFLAGS\s*=.*", "HDFINCFLAGS = -I%s" % spec["hdf5"].prefix.include
@ -100,7 +100,7 @@ def edit(self, spec, prefix):
defs_file.filter(
r"^#\s*HDFLIBFLAGS\s*=.*", "HDFLIBFLAGS = %s" % spec["hdf5"].libs.ld_flags
)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
defs_file.filter(
r"^#\s*HDFMPIINCFLAGS\s*=.*",
"HDFMPIINCFLAGS = -I%s" % spec["hdf5"].prefix.include,

View File

@ -43,7 +43,7 @@ class Citcoms(AutotoolsPackage):
depends_on("hdf5+mpi", when="+hdf5")
def setup_build_environment(self, env):
if "+ggrd" in self.spec:
if self.spec.satisfies("+ggrd"):
env.set("HC_HOME", self.spec["hc"].prefix)
def configure_args(self):
@ -54,17 +54,17 @@ def configure_args(self):
args.append("--without-pyre")
args.append("--without-exchanger")
if "+ggrd" in self.spec:
if self.spec.satisfies("+ggrd"):
args.append("--with-ggrd")
else:
args.append("--without-ggrd")
if "+cuda" in self.spec:
if self.spec.satisfies("+cuda"):
args.append("--with-cuda")
else:
args.append("--without-cuda")
if "+hdf5" in self.spec:
if self.spec.satisfies("+hdf5"):
args.extend(
[
"--with-hdf5",

View File

@ -44,16 +44,16 @@ class Clamr(CMakePackage):
def cmake_args(self):
spec = self.spec
cmake_args = []
if "graphics=none" in spec:
if spec.satisfies("graphics=none"):
cmake_args.append("-DGRAPHICS_TYPE=None")
elif "graphics=mpe" in spec:
elif spec.satisfies("graphics=mpe"):
cmake_args.append("-DGRAPHICS_TYPE=MPE")
else:
cmake_args.append("-DGRAPHICS_TYPE=OpenGL")
if "precision=full" in spec:
if spec.satisfies("precision=full"):
cmake_args.append("-DPRECISION_TYPE=full_precision")
elif "precision=single" in spec:
elif spec.satisfies("precision=single"):
cmake_args.append("-DPRECISION_TYPE=minimum_precision")
else:
cmake_args.append("-DPRECISION_TYPE=mixed_precision")

View File

@ -30,7 +30,7 @@ class Clapack(MakefilePackage):
def edit(self, spec, prefix):
copy("make.inc.example", "make.inc")
if "+external-blas" in spec:
if spec.satisfies("+external-blas"):
make_inc = FileFilter("make.inc")
make_inc.filter(r"^BLASLIB.*", "BLASLIB = ../../libcblaswr.a -lcblas -latlas")
makefile = FileFilter("Makefile")

View File

@ -136,7 +136,7 @@ def pgo_train(self):
cmake.add_default_envmod(use_mods)
def setup_build_environment(self, env):
if "%apple-clang" in self.spec:
if self.spec.satisfies("%apple-clang"):
env.append_flags("CFLAGS", "-mmacosx-version-min=10.13")
env.append_flags("CXXFLAGS", "-mmacosx-version-min=10.13")
env.append_flags("LDFLAGS", "-mmacosx-version-min=10.13")

View File

@ -98,7 +98,7 @@ def cmake_args(self):
args = [self.define("CLINGO_BUILD_WITH_LUA", False)]
if "+python" in self.spec:
if self.spec.satisfies("+python"):
suffix = python(
"-c", "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))", output=str
).strip()
@ -116,7 +116,7 @@ def cmake_args(self):
# Use LTO also for non-Intel compilers please. This can be removed when they
# bump cmake_minimum_required to VERSION 3.9.
if "+ipo" in self.spec:
if self.spec.satisfies("+ipo"):
args.append(self.define("CMAKE_POLICY_DEFAULT_CMP0069", "NEW"))
return args

View File

@ -76,7 +76,7 @@ def configure_args(self):
configure_args = []
if "+gmp" in spec:
if spec.satisfies("+gmp"):
configure_args.append("--with-gmp={0}".format(spec["gmp"].prefix))
else:
configure_args.append("--without-gmp")

View File

@ -45,9 +45,9 @@ def build_targets(self):
targets.append("MPI_COMPILER={0}".format(self.spec["mpi"].mpifc))
targets.append("C_MPI_COMPILER={0}".format(self.spec["mpi"].mpicc))
if "+debug" in self.spec:
if self.spec.satisfies("+debug"):
targets.append("DEBUG=1")
if "+ieee" in self.spec:
if self.spec.satisfies("+ieee"):
targets.append("IEEE=1")
# Work around for bug in Makefiles for versions 1.3 and 1.1 (mis-defined as -openmp)

View File

@ -58,15 +58,15 @@ def patch_for_reference_module(self):
def type_of_build(self):
build = "ref"
if "build=cuda" in self.spec:
if self.spec.satisfies("build=cuda"):
build = "CUDA"
elif "build=mpi_only" in self.spec:
elif self.spec.satisfies("build=mpi_only"):
build = "MPI"
elif "build=openacc_cray" in self.spec:
elif self.spec.satisfies("build=openacc_cray"):
build = "OpenACC_CRAY"
elif "build=openmp_only" in self.spec:
elif self.spec.satisfies("build=openmp_only"):
build = "OpenMP"
elif "build=serial" in self.spec:
elif self.spec.satisfies("build=serial"):
build = "Serial"
return build
@ -75,42 +75,42 @@ def type_of_build(self):
def build_targets(self):
targets = ["--directory=CloverLeaf_{0}".format(self.type_of_build)]
if "mpi" in self.spec:
if self.spec.satisfies("^mpi"):
targets.append("MPI_COMPILER={0}".format(self.spec["mpi"].mpifc))
targets.append("C_MPI_COMPILER={0}".format(self.spec["mpi"].mpicc))
else:
targets.append("MPI_COMPILER=f90")
targets.append("C_MPI_COMPILER=cc")
if "%gcc" in self.spec:
if self.spec.satisfies("%gcc"):
targets.append("COMPILER=GNU")
targets.append("FLAGS_GNU=")
targets.append("CFLAGS_GNU=")
elif "%cce" in self.spec:
elif self.spec.satisfies("%cce"):
targets.append("COMPILER=CRAY")
targets.append("FLAGS_CRAY=")
targets.append("CFLAGS_CRAY=")
elif "%intel" in self.spec:
elif self.spec.satisfies("%intel"):
targets.append("COMPILER=INTEL")
targets.append("FLAGS_INTEL=")
targets.append("CFLAGS_INTEL=")
elif "%aocc" in self.spec:
elif self.spec.satisfies("%aocc"):
targets.append("COMPILER=AOCC")
elif "%pgi" in self.spec:
elif self.spec.satisfies("%pgi"):
targets.append("COMPILER=PGI")
targets.append("FLAGS_PGI=")
targets.append("CFLAGS_PGI=")
elif "%xl" in self.spec:
elif self.spec.satisfies("%xl"):
targets.append("COMPILER=XLF")
targets.append("FLAGS_XLF=")
targets.append("CFLAGS_XLF=")
# Explicit mention of else clause is not working as expected
# So, not mentioning them
if "+debug" in self.spec:
if self.spec.satisfies("+debug"):
targets.append("DEBUG=1")
if "+ieee" in self.spec:
if self.spec.satisfies("+ieee"):
targets.append("IEEE=1")
return targets

View File

@ -39,9 +39,9 @@ class Cloverleaf3d(MakefilePackage):
def type_of_build(self):
build = "ref"
if "+opencl" in self.spec:
if self.spec.satisfies("+opencl"):
build = "OpenCL"
elif "+openacc" in self.spec:
elif self.spec.satisfies("+openacc"):
build = "OpenACC"
return build
@ -54,33 +54,33 @@ def build_targets(self):
"--directory=CloverLeaf3D_{0}".format(self.type_of_build),
]
if "%gcc" in self.spec:
if self.spec.satisfies("%gcc"):
targets.append("COMPILER=GNU")
targets.append("FLAGS_GNU=-O3 -funroll-loops")
targets.append("CFLAGS_GNU=-O3 -funroll-loops")
targets.append("OMP_GNU=-fopenmp")
elif "%cce" in self.spec:
elif self.spec.satisfies("%cce"):
targets.append("COMPILER=CRAY")
targets.append("FLAGS_CRAY=")
targets.append("CFLAGS_CRAY=")
elif "%intel" in self.spec:
elif self.spec.satisfies("%intel"):
targets.append("COMPILER=INTEL")
targets.append("FLAGS_INTEL=")
targets.append("CFLAGS_INTEL=")
elif "%pgi" in self.spec:
elif self.spec.satisfies("%pgi"):
targets.append("COMPILER=PGI")
targets.append("FLAGS_PGI=")
targets.append("CFLAGS_PGI=")
elif "%xl" in self.spec:
elif self.spec.satisfies("%xl"):
targets.append("COMPILER=XLF")
targets.append("FLAGS_XLF=")
targets.append("CFLAGS_XLF=")
elif "%arm" in self.spec:
elif self.spec.satisfies("%arm"):
targets.append("COMPILER=ARM")
targets.append("FLAGS_ARM=-O3 -funroll-loops")
targets.append("CFLAGS_ARM=-O3 -funroll-loops")
targets.append("OMP_ARM=-fopenmp")
elif "%nvhpc" in self.spec:
elif self.spec.satisfies("%nvhpc"):
targets.append("COMPILER=NVHPC")
targets.append("FLAGS_NVHPC=-O3 -fast")
targets.append("CFLAGS_NVHPC=-O3 -fast")

View File

@ -297,7 +297,7 @@ def bootstrap_args(self):
if jobs is not None:
args.append("--parallel={0}".format(jobs))
if "+ownlibs" in spec:
if spec.satisfies("+ownlibs"):
# Build and link to the CMake-provided third-party libraries
args.append("--no-system-libs")
else:
@ -312,7 +312,7 @@ def bootstrap_args(self):
args.append("--system-curl")
args.append("--no-qt-gui")
if "+doc" in spec:
if spec.satisfies("+doc"):
args.append("--sphinx-html")
args.append("--sphinx-man")

View File

@ -37,7 +37,7 @@ def edit(self, spec, prefix):
else:
cxx_type = spec.compiler.name
if "+mpi" in spec:
if spec.satisfies("+mpi"):
cxx = spec["mpi"].mpicxx
else:
cxx = spack_cxx
@ -53,13 +53,13 @@ def edit(self, spec, prefix):
"TBB_CXX_TYPE={0}\n".format(cxx_type),
]
if "+threads" in spec:
if spec.satisfies("+threads"):
make_options.append("STAN_THREADS=true\n")
if "+opencl" in spec:
if spec.satisfies("+opencl"):
make_options.append("STAN_OPENCL=true\n")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
make_options.append("STAN_MPI=true\n")
filepath = join_path(self.stage.source_path, "make", "local")

View File

@ -82,29 +82,29 @@ def install(self, spec, prefix):
args.append("--with-boost=" + spec["boost"].prefix)
args.append("--with-protobuf=" + spec["protobuf"].prefix)
if "+debug" in spec:
if spec.satisfies("+debug"):
args.append("--with-buildtype=debug")
else:
args.append("--with-buildtype=release")
if "+1bitsgd" in spec:
if spec.satisfies("+1bitsgd"):
args.append("--1bitsgd=yes")
args.append("--with-1bitsgd={0}/include".format(spec["cntk1bitsgd"].prefix))
if "+asgd" in spec:
if spec.satisfies("+asgd"):
args.append("--asgd=yes")
args.append("--with-multiverso={0}".format(spec["multiverso"].prefix))
else:
args.append("--asgd=no")
if "+opencv" in spec:
if spec.satisfies("+opencv"):
args.append("--with-opencv=" + spec["opencv"].prefix)
if "+kaldi" in spec:
if spec.satisfies("+kaldi"):
args.append("--with-kaldi=" + spec["kaldi"].prefix)
args.append("--with-openfst=" + spec["openfst"].prefix)
if "+cuda" in spec:
if spec.satisfies("+cuda"):
args.append("--cuda=yes")
args.append("--with-cuda={0}".format(spec["cuda"].prefix))
args.append("--with-cub={0}".format(spec["cub"].prefix.include))

View File

@ -45,7 +45,7 @@ def configure_args(self):
"PKG_CONFIG_PATH=%s/pkgconfig" % spec["ross"].prefix.lib,
]
if "+dumpi" in spec:
if spec.satisfies("+dumpi"):
config_args.extend(["--with-dumpi=%s" % spec["sst-dumpi"].prefix])
return config_args

View File

@ -42,11 +42,11 @@ class Coevp(MakefilePackage):
@property
def build_targets(self):
targets = []
if "+mpi" in self.spec:
if self.spec.satisfies("+mpi"):
targets.append("COEVP_MPI=yes")
else:
targets.append("COEVP_MPI=no")
if "+flann" in self.spec:
if self.spec.satisfies("+flann"):
targets.append("FLANN=yes")
targets.append("FLANN_TARGET=")
targets.append(
@ -55,7 +55,7 @@ def build_targets(self):
else:
targets.append("FLANN=no")
targets.append("REDIS=no")
if "+silo" in self.spec:
if self.spec.satisfies("+silo"):
targets.append("SILO=yes")
targets.append("SILO_TARGET=")
targets.append("SILO_LOC={0}".format(self.spec["silo"].prefix))

View File

@ -28,9 +28,9 @@ class Cohmm(MakefilePackage):
depends_on("gnuplot", when="+gnuplot")
def edit(self, spec, prefix):
if "+openmp" in spec:
if spec.satisfies("+openmp"):
filter_file("DO_OPENMP = O.*", "DO_OPENMP = ON", "Makefile")
if "+gnuplot" in spec:
if spec.satisfies("+gnuplot"):
filter_file("DO_GNUPLOT = O.*", "DO_GNUPLOT = ON", "Makefile")
def install(self, spec, prefix):

View File

@ -50,11 +50,11 @@ def build_targets(self):
comd_variant = "CoMD"
cc = spack_cc
if "+openmp" in self.spec:
if self.spec.satisfies("+openmp"):
targets.append("--directory=src-openmp")
comd_variant += "-openmp"
cflags += " -fopenmp "
if "+mpi" in self.spec:
if self.spec.satisfies("+mpi"):
comd_variant += "-mpi"
targets.append("CC = {0}".format(self.spec["mpi"].mpicc))
else:
@ -62,17 +62,17 @@ def build_targets(self):
else:
targets.append("--directory=src-mpi")
if "~mpi" in self.spec:
if self.spec.satisfies("~mpi"):
comd_variant += "-serial"
targets.append("CC = {0}".format(cc))
else:
comd_variant += "-mpi"
targets.append("CC = {0}".format(self.spec["mpi"].mpicc))
if "+mpi" in self.spec:
if self.spec.satisfies("+mpi"):
cflags += "-DDO_MPI"
targets.append("INCLUDES = {0}".format(self.spec["mpi"].prefix.include))
if "+precision" in self.spec:
if self.spec.satisfies("+precision"):
cflags += " -DDOUBLE "
else:
cflags += " -DSINGLE "

View File

@ -59,14 +59,14 @@ def cmake_args(self):
]
)
if "+mpi" in spec:
if spec.satisfies("+mpi"):
options.append("-DCompadre_USE_MPI:BOOL=ON")
if "~tests" in spec:
if spec.satisfies("~tests"):
options.append("-DCompadre_EXAMPLES:BOOL=OFF")
options.append("-DCompadre_TESTS:BOOL=OFF")
if "+shared" in spec:
if spec.satisfies("+shared"):
options.append("-DBUILD_SHARED_LIBS:BOOL=ON")
else:
options.append("-DBUILD_SHARED_LIBS:BOOL=OFF")

View File

@ -313,7 +313,7 @@ def hostconfig(self):
#######################
c_compiler = env["SPACK_CC"]
cpp_compiler = env["SPACK_CXX"]
if "+fortran" in spec:
if spec.satisfies("+fortran"):
f_compiler = env["SPACK_FC"]
else:
f_compiler = None
@ -364,13 +364,13 @@ def hostconfig(self):
cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler))
cfg.write("# fortran compiler used by spack\n")
if "+fortran" in spec:
if spec.satisfies("+fortran"):
cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "ON"))
cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER", f_compiler))
else:
cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "OFF"))
if "+shared" in spec:
if spec.satisfies("+shared"):
cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "ON"))
else:
cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "OFF"))
@ -405,12 +405,12 @@ def hostconfig(self):
#######################
# Examples/Utilities
#######################
if "+examples" in spec:
if spec.satisfies("+examples"):
cfg.write(cmake_cache_entry("ENABLE_EXAMPLES", "ON"))
else:
cfg.write(cmake_cache_entry("ENABLE_EXAMPLES", "OFF"))
if "+utilities" in spec:
if spec.satisfies("+utilities"):
cfg.write(cmake_cache_entry("ENABLE_UTILS", "ON"))
else:
cfg.write(cmake_cache_entry("ENABLE_UTILS", "OFF"))
@ -418,7 +418,7 @@ def hostconfig(self):
#######################
# Unit Tests
#######################
if "+test" in spec:
if spec.satisfies("+test"):
cfg.write(cmake_cache_entry("ENABLE_TESTS", "ON"))
else:
cfg.write(cmake_cache_entry("ENABLE_TESTS", "OFF"))
@ -434,7 +434,7 @@ def hostconfig(self):
flags = "${BLT_EXE_LINKER_FLAGS} -lstdc++ " + rpaths
cfg.write(cmake_cache_entry("BLT_EXE_LINKER_FLAGS", flags))
if "+shared" in spec:
if spec.satisfies("+shared"):
flags = "${CMAKE_SHARED_LINKER_FLAGS} " + rpaths
cfg.write(cmake_cache_entry("CMAKE_SHARED_LINKER_FLAGS", flags))
@ -444,7 +444,7 @@ def hostconfig(self):
cfg.write("# Python Support\n")
if "+python" in spec:
if spec.satisfies("+python"):
cfg.write("# Enable python module builds\n")
cfg.write(cmake_cache_entry("ENABLE_PYTHON", "ON"))
cfg.write("# python from spack \n")
@ -458,14 +458,14 @@ def hostconfig(self):
else:
cfg.write(cmake_cache_entry("ENABLE_PYTHON", "OFF"))
if "+doc" in spec:
if "+python" in spec:
if spec.satisfies("+doc"):
if spec.satisfies("+python"):
cfg.write(cmake_cache_entry("ENABLE_DOCS", "ON"))
cfg.write("# sphinx from spack \n")
sphinx_build_exe = join_path(spec["py-sphinx"].prefix.bin, "sphinx-build")
cfg.write(cmake_cache_entry("SPHINX_EXECUTABLE", sphinx_build_exe))
if "+doxygen" in spec:
if spec.satisfies("+doxygen"):
cfg.write("# doxygen from uberenv\n")
doxygen_exe = spec["doxygen"].command.path
cfg.write(cmake_cache_entry("DOXYGEN_EXECUTABLE", doxygen_exe))
@ -478,7 +478,7 @@ def hostconfig(self):
cfg.write("# MPI Support\n")
if "+mpi" in spec:
if spec.satisfies("+mpi"):
mpicc_path = spec["mpi"].mpicc
mpicxx_path = spec["mpi"].mpicxx
mpifc_path = spec["mpi"].mpifc if "+fortran" in spec else None
@ -493,11 +493,11 @@ def hostconfig(self):
cfg.write(cmake_cache_entry("ENABLE_MPI", "ON"))
cfg.write(cmake_cache_entry("MPI_C_COMPILER", mpicc_path))
cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", mpicxx_path))
if "+blt_find_mpi" in spec:
if spec.satisfies("+blt_find_mpi"):
cfg.write(cmake_cache_entry("ENABLE_FIND_MPI", "ON"))
else:
cfg.write(cmake_cache_entry("ENABLE_FIND_MPI", "OFF"))
if "+fortran" in spec:
if spec.satisfies("+fortran"):
cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", mpifc_path))
mpiexe_bin = join_path(spec["mpi"].prefix.bin, "mpiexec")
@ -515,7 +515,7 @@ def hostconfig(self):
# ZFP
#######################
cfg.write("# zfp from spack \n")
if "+zfp" in spec:
if spec.satisfies("+zfp"):
cfg.write(cmake_cache_entry("ZFP_DIR", spec["zfp"].prefix))
else:
cfg.write("# zfp not built by spack \n")
@ -524,7 +524,7 @@ def hostconfig(self):
# Caliper
#######################
cfg.write("# caliper from spack \n")
if "+caliper" in spec:
if spec.satisfies("+caliper"):
cfg.write(cmake_cache_entry("CALIPER_DIR", spec["caliper"].prefix))
cfg.write(cmake_cache_entry("ADIAK_DIR", spec["adiak"].prefix))
else:
@ -542,9 +542,9 @@ def hostconfig(self):
cfg.write("# hdf5 from spack \n")
if "+hdf5" in spec:
if spec.satisfies("+hdf5"):
cfg.write(cmake_cache_entry("HDF5_DIR", spec["hdf5"].prefix))
if "zlib-api" in spec:
if spec.satisfies("^zlib-api"):
# HDF5 depends on zlib
cfg.write(cmake_cache_entry("ZLIB_DIR", spec["zlib-api"].prefix))
else:
@ -556,7 +556,7 @@ def hostconfig(self):
cfg.write("# h5z-zfp from spack \n")
if "+hdf5+zfp" in spec:
if spec.satisfies("+hdf5+zfp"):
cfg.write(cmake_cache_entry("H5ZZFP_DIR", spec["h5z-zfp"].prefix))
else:
cfg.write("# h5z-zfp not built by spack \n")
@ -567,7 +567,7 @@ def hostconfig(self):
cfg.write("# silo from spack \n")
if "+silo" in spec:
if spec.satisfies("+silo"):
cfg.write(cmake_cache_entry("SILO_DIR", spec["silo"].prefix))
else:
cfg.write("# silo not built by spack \n")
@ -578,7 +578,7 @@ def hostconfig(self):
cfg.write("# ADIOS from spack \n")
if "+adios" in spec:
if spec.satisfies("+adios"):
cfg.write(cmake_cache_entry("ADIOS_DIR", spec["adios"].prefix))
else:
cfg.write("# adios not built by spack \n")
@ -589,7 +589,7 @@ def hostconfig(self):
cfg.write("# parmetis from spack \n")
if "+parmetis" in spec:
if spec.satisfies("+parmetis"):
cfg.write(cmake_cache_entry("METIS_DIR", spec["metis"].prefix))
cfg.write(cmake_cache_entry("PARMETIS_DIR", spec["parmetis"].prefix))
else:

View File

@ -66,7 +66,7 @@ def edit(self, spec, prefix):
fflags = "-O3 -fallow-argument-mismatch"
ldflags = ""
if "+openmp" in self.spec:
if self.spec.satisfies("+openmp"):
fflags += " " + self.compiler.openmp_flag
ldflags += " " + self.compiler.openmp_flag
@ -94,7 +94,7 @@ def edit(self, spec, prefix):
defs_file.filter(".*FFT_LIB=.*", f"FFT_LIB={fftw_ld}")
defs_file.filter(".*XC_LIB=.*", f"XC_LIB={libxc_ld} -lxcf90 -lxc")
if "+openmp" in self.spec:
if self.spec.satisfies("+openmp"):
defs_file.filter("OMP_DUMMY = DUMMY", "OMP_DUMMY = ")
if self.spec.variants["mult_kern"].value != "default":

View File

@ -146,29 +146,29 @@ def install(self, spec, prefix):
# The CONVERGE tarball comes with binaries for several MPI libraries.
# Only install the binary that matches the MPI we are building with.
with working_dir("l_x86_64/bin"):
if "~mpi" in spec:
if spec.satisfies("~mpi"):
converge = glob.glob("converge-*-serial*")
post_convert = glob.glob("post_convert_serial*")
elif "hp-mpi" in spec:
elif spec.satisfies("^hp-mpi"):
converge = glob.glob("converge-*-hpmpi*")
# No HP-MPI version of post_convert
post_convert = glob.glob("post_convert_serial*")
elif "intel-mpi" in spec or "intel-parallel-studio+mpi" in spec:
elif spec.satisfies("intel-mpi") or spec.satisfies("intel-parallel-studio+mpi"):
converge = glob.glob("converge-*-intel*")
# No Intel MPI version of post_convert
post_convert = glob.glob("post_convert_serial*")
elif "mpich" in spec:
elif spec.satisfies("^mpich"):
converge = glob.glob("converge-*-mpich*")
post_convert = glob.glob("post_convert_mpich*")
elif "mvapich2" in spec:
elif spec.satisfies("^mvapich2"):
converge = glob.glob("converge-*-mvapich*")
# MVAPICH2 hasn't been supported since CONVERGE
# came with a single serial post_convert
post_convert = glob.glob("post_convert")
elif "openmpi" in spec:
elif spec.satisfies("^openmpi"):
converge = glob.glob("converge-*-o*mpi*")
post_convert = glob.glob("post_convert_o*mpi*")
elif "platform-mpi" in spec:
elif spec.satisfies("^platform-mpi"):
converge = glob.glob("converge-*-pmpi*")
post_convert = glob.glob("post_convert_pmpi*")
else:

View File

@ -60,7 +60,7 @@ def configure_args(self):
spec = self.spec
configure_args = []
if spec.satisfies("platform=darwin"):
if "+gprefix" in self.spec:
if self.spec.satisfies("+gprefix"):
configure_args.append("--program-prefix=g")
configure_args.append("--without-gmp")
configure_args.append("gl_cv_func_ftello_works=yes")

View File

@ -83,7 +83,7 @@ class Cosma(CMakePackage):
patch("fj-ssl2.patch", when="^fujitsu-ssl2")
def setup_build_environment(self, env):
if "+cuda" in self.spec:
if self.spec.satisfies("+cuda"):
env.set("CUDA_PATH", self.spec["cuda"].prefix)
def cosma_blas_cmake_arg(self):
@ -112,11 +112,11 @@ def cosma_blas_cmake_arg(self):
def cosma_scalapack_cmake_arg(self):
spec = self.spec
if "~scalapack" in spec:
if spec.satisfies("~scalapack"):
return "OFF"
elif "^intel-mkl" in spec or "^intel-oneapi-mkl" in spec:
elif spec.satisfies("^intel-mkl") or spec.satisfies("^intel-oneapi-mkl"):
return "MKL"
elif "^cray-libsci" in spec:
elif spec.satisfies("^cray-libsci"):
return "CRAY_LIBSCI"
return "CUSTOM"

View File

@ -66,7 +66,7 @@ def install(self, spec, prefix):
os.remove(clikdir)
except OSError:
pass
if "+planck" in spec:
if spec.satisfies("+planck"):
os.symlink(join_path(os.environ["CLIK_DATA"], "plc_2.0"), clikdir)
else:
os.environ.pop("CLIK_DATA", "")
@ -93,7 +93,7 @@ def install(self, spec, prefix):
raise InstallError("Only GCC and Intel compilers are supported")
# Configure MPI
if "+mpi" in spec:
if spec.satisfies("+mpi"):
wantmpi = "BUILD=MPI"
mpif90 = "MPIF90C=%s" % spec["mpi"].mpifc
else:
@ -138,7 +138,7 @@ def install(self, spec, prefix):
"test_planck.ini",
"tests",
]
if "+python" in spec:
if spec.satisfies("+python"):
entries += ["python"]
for entry in entries:
if os.path.isfile(entry):
@ -171,7 +171,7 @@ def check_install(self):
exe = spec["cosmomc"].command.path
args = []
if "+mpi" in spec:
if spec.satisfies("+mpi"):
# Add mpirun prefix
args = ["-np", "1", exe]
exe = join_path(spec["mpi"].prefix.bin, "mpiexec")
@ -181,6 +181,6 @@ def check_install(self):
os.symlink(join_path(prefix.share, "cosmomc", entry), entry)
inifile = join_path(prefix.share, "cosmomc", "test.ini")
cosmomc(*(args + [inifile]))
if "+planck" in spec:
if spec.satisfies("+planck"):
inifile = join_path(prefix.share, "cosmomc", "test_planck.ini")
cosmomc(*(args + [inifile]))

View File

@ -33,14 +33,14 @@ class Cosp2(MakefilePackage):
def edit(self, spec, prefix):
cc = spack_cc
if "+mpi" in spec:
if spec.satisfies("+mpi"):
cc = spec["mpi"].mpicc
with working_dir(self.build_directory):
makefile = FileFilter("Makefile.vanilla")
makefile.filter(r"^CC\s*=.*", "CC = {0}".format(cc))
if "+double" in spec:
if spec.satisfies("+double"):
filter_file("DOUBLE_PRECISION = O.*", "DOUBLE_PRECISION = OFF", "Makefile.vanilla")
copy("Makefile.vanilla", "Makefile")

View File

@ -57,11 +57,11 @@ def setup_build_environment(self, env):
def costa_scalapack_cmake_arg(self):
spec = self.spec
if "~scalapack" in spec:
if spec.satisfies("~scalapack"):
return "OFF"
elif "^intel-mkl" in spec or "^intel-oneapi-mkl" in spec:
elif spec.satisfies("^intel-mkl") or spec.satisfies("^intel-oneapi-mkl"):
return "MKL"
elif "^cray-libsci" in spec:
elif spec.satisfies("^cray-libsci"):
return "CRAY_LIBSCI"
return "CUSTOM"

View File

@ -409,10 +409,10 @@ def edit(self, pkg, spec, prefix):
# CP2K requires MPI 3 starting at version 2023.1
# and __MPI_VERSION is not supported anymore.
if "@:2022.2" in spec:
if "^mpi@3:" in spec:
if spec.satisfies("@:2022.2"):
if spec.satisfies("^mpi@3:"):
cppflags.append("-D__MPI_VERSION=3")
elif "^mpi@2:" in spec:
elif spec.satisfies("^mpi@2:"):
cppflags.append("-D__MPI_VERSION=2")
cflags = optimization_flags[spec.compiler.name][:]
@ -430,23 +430,23 @@ def edit(self, pkg, spec, prefix):
# C99-style for-loops with inline definition of iterating variable.
cflags.append(pkg.compiler.c99_flag)
if "%intel" in spec:
if spec.satisfies("%intel"):
cflags.append("-fp-model precise")
cxxflags.append("-fp-model precise")
fcflags += ["-fp-model precise", "-heap-arrays 64", "-g", "-traceback"]
elif "%gcc" in spec:
elif spec.satisfies("%gcc"):
fcflags += [
"-ffree-form",
"-ffree-line-length-none",
"-ggdb", # make sure we get proper Fortran backtraces
]
elif "%aocc" in spec:
elif spec.satisfies("%aocc"):
fcflags += ["-ffree-form", "-Mbackslash"]
elif "%pgi" in spec or "%nvhpc" in spec:
elif spec.satisfies("%pgi") or spec.satisfies("%nvhpc"):
fcflags += ["-Mfreeform", "-Mextend"]
elif "%cce" in spec:
elif spec.satisfies("%cce"):
fcflags += ["-emf", "-ffree", "-hflex_mp=strict"]
elif "%xl" in spec:
elif spec.satisfies("%xl"):
fcflags += ["-qpreprocess", "-qstrict", "-q64"]
ldflags += ["-Wl,--allow-multiple-definition"]
@ -457,31 +457,31 @@ def edit(self, pkg, spec, prefix):
if spec.satisfies("@7.1%gcc@13:"):
fcflags.append("-fallow-argument-mismatch")
if "+openmp" in spec:
if spec.satisfies("+openmp"):
cflags.append(pkg.compiler.openmp_flag)
cxxflags.append(pkg.compiler.openmp_flag)
fcflags.append(pkg.compiler.openmp_flag)
ldflags.append(pkg.compiler.openmp_flag)
nvflags.append('-Xcompiler="{0}"'.format(pkg.compiler.openmp_flag))
elif "%cce" in spec: # Cray enables OpenMP by default
elif spec.satisfies("%cce"): # Cray enables OpenMP by default
cflags += ["-hnoomp"]
cxxflags += ["-hnoomp"]
fcflags += ["-hnoomp"]
ldflags += ["-hnoomp"]
if "@7:" in spec: # recent versions of CP2K use C++14 CUDA code
if spec.satisfies("@7:"): # recent versions of CP2K use C++14 CUDA code
cxxflags.append(pkg.compiler.cxx14_flag)
nvflags.append(pkg.compiler.cxx14_flag)
ldflags.append(fftw.libs.search_flags)
if "superlu-dist@4.3" in spec:
if spec.satisfies("^superlu-dist@4.3"):
ldflags.insert(0, "-Wl,--allow-multiple-definition")
if "+libint" in spec:
if spec.satisfies("+libint"):
cppflags += ["-D__LIBINT"]
if "@:6.9" in spec:
if spec.satisfies("@:6.9"):
cppflags += ["-D__LIBINT_MAX_AM=6", "-D__LIBDERIV_MAX_AM1=5"]
# libint-1.x.y has to be linked statically to work around
@ -499,10 +499,10 @@ def edit(self, pkg, spec, prefix):
fcflags += pkgconf("--cflags", "libint2", output=str).split()
libs += pkgconf("--libs", "libint2", output=str).split()
if "+libxc" in spec:
if spec.satisfies("+libxc"):
cppflags += ["-D__LIBXC"]
if "@:6.9" in spec:
if spec.satisfies("@:6.9"):
libxc = spec["libxc:fortran,static"]
cppflags += [libxc.headers.cpp_flags]
ldflags.append(libxc.libs.search_flags)
@ -514,7 +514,7 @@ def edit(self, pkg, spec, prefix):
# requiring `-lxc` to be present in addition to `-lxcf03`
libs += pkgconf("--libs", "libxcf03", "libxc", output=str).split()
if "+pexsi" in spec:
if spec.satisfies("+pexsi"):
cppflags.append("-D__LIBPEXSI")
fcflags.append("-I" + join_path(spec["pexsi"].prefix, "fortran"))
libs.extend(
@ -530,7 +530,7 @@ def edit(self, pkg, spec, prefix):
]
)
if "+elpa" in spec:
if spec.satisfies("+elpa"):
elpa = spec["elpa"]
elpa_suffix = "_openmp" if "+openmp" in elpa else ""
elpa_incdir = elpa.headers.directories[0]
@ -538,7 +538,7 @@ def edit(self, pkg, spec, prefix):
fcflags += ["-I{0}".format(join_path(elpa_incdir, "modules"))]
# Currently AOCC support only static libraries of ELPA
if "%aocc" in spec:
if spec.satisfies("%aocc"):
libs.append(
join_path(
elpa.prefix.lib, ("libelpa{elpa_suffix}.a".format(elpa_suffix=elpa_suffix))
@ -578,19 +578,19 @@ def edit(self, pkg, spec, prefix):
fcflags += ["-I{0}".format(sirius.prefix.include.sirius)]
libs += list(sirius.libs)
if "+plumed" in spec:
if spec.satisfies("+plumed"):
dflags.extend(["-D__PLUMED2"])
cppflags.extend(["-D__PLUMED2"])
libs.extend([join_path(spec["plumed"].prefix.lib, "libplumed.{0}".format(dso_suffix))])
if "+libvori" in spec:
if spec.satisfies("+libvori"):
cppflags += ["-D__LIBVORI"]
libvori = spec["libvori"].libs
ldflags += [libvori.search_flags]
libs += libvori
libs += ["-lstdc++"]
if "+spglib" in spec:
if spec.satisfies("+spglib"):
cppflags += ["-D__SPGLIB"]
spglib = spec["spglib"].libs
ldflags += [spglib.search_flags]
@ -601,7 +601,7 @@ def edit(self, pkg, spec, prefix):
fc = spack_fc if "~mpi" in spec else spec["mpi"].mpifc
# Intel
if "%intel" in spec:
if spec.satisfies("%intel"):
cppflags.extend(["-D__INTEL", "-D__HAS_ISO_C_BINDING", "-D__USE_CP2K_TRACE"])
fcflags.extend(["-diag-disable 8290,8291,10010,10212,11060", "-free", "-fpp"])
@ -619,14 +619,14 @@ def edit(self, pkg, spec, prefix):
elif spec["blas"].name == "accelerate":
cppflags += ["-D__ACCELERATE"]
if "+cosma" in spec:
if spec.satisfies("+cosma"):
# add before ScaLAPACK to override the p?gemm symbols
cosma = spec["cosma"].libs
ldflags.append(cosma.search_flags)
libs.extend(cosma)
# MPI
if "+mpi" in spec:
if spec.satisfies("+mpi"):
cppflags.extend(["-D__parallel", "-D__SCALAPACK"])
if spec["mpi"].name == "intel-oneapi-mpi":
@ -655,10 +655,10 @@ def edit(self, pkg, spec, prefix):
libs.extend(mpi)
libs.extend(pkg.compiler.stdcxx_libs)
if "+mpi_f08" in spec:
if spec.satisfies("+mpi_f08"):
cppflags.append("-D__MPI_F08")
if "wannier90" in spec:
if spec.satisfies("^wannier90"):
cppflags.append("-D__WANNIER90")
wannier = join_path(spec["wannier90"].libs.directories[0], "libwannier.a")
libs.append(wannier)
@ -710,7 +710,7 @@ def edit(self, pkg, spec, prefix):
if cuda_arch == "35" and spec.satisfies("+cuda_arch_35_k20x"):
gpuver = "K20X"
if "@2022: +rocm" in spec:
if spec.satisfies("@2022: +rocm"):
libs += [
"-L{}".format(spec["rocm"].libs.directories[0]),
"-L{}/stubs".format(spec["rocm"].libs.directories[0]),
@ -726,7 +726,7 @@ def edit(self, pkg, spec, prefix):
cppflags += ["-D__DBCSR_ACC"]
gpuver = GPU_MAP[spec.variants["amdgpu_target"].value[0]]
if "smm=libsmm" in spec:
if spec.satisfies("smm=libsmm"):
lib_dir = join_path("lib", self.makefile_architecture, self.makefile_version)
mkdirp(lib_dir)
try:
@ -744,7 +744,7 @@ def edit(self, pkg, spec, prefix):
cppflags.extend(["-D__HAS_smm_dnn", "-D__HAS_smm_vec"])
libs.append("-lsmm")
elif "smm=libxsmm" in spec:
elif spec.satisfies("smm=libxsmm"):
cppflags += ["-D__LIBXSMM"]
cppflags += pkgconf("--cflags-only-other", "libxsmmf", output=str).split()
fcflags += pkgconf("--cflags-only-I", "libxsmmf", output=str).split()
@ -757,7 +757,7 @@ def edit(self, pkg, spec, prefix):
nvflags.extend(cppflags)
with open(self.makefile, "w") as mkf:
if "+plumed" in spec:
if spec.satisfies("+plumed"):
mkf.write(
"# include Plumed.inc as recommended by"
"PLUMED to include libraries and flags"
@ -769,7 +769,7 @@ def edit(self, pkg, spec, prefix):
"FC = {0}\n" "CC = {1}\n" "CXX = {2}\n" "LD = {3}\n".format(fc, cc, cxx, fc)
)
if "%intel" in spec:
if spec.satisfies("%intel"):
intel_bin_dir = ancestor(pkg.compiler.cc)
# CPP is a commented command in Intel arch of CP2K
# This is the hack through which cp2k developers avoid doing :
@ -783,7 +783,7 @@ def edit(self, pkg, spec, prefix):
mkf.write("CPP = # {0} -E\n".format(spack_cc))
mkf.write("AR = ar -qs\n") # r = qs is a GNU extension
if "+cuda" in spec:
if spec.satisfies("+cuda"):
mkf.write(
"{0} = {1}\n".format(
acc_compiler_var, join_path(spec["cuda"].prefix, "bin", "nvcc")
@ -799,13 +799,13 @@ def fflags(var, lst):
mkf.write(fflags("CPPFLAGS", cppflags))
mkf.write(fflags("CFLAGS", cflags))
mkf.write(fflags("CXXFLAGS", cxxflags))
if "+cuda" in spec:
if spec.satisfies("+cuda"):
mkf.write(fflags(acc_flags_var, nvflags))
mkf.write(fflags("FCFLAGS", fcflags))
mkf.write(fflags("LDFLAGS", ldflags))
mkf.write(fflags("LIBS", libs))
if "%intel" in spec:
if spec.satisfies("%intel"):
mkf.write(fflags("LDFLAGS_C", ldflags + ["-nofor-main"]))
mkf.write("# CP2K-specific flags\n\n")
@ -921,7 +921,7 @@ def cmake_args(self):
spec = self.spec
args = []
if "+cuda" in spec:
if spec.satisfies("+cuda"):
if (len(spec.variants["cuda_arch"].value) > 1) or spec.satisfies("cuda_arch=none"):
raise InstallError("CP2K supports only one cuda_arch at a time.")
else:
@ -931,7 +931,7 @@ def cmake_args(self):
self.define("CP2K_WITH_GPU", gpu_ver),
]
if "+rocm" in spec:
if spec.satisfies("+rocm"):
if len(spec.variants["amdgpu_target"].value) > 1:
raise InstallError("CP2K supports only one amdgpu_target at a time.")
else:

View File

@ -42,10 +42,10 @@ def flag_handler(self, name, flags):
spec = self.spec
if name == "cflags":
if "%intel@:17" in spec:
if spec.satisfies("%intel@:17"):
flags.append("-no-gcc")
elif "%clang" in spec or "%fj" in spec:
elif spec.satisfies("%clang") or spec.satisfies("%fj"):
flags.append("--rtlib=compiler-rt")
return (flags, None, None)

View File

@ -64,11 +64,11 @@ def blas_libs(self):
compiler = self.spec.compiler.name
lib = []
if "+openmp" in self.spec and "+mpi" in self.spec:
if self.spec.satisfies("+openmp") and self.spec.satisfies("+mpi"):
lib = ["libsci_{0}_mpi_mp", "libsci_{0}_mp"]
elif "+openmp" in self.spec:
elif self.spec.satisfies("+openmp"):
lib = ["libsci_{0}_mp"]
elif "+mpi" in self.spec:
elif self.spec.satisfies("+mpi"):
lib = ["libsci_{0}_mpi", "libsci_{0}"]
else:
lib = ["libsci_{0}"]

View File

@ -65,7 +65,7 @@ def external_prefix(self):
return os.path.dirname(os.path.normpath(libdir))
def setup_run_environment(self, env):
if "+wrappers" in self.spec:
if self.spec.satisfies("+wrappers"):
env.set("MPICC", join_path(self.prefix.bin, "mpicc"))
env.set("MPICXX", join_path(self.prefix.bin, "mpicxx"))
env.set("MPIF77", join_path(self.prefix.bin, "mpif77"))
@ -86,7 +86,7 @@ def setup_dependent_build_environment(self, env, dependent_spec):
def setup_dependent_package(self, module, dependent_spec):
spec = self.spec
if "+wrappers" in spec:
if spec.satisfies("+wrappers"):
spec.mpicc = join_path(self.prefix.bin, "mpicc")
spec.mpicxx = join_path(self.prefix.bin, "mpicxx")
spec.mpifc = join_path(self.prefix.bin, "mpif90")

View File

@ -42,12 +42,12 @@ def install(self, spec, prefix):
mkdir(self.prefix.fix)
endian_dirs = []
if "+big_endian" in spec:
if spec.satisfies("+big_endian"):
endian_dirs.append("Big_Endian")
elif "+little_endian" in spec:
elif spec.satisfies("+little_endian"):
endian_dirs.append("Little_Endian")
if "+netcdf" in spec:
if spec.satisfies("+netcdf"):
endian_dirs.extend(["netcdf", "netCDF"])
fix_files = []

View File

@ -386,13 +386,13 @@ def setup_run_environment(self, env):
# Package is not compiled, and does not work unless LD_LIBRARY_PATH is set
env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib)
if "target=ppc64le: platform=linux" in self.spec:
if self.spec.satisfies("target=ppc64le: platform=linux"):
env.set("cuDNN_ROOT", os.path.join(self.prefix, "targets", "ppc64le-linux"))
def install(self, spec, prefix):
install_tree(".", prefix)
if "target=ppc64le: platform=linux" in spec:
if spec.satisfies("target=ppc64le: platform=linux"):
target_lib = os.path.join(prefix, "targets", "ppc64le-linux", "lib")
if os.path.isdir(target_lib) and not os.path.isdir(prefix.lib):
symlink(target_lib, prefix.lib)

View File

@ -281,21 +281,21 @@ def nmake_args(self):
args.append("mode=%s" % mode)
args.append("WITH_ZLIB=%s" % mode)
args.append("ZLIB_PATH=%s" % self.spec["zlib-api"].prefix)
if "+libssh" in self.spec:
if self.spec.satisfies("+libssh"):
args.append("WITH_SSH=%s" % mode)
if "+libssh2" in self.spec:
if self.spec.satisfies("+libssh2"):
args.append("WITH_SSH2=%s" % mode)
args.append("SSH2_PATH=%s" % self.spec["libssh2"].prefix)
if "+nghttp2" in self.spec:
if self.spec.satisfies("+nghttp2"):
args.append("WITH_NGHTTP2=%s" % mode)
args.append("NGHTTP2=%s" % self.spec["nghttp2"].prefix)
if "tls=openssl" in self.spec:
if self.spec.satisfies("tls=openssl"):
args.append("WITH_SSL=%s" % mode)
args.append("SSL_PATH=%s" % self.spec["openssl"].prefix)
elif "tls=mbedtls" in self.spec:
elif self.spec.satisfies("tls=mbedtls"):
args.append("WITH_MBEDTLS=%s" % mode)
args.append("MBEDTLS_PATH=%s" % self.spec["mbedtls"].prefix)
elif "tls=sspi" in self.spec:
elif self.spec.satisfies("tls=sspi"):
args.append("ENABLE_SSPI=%s" % mode)
# The trailing path seperator is REQUIRED for cURL to install