2018-03-22 01:16:56 +08:00
|
|
|
<h1>Running CARLA without Display and Selecting GPUs</h1>
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
!!! note
|
|
|
|
See [#225](https://github.com/carla-simulator/carla/issues/225) for an
|
|
|
|
alternative method.
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
This tutorial is designed for
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
* Remote server users that have several nvidia graphical cards and want to
|
|
|
|
effectively use CARLA on all GPUs.
|
|
|
|
* Desktop users who want to use the GPU that is not plugged on the screen for
|
|
|
|
rendering CARLA.
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
On this tutorial you will learn
|
|
|
|
|
|
|
|
* How to configure your server to have nvidia working on rendering without a
|
|
|
|
display attached.
|
|
|
|
* How to use VNC + VGL to simulate a display connected to any GPU you have in
|
|
|
|
your machine.
|
|
|
|
* And Finally, how to run CARLA in this environment
|
2018-01-24 22:30:54 +08:00
|
|
|
|
|
|
|
This tutorial was tested in Ubuntu 16.04 and using NVIDIA 384.11 drivers.
|
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
## Preliminaries
|
|
|
|
|
|
|
|
A few things need to be working in your server before. Latest NVIDIA Drivers,
|
|
|
|
OpenGL, VirtualGL(VGL), TurboVNC 2.11.
|
|
|
|
|
|
|
|
<h4>NVIDIA Drivers</h4>
|
|
|
|
|
|
|
|
Download and install [NVIDIA-drivers][nvidialink] with typical tutorials.
|
|
|
|
|
|
|
|
[nvidialink]: http://www.nvidia.es/Download/index.aspx
|
|
|
|
|
|
|
|
<h4>OpenGL</h4>
|
|
|
|
|
|
|
|
Openg GL is necessary for Virtual GL. Normally OpenGL can be installed through
|
|
|
|
apt.
|
2018-01-24 22:30:54 +08:00
|
|
|
|
|
|
|
sudo apt-get install freeglut3-dev mesa-utils
|
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
<h4>VGL</h4>
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
Follow this tutorial and install vgl:
|
|
|
|
[Installing VGL](https://virtualgl.org/vgldoc/2_2_1/#hd004001)
|
2018-01-29 21:23:28 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
<h4>TurboVNC</h4>
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
Follow the tutorial below to install TurboVNC 2.11:
|
|
|
|
[Installing TurboVNC](https://cdn.rawgit.com/TurboVNC/turbovnc/2.1.1/doc/index.html#hd005001)
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
WARNING: Take care on which VNC you install as it may not be compatible with
|
|
|
|
Unreal. The one above was the only one that worked for me.
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
<h4>Extra Packages</h4>
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
These extra packages were necessary to make unreal to work.
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
sudo apt install x11-xserver-utils libxrandr-dev
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
<h4>Configure your X</h4>
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
You must generate a X compatible with your nvdia and compatible to run without
|
|
|
|
display. For that, the following command worked:
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
|
2018-01-24 22:30:54 +08:00
|
|
|
|
|
|
|
## Emulating The Virtual Display
|
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
Run your own Xorg. Here I use number 7, but it could be labeled with any free
|
|
|
|
number
|
2018-01-24 22:30:54 +08:00
|
|
|
|
|
|
|
sudo nohup Xorg :7 &
|
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
Run an auxiliary remote VNC-Xserver. This will create a virtual display "8".
|
2018-01-24 22:30:54 +08:00
|
|
|
|
|
|
|
/opt/TurboVNC/bin/vncserver :8
|
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
If everything is working fine the following command should run smoothly.
|
2018-01-24 22:30:54 +08:00
|
|
|
|
|
|
|
DISPLAY=:8 vglrun -d :7.0 glxinfo
|
2018-03-22 01:16:56 +08:00
|
|
|
|
|
|
|
Note. This will run glxinfo on Xserver 7, device 0. This means you are selecting
|
|
|
|
the GPU 0 on your machine. To run on other GPU, such as GPU 1 run:
|
2018-01-24 22:30:54 +08:00
|
|
|
|
|
|
|
DISPLAY=:8 vglrun -d :7.1 glxinfo
|
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
<h4>Extra</h4>
|
2018-02-02 22:02:12 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
If you want disable the need of sudo when creating the 'nohup Xorg' go to the
|
|
|
|
'/etc/X11/Xwrapper.config' file and change 'allowed_users=console' to
|
|
|
|
'allowed_users=anybody'
|
2018-02-02 22:02:12 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
It may be needed to stop all Xorg servers before running nohup Xorg. The command
|
|
|
|
for that could change depending on your system. Generally for Ubuntu 16.04 you
|
|
|
|
should use:
|
2018-02-02 22:22:26 +08:00
|
|
|
|
|
|
|
sudo service lightdm stop
|
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
## Running CARLA
|
2018-02-02 22:02:12 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
Now, finally, to run CARLA on a certain gpu_number placed in a certain
|
|
|
|
$CARLA_PATH, run.
|
2018-01-24 22:30:54 +08:00
|
|
|
|
2018-03-22 01:16:56 +08:00
|
|
|
DISPLAY=:8 vglrun -d :7.<gpu_number> $CARLA_PATH/CarlaUE4/Binaries/Linux/CarlaUE4
|