From fb912952f59106d1adec0b0a40259b191b849bb5 Mon Sep 17 00:00:00 2001 From: Net Zhang Date: Thu, 11 Jun 2026 13:50:30 -0400 Subject: [PATCH] Skip `cuML` probe on CPU-only hosts in `resolve_backend` `check_cuml_available()` does a full `import cuml` which is very slow and pointless when no GPU is present. `resolve_backend()` now short-circuites: `check_cuml_available()` now only runs when `cuda_available` is True. --- shared/utils/backend.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shared/utils/backend.py b/shared/utils/backend.py index c75db3f..7af37a3 100644 --- a/shared/utils/backend.py +++ b/shared/utils/backend.py @@ -99,9 +99,8 @@ def resolve_backend(backend: str, operation: str = "general") -> str: return backend cuda_available, device_info = check_cuda_available() - has_cuml = check_cuml_available() - - if cuda_available and has_cuml: + # Only probe for cuML when CUDA is actually available. + if cuda_available and check_cuml_available(): resolved = "cuml" logger.info(f"Auto-resolved {operation} backend to cuML (GPU: {device_info})") else: