bayespecon.enable_compile_cache¶
-
bayespecon.enable_compile_cache(path=
None)[source]¶ Enable persistent on-disk compile caches for JAX and PyTensor.
JAX-backed NUTS samplers (
"numpyro","blackjax") and the PyTensor-compiled PyMC sampler can both reuse compiled artefacts across processes when given a stable cache directory. This helper sets:jax.config.update("jax_compilation_cache_dir", <path>/"jax")pytensor.config.compiledir = <path>/"pytensor"
Both subdirectories are created if they do not already exist. The helper is idempotent and safe to call from notebooks or scripts at startup.
- Parameters:¶
- path=
None¶ Root directory for the caches. When omitted, defaults to the platform-appropriate user cache directory (
platformdirs.user_cache_dir("bayespecon")).
- path=
- Returns:¶
The resolved root cache path.
- Return type:¶
Notes
This is an opt-in helper. The package does not enable caching automatically because tests and CI generally prefer ephemeral directories.