-
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
enhancement proposal : variant forwarding #391
Conversation
…ependency is provided from command line
@tgamblin : if you find this PR interesting, I think I need some help in one thing. There are currently 12 tests failing because I modify the dictionary
and then modify |
@tgamblin : I'll be waiting for your feedback on this PR before writing a few lines in |
@alalazo: I really like this PR. The capability is obviously really useful, AND it goes through vdeps so that will solve a lot of consistency problems with There are a few things I would think about here:
Thoughts? @fpruvost has been thinking about this for a while and has a bunch of packages that use threading, MPI, and cuda. I wonder if he has any thoughts on the implementation. This would at least solve the combinatorial dep specification problem he reported on the mailing list, so he should look at this PR. |
@alalazo: w.r.t. tests, I think it's hard to avoid brittleness for things that get defined at package definition time. I have thought about modifying MockPackagesTest so that the package modules get imported new each time through, which would solve the problem. Right now the tests either save and restore class data, or they could do something like what you've done here. I think this is fine for the moment; it's no worse than some of the other tests. |
Hi, thanks @tgamblin for having me in the loop. Concerning @tgamblin thoughts 1, 2:
|
Fast answers first : @tgamblin (answers to 1 and 2) The cons of this is that to obtain global propagation of something all the packages in the relevant portion of the DAG need to be modified, and you can't have a "hole" in the chain (i.e. you can't have a variant propagated from A to C via B if B does not declare that variant). The last may be a major issue with this PR right now. I didn't think of making @fpruvost (answers to 1 and 2) OpenMP at point 2. is a nice counterexample of why finer control than just propagating the same variant all over the DAG may be needed. It's true that being more specific about a spec at
if it is known at package definition time that
and let A take care of what is a "consequence" of On point 3. I'll post a separate comment with some thoughts that may be relevant also for #234 . |
Hi, |
@gauthier12 Nothing similar to this PR was ever merged. The good news is that something much better will be landing shortly: a more powerful concretizer that does not rely on a greedy algorithm and takes into account constraints wherever they come from. In this sense I suspect that most of the use cases that led to this PR will be covered by the new concretization algorithm. If you want to follow the final stages of development the feature branch on which this is being coded is https://github.com/spack/spack/tree/features/solver |
What do you mean by that? Can you make a concrete example? |
Thanks for your response.
So 8 combinations for 3 variants and I have 14 common variants and I may have forgotten some. |
@gauthier12 I see two options here. The first one is to employ for loops within class definition: def v_str(name, active):
s = '+' if active else '~'
s += name
return s
class B(Package):
names = ['lapack', 'vc', 'mkl']
for active in itertools.product((True, False), repeat=3):
variant_str = ''.join([v_str(name, value) for value, name in zip(active, names)])
depends_on('A'+variant_str, when=variant_str) This is quite involved and certainly not recommended in general, but is used in a few packages that present similar issues. Maybe a better solution, if it makes sense for Dune, is to treat Dune modules as resources. This means having a single "Dune" package with multiple |
@alalazo Thank you for your answer, the first solution you mention probably works but it doesn't seem practical especially if the number of variants increases but the second solution is a good idea ! |
…edi_neptune_env_passive Add fftw and netlib-lapack as passive dependencies for jedi-neptune-env
Rationale
This PR adds a
forward
keyword to thedepends_on
andextends
directives to enable the forwarding of a variant from a dependent to a direct dependency. Forwarding is taken into consideration only if nothing was explicitly specified about the forwarded variant in the dependency.Modifications
forward
keyword todepends_on
andextends
shared
anddebug
Examples
Implementation notes
I had originally some issues with regression tests, due to the fact that I was modifying directly a dictionary in
spec.package
that was shared among multiple specs. As I couldn't find a way of copying the dictionary during__init__
, I made it a property to compute it lazily the first time it's needed. I am not sure this is the best approach in terms of clarity. Hints on alternative ways to accomplish the same thing are welcome.