Add mechanism to clear full compilation cache
See original GitHub issueThere is currently no way to clear the full compilation class in JAX — something like f._clear_cache()
, but which applies to all JIT-ted functions that have been compiled so far. This would be useful in situations where multiple high-memory-usage tasks need to be done sequentially. See discussion in https://github.com/google/jax/discussions/10826
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Correct Method of Flushing Caches & Managing the Compiler
This is the “safer” way to clear the cache, as it does not clear absolutely everything. If you are using any secondary cache...
Read more >11.4 Cache time-consuming code chunks - Bookdown
One way to do it is to add another chunk option cache.extra = file.mtime('my-precious.csv') or more rigorously, cache.extra = tools::md5sum('my-precious.
Read more >Cache clear option - Arduino IDE 2.0
I use a build_opt.h file in the sketch to set options in the processor core and or/library. The problem is that swapping between...
Read more >Build Cache - Gradle User Manual
The Gradle build cache is a cache mechanism that aims to save time by reusing outputs produced by other builds. The build cache...
Read more >20 Performing Basic Cache Operations - Oracle Help Center
Basic cache put operations are performed using the put method as defined by the Map interface. The put method adds an entry to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Whilst we’re at it – JAX caches a lot of things (e.g. jaxprs) and I’ve found that this can also contribute to OOM on limited memory machines. (Such as GitHub Actions runners, for running tests.) Ways to clean these up would also be desirable.
FWIW my hugely hacky approach so far has been
(which in the context of tests is wrapped in a
@pytest.fixture(autouse=True)
.)I think the need for manually cleaning the cache once in a while is not natural. It would be nice to have an internal garbage collector inside Jax that cleans the least recently used objects in the cache (depending on the memory usage by the cache at the time).