I installed wsl2 Ubuntu on windows,
and then installed docker desktop to get a docker engine.
I ran a image from osrf/ros, the gazebo started sucessfully, but ran slowly.
And I checked the nvidia-smi, gazebo didn't use gpu to accerlate.
My question is how to setup the environment corretly to make gazebo use gpu?
I already searched a lot, but sadly that all failed for me.
And I can't run the container with --runtime=nvidia, the error msg is below
docker: Error response from daemon: unknown or invalid runtime name: nvidia.
nvidia-smi output in wsl2 ubuntu
nvidia-smi output in container
What I did:
docker pull osrf/ros:jazzy-desktop-full
docker run --name test -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -it --gpus all --device /dev/dri:/dev/dri --privileged -v /dev:/dev --env="NVIDIA_DRIVER_CAPABILITIES=all" --net=host osrf/ros:jazzy-desktop-full /bin/bash
I'm not sure that if I need to install Nvidia-Container-toolkit in wsl2. And the nvidia-smi can recognize the gpu, so I think there is no need.
but I have installed once, and it didn't work.
similar question:ROS2 on Windows with NVidia GPU
He gave up!!! So I have no choice./(ㄒoㄒ)/~~😢
No more words can describe my appreciation if someone fix it..