Robotics StackExchange | Archived questions

Gazebo doesn't use GPU when run inside a container

Hi Everyone, I have set up a singularity container (Ubuntu 16.04, Ros Kinetic, Gazebo 7.16), and I am running it on an HPC(high performance computing cluster). Everything is set up, I have access to Nvidia libraries, I can run OpenGL apps, and I also have CUDA. However, the gzserver and gzclient process refuse to use the GPU. This means that my robot's laser and camera render is stuck to 2 and 7 Hz. Does anyone know how can I force it? It is notable that the gazebo uses the GPU when I run the container on my own PC with Ubuntu 20.04 as a host. Any suggestions are welcome.

Asked by shantia on 2020-08-24 02:22:01 UTC

Comments

Di you solve your issue? I am sort of struggling with the same.

Asked by Basti on 2021-03-16 04:57:15 UTC

Answers

I have the same issue. I run ROS/gazebo in a docker container that runs on a remote computer (Ubuntu 18.04). The docker image is based on "nvcr.io/nvidia/cudagl:10.1-devel-ubuntu18.04", and has ROS Melodic, Gazebo 9.16 installed. Except for Gazebo, I can run other OpenGL/CUDA apps, I can even train neural networks on the GPU. But Gazebo won't use the GPU.

Another detail that could help the resolution: I have physical access to the remote machine, so I can run my code on it without ssh. When I do that, gazebo uses the GPU correctly.

Anyone have found a solution to fix this?


EDIT: FOUND A SOLUTION

It seems that gazebo server will not run on GPU if the $DISPLAY environment variable is not set to ":0".

Before running gazebo, execute:

export DISPLAY=:0

If you need to run other X applications through ssh (like RVIZ for example), reexport the right DISPLAY after gazebo has been launched

Asked by HuguesTHOMAS on 2021-03-29 14:39:16 UTC

Comments

Have you installed the nvidia docker container toolkit? https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html

Asked by chuckclaunch on 2021-06-22 20:16:38 UTC

Comments

I have a similar problem when running Ignition Gazebo on a remote machine over ssh. GPU is utilized only if a user is logged in and the docker is passed the existing display (although I run Gazebo headless). Any ideas?

Asked by Tomas on 2022-08-24 05:21:42 UTC

Comments