From ed6f002d3340888142cb67c13a37c060b51fa889 Mon Sep 17 00:00:00 2001 From: youkaichao Date: Tue, 27 Aug 2024 12:06:11 -0700 Subject: [PATCH] [cuda][misc] error on empty CUDA_VISIBLE_DEVICES (#7924) --- vllm/platforms/cuda.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vllm/platforms/cuda.py b/vllm/platforms/cuda.py index bda82d37..8d18527e 100644 --- a/vllm/platforms/cuda.py +++ b/vllm/platforms/cuda.py @@ -84,6 +84,9 @@ except ModuleNotFoundError: def device_id_to_physical_device_id(device_id: int) -> int: if "CUDA_VISIBLE_DEVICES" in os.environ: device_ids = os.environ["CUDA_VISIBLE_DEVICES"].split(",") + if device_ids == [""]: + raise RuntimeError("CUDA_VISIBLE_DEVICES is set to empty string," + " which means GPU support is disabled.") physical_device_id = device_ids[device_id] return int(physical_device_id) else: