Repository navigation
fix(heatconduction): keep the FEniCS JIT cache on the host - #278
Merged
Merged
Conversation
Every simulate/optimize starts a new container, so the compiled forms were lost with it and each call recompiled them. Mount a host directory as the dijitso cache instead. Fixes #273.
mkeeler43
force-pushed
the
fix/heatconduction-fenics-jit-cache
branch
from
September 3, 2026 17:09
4a47a73 to
8ff675a
Compare
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.
Fixes #273.
Every
simulateandoptimizeof the heat conduction problems starts a new container. FEniCS compiles its forms on first use and caches the result, but the cache is inside the container, so it is lost when the call ends and the next call compiles everything again. In the sweep behind #273 that was about 18 compilations per call, against 0.35 s of actual solver time.Fix: mount a host directory into the container and point
DIJITSO_CACHE_DIRat it. The directory is$SCRATCH/.cache/engibench/dijitsoifSCRATCHis set, otherwise~/.cache/engibench/dijitso. Delete it to reset the cache.Both heat problems go through
run_container_script, and the mount and environment variable go through the existingmounts=/env=arguments ofcontainer.run, so this is the same for Docker, Podman and Apptainer.Verified
Docker (macOS): a script that assembles one form takes 7.4 s cold and 1.1 s warm. Three containers started at once on an empty cache all succeed and leave exactly one copy of each compiled module. dijitso is written for this: it compiles to a temp file and moves it into the cache with an atomic rename.
Apptainer (Euler): three back-to-back
simulatecalls take 19 s, 5 s, 5 s. A 50-design package went from ~57 min to ~12 min with the same results.DIJITSO_CACHE_DIRis the only variable dijitso reads;INSTANT_CACHE_DIRfrom the issue's workaround is ignored by this FEniCS version.Not in this PR
run_container_scriptnames every containerdolfin, so two heat conduction jobs on one Docker or Podman host fail with a name conflict. Apptainer ignores the name. That is an existing bug, not touched here.