Skip to content

Commit

Permalink
We are in 2024, so raise the 'safe' limit to 16 threads
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescAlted committed May 30, 2024
1 parent 7ef1e04 commit c7f3d57
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions numexpr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ def _init_num_threads():
# configured NumExpr as desired, so we emit info logs.
if n_cores > MAX_THREADS:
log.info('Note: detected %d virtual cores but NumExpr set to maximum of %d, check "NUMEXPR_MAX_THREADS" environment variable.'%(n_cores, MAX_THREADS))
if n_cores > 8:
# The historical 'safety' limit.
log.info('Note: NumExpr detected %d cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.'%n_cores)
n_cores = 8
if n_cores > 16:
# Back in 2019, 8 threads would be considered safe for performance. We are in 2024 now, so adjusting.
log.info('Note: NumExpr detected %d cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 16.'%n_cores)
n_cores = 16

# Now we check for 'NUMEXPR_NUM_THREADS' or 'OMP_NUM_THREADS' to set the
# actual number of threads used.
Expand Down

0 comments on commit c7f3d57

Please sign in to comment.