mirror of
https://github.com/vale981/ray
synced 2025-03-07 02:51:39 -05:00
parent
9d04f6617a
commit
52c33b53f7
1 changed files with 7 additions and 1 deletions
|
@ -15,6 +15,8 @@ import uuid
|
||||||
import ray.gcs_utils
|
import ray.gcs_utils
|
||||||
import ray.ray_constants as ray_constants
|
import ray.ray_constants as ray_constants
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _random_string():
|
def _random_string():
|
||||||
id_hash = hashlib.sha1()
|
id_hash = hashlib.sha1()
|
||||||
|
@ -261,7 +263,8 @@ def get_cuda_visible_devices():
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
if CUDA_VISIBLE_DEVICES is set, this returns a list of integers with
|
if CUDA_VISIBLE_DEVICES is set, this returns a list of integers with
|
||||||
the IDs of the GPUs. If it is not set, this returns None.
|
the IDs of the GPUs. If it is not set or is set to NoDevFiles,
|
||||||
|
this returns None.
|
||||||
"""
|
"""
|
||||||
gpu_ids_str = os.environ.get("CUDA_VISIBLE_DEVICES", None)
|
gpu_ids_str = os.environ.get("CUDA_VISIBLE_DEVICES", None)
|
||||||
|
|
||||||
|
@ -271,6 +274,9 @@ def get_cuda_visible_devices():
|
||||||
if gpu_ids_str == "":
|
if gpu_ids_str == "":
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
if gpu_ids_str == "NoDevFiles":
|
||||||
|
return []
|
||||||
|
|
||||||
return [int(i) for i in gpu_ids_str.split(",")]
|
return [int(i) for i in gpu_ids_str.split(",")]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue