Actor running on gpu

How severe does this issue affect your experience of using Ray?

  • None: Just asking a question out of curiosity
  • Low: It annoys or frustrates me for a moment.
  • Medium: It contributes to significant difficulty to complete my task, but I can work around it.
  • High: It blocks me to complete my task.

Hello, I would like to ask you a question about actor running on gpu.
When I create an actor, how can I asign a specified GPU to the actor.
For example, there are 8 gpus on my machine, like gpu[0,1,2,3,4,5,6,7]
but gpu[2, 3, 4, 6] is broken, I want to create 4 actors running on gpu[0,1,5,7].
How can I do that?
For some reason, I don’t want to use CUDA_VISIBLE_DEVICE , is there any other way to do this? Thanks for your reading.

Hi @DuoblaK , welcome to the community, and sorry for the delay in responding (the ray core team was stretched pretty thin by the 2.0 release rc)

Have you tried to specify the num_gpus=1 for your actor? I.e.

@ray.remote(num_gpus=1)
class ActorUsesOneGpu:
   def __init__(self):
          pass

...

actor = ActorusesOneGpu.remote()

Ray will automatically detect if GPUs are available on the various nodes, and reserve 1 GPU for the worker that will be running this actor.

You don’t have to specify CUDA_VISIBLE_DEVICE env variable on your own.

Does this address your problem?
There is a bit more info here if you haven’t landed on this doc before: GPU Support — Ray 3.0.0.dev0