brainevent.config.clear_backends

Contents

brainevent.config.clear_backends#

brainevent.config.clear_backends()[source]#

Clear all global backend defaults.

After calling this function, all primitives revert to their per-primitive defaults (set via XLACustomKernel.set_default or registration order).

See also

set_backend

Set the global backend for a platform.

get_backend

Query the current global backend for a platform.

Notes

Like set_backend(), this invalidates JAX’s lowering/compilation caches (via jax.clear_caches()) so that call sites already compiled under the old global backends pick up the reverted per-primitive defaults – but only when there was something to clear: if no global backend was set for any platform, this is a no-op and does not touch JAX’s caches. This is a setup-time, single-threaded control; see set_backend() for the concurrency caveat.

Examples

>>> import brainevent
>>> brainevent.set_backend('gpu', 'warp')
>>> brainevent.clear_backends()
>>> brainevent.get_backend('gpu') is None
True