mirror of
https://github.com/wassname/ray.git
synced 2026-07-18 12:40:56 +08:00
Force OMP_NUM_THREADS=1 if unset (#6998)
* force omp * update * set * workers * link
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import os
|
||||
import logging
|
||||
import multiprocessing
|
||||
from os.path import dirname
|
||||
import sys
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# MUST add pickle5 to the import path because it will be imported by some
|
||||
# raylet modules.
|
||||
|
||||
@@ -10,6 +14,12 @@ if "pickle5" in sys.modules:
|
||||
"requires a specific version of pickle5 (which is "
|
||||
"packaged along with Ray).")
|
||||
|
||||
if "OMP_NUM_THREADS" not in os.environ and multiprocessing.cpu_count() > 8:
|
||||
logger.warning("[ray] Forcing OMP_NUM_THREADS=1 to avoid performance "
|
||||
"degradation with many workers (issue #6998). You can "
|
||||
"override this by explicitly setting OMP_NUM_THREADS.")
|
||||
os.environ["OMP_NUM_THREADS"] = "1"
|
||||
|
||||
# Add the directory containing pickle5 to the Python path so that we find the
|
||||
# pickle5 version packaged with ray and not a pre-existing pickle5.
|
||||
pickle5_path = os.path.join(
|
||||
|
||||
Reference in New Issue
Block a user