# Ray tune with environment using GPU

**URL:** <https://discuss.ray.io/t/ray-tune-with-environment-using-gpu/734>\
**Category:** RLlib\
**Created:** [February 4, 2021, 8:42pm UTC](https://discuss.ray.io/t/ray-tune-with-environment-using-gpu/734 "2021-02-04T20:42:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![albheim](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@albheim](https://discuss.ray.io/u/albheim)\
**Post date:** [February 4, 2021, 8:42pm UTC](https://discuss.ray.io/t/ray-tune-with-environment-using-gpu/734/1 "2021-02-04T20:42:09Z")

</div>

So I have an environment doing some fluid dynamics on a gpu. I want to use some rllib algorithms and tune to train an agent in this environment. I don’t have a proper cuda for tensorflow and simulating the environment will still be the bottleneck so I don’t care enough to fix it. Can I assign a gpu to a worker without ray complaining that tensorflow can’t use it the gpu that was assigned?

The environment works fine without ray. The code running ray is pretty much just

```python
ray.init()
tune.run("PPO", config={"env": TestEnv, "num_workers": 1, "num_gpus_per_worker": 1}) 

```

which results in

```auto
...
RuntimeError: GPUs were assigned to this worker by Ray, but your DL framework (tf) reports GPU acceleration is disabled. This could be due to a bad CUDA- or tf installation.
...

```

---

<div class="post-metadata">

**Author:** ![sven1977](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sven1977/32/53_2.png) [@sven1977](https://discuss.ray.io/u/sven1977)\
**Post date:** [February 5, 2021, 2:55pm UTC](https://discuss.ray.io/t/ray-tune-with-environment-using-gpu/734/2 "2021-02-05T14:55:59Z")

</div>

Could you simply try to comment out this error in the code and see what happens?  
ray/rllib/evaluation/rollout\_worker.py:~508

---

<div class="post-metadata">

**Author:** ![albheim](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@albheim](https://discuss.ray.io/u/albheim)\
**Post date:** [February 8, 2021, 4:02pm UTC](https://discuss.ray.io/t/ray-tune-with-environment-using-gpu/734/3 "2021-02-08T16:02:08Z")

</div>

Before I saw this I actually just went and installed a full cuDNN so that tf would stop complaining to ray and that worked fine. But this seems like it would also solve my problem, I disabled the cuDNN installation and commented out the line for that error and it seems to run like it should.

Thanks for taking the time anyway!
