diff --git a/python/ray/utils.py b/python/ray/utils.py index 152c4d1e4..dc07df371 100644 --- a/python/ray/utils.py +++ b/python/ray/utils.py @@ -15,6 +15,8 @@ import uuid import ray.gcs_utils import ray.ray_constants as ray_constants +logger = logging.getLogger(__name__) + def _random_string(): id_hash = hashlib.sha1() @@ -261,7 +263,8 @@ def get_cuda_visible_devices(): Returns: 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) @@ -271,6 +274,9 @@ def get_cuda_visible_devices(): if gpu_ids_str == "": return [] + if gpu_ids_str == "NoDevFiles": + return [] + return [int(i) for i in gpu_ids_str.split(",")]