carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.54k stars 3.72k forks source link

carla docker + vnc with selected GPU #6693

Open AFKoschi opened 1 year ago

AFKoschi commented 1 year ago

Hello,

i use the docker version of carla to run it on a remote server.

CARLA version: carlasim/carla:0.9.12 Server: Platform/OS: Ubuntu 20.04.6 LTS GPUs: 4x Tesla T4

My goal is to get the carla spectator per VNC. So I expand the docker container with a VNC Server, a virtual Framebuffer and a window manager. VNC: x11vnc Virtual Framebuffer: xvfb Window Manager: fluxbox

My docker command was:

docker run --rm -it --privileged -p 22000:22000 -p 22001:22001 -p 5950:5900 --runtime=nvidia -e DISPLAY=:99 -e NVIDIA_VISIBLE_DEVICES=all -e  NVIDIA_DRIVER_CAPABILITIES=all -v /tmp/.X11-unix:/tmp/.X11-unix --name=carlasim carlasim/carla:0.9.12 /bin/bash

For test reasons i extended the carla container manual and also started the carla server manual.

My start command in the container was:

./CarlaUE4.sh -carla-server --world-port=22000

This Setup worked fine.

My Problem now is, that i have to use a specific GPU from the server for the docker container.

I have to use --privileged, without it I get an error message by starting the server in my extended container. (Setup like described above, but without --privileged) error message:

4.26.2-0+++UE4+Release-4.26 522 0
Disabling core dumps.
sh: 1: xdg-user-dir: not found
LowLevelFatalError [File:Unknown] [Line: 803]
VulkanRHI::vkGetPhysicalDeviceSurfaceFormatsKHR(Device.GetPhysicalHandle(), Surface, &NumFormats, nullptr) failed, VkResult=-13
 at /home/jenkins/UnrealEngine_4.26/Engine/Source/Runtime/VulkanRHI/Private/VulkanSwapChain.cpp:179
 with error
Signal 11 caught.
Malloc Size=65538 LargeMemoryPoolOffset=65554
CommonUnixCrashHandler: Signal=11
Malloc Size=131160 LargeMemoryPoolOffset=196744
Malloc Size=131160 LargeMemoryPoolOffset=327928
Engine crash handling finished; re-raising signal 11 for the default handler. Good bye.

So my question is their an opportunity, to tell the carla server which gpu it has to use. Or has someone a solution to start my container without --privileged so i can use NVIDIA_VISIBLE_DEVICES to set the gpu for the container.

Mariusmarten commented 10 months ago

This might potentially be a Docker-related question. You can specify the GPU the running Container is utilizing with the --gpu flag, see here: https://docs.docker.com/config/containers/resource_constraints/