# utils/perf_tuning.py import os, logging try: import cv2 except Exception: cv2 = None import torch def apply(): os.environ.setdefault("OMP_NUM_THREADS", "4") if cv2: try: cv2.setNumThreads(4) except Exception as e: logging.info("cv2 threads not set: %s", e) if torch.cuda.is_available(): torch.backends.cudnn.benchmark = True try: logging.info("CUDA device %s — cuDNN benchmark ON", torch.cuda.get_device_name(0)) except Exception: logging.info("CUDA available — cuDNN benchmark ON")