dsf.utils.thread_limits module

Thread-limit scripts for numerical forecast runs.

These settings avoid CAMB/OpenMP thread issues that can otherwise cause segmentation faults when CCL calls CAMB. They must be applied before importing NumPy, SciPy, PyCCL, CAMB, or libraries that import them internally.

This is intentionally conservative: most scripts do not need many numerical backend threads, and setting the limits early makes local forecast runs more stable.

dsf.utils.thread_limits.limit_numerical_threads(n_threads=1)[source]

Limit numerical backend threads before CCL/CAMB are imported.

Parameters:

n_threads (int) – Number of threads to allow for OpenMP, BLAS, and NumExpr backends. Defaults to 1.

Return type:

None