MogensR commited on
Commit
76d53eb
·
1 Parent(s): 17fe291

Update utils/hardware/device_manager.py

Browse files
Files changed (1) hide show
  1. utils/hardware/device_manager.py +6 -1
utils/hardware/device_manager.py CHANGED
@@ -182,6 +182,11 @@ def setup_optimal_threading(self):
182
  logger.info(f"Threading already configured: OMP_NUM_THREADS={current_omp}")
183
  # Just ensure PyTorch uses the same settings
184
  torch.set_num_threads(int(current_omp))
 
 
 
 
 
185
  return
186
 
187
  # Get physical CPU count
@@ -355,4 +360,4 @@ def get_system_diagnostics() -> Dict[str, Any]:
355
  # Only run setup_optimal_threading if needed (it will check internally)
356
  manager.setup_optimal_threading()
357
  except Exception as e:
358
- logger.warning(f"Error during device manager initialization: {e}")
 
182
  logger.info(f"Threading already configured: OMP_NUM_THREADS={current_omp}")
183
  # Just ensure PyTorch uses the same settings
184
  torch.set_num_threads(int(current_omp))
185
+
186
+ # Ensure MKL matches OMP if it's not set
187
+ if 'MKL_NUM_THREADS' not in os.environ:
188
+ os.environ['MKL_NUM_THREADS'] = current_omp
189
+
190
  return
191
 
192
  # Get physical CPU count
 
360
  # Only run setup_optimal_threading if needed (it will check internally)
361
  manager.setup_optimal_threading()
362
  except Exception as e:
363
+ logger.warning(f"Error during device manager initialization: {e}")