diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2023-11-30 18:36:24 +0100 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2023-12-21 12:22:58 -0800 |
commit | ea7e3e4f9fdf98abd22f530dc61048ad0ce23d04 (patch) | |
tree | a8205a86f9b4bc15487eec436a47d96a1a73d279 /var/spack/repos/compiler_runtime.test | |
parent | 8371bb4e192f876978fd77ea81c728bcd3475768 (diff) | |
download | spack-ea7e3e4f9fdf98abd22f530dc61048ad0ce23d04.tar.gz spack-ea7e3e4f9fdf98abd22f530dc61048ad0ce23d04.tar.bz2 spack-ea7e3e4f9fdf98abd22f530dc61048ad0ce23d04.tar.xz spack-ea7e3e4f9fdf98abd22f530dc61048ad0ce23d04.zip |
Compilers can inject first order rules into the solver
* Restore PackageBase class, and modify only ASP
This prevents a noticeable slowdown in concretization
due to the number of directives involved.
* Fix issue with 'clang' being preferred to 'gcc',
due to runtime version weights
* Constraints on runtimes are declared by compilers
The declaration of available runtime versions, and of
their compatibility constraints are in the associated
compiler class.
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Diffstat (limited to 'var/spack/repos/compiler_runtime.test')
5 files changed, 72 insertions, 0 deletions
diff --git a/var/spack/repos/compiler_runtime.test/packages/a/package.py b/var/spack/repos/compiler_runtime.test/packages/a/package.py new file mode 100644 index 0000000000..1f68aadc2f --- /dev/null +++ b/var/spack/repos/compiler_runtime.test/packages/a/package.py @@ -0,0 +1,13 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +from spack.package import * + + +class A(Package): + homepage = "http://www.example.com" + has_code = False + + version("1.0") + depends_on("b") diff --git a/var/spack/repos/compiler_runtime.test/packages/b/package.py b/var/spack/repos/compiler_runtime.test/packages/b/package.py new file mode 100644 index 0000000000..ab9f3150e6 --- /dev/null +++ b/var/spack/repos/compiler_runtime.test/packages/b/package.py @@ -0,0 +1,12 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +from spack.package import * + + +class B(Package): + homepage = "http://www.example.com" + has_code = False + + version("1.0") diff --git a/var/spack/repos/compiler_runtime.test/packages/gcc-runtime/package.py b/var/spack/repos/compiler_runtime.test/packages/gcc-runtime/package.py new file mode 100644 index 0000000000..61d40a2df6 --- /dev/null +++ b/var/spack/repos/compiler_runtime.test/packages/gcc-runtime/package.py @@ -0,0 +1,13 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class GccRuntime(Package): + homepage = "https://example.com" + has_code = False + tags = ["runtime"] + requires("%gcc") diff --git a/var/spack/repos/compiler_runtime.test/packages/gcc/package.py b/var/spack/repos/compiler_runtime.test/packages/gcc/package.py new file mode 100644 index 0000000000..db81066599 --- /dev/null +++ b/var/spack/repos/compiler_runtime.test/packages/gcc/package.py @@ -0,0 +1,32 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Gcc(Package): + homepage = "http://www.example.com/" + has_code = False + + version("13.2.0") + version("12.3.0") + + @classmethod + def runtime_constraints(cls, *, compiler, pkg): + pkg("*").depends_on( + "gcc-runtime", + when="%gcc", + type="link", + description="If any package uses %gcc, it depends on gcc-runtime", + ) + pkg("*").depends_on( + f"gcc-runtime@{str(compiler.version)}:", + when=f"%{str(compiler.spec)}", + type="link", + description=f"If any package uses %{str(compiler.spec)}, " + f"it depends on gcc-runtime@{str(compiler.version)}:", + ) + # The version of gcc-runtime is the same as the %gcc used to "compile" it + pkg("gcc-runtime").requires(f"@={str(compiler.version)}", when=f"%{str(compiler.spec)}") diff --git a/var/spack/repos/compiler_runtime.test/repo.yaml b/var/spack/repos/compiler_runtime.test/repo.yaml new file mode 100644 index 0000000000..1be826a641 --- /dev/null +++ b/var/spack/repos/compiler_runtime.test/repo.yaml @@ -0,0 +1,2 @@ +repo: + namespace: compiler_runtime.test |