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/builtin/packages/gcc/package.py | |
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/builtin/packages/gcc/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/gcc/package.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index f6dce2ea00..2fb8d23aed 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -1111,3 +1111,32 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage): ), ), ) + + @classmethod + def runtime_constraints(cls, *, compiler, pkg): + """Callback function to inject runtime-related rules into the solver. + + Rule-injection is obtained through method calls of the ``pkg`` argument. + + Documentation for this function is temporary. When the API will be in its final state, + we'll document the behavior at https://spack.readthedocs.io/en/latest/ + + Args: + compiler: compiler object (node attribute) currently considered + pkg: object used to forward information to the solver + """ + 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)}") |