mirror of
https://github.com/wassname/ray.git
synced 2026-07-04 09:36:46 +08:00
[Core] Do not convert gpu id to int (#9744)
Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
This commit is contained in:
+6
-5
@@ -271,9 +271,9 @@ def get_cuda_visible_devices():
|
||||
"""Get the device IDs in the CUDA_VISIBLE_DEVICES environment variable.
|
||||
|
||||
Returns:
|
||||
if CUDA_VISIBLE_DEVICES is set, this returns a list of integers with
|
||||
the IDs of the GPUs. If it is not set or is set to NoDevFiles,
|
||||
this returns None.
|
||||
devices (List[str]): If CUDA_VISIBLE_DEVICES is set, returns a
|
||||
list of strings representing the IDs of the visible GPUs.
|
||||
If it is not set or is set to NoDevFiles, returns empty list.
|
||||
"""
|
||||
gpu_ids_str = os.environ.get("CUDA_VISIBLE_DEVICES", None)
|
||||
|
||||
@@ -286,7 +286,8 @@ def get_cuda_visible_devices():
|
||||
if gpu_ids_str == "NoDevFiles":
|
||||
return []
|
||||
|
||||
return [int(i) for i in gpu_ids_str.split(",")]
|
||||
# GPU identifiers are given as strings representing integers or UUIDs.
|
||||
return list(gpu_ids_str.split(","))
|
||||
|
||||
|
||||
last_set_gpu_ids = None
|
||||
@@ -296,7 +297,7 @@ def set_cuda_visible_devices(gpu_ids):
|
||||
"""Set the CUDA_VISIBLE_DEVICES environment variable.
|
||||
|
||||
Args:
|
||||
gpu_ids: This is a list of integers representing GPU IDs.
|
||||
gpu_ids (List[str]): List of strings representing GPU IDs.
|
||||
"""
|
||||
|
||||
global last_set_gpu_ids
|
||||
|
||||
Reference in New Issue
Block a user