# Openai\_ros using torch GPU

**URL:** <https://get-help.theconstruct.ai/t/openai-ros-using-torch-gpu/20517>\
**Category:** Open Discussions\
**Created:** [November 15, 2022, 11:10pm UTC](https://get-help.theconstruct.ai/t/openai-ros-using-torch-gpu/20517 "2022-11-15T23:10:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShuaiLee](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@ShuaiLee](https://get-help.theconstruct.ai/u/ShuaiLee)\
**Post date:** [November 15, 2022, 11:10pm UTC](https://get-help.theconstruct.ai/t/openai-ros-using-torch-gpu/20517/1 "2022-11-15T23:10:19Z")

</div>

hello, friends, I am learning examples using openai\_ros, I need to make the tensor run in CUDA, but when I call to\_device(‘cuda’), I cannot see the python is loaded to the gpu, seems if I do rosrun pkg\_name python\_code, it block the possible to run on gpu, any one has some insights ? thank u.

---

<div class="post-metadata">

**Author:** ![duckfrost2](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/duckfrost2/32/9365_2.png) [@duckfrost2](https://get-help.theconstruct.ai/u/duckfrost2)\
**Post date:** [November 17, 2022, 8:49am UTC](https://get-help.theconstruct.ai/t/openai-ros-using-torch-gpu/20517/2 "2022-11-17T08:49:24Z")

</div>

Hi,

Check the configuration of the running. Because it might be configured to NOT use CUDA.

---

<div class="post-metadata">

**Author:** ![ShuaiLee](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@ShuaiLee](https://get-help.theconstruct.ai/u/ShuaiLee)\
**Post date:** [November 17, 2022, 11:10pm UTC](https://get-help.theconstruct.ai/t/openai-ros-using-torch-gpu/20517/3 "2022-11-17T23:10:36Z")

</div>

appreciate your quick response ! Now I can settle this done, answer my own question,

1. rosrun will NOT block cuda function using pytorch
2. the reason why my code not loaded, it is my python code fault, forgot send whole tensor to cuda, it always report errors tensors not in the same device, so if u guys met the same issues, check your code, the rosrun basically equivalent to /bin/python _python\_ros\_node_

Just want ask another ros-Gazebo openai\_ros issue:

- openai\_ros need reset the Gazebo and controller or other plugins, millions times, I will met one issue is if u turn on the node loglevel to **loedebug** , when before or after reset, it will print _Connecting to \<ros\_master id\>_, and **stuck there for few seconds or even longer, and Gazebo will also freeze** , it slow down the training process, could u please provide some help on this issue ? great thanks !!  
sli

---

<div class="post-metadata">

**Author:** ![duckfrost2](https://get-help.theconstruct.ai/user_avatar/get-help.theconstruct.ai/duckfrost2/32/9365_2.png) [@duckfrost2](https://get-help.theconstruct.ai/u/duckfrost2)\
**Post date:** [November 22, 2022, 3:05pm UTC](https://get-help.theconstruct.ai/t/openai-ros-using-torch-gpu/20517/4 "2022-11-22T15:05:28Z")

</div>

No idea that issue why is happening. It might bee too much logging for the system.  
But I would have to take a deeper look into that

---

<div class="post-metadata">

**Author:** ![ShuaiLee](https://get-help.theconstruct.ai/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@ShuaiLee](https://get-help.theconstruct.ai/u/ShuaiLee)\
**Post date:** [November 30, 2022, 9:50pm UTC](https://get-help.theconstruct.ai/t/openai-ros-using-torch-gpu/20517/5 "2022-11-30T21:50:37Z")

</div>

thank u, probably web ros restrict the number of cpu core, when using local not web u probably can meet this issue, just try the pendulum, it has this issue

---

<div class="post-metadata">

**Author:** ![system](https://get-help.theconstruct.ai/uploads/default/original/2X/9/9d3ce8305cc0d0d9b6e07d15767a6f245c526f1b.jpeg) [@system](https://get-help.theconstruct.ai/u/system)\
**Post date:** [December 10, 2022, 9:50pm UTC](https://get-help.theconstruct.ai/t/openai-ros-using-torch-gpu/20517/6 "2022-12-10T21:50:47Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
