blosc2.set_nthreads#
- blosc2.set_nthreads(nthreads: int) int #
Set the number of threads to be used during Blosc operations.
- Parameters:
nthreads¶ (int) – The number of threads to be used during Blosc operations.
- Returns:
out – The previous number of threads used.
- Return type:
int
- Raises:
ValueError – If
nthreads
is larger than the maximum number of threads Blosc can use. Ifnthreads
is not a positive integer.
Notes
The maximum number of threads for Blosc is \(2^{31} - 1\). In some cases, Blosc gets better results if you set the number of threads to a value slightly below your number of cores (via
detect_number_of_cores()
).Examples
Set the number of threads to 2 and then to 1:
>>> oldn = blosc2.set_nthreads(2) >>> blosc2.set_nthreads(1) 2
See also