glenn-jocher commited on
Commit
fbe67e4
·
unverified ·
1 Parent(s): 9cf5fd5

Fix `OMP_NUM_THREADS=1` for macOS (#8624)

Browse files

Resolves https://github.com/ultralytics/yolov5/issues/8623

Files changed (1) hide show
  1. utils/general.py +1 -1
utils/general.py CHANGED
@@ -52,7 +52,7 @@ np.set_printoptions(linewidth=320, formatter={'float_kind': '{:11.5g}'.format})
52
  pd.options.display.max_columns = 10
53
  cv2.setNumThreads(0) # prevent OpenCV from multithreading (incompatible with PyTorch DataLoader)
54
  os.environ['NUMEXPR_MAX_THREADS'] = str(NUM_THREADS) # NumExpr max threads
55
- os.environ['OMP_NUM_THREADS'] = str(NUM_THREADS) # OpenMP max threads (PyTorch and SciPy)
56
 
57
 
58
  def is_kaggle():
 
52
  pd.options.display.max_columns = 10
53
  cv2.setNumThreads(0) # prevent OpenCV from multithreading (incompatible with PyTorch DataLoader)
54
  os.environ['NUMEXPR_MAX_THREADS'] = str(NUM_THREADS) # NumExpr max threads
55
+ os.environ['OMP_NUM_THREADS'] = '1' if platform.system() == 'darwin' else str(NUM_THREADS) # OpenMP (PyTorch and SciPy)
56
 
57
 
58
  def is_kaggle():