# Actor running on gpu

**URL:** <https://discuss.ray.io/t/actor-running-on-gpu/7052>\
**Category:** Ray Core\
**Created:** [August 2, 2022, 5:13pm UTC](https://discuss.ray.io/t/actor-running-on-gpu/7052 "2022-08-02T17:13:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DuoblaK](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/duoblak/32/2933_2.png) [@DuoblaK](https://discuss.ray.io/u/DuoblaK)\
**Post date:** [August 2, 2022, 5:13pm UTC](https://discuss.ray.io/t/actor-running-on-gpu/7052/1 "2022-08-02T17:13:52Z")

</div>

**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.

---

<div class="post-metadata">

**Author:** ![rickyyx](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rickyyx/32/2671_2.png) [@rickyyx](https://discuss.ray.io/u/rickyyx)\
**Post date:** [August 4, 2022, 10:33pm UTC](https://discuss.ray.io/t/actor-running-on-gpu/7052/2 "2022-08-04T22:33:56Z")

</div>

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.

```auto
@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](https://docs.ray.io/en/master/ray-core/tasks/using-ray-with-gpus.html)
