mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 02:01:24 +08:00
Speed up task submissions a bit (#5992)
This commit is contained in:
@@ -263,13 +263,22 @@ def get_cuda_visible_devices():
|
||||
return [int(i) for i in gpu_ids_str.split(",")]
|
||||
|
||||
|
||||
last_set_gpu_ids = None
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
global last_set_gpu_ids
|
||||
if last_set_gpu_ids == gpu_ids:
|
||||
return # optimization: already set
|
||||
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = ",".join([str(i) for i in gpu_ids])
|
||||
last_set_gpu_ids = gpu_ids
|
||||
|
||||
|
||||
def resources_from_resource_arguments(
|
||||
|
||||
Reference in New Issue
Block a user