# RLlib in conjuncton with GPU env

**URL:** <https://discuss.ray.io/t/rllib-in-conjuncton-with-gpu-env/5611>\
**Category:** RLlib\
**Created:** [March 30, 2022, 10:34am UTC](https://discuss.ray.io/t/rllib-in-conjuncton-with-gpu-env/5611 "2022-03-30T10:34:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blubberblub](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/blubberblub/32/1396_2.png) [@Blubberblub](https://discuss.ray.io/u/Blubberblub)\
**Post date:** [March 30, 2022, 10:34am UTC](https://discuss.ray.io/t/rllib-in-conjuncton-with-gpu-env/5611/1 "2022-03-30T10:34:10Z")

</div>

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

- High: It blocks me to complete my task.

**Setting:** I have created a hierarchical multi-agent environment based on the python MultiAgentEnv class. The environment uses GPU resources for calling complex calculations embedded in a c++ library.  
**What is working:** When i run the env on its own with simulated action dicts it runs fine.  
**Problem:** When i want to train with tune the c++ library doesn’t detect my CUDA device anymore.  
**Question:** How does ray RLLib/Tune affect the GPU availability when a cluster is started? Would it solve the problem to use an ExternalEnv?

---

<div class="post-metadata">

**Author:** ![Aidan\_McLaughlin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/aidan_mclaughlin/32/3778_2.png) [@Aidan\_McLaughlin](https://discuss.ray.io/u/Aidan_McLaughlin)\
**Post date:** [March 28, 2023, 7:33pm UTC](https://discuss.ray.io/t/rllib-in-conjuncton-with-gpu-env/5611/2 "2023-03-28T19:33:56Z")

</div>

Having a similar issue; I opened a question too. It seems that RLLIB sets CUDA\_VISIBLE\_DEVICES = 0 when the env is initialized. This makes sense, as the requested resources is used.

However, (it sounds like this is your case, too), there seems to be a problems when specifying fractional resources, which should be the natural solution. Curious to hear if you’ve resolved this!

---

<div class="post-metadata">

**Author:** ![Blubberblub](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/blubberblub/32/1396_2.png) [@Blubberblub](https://discuss.ray.io/u/Blubberblub)\
**Post date:** [March 29, 2023, 6:20am UTC](https://discuss.ray.io/t/rllib-in-conjuncton-with-gpu-env/5611/3 "2023-03-29T06:20:20Z")

</div>

@Aidan_McLaughlin I’m not completely sure what solved the issue in the end but with the newer ray versions i din’t have any issue regarding this. We had some raytracer built with NVIDIAoptix in our env. However we moved away to a different solution but our env still uses GPU. We are currently on 3.0.0.dev0 and everything works fine. What version are you using?
