From fbe67e465375231474a2ad80a4389efc77ecff99 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 18 Jul 2022 17:53:30 +0200 Subject: [PATCH] Fix `OMP_NUM_THREADS=1` for macOS (#8624) Resolves https://github.com/ultralytics/yolov5/issues/8623 --- utils/general.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/general.py b/utils/general.py index a85a2915a31a..cb5ca500b9f3 100755 --- a/utils/general.py +++ b/utils/general.py @@ -52,7 +52,7 @@ pd.options.display.max_columns = 10 cv2.setNumThreads(0) # prevent OpenCV from multithreading (incompatible with PyTorch DataLoader) os.environ['NUMEXPR_MAX_THREADS'] = str(NUM_THREADS) # NumExpr max threads -os.environ['OMP_NUM_THREADS'] = str(NUM_THREADS) # OpenMP max threads (PyTorch and SciPy) +os.environ['OMP_NUM_THREADS'] = '1' if platform.system() == 'darwin' else str(NUM_THREADS) # OpenMP (PyTorch and SciPy) def is_kaggle():