oasislmf.warmup

Warm the Numba JIT cache for all pytools modules.

Runs each tool’s compilation in a parallel process pool so that all ~191 Numba-compiled functions are cached in __pycache__ before the first real model run. This eliminates the 163-365 s cold-start overhead.

Test assets are bundled in oasislmf/_data/warmup/ (~400 KB) so this works both from a source checkout and after pip install oasislmf from PyPI.

Usage (CLI):

oasislmf warmup

Usage (standalone):

python -m oasislmf.warmup

Usage (Dockerfile):

RUN pip install oasislmf && oasislmf warmup

Usage (pytest):

pytest tests/pytools/test_jit_compilation.py::test_jit_compile_all -v

Disable (when using NUMBA_DISABLE_JIT):

NUMBA_DISABLE_JIT=1 oasislmf warmup

Attributes

Functions

warmup([max_workers])

Run all JIT compilations in parallel.

main()

Module Contents

oasislmf.warmup.occurrence_rel_path[source]
oasislmf.warmup.periods_rel_path[source]
oasislmf.warmup.returnperiods_rel_path[source]
oasislmf.warmup.quantile_rel_path[source]
oasislmf.warmup.correlations_rel_path[source]
oasislmf.warmup.coverages_rel_path[source]
oasislmf.warmup.events_rel_path[source]
oasislmf.warmup.items_rel_path[source]
oasislmf.warmup.amplifications_rel_path[source]
oasislmf.warmup.damage_bin_dict_rel_path[source]
oasislmf.warmup.footprint_rel_path[source]
oasislmf.warmup.footprint_idx_rel_path[source]
oasislmf.warmup.vulnerability_rel_path[source]
oasislmf.warmup.lossfactors_rel_path[source]
oasislmf.warmup.summary_rel_path[source]
oasislmf.warmup.ALL_SILENT_TASKS[source]
oasislmf.warmup.warmup(max_workers=None)[source]

Run all JIT compilations in parallel.

Args:

max_workers: Max parallel processes. Defaults to cpu_count.

Returns:

dict of task_name -> error for any failures (empty on success).

oasislmf.warmup.main()[source]