-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concretizer: fix duplicate count when strategy=full #46169
base: develop
Are you sure you want to change the base?
Conversation
…fixes spack#46034) * Each parent gets its own "build environment" where the build deps are unified. * Things that don't allow multiple nodes are also thrown into the "generic_build" unification In spack#46034, a package X build-depends on a `build-tools`-tagged package, e.g., `py-setuptools`, as well as another package Y that itself depends (build+run) on the same `build-tools` tagged package. In this case, the concretizer puts the possibly two versions of the build tool into separate unification sets, but the run-type dependency requires the build environment of X to have both versions in its environment — which is illegal. With this fix, the concretizer puts the two build tool nodes into a new common unification set if there is a build→run-type dependency chain on the build tool ⇒ spack now reports the expected error about not being able to find a common concretization of the build tool. Change-Id: I99257b225602c21d4f270fe16e68c1f8bd4b1eba
This introduces `-fixed` packages for py-shapely and py-floating which depend on a `-fixed` py-numpy that does NOT run-depend on py-setuptools. If we allow run deps of build deps, it causes the tool to appear multiple times in the build environment ⇒ fail. Change-Id: I1ef1fa0b8636c23626c7e2ea521d3b5438f97d0a
This introduces a regression test to ensure that the concretizer fails when trying to solve a spec where we have a build tool in two versions and the "lower" (in the DAG) version being also a run-dependency. If this would be allowed, we could end up having multiple paths to different tool versions/variants in the build env. Change-Id: I050efc9471d89580f5546a1c56ab419891bcc792
Existing tests use py-setuptools for multiple-build-tool testing; here we add a case where a build-tool ("cmake") depends on another one ("gmake"). Change-Id: I08c3144b30258a43eda152aa72e1379472660432
…tegy=full add tests where two different versions of a build-tool are needed, but have conflicting dependencies (either direct or deeper in the build stack DAG)
Build-tools with multiple dependents and all packages in their subDAGs are allowed to have multiple nodes in the DAG.
dep_tree = spack.package_base.possible_dependencies( | ||
*self.specs, virtuals=self._possible_virtuals, depflag=self.all_types | ||
) | ||
gen.h2("Maximum number of nodes") | ||
for pkg, count in sorted(counter.items(), key=lambda x: (x[1], x[0])): | ||
count = min(count, 2) | ||
gen.fact(fn.max_dupes(pkg, count)) | ||
dep_counter = collections.Counter( | ||
[dep for pkg_deps in dep_tree.values() for dep in pkg_deps] | ||
) | ||
dupe_build_tools = set([n for n in build_tools if dep_counter[n] > 1]) | ||
possible_dupes = set( | ||
spack.package_base.possible_dependencies( | ||
*dupe_build_tools, virtuals=self._possible_virtuals, depflag=self.all_types | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: The dependent-counting is just an optimisation, I just tried to follow the logic of the previous implementation.
Having just:
build_tools = spack.repo.PATH.packages_with_tags("build-tools")
possible_dupes = set(
spack.package_base.possible_dependencies(
*build_tools, virtuals=self._possible_virtuals, depflag=self.all_types
)
)
instead would also work and have the same results, I believe, but would create more duplicates/unification sets (than strictly needed).
When testing this with real packages, I noticed that concretization seems to hang indefinitely sometimes, and traced this to packages that depend on |
Maybe open an issue for this :) ? (And it's unrelated to this PR (even if it might have been hidden before)… i.e. should not affect the review :) ) |
Depends on #46106
This PR resolves the error reported by @muffgaga in #46106 (comment) when using the "full" concretization strategy.
The previous implementation did not always correctly handle the selection of packages that were allowed to have multiple nodes in the DAG, because
self._total_build
is a set, so packages that appeared multiple times in the build subgraph were not counted correctly.With this PR, the
FullDuplicatesCounter
instead:Additionally, this adds 3 tests (that would fail before the PR):