Respect ENV value for OMP_NUM_THREADS if set (#16751)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Burhan 2024-10-08 14:58:48 -04:00 committed by GitHub
parent 67683a87f1
commit 1e6c454460
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,8 +4,9 @@ __version__ = "8.3.7"
import os
# Set ENV Variables (place before imports)
os.environ["OMP_NUM_THREADS"] = "1" # reduce CPU utilization during training
# Set ENV variables (place before imports)
if not os.environ.get("OMP_NUM_THREADS"):
os.environ["OMP_NUM_THREADS"] = "1" # default for reduced CPU utilization during training
from ultralytics.data.explorer.explorer import Explorer
from ultralytics.models import NAS, RTDETR, SAM, YOLO, FastSAM, YOLOWorld