Compare commits

..

5 Commits

Author SHA1 Message Date
Harmen Stoppels
ecf882c240 fix fullnames 2025-04-25 13:52:09 +02:00
Harmen Stoppels
6822db0fe7 inline packages definitions dont have a name 2025-04-25 13:33:21 +02:00
Harmen Stoppels
868d538958 simplify and speed up external list 2025-04-25 11:53:07 +02:00
Harmen Stoppels
57ac37eb67 set __module__ prop so it's usable in init 2025-04-25 11:48:58 +02:00
Harmen Stoppels
4779322247 package_base.py: correctly compute package name 2025-04-25 11:48:58 +02:00
19 changed files with 84 additions and 305 deletions

View File

@@ -121,6 +121,7 @@ def __init__(self, wrapped_pkg_object, root_builder):
new_cls_name,
bases,
{
"__module__": package_cls.__module__,
"run_tests": property(lambda x: x.wrapped_package_object.run_tests),
"test_requires_compiler": property(
lambda x: x.wrapped_package_object.test_requires_compiler
@@ -129,7 +130,6 @@ def __init__(self, wrapped_pkg_object, root_builder):
"tester": property(lambda x: x.wrapped_package_object.tester),
},
)
new_cls.__module__ = package_cls.__module__
self.__class__ = new_cls
self.__dict__.update(wrapped_pkg_object.__dict__)

View File

@@ -5,7 +5,7 @@
import errno
import os
import re
import sys
from collections import defaultdict
from typing import List, Optional, Set
import llnl.util.tty as tty
@@ -17,7 +17,6 @@
import spack.cray_manifest as cray_manifest
import spack.detection
import spack.error
import spack.package_base
import spack.repo
import spack.spec
from spack.cmd.common import arguments
@@ -246,13 +245,16 @@ def _collect_and_consume_cray_manifest_files(
def external_list(args):
# Trigger a read of all packages, might take a long time.
list(spack.repo.PATH.all_package_classes())
# Print all the detectable packages
tty.msg("Detectable packages per repository")
for namespace, pkgs in sorted(spack.package_base.detectable_packages.items()):
repo_to_packages = defaultdict(list)
for fullname in spack.repo.PATH.packages_with_tags("detectable", full=True):
repo, _, pkg = fullname.rpartition(".")
repo_to_packages[repo].append(pkg)
for namespace in sorted(repo_to_packages):
print("Repository:", namespace)
colify.colify(pkgs, indent=4, output=sys.stdout)
colify.colify(repo_to_packages[namespace], indent=4)
def external(parser, args):

View File

@@ -132,11 +132,6 @@ def windows_establish_runtime_linkage(self):
win_rpath.establish_link()
#: Registers which are the detectable packages, by repo and package name
#: Need a pass of package repositories to be filled.
detectable_packages = collections.defaultdict(list)
class DetectablePackageMeta(type):
"""Check if a package is detectable and add default implementations
for the detection function.
@@ -242,9 +237,6 @@ def determine_spec_details(cls, prefix, objs_in_prefix):
def determine_variants(cls, objs, version_str):
return ""
# Register the class as a detectable package
detectable_packages[cls.namespace].append(cls.name)
# Attach function implementations to the detectable class
default = False
if not hasattr(cls, "determine_spec_details"):
@@ -839,26 +831,17 @@ def fullname(cls):
def fullnames(cls):
"""Fullnames for this package and any packages from which it inherits."""
fullnames = []
for cls in cls.__mro__:
namespace = getattr(cls, "namespace", None)
if namespace:
fullnames.append("%s.%s" % (namespace, cls.name))
if namespace == "builtin":
# builtin packages cannot inherit from other repos
for base in cls.__mro__:
if not base.__module__.startswith(f"{spack.repo.ROOT_PYTHON_NAMESPACE}."):
break
fullnames.append(base.fullname)
return fullnames
@classproperty
def name(cls):
"""The name of this package.
The name of a package is the name of its Python module, without
the containing module names.
"""
"""The canonical name of this package"""
if cls._name is None:
cls._name = cls.module.__name__
if "." in cls._name:
cls._name = cls._name[cls._name.rindex(".") + 1 :]
cls._name = spack.repo.pkg_name_from_module(cls.__module__)
return cls._name
@classproperty

View File

@@ -83,6 +83,21 @@ def namespace_from_fullname(fullname):
return namespace
def pkg_name_from_module(module_name: str) -> str:
"""Return the actual package name from a module name.
For instance ``spack.pkg.builtin.num3dtk`` has package name ``3dtk``
and ``spack.pkg.builtin.py_numpy`` has package name ``py-numpy``
"""
if not module_name.startswith(f"{ROOT_PYTHON_NAMESPACE}."):
raise ValueError(f"Module '{module_name}' is not a Spack package module")
namespace, _, import_name = module_name[len(ROOT_PYTHON_NAMESPACE) + 1 :].rpartition(".")
name = PATH.get_repo(namespace).real_name(import_name)
if name is None:
raise ValueError(f"Module '{module_name}' does not correspond to a known package")
return name
class SpackNamespaceLoader:
def create_module(self, spec):
return SpackNamespace(spec.name)

View File

@@ -85,10 +85,8 @@ def is_virtual(self, name: str) -> bool:
def is_allowed_on_this_platform(self, *, pkg_name: str) -> bool:
"""Returns true if a package is allowed on the current host"""
pkg_cls = self.repo.get_pkg_class(pkg_name)
no_condition = spack.spec.Spec()
for when_spec, conditions in pkg_cls.requirements.items():
# Restrict analysis to unconditional requirements
if when_spec != no_condition:
if not when_spec.intersects(self._platform_condition):
continue
for requirements, _, _ in conditions:
if not any(x.intersects(self._platform_condition) for x in requirements):

View File

@@ -3366,17 +3366,3 @@ def test_reuse_when_requiring_build_dep(
with spack.config.override("concretizer:reuse", True):
result = spack.concretize.concretize_one("pkg-b")
assert pkgb_old.dag_hash() == result.dag_hash(), result.tree()
@pytest.mark.regression("50167")
def test_input_analysis_and_conditional_requirements(default_mock_concretization):
"""Tests that input analysis doesn't account for conditional requirement
to discard possible dependencies.
If the requirement is conditional, and impossible to achieve on the current
platform, the valid search space is still the complement of the condition that
activates the requirement.
"""
libceed = default_mock_concretization("libceed")
assert libceed["libxsmm"].satisfies("@main")
assert libceed["libxsmm"].satisfies("platform=test")

View File

@@ -9,6 +9,7 @@
"""
import os
import pathlib
import shutil
import pytest
@@ -22,6 +23,7 @@
import spack.install_test
import spack.package
import spack.package_base
import spack.repo
import spack.spec
import spack.store
from spack.build_systems.generic import Package
@@ -245,23 +247,31 @@ class BadDetectablePackage(spack.package.Package):
libraries = ["libFindMe.a"]
def test_package_url_and_urls():
class URLsPackage(spack.package.Package):
url = "https://www.example.com/url-package-1.0.tgz"
urls = ["https://www.example.com/archive"]
def test_package_url_and_urls(tmp_path: pathlib.Path):
repo_path = tmp_path / "test-repo"
spack.repo.create_repo(str(repo_path))
package_py = repo_path / "packages" / "urls-package" / "package.py"
package_py.parent.mkdir(parents=True)
package_py.write_text(
"""\
from spack.package import *
class UrlsPackage(Package):
url = "https://www.example.com/url-package-1.0.tgz"
urls = ["https://www.example.com/archive"]
"""
)
with spack.repo.use_repositories(str(repo_path)) as repo:
pkg_cls = repo.get_pkg_class("urls-package")
s = spack.spec.Spec("urls-package")
with pytest.raises(ValueError, match="defines both"):
pkg_cls(s)
def test_package_license(mock_packages):
s = spack.spec.Spec("pkg-a")
with pytest.raises(ValueError, match="defines both"):
URLsPackage(s)
def test_package_license():
class LicensedPackage(spack.package.Package):
extendees = None # currently a required attribute for is_extension()
license_files = None
s = spack.spec.Spec("pkg-a")
pkg = LicensedPackage(s)
pkg = spack.repo.PATH.get_pkg_class("pkg-a")(s)
assert pkg.global_license_file is None
pkg.license_files = ["license.txt"]

View File

@@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import importlib
import os
import pytest
@@ -333,3 +334,8 @@ def test_package_can_have_sparse_checkout_properties(mock_packages, mock_fetch,
assert isinstance(fetcher, spack.fetch_strategy.GitFetchStrategy)
assert hasattr(fetcher, "git_sparse_paths")
assert fetcher.git_sparse_paths == pkg_cls.git_sparse_paths
def test_package_name_from_class_type(mock_packages):
module = importlib.import_module("spack.pkg.builtin.mock.num7zip")
assert module._7zip.name == "7zip"

View File

@@ -1,18 +0,0 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Libceed(Package):
"""Package that has a dependency imposing conditional requirements on platforms"""
homepage = "https://github.com/CEED/libCEED"
url = "http://www.fake.com/libceed.tgz"
version("0.12.0", sha256="e491ccadebc5cdcd1fc08b5b4509a0aba4e2c096f53d7880062a66b82a0baf84")
depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("libxsmm")

View File

@@ -1,21 +0,0 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Libxsmm(Package):
"""Package that imposes conditional requirements on platforms"""
homepage = "https://github.com/libxsmm/libxsmm"
url = "https://github.com/libxsmm/libxsmm/archive/1.17.tar.gz"
git = "https://github.com/libxsmm/libxsmm.git"
version("main", branch="main")
version("1.16.3", sha256="e491ccadebc5cdcd1fc08b5b4509a0aba4e2c096f53d7880062a66b82a0baf84")
depends_on("c", type="build")
depends_on("cxx", type="build")
requires("platform=linux", "platform=test")
requires("platform=linux", when="@:1")

View File

@@ -29,7 +29,6 @@ class Boost(Package):
license("BSL-1.0")
version("develop", branch="develop", submodules=True)
version("1.88.0", sha256="46d9d2c06637b219270877c9e16155cbd015b6dc84349af064c088e9b5b12f7b")
version("1.87.0", sha256="af57be25cb4c4f4b413ed692fe378affb4352ea50fbe294a11ef548f4d527d89")
version("1.86.0", sha256="1bed88e40401b2cb7a1f76d4bab499e352fa4d0c5f31c0dbae64e24d34d7513b")
version("1.85.0", sha256="7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617")
@@ -135,7 +134,6 @@ class Boost(Package):
"log",
"math",
"mpi",
"mqtt5",
"nowide",
"program_options",
"python",
@@ -737,8 +735,6 @@ def install(self, spec, prefix):
with_libs = {f"{lib}" for lib in Boost.all_libs if f"+{lib}" in spec}
# Remove libraries that the release version does not support
if not spec.satisfies("@1.88.0:"):
with_libs.discard("mqtt5")
if not spec.satisfies("@1.85.0:"):
with_libs.discard("charconv")
if not spec.satisfies("@1.84.0:"):

View File

@@ -5,7 +5,7 @@
from spack.package import *
class Draco(CMakePackage, CudaPackage, ROCmPackage):
class Draco(CMakePackage):
"""Draco is an object-oriented component library geared towards numerically
intensive, radiation (particle) transport applications built for parallel
computing hardware. It consists of semi-independent packages and a robust
@@ -19,7 +19,6 @@ class Draco(CMakePackage, CudaPackage, ROCmPackage):
license("BSD-3-Clause-Open-MPI")
version("develop", branch="develop")
version("7.20.0", sha256="5b695f686c914dfac7cc144ffba37f24b1fb1e53058fbcb6df0ea94fe9971ea6")
version("7.19.0", sha256="04b33cfea244052efcdd40d2b9dd79348749d34647aaf4dfcb15cdfdbe989783")
version("7.18.0", sha256="b210e202a06ffdaf149193b5cba164411fd508e20e573e1dfc46d1f56e3fffaa")
version("7.14.1", sha256="b05c75f1b8ea1d4fac4900d897fb1c948b470826b174ed8b97b32c6da9f030bf")
@@ -45,12 +44,6 @@ class Draco(CMakePackage, CudaPackage, ROCmPackage):
version("6.20.1", sha256="b1c51000c9557e0818014713fce70d681869c50ed9c4548dcfb2e9219c354ebe")
version("6.20.0", sha256="a6e3142c1c90b09c4ff8057bfee974369b815122b01d1f7b57888dcb9b1128f6")
variant(
"build_type",
default="Release",
description="CMake build type",
values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"),
)
variant("caliper", default=False, description="Enable caliper timers support")
variant("cuda", default=False, description="Enable Cuda/GPU support")
variant("eospac", default=True, description="Enable EOSPAC support")
@@ -61,9 +54,6 @@ class Draco(CMakePackage, CudaPackage, ROCmPackage):
variant("pythontools", default=False, description="Enable support for extra python tools")
variant("qt", default=False, description="Enable Qt support")
variant("superlu-dist", default=True, description="Enable SuperLU-DIST support")
variant(
"openmp", default=True, when="@7.16.0:", description="Enable OpenMP support if available"
)
depends_on("cmake@3.9:", when="@:6", type="build")
depends_on("cmake@3.11:", when="@7.0.0:7.1", type="build")
@@ -81,6 +71,7 @@ class Draco(CMakePackage, CudaPackage, ROCmPackage):
# Optional dependencies
depends_on("caliper", when="+caliper")
depends_on("cuda@11.0:", when="+cuda")
depends_on("eospac@6.3:", when="+eospac")
depends_on("lapack", when="+lapack")
depends_on("libquo@1.3.1:", when="@7.4.0:+libquo")
@@ -91,13 +82,7 @@ class Draco(CMakePackage, CudaPackage, ROCmPackage):
depends_on("superlu-dist@:5", when="@:7.6+superlu-dist")
depends_on("py-matplotlib", when="+pythontools", type=("run"))
# Hardware-specific variants
depends_on("cuda@11.0:", when="+cuda")
conflicts("+cuda", when="@:7.6")
# HIP support existed pre-7.18, but was not exposed via Spack recipe:
conflicts("+rocm", when="@:7.18.0")
conflicts("+cuda", when="+rocm", msg="+cuda and +rocm cannot both be set")
conflicts("+caliper", when="@:7.7")
with when("@7.19.0:"):
conflicts("gcc@:9.0")
@@ -118,41 +103,23 @@ def url_for_version(self, version):
return url.format(version.underscored)
def cmake_args(self):
spec = self.spec
options = []
options.extend(
[
"-Wno-dev",
self.define("BUILD_TESTING", self.run_tests),
"-DUSE_CUDA={0}".format("ON" if "+cuda" in self.spec else "OFF"),
"-DUSE_QT={0}".format("ON" if "+qt" in self.spec else "OFF"),
]
)
# OpenMP toggle exposed via CMake for 7.16+
if spec.satisfies("@7.16.0:"):
options.extend(["-DUSE_OPENMP={0}".format("ON" if "+openmp" in self.spec else "OFF")])
# "rocm" variant introduced at 7.18
if spec.satisfies("@7.18.0:"):
options.extend(
["-DUSE_GPU={0}".format("ON" if ("+cuda" in spec) or ("+rocm" in spec) else "OFF")]
)
elif spec.satisfies("@7.15.0:7.17.99"):
options.extend(["-DUSE_GPU={0}".format("ON" if "+cuda" in spec else "OFF")])
else:
options.extend(["-DUSE_CUDA={0}".format("ON" if "+cuda" in spec else "OFF")])
# FMA option
if "+fast_fma" in self.spec:
if self.spec.satisfies("+fast_fma"):
options.extend(
[
"-DDRACO_ROUNDOFF_MODE={0}".format(
"FAST" if "build_type=Release" in spec else "ACCURATE"
"FAST" if "build_type=Release" in self.spec else "ACCURATE"
)
]
)
# OneAPI-specific logic
if spec.satisfies("%oneapi"):
# Known issues with oneapi+IPO for packages that depend on draco.
options.extend(["-DUSE_IPO=OFF"])
return options
def check(self):

View File

@@ -40,12 +40,12 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage, CompilerPackage):
version("master", branch="master")
# Latest stable
version("15.1.0", sha256="e2b09ec21660f01fecffb715e0120265216943f038d0e48a9868713e54f06cea")
version("14.2.0", sha256="a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9")
# Previous stable series releases
version("14.1.0", sha256="e283c654987afe3de9d8080bc0bd79534b5ca0d681a73a11ff2b5d3767426840")
# Final releases of previous versions
version("14.2.0", sha256="a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9")
version("13.3.0", sha256="0845e9621c9543a13f484e94584a49ffc0129970e9914624235fc1d061a0c083")
version("12.4.0", sha256="704f652604ccbccb14bdabf3478c9511c89788b12cb3bbffded37341916a9175")
version("11.5.0", sha256="a6e21868ead545cf87f0c01f84276e4b5281d672098591c1c896241f09363478")
@@ -63,10 +63,6 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage, CompilerPackage):
# Deprecated older non-final releases
with default_args(deprecated=True):
version(
"14.1.0", sha256="e283c654987afe3de9d8080bc0bd79534b5ca0d681a73a11ff2b5d3767426840"
)
version(
"13.2.0", sha256="e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da"
)

View File

@@ -37,7 +37,6 @@ class Mapl(CMakePackage):
version("develop", branch="develop")
version("main", branch="main")
version("2.55.1", sha256="eb8bbb42a9a488155bd38f9bc6f6863b8a0acb210852ee71834f160958500243")
version("2.55.0", sha256="13ec3d81d53cf18aa18322b74b9a6990ad7e51224f1156be5d1f834ee826f95c")
version("2.54.2", sha256="70b7be425d07a7be7d9bb0e53b93a372887a048caf23260e0ae602ca6e3670ed")
version("2.54.1", sha256="2430ded45a98989e9100037f54cf22f5a5083e17196514b3667d3003413e49e1")

View File

@@ -16,7 +16,6 @@ class Mepo(PythonPackage):
license("Apache-2.0", checked_by="mathomp4")
version("2.3.2", sha256="82affbf7e40856c6d8e8b3c4998ab4ea4d37c0baac73ddc1d698bce0d73a5082")
version("2.3.1", sha256="76b7fe081de7b34e5680879352a070dd447e2b113f3e34e4ce20c02486c3c0d8")
version("2.3.0", sha256="e80d7157553d33382ab0c399fcd5ec43ab5ff642504b07c8aef266165f9095d2")
version("2.2.1", sha256="b691989bb762dc5944a2f13afd89666602fa7e40816f0cfb0278fe2164b34e30")

View File

@@ -129,8 +129,6 @@ class Pika(CMakePackage, CudaPackage, ROCmPackage):
# Other dependencies
depends_on("boost@1.71:")
# https://github.com/pika-org/pika/pull/1428
conflicts("^boost@1.88:", when="@:0.33")
depends_on("fmt@9:", when="@0.11:")
# https://github.com/pika-org/pika/issues/686
conflicts("^fmt@10:", when="@:0.15 +cuda")

View File

@@ -17,14 +17,12 @@ class PyRepligit(PythonPackage):
license("Apache-2.0 WITH LLVM-exception")
version("main", branch="main")
version("0.1.1", sha256="e1fec2b080dd657502b967148fbb7dd5d33eb02fc47a2e91ed7bbfebf082410e")
version("0.1.0", sha256="9beac1a14542704f2e5af6a2f3d391d8adf2112ae3c70e98339db251a9e1079e")
variant("aiohttp", default="False", description="Enable aiohttp support")
conflicts("python@:3.12", when="@0.1.0")
depends_on("python@3.10:", type=("build", "run"))
depends_on("py-hatchling", type="build")
depends_on("py-aiohttp", type=("build", "run"), when="+aiohttp")

View File

@@ -2,8 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
from spack.build_systems.python import PythonPipBuilder
from spack.package import *
from spack.pkg.builtin.boost import Boost
@@ -53,22 +51,10 @@ class Sgpp(SConsPackage):
# to complain about missing headers (due to a path check not working anymore)
# See issue https://github.com/SGpp/SGpp/issues/263 and https://github.com/SGpp/SGpp/pull/266
patch("disable_disutils_deprecation_warning.patch", when="@:3.4.0 ^python@3.10:3.11")
# SGpp does not contain aarch64 support as of 3.4.0. To make it work still, this patch adds
# SGpp does not contain aarch64 support as of yet. To make it work still, this patch adds
# simple build system support for it.
patch("for_aarch64.patch", when="@:3.4.0 target=aarch64:")
# SGpp will default to the system paths when linking boost without the patch
# This may work (depending on the boost versions in question) but we should use the boost
# from spack. This patch allows to correctly pass the spack's boost path to SGpp
# Fixed in SGpp PR https://github.com/SGpp/SGpp/pull/273
patch("set_boost_lib_path_internally.patch", when="@3.3.0:3.4.0")
patch("for_aarch64.patch", when="target=aarch64:")
variant("debug", default=False, description="Build debug version instead of release version")
variant(
"doc",
default=False,
description="Build sgpp documentation (doxygen / pydoc)",
when="@3.4.0:",
)
variant("python", default=True, description="Provide Python bindings for SGpp")
variant("optimization", default=True, description="Builds the optimization module of SGpp")
variant("pde", default=True, description="Builds the datadriven module of SGpp")
@@ -81,37 +67,24 @@ class Sgpp(SConsPackage):
"opencl", default=False, description="Enables support for OpenCL accelerated operations"
)
variant("mpi", default=False, description="Enables support for MPI-distributed operations")
variant(
"eigen", default=False, description="Enables Eigen support", when="@3.4.0: +optimization"
)
variant(
"dakota", default=False, description="Enables Dakota support", when="@3.4.0: +combigrid"
)
variant(
"visualization",
default=False,
description="Build with visualization support",
when="+python",
)
# Mandatory dependencies
depends_on("cxx", type="build") # generated
depends_on("scons@3:", type="build")
depends_on("zlib-api", type="link")
depends_on("doxygen+graphviz", when="+doc", type="build")
depends_on("eigen", when="+eigen", type=("build", "run"))
depends_on("dakota", when="+dakota", type=("build", "run"))
# Python dependencies
extends("python", when="+python")
depends_on("py-pip", when="+python", type="build")
depends_on("py-wheel", when="+python", type="build")
depends_on("py-setuptools", type="build")
# Older SGpp releases (:3.4.0) do not support python 3.12 due to them using distutils
depends_on("python@3.7:3.11", type=("build", "run"), when="@:3.4.0")
# SGpp@master works with newer python versions (3.12:) as well
depends_on("python@3.7:", type=("build", "run"))
depends_on("swig@3:", when="+python", type="build")
# Newest swig version 4.1 seems to cause problem -> limit to 3:4.0 for now
depends_on("swig@3:4.0", when="+python", type="build")
depends_on("py-numpy@1.17:", when="+python", type=("build", "run"))
depends_on("py-pandas@1.1:", when="+python+visualization", type=("build", "run"))
depends_on("py-matplotlib@3:", when="+python+visualization", type=("build", "run"))
depends_on("py-scipy@1.5:", when="+python", type=("build", "run"))
depends_on("py-scipy@1.3:", when="+python", type=("build", "run"))
# OpenCL dependency
depends_on("opencl@1.1:", when="+opencl", type=("build", "run"))
# MPI dependency
@@ -120,7 +93,7 @@ class Sgpp(SConsPackage):
# TODO: replace this with an explicit list of components of Boost,
# for instance depends_on('boost +filesystem')
# See https://github.com/spack/spack/pull/22303 for reference
depends_on(Boost.with_default_variants, type=("build", "run", "test"))
depends_on(Boost.with_default_variants, type="test")
# Compiler with C++11 support is required
conflicts("%gcc@:4.8.4", msg="Compiler with c++11 support is required!")
@@ -146,50 +119,24 @@ class Sgpp(SConsPackage):
conflicts("+combigrid", when="@1.0.0:3.2.0~pde")
conflicts("+combigrid", when="@1.0.0:3.2.0~solver")
conflicts("+combigrid", when="@1.0.0:3.2.0~quadrature")
# Conflicts due the changes in the respective frameworks
# Fixed in newer SGpp versions, but 3.4.0 or older versions do not work
conflicts("^python@3.12:", when="@:3.4.0+python")
conflicts("^py-numpy@2:", when="@:3.4.0+python")
conflicts("^py-pandas@1.4:", when="@:3.4.0+python")
conflicts("^py-matplotlib@3.6:", when="@:3.4.0+python")
conflicts("^swig@4.1:", when="@:3.4.0+python")
def build_args(self, spec, prefix):
# Testing parameters
if self.run_tests:
self.args = [
"COMPILE_BOOST_TESTS=1",
"RUN_BOOST_TESTS=1",
"COMPILE_BOOST_PERFORMANCE_TESTS=1",
"RUN_BOOST_PERFORMANCE_TESTS=1",
]
self.args = ["COMPILE_BOOST_TESTS=1", "RUN_BOOST_TESTS=1"]
if "+python" in spec:
self.args.append("RUN_PYTHON_TESTS=1")
if spec.satisfies("@3.3.0:"):
self.args.append("RUN_PYTHON_EXAMPLES=1")
if spec.satisfies("@1.0.0:3.2.0"): # argument was renamed after 3.2.0
if spec.satisfies("@1.0.0:3.2.0"):
self.args.append("RUN_CPPLINT=1")
else:
self.args.append("RUN_CPP_EXAMPLES=1")
else: # argument was renamed after 3.2.0
self.args.append("CHECK_STYLE=1")
else:
self.args = [
"COMPILE_BOOST_TESTS=0",
"RUN_BOOST_TESTS=0",
"COMPILE_BOOST_PERFORMANCE_TESTS=0",
"RUN_BOOST_PERFORMANCE_TESTS=0",
"RUN_PYTHON_TESTS=0",
]
if spec.satisfies("@1.0.0:3.2.0"): # argument was renamed after 3.2.0
self.args = ["COMPILE_BOOST_TESTS=0", "RUN_BOOST_TESTS=0", "RUN_PYTHON_TESTS=0"]
if spec.satisfies("@1.0.0:3.2.0"):
self.args.append("RUN_CPPLINT=0")
else:
self.args.append("RUN_PYTHON_EXAMPLES=0")
self.args.append("RUN_CPP_EXAMPLES=0")
else: # argument was renamed after 3.2.0
self.args.append("CHECK_STYLE=0")
# Debug build or not
self.args.append("OPT={0}".format("0" if "+debug" in spec else "1"))
# Install direction
self.args.append("PREFIX={0}".format(prefix))
@@ -221,8 +168,6 @@ def build_args(self, spec, prefix):
self.args.append("ARCH=sse42")
elif "sse3" in self.spec.target:
self.args.append("ARCH=sse3")
elif "target=aarch64:" in spec:
self.args.append("ARCH=aarch64")
# OpenCL Flags
self.args.append("USE_OCL={0}".format("1" if "+opencl" in spec else "0"))
@@ -234,54 +179,10 @@ def build_args(self, spec, prefix):
else:
self.args.append("CXX={0}".format(self.compiler.cxx))
# Include PYDOC when building the documentation
self.args.append("PYDOC={0}".format("1" if "+doc +python" in spec else "0"))
# For some libraries, SGpp expects the path to be explicitly passed to scons (either using
# CPPPATH and LIBPATH or using depency-specific variables (BOOST_LIBRARY_PATH).
# Here, we set those paths and associated flags the dependencies where SGpp expects them
# to be passed manually via CPPPATH/LIBPATH (Eigen, Dakota, ...):
custom_cpppath = ""
custom_libpath = ""
path_separator = ";" if sys.platform == "win32" else ":"
if "+eigen" in spec:
self.args.append("USE_EIGEN=1")
custom_cpppath += "{0}{1}".format(self.spec["eigen"].prefix.include, path_separator)
if "+dakota" in spec:
self.args.append("USE_DAKOTA=1")
custom_cpppath += "{0}{1}".format(self.spec["dakota"].prefix.include, path_separator)
# Simply using spec["dakota"].libs.directories[0] does not work because spack will look
# for a libdakota library file which does not exist. However, we can use find_libraries
# and manually specify an existing library
# name within dakota to find the correct lib directory:
custom_libpath += "{0}{1}".format(
find_libraries(
"libdakota_src", root=self.spec["dakota"].prefix, shared=True, recursive=True
).directories[0],
path_separator,
)
# Add combined paths to CPPPATH/LIBPATH
if custom_cpppath:
self.args.append("CPPPATH={0}".format(custom_cpppath))
if custom_libpath:
self.args.append("LIBPATH={0}".format(custom_libpath))
# Manually set Boost location to the spack one (otherwise SGpp will try to look for
# Boost within the System install directory first)
self.args.append("BOOST_INCLUDE_PATH={0}".format(self.spec["boost"].prefix.include))
self.args.append("BOOST_LIBRARY_PATH={0}".format(self.spec["boost"].libs.directories[0]))
# Parallel builds do not seem to work without this:
self.args.append("-j{0}".format(make_jobs))
return self.args
@run_after("build")
def build_docs(self):
# Run Doxygen Step after build but before install
if "+doc" in self.spec:
args = self.args
scons("doxygen", *args)
def install_args(self, spec, prefix):
# SGpp expects the same args for the install and build commands
return self.args
@@ -290,6 +191,3 @@ def install_args(self, spec, prefix):
def python_install(self):
if "+python" in self.spec:
pip(*PythonPipBuilder.std_args(self), f"--prefix={self.prefix}", ".")
# Install docs
if "+doc" in self.spec:
install_tree("doc", self.prefix.doc)

View File

@@ -1,33 +0,0 @@
diff --git a/SConstruct b/SConstruct
index d7c85bd72..9d9fd494d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -443,6 +443,10 @@ if env["RUN_PYTHON_TESTS"]:
Helper.printWarning("Python tests disabled because SG_PYTHON is disabled.")
if env["COMPILE_BOOST_TESTS"]:
+ # also add the Boost library path to the PATH
+ # so that the Boost test lib can be found when running the tests
+ env["ENV"]["LD_LIBRARY_PATH"] = os.pathsep.join([env["BOOST_LIBRARY_PATH"],
+ env["ENV"].get("LD_LIBRARY_PATH", "")])
builder = Builder(action="./$SOURCE --log_level=test_suite")
env.Append(BUILDERS={"BoostTest" : builder})
diff --git a/datadriven/SConscript b/datadriven/SConscript
index 031f641cd..6380cd43f 100755
--- a/datadriven/SConscript
+++ b/datadriven/SConscript
@@ -83,7 +83,11 @@ if env["USE_HPX"]:
module.runPythonTests()
module.buildBoostTests()
module.runBoostTests()
+# Build performance tests...
module.buildBoostTests("performanceTests", compileFlag=performanceTestFlag)
-module.runBoostTests("performanceTests", compileFlag=performanceTestFlag,
- runFlag=performanceTestRunFlag)
+# ... however, without OCL they are empty (via ifdefs) and boost would does
+# throw an error. Only run them when OCL is used
+if env["USE_OCL"]:
+ module.runBoostTests("performanceTests", compileFlag=performanceTestFlag,
+ runFlag=performanceTestRunFlag)
module.checkStyle()