Allow reusing specs built with compilers not in config#43539
Merged
haampie merged 9 commits intospack:developfrom Apr 11, 2024
Merged
Allow reusing specs built with compilers not in config#43539haampie merged 9 commits intospack:developfrom
haampie merged 9 commits intospack:developfrom
Conversation
This limits the implicit use of globals, and can be leveraged to have simpler unit-tests.
This commit allows reusing binaries with compilers that don't match any in the local configuration.
8d1385e to
c2d3359
Compare
This is needed if we want to simulate x86_64 preferences on aarch64 host when running unit tests
70efd09 to
a679dcf
Compare
Member
Author
|
The usual performance benchmark for this test seems ok: |
a679dcf to
d91e076
Compare
haampie
reviewed
Apr 10, 2024
| module.spack_cxx = os.path.join(link_dir, pkg.compiler.link_paths["cxx"]) | ||
| module.spack_f77 = os.path.join(link_dir, pkg.compiler.link_paths["f77"]) | ||
| module.spack_fc = os.path.join(link_dir, pkg.compiler.link_paths["fc"]) | ||
| try: |
Member
There was a problem hiding this comment.
This looks a bit too generic. Can't you catch a specific error? Maybe refactor to compiler = get_compiler(pkg) and then if compiler: module.spack_cc = ... etc?
Member
Author
There was a problem hiding this comment.
Per DM, we need to check how to deal with mpi implementations, and similar specs that have a real run dependency on the compiler.
haampie
reviewed
Apr 10, 2024
| @pytest.mark.only_clingo("Old concretizer cannot reuse") | ||
| def test_reuse_specs_from_non_available_compilers(self, mutable_config, mutable_database): | ||
| """Tests that we can reuse specs with compilers that are not configured locally.""" | ||
| # All the specs in the mutable DB have been compiled with %gcc@=10.2.1 |
Member
There was a problem hiding this comment.
maybe also assert this? mutable_database.query_local(...)?
haampie
reviewed
Apr 10, 2024
| return False | ||
|
|
||
|
|
||
| class CompilerParser: |
Member
Author
There was a problem hiding this comment.
I'd leave this as is, at least here. There is also a RequirementParser - open to change both names in a following Pr.
haampie
reviewed
Apr 10, 2024
lib/spack/spack/solver/asp.py
Outdated
| result = sorted(self.compilers, key=lambda x: (x.spec.name, x.spec.version), reverse=True) | ||
| # Then stable sort to prefer available compilers and account for preferences | ||
| ppk = spack.package_prefs.PackagePrefs("all", "compiler", all=False) | ||
| result = sorted(result, key=lambda x: (not x.available, ppk(x.spec))) |
haampie
reviewed
Apr 10, 2024
This would happen if the mpi was installed from a buildcache, and the compiler is not available.
acca63b to
7525e7a
Compare
haampie
approved these changes
Apr 11, 2024
Member
Author
|
@spackbot run pipeline |
|
I've started that pipeline for you! |
tldahlgren
pushed a commit
to tldahlgren/spack
that referenced
this pull request
Apr 23, 2024
Allow reuse of specs that were built with compilers not in the current configuration. This means that specs from build caches don't need to have a matching compiler locally to be reused. Similarly when updating a distro. If a node needs to be built, only available compilers will be considered as candidates.
stephenmsachs
pushed a commit
to stephenmsachs/spack
that referenced
this pull request
Apr 29, 2024
Allow reuse of specs that were built with compilers not in the current configuration. This means that specs from build caches don't need to have a matching compiler locally to be reused. Similarly when updating a distro. If a node needs to be built, only available compilers will be considered as candidates.
danlipsa
added a commit
to danlipsa/spack
that referenced
this pull request
May 22, 2024
The full error: ==> Installing hdf5-1.14.3-ohtopgtkb3nmwyxxgqdpwjvvnttospev [24/35] ==> No binary for hdf5-1.14.3-ohtopgtkb3nmwyxxgqdpwjvvnttospev found: installing from source ==> Error: AttributeError: module 'spack.pkg.builtin.hdf5' has no attribute 'spack_cc' The 'hdf5' package cannot find an attribute while trying to build from sources. This might be due to a change in Spack's package format to support multiple build-systems for a single package. You can fix this by updating the build recipe, and you can also report the issue as a bug. More information at https://spack.readthedocs.io/en/latest/packaging_guide.html#installation-procedure C:\Users\dan.lipsa\projects\spack\var\spack\repos\builtin\packages\msmpi\package.py:48, in setup_dependent_package: 45 # be manually supplied to compiler by consuming package 46 # Note: This is not typical of MPI installations 47 dependent_module = dependent_spec.package.module >> 48 self.spec.mpicc = dependent_module.spack_cc 49 self.spec.mpicxx = dependent_module.spack_cxx 50 self.spec.mpifc = dependent_module.spack_fc 51 self.spec.mpif77 = dependent_module.spack_f77 This reverts changes to msmpi/package.py 1fe8e63 * Reuse specs built with compilers not in config (spack#43539)
teaguesterling
pushed a commit
to teaguesterling/spack
that referenced
this pull request
Jun 15, 2024
Allow reuse of specs that were built with compilers not in the current configuration. This means that specs from build caches don't need to have a matching compiler locally to be reused. Similarly when updating a distro. If a node needs to be built, only available compilers will be considered as candidates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR allows to reuse specs that were built with compilers that are not in the current configuration. This means that specs from buildcaches don't need to have a matching compiler locally to be reused. If a node needs to be built, only available compilers will be considered as candidates.
Below most of the specs are reused and have

%gcc@=9.4.0which is not in the configuration. The root node is built and has%gcc@=11.1.0: