Skip to content

Commit

Permalink
Some fine tuning on the number of threads
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescAlted committed Jan 14, 2025
1 parent e27acd4 commit d656d13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/blosc2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

from enum import Enum

import numexpr

from .version import __version__

__version__ = __version__
Expand Down Expand Up @@ -195,7 +197,9 @@ class Tuner(Enum):
# Protection against too many threads
nthreads = min(nthreads, 32)
# Experiments say that, when using a large number of threads, it is better to not use them all
nthreads -= nthreads // 8
if nthreads > 16:
nthreads -= nthreads // 8
numexpr.set_num_threads(nthreads)

# This import must be before ndarray and schunk
from .storage import ( # noqa: I001
Expand Down

0 comments on commit d656d13

Please sign in to comment.