Skip to content

Commit

Permalink
Add self-referential deps
Browse files Browse the repository at this point in the history
  • Loading branch information
alalazo committed Jun 10, 2024
1 parent 7178868 commit c897fe7
Showing 1 changed file with 95 additions and 39 deletions.
134 changes: 95 additions & 39 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,12 @@ <h2>How does reuse work?</h2>
Spack can also actively try to reuse
<pre><code data-trim data-noescape class="yaml">
concretizer:
# Whether to consider installed packages or packages
# from buildcaches when concretizing specs. If `true`,
# Whether to consider installed packages or packages
# from buildcaches when concretizing specs. If `true`,
# we'll try to use as many installs/binaries as possible,
# rather than building. If `false`, we'll always give you
# a fresh concretization. If `dependencies`, we'll only
# reuse dependencies but give you a fresh concretization
# rather than building. If `false`, we'll always give you
# a fresh concretization. If `dependencies`, we'll only
# reuse dependencies but give you a fresh concretization
# for your root specs.
reuse: true
</code></pre>
Expand Down Expand Up @@ -718,7 +718,7 @@ <h2>How does reuse work?</h2>
reuse:
roots: true
from:
# OpenMPI should not be reused
# OpenMPI should not be reused
# from store or buildcache...
- type: local
exclude: ["openmpi"]
Expand All @@ -740,7 +740,7 @@ <h2>Hands-on</h2>
<pre><code data-trim data-noescape class="bash">
# Check that using --fresh doesn't emit hash facts
spack solve --fresh --show=asp ... | less

# Add a mirror, retry
spack mirror add developer-tools https://binaries.spack.io/develop/developer-tools-manylinux2014
spack buildcache keys --install --trust
Expand All @@ -756,7 +756,7 @@ <h2>Hands-on</h2>
<section>
<h2>What is an optimal solution?</h2>
</section>
<section>
<section>
Many optimization criteria for an optimal spec
<ul class="small-text">
<li>Prefer newer versions</li>
Expand All @@ -779,7 +779,7 @@ <h2>What is an optimal solution?</h2>
1@20,Package,Variant,Value
: variant_default_not_used(Package, Variant, Value)
}.
</code></pre>
</code></pre>
</section>
<section>
<img class="r-stretch" src="dist/images/sums.svg" style="background: none; border: 0px">
Expand Down Expand Up @@ -826,7 +826,7 @@ <h2>Hands-on</h2>
</section>
</section>
<section>
<section>
<section>
<h2>How are errors modeled?</h2>
</section>
<section>
Expand All @@ -838,7 +838,7 @@ <h2>How are errors modeled?</h2>
:- attribute(P).
</code></pre>
<pre><code data-trim data-noescape class="console">
$ clingo example.lp
$ clingo example.lp
clingo version 5.6.2
Reading from example.lp
Solving...
Expand All @@ -858,7 +858,7 @@ <h2>How are errors modeled?</h2>
error("{P} cannot have an attribute!", P) :- attribute(P).
</code></pre>
<pre><code data-trim data-noescape class="console">
$ clingo example.lp
$ clingo example.lp
clingo version 5.6.2
Reading from example.lp
Solving...
Expand All @@ -874,7 +874,7 @@ <h2>How are errors modeled?</h2>
<section>
Highest priority optimization is <em>minimize errors</em>
</section>
<section>
<section>
<div>
<img src="dist/images/error-flow-chart.svg" style="background: none; border: 0px">
</div>
Expand All @@ -890,22 +890,22 @@ <h2>How are errors modeled?</h2>
4. Cannot satisfy '[email protected]:'
5. Cannot satisfy '[email protected]'
6. Cannot satisfy '[email protected]:'
required because hdf5 depends on [email protected]: when @1.13:
required because [email protected] ^[email protected] requested explicitly
required because hdf5 depends on [email protected]: when @1.13:
required because [email protected] ^[email protected] requested explicitly
7. Cannot satisfy '[email protected]'
required because [email protected] ^[email protected] requested explicitly
required because [email protected] ^[email protected] requested explicitly
8. Cannot satisfy '[email protected]:' and '[email protected]
required because [email protected] ^[email protected] requested explicitly
required because hdf5 depends on [email protected]: when @1.13:
required because [email protected] ^[email protected] requested explicitly
required because [email protected] ^[email protected] requested explicitly
required because hdf5 depends on [email protected]: when @1.13:
required because [email protected] ^[email protected] requested explicitly
9. Cannot satisfy '[email protected]' and '[email protected]:
required because [email protected] ^[email protected] requested explicitly
required because hdf5 depends on [email protected]: when @1.13:
required because [email protected] ^[email protected] requested explicitly
required because [email protected] ^[email protected] requested explicitly
required because hdf5 depends on [email protected]: when @1.13:
required because [email protected] ^[email protected] requested explicitly
10. Cannot satisfy '[email protected]:' and '[email protected]
required because [email protected] ^[email protected] requested explicitly
required because hdf5 depends on [email protected]:
required because [email protected] ^[email protected] requested explicitly
required because [email protected] ^[email protected] requested explicitly
required because hdf5 depends on [email protected]:
required because [email protected] ^[email protected] requested explicitly
</code></pre>
</section>
</section>
Expand Down Expand Up @@ -937,14 +937,14 @@ <h2>What are requirements and strong preferences?</h2>
<pre><code data-trim data-noescape class="YAML">
packages:
all:
require:
require:
- "+shared +cuda"
</code></pre>
vs.
<pre><code data-trim data-noescape class="YAML">
packages:
all:
require:
require:
- "+shared"
- "+cuda"
</code></pre>
Expand All @@ -967,10 +967,10 @@ <h2>What are requirements and strong preferences?</h2>
<pre><code data-trim data-noescape class="YAML">
packages:
mpi:
require:
require:
- 'mvapich2 %gcc'
mvapich2:
require:
require:
- '~cuda'
</code></pre>
</section>
Expand All @@ -983,29 +983,85 @@ <h2>What are requirements and strong preferences?</h2>
- 'build_type=Release'
- '+cuda'
</code></pre>
==
<pre><code data-trim data-noescape class="YAML">
packages:
all:
require:
- any_of: ['build_type=Release', '@:']
- any_of: ['+cuda', '@:']
</code></pre>
</section>
<section>
<h2>Hands-on</h2>
<pre><code data-trim data-noescape class="bash">
# Add a requirement to configuration,
# try to violate it, check the error message

# Do the same with a strong preference, observe
# Do the same with a strong preference, observe
# spack solve weights

# Enforce virtuals in an environment using
# Enforce virtuals in an environment using
# requirements
</code></pre>
</section>
</section>
<section>
<section>
<h2>How can I constrain a virtual provider in a recipe?</h2>
</section>
<section>
Refer to a provider in a condition
<pre><code class="python" data-trim data-noescape>
class Hdf5VolAsync(CMakePackage):

depends_on("mpi")

# If using openmpi as a provider, needs
# thread multiple support
depends_on(
"openmpi +thread_multiple",
when="^[virtuals=mpi] openmpi@:2"
)
</code></pre>
</section>
<section>
This is bad, since it's self referential
<pre><code class="python" data-trim data-noescape>
class Hdf5VolAsync(CMakePackage):

depends_on("mpi")

# openmpi can be used as a "normal" dependency
# clingo can choose to add it or not
depends_on(
"openmpi +thread_multiple",
when="^openmpi@:2"
)
</code></pre>
</section>
<section>
Conditionally constrain a normal package
<pre><code class="python" data-trim data-noescape>
class GribUtil(CMakePackage)::

depends_on("ip")

# If ip is at version 4.1 or later, then also
# require precision=d
requires("^ip precision=d", when="^[email protected]:")
</code></pre>
</section>
<section>
<h2>Hands-on</h2>
<pre><code data-trim data-noescape class="bash">
# Make mpich the preferred provider
spack config add packages:all:providers:mpi:[mpich]

# Try to concretize hdf5-vol-async with different mpis
spack spec hdf5-vol-async ^mpich
spack spec hdf5-vol-async ^openmpi

# Edit hdf5-vol-async to use the wrong idiom
# and repeat

# https://dreampuf.github.io/GraphvizOnline
spack graph -d --color hdf5-vol-async ^openmpi
</code></pre>
</section>
</section>
</div>
</div>

Expand Down

0 comments on commit c897fe7

Please sign in to comment.