brainevent.config.set_numba_parallel#
- brainevent.config.set_numba_parallel(parallel=True, num_threads=None)[source]#
Enable or disable Numba parallel execution and optionally set the thread count.
Controls whether Numba-based kernels in brainevent use parallel execution (via
numba.prange). Whennum_threadsis provided, it also callsnumba.set_num_threadsto configure the Numba thread pool size.- Parameters:
See also
get_numba_parallelQuery whether Numba parallel mode is enabled.
get_numba_num_threadsQuery the configured Numba thread count.
Notes
Setting
num_threadsimports thenumbapackage and immediately callsnumba.set_num_threads. This affects all subsequent Numba JIT-compiled functions, not just those in brainevent.Kernels read the flag when they are compiled, and JAX caches compiled executables independently of it. If this call changes the flag it therefore calls
jax.clear_caches(), so already-compiled call sites recompile with the new setting on their next use. Likeset_backend(), it is a setup-time, single-threaded control.Examples
>>> import brainevent >>> brainevent.config.set_numba_parallel(True, num_threads=4) >>> brainevent.config.get_numba_parallel() True >>> brainevent.config.get_numba_num_threads() 4