I want to specifically set a actor to a GPU device, with out set CUDA_VISIBALE_DEVICES, how can I do this? BTW, I found the the assignment schedule is not round robin, there are some randomness.
@ray.remote(num_gpus=0.25)
class Worker:
def __init__(self):
pass
def show(self):
self.gpu_id = ray.get_gpu_ids()[0]
print(f"#GPU{self.gpu_id}")
return self.gpu_id
worker_0 = Worker.options(num_gpus=0.25).remote()
worker_1 = Worker.options(num_gpus=0.25).remote()
worker_2 = Worker.options(num_gpus=0.25).remote()
worker_3 = Worker.options(num_gpus=0.25).remote()
worker_4 = Worker.options(num_gpus=0.25).remote()
worker_5 = Worker.options(num_gpus=0.25).remote()
worker_6 = Worker.options(num_gpus=0.25).remote()
worker_7 = Worker.options(num_gpus=0.25).remote()
worker_0 = ray.get(worker_0.show.remote())
worker_1 = ray.get(worker_1.show.remote())
worker_2 = ray.get(worker_2.show.remote())
worker_3 = ray.get(worker_3.show.remote())
worker_4 = ray.get(worker_4.show.remote())
worker_5 = ray.get(worker_5.show.remote())
worker_6 = ray.get(worker_6.show.remote())
worker_7 = ray.get(worker_7.show.remote())
print([worker_0, worker_1,worker_2,worker_3,worker_4,worker_5,worker_6,worker_7])```