Set JIT cache directory

Hi all,

I am using latest dolfin-x in a Docker container, and I control and start my simulations with an external Python script that launches the container, runs, then exits again and post-processes.
Problem is that the JIT cache dies when exiting the container, so all JIT compilation has to be re-done each time even if only very few parameters of a simulation have changed.

Is there any way to set the JIT cache directory to a user-specified folder? I’ve read something about a setting for dijitso (is that still used in dolfinx?), so I did a

export DIJITSO_CACHE_DIR=/my_folder

but that didn’t work - nothing was saved in there.

Would be great if someone had ideas how to specify this cache folder.

Best,
Marc

1 Like

Create the file dolfinx_jit_parameters.json in your local file directory and add

{
    "cache_dir": "/path/to/new/cache/dir"
}

to it.
Other options are listed in: dolfinx/jit.py at a02989a896ca94940b26cfeab76c35fbba254391 · FEniCS/dolfinx · GitHub

2 Likes

It seems that the file now has to be named dolfinx_jit_options.json, otherwise it won’t be read anymore. Just in case anyone stumbles across this topic.

Update: With the cache file named
dolfinx_jit_options.json
this still works with dolfinx 0.8.0. Again just in case anyone comes across this topic.