Use GPU for display
Some hosts may have a dual GPU, typically servers where a simple GPU is attached to the CPU and a NVIDIA GPU is added. Natively SENSR will always run its vehicle detection algorithm on the NVIDIA GPU. However for machines that do not have a display port on their GPU, SENSR's rendering may not be done through the GPU. This article explains how to render SENSR's native UI with a NVIDIA GPU in case it is not working out of the box.
Applicable environment
A host equipped with a NVIDIA GPU that does not have any display port.
SENSR single machine
To resolve this issue, modify the Docker Compose file used to run SENSR by following these steps:
Stop the running instance of SENSR.
Navigate to the installation directory:
cd /opt/sensr-singlemachine-installer
Open the
compose.yml
file with a text editor:sudo gedit compose.yml
Locate the
environment
section undermaster
and add the following lines:
```yaml
environment:
__NV_PRIME_RENDER_OFFLOAD: 1
__GLX_VENDOR_LIBRARY_NAME: nvidia
```
- Save the file and restart SENSR.
SENSR distributed system
The example below is for 3.4.12, for other SENSR version please just replace the version by the one in use.
Tag the Original Image First, create a backup tag for your existing master image to avoid losing it.
docker tag sensr_master:3.4.12 sensr_master:3.4.12-original
Create a New Dockerfile Create a Dockerfile in your current directory that uses the original image as a base and adds the required environment variables.
tee Dockerfile <<EOF
FROM sensr_master:3.4.12-original
ENV __NV_PRIME_RENDER_OFFLOAD=1
ENV __GLX_VENDOR_LIBRARY_NAME=nvidia
EOF
Build the New Image Build a new Docker image with the original tag. This replaces the old sensr_master:3.4.12 image with your new, modified one.
docker build . -t sensr_master:3.4.12
Run SENSR:
sr-launcher-cli run sensr
Verification
Run the following command to verify that argos_master is correctly allocated to the GPU:
nvidia-smi
After applying these changes, nvidia-smi should confirm that argos_master is now utilizing the NVIDIA GPU for rendering.