From 23466aff6b4d4f4e70d4ee4321bf41bb36962ebd Mon Sep 17 00:00:00 2001 From: Francesc Alted Date: Mon, 19 Feb 2024 06:11:13 +0100 Subject: [PATCH] Do not warn if OMP_NUM_THREAD set. Fixes #344. --- README.rst | 2 +- numexpr/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 84755b6..37da5c2 100644 --- a/README.rst +++ b/README.rst @@ -148,7 +148,7 @@ Usage array([ 1.00000000e+00, 2.00000000e+00, 3.00000000e+00, ..., 9.99998000e+05, 9.99999000e+05, 1.00000000e+06]) - >>> ne.evaluate('a*b-4.1*a > 2.5*b') # a more complex one + >>> ne.evaluate("a * b - 4.1 * a > 2.5 * b") # a more complex one array([False, False, False, ..., True, True, True], dtype=bool) >>> ne.evaluate("sin(a) + arcsinh(a/b)") # you can also use functions diff --git a/numexpr/utils.py b/numexpr/utils.py index ca13fcd..073b879 100644 --- a/numexpr/utils.py +++ b/numexpr/utils.py @@ -13,7 +13,6 @@ import os import subprocess -import platform from numexpr.interpreter import _set_num_threads, _get_num_threads, MAX_THREADS from numexpr import use_vml @@ -134,7 +133,8 @@ def _init_num_threads(): env_configured = False n_cores = detect_number_of_cores() - if 'NUMEXPR_MAX_THREADS' in os.environ and os.environ['NUMEXPR_MAX_THREADS'] != '': + if ('NUMEXPR_MAX_THREADS' in os.environ and os.environ['NUMEXPR_MAX_THREADS'] != '' or + 'OMP_NUM_THREADS' in os.environ and os.environ['OMP_NUM_THREADS'] != ''): # The user has configured NumExpr in the expected way, so suppress logs. env_configured = True n_cores = MAX_THREADS