[rocm][ray] Fix: Unify Ray device visibility handling across CUDA and ROCm (#33308)

Signed-off-by: Kourosh Hakhamaneshi <kourosh@anyscale.com>
This commit is contained in:
kourosh hakhamaneshi
2026-02-04 10:09:14 -08:00
committed by GitHub
parent 192ad4648b
commit 2f6d17cb2f
8 changed files with 43 additions and 8 deletions
+1
View File
@@ -209,6 +209,7 @@ class Worker(WorkerBase):
f"be less than or equal to the number of visible devices "
f"({visible_device_count})."
)
self.device = torch.device(f"cuda:{self.local_rank}")
current_platform.set_device(self.device)
-6
View File
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import os
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, TypeVar
@@ -221,11 +220,6 @@ class WorkerWrapperBase:
envs_list: list[dict[str, str]],
) -> None:
envs = envs_list[self.rpc_rank]
key = "CUDA_VISIBLE_DEVICES"
if key in envs and key in os.environ:
# overwriting CUDA_VISIBLE_DEVICES is desired behavior
# suppress the warning in `update_environment_variables`
del os.environ[key]
update_environment_variables(envs)
def init_worker(self, all_kwargs: list[dict[str, Any]]) -> None: