I’m trying to get GPU acceleration working for a docker image running on the Jetson AGX developer kit, running the latest JetPack 4.1.1 release.
I decided to build an Ubuntu-18.04 docker image to minimize the differences with the host Jetson AGX root filesystem.
libGL.so is present in cd /usr/lib/aarch64-linux-gnu/ for Ubuntu-18.04. I also compared the filesizes of the contents of all the libGL* files in the docker image and the host Jetson AGX rootfilesystem and the file sizes match. I have also applied all the binaries from the JetPack 4.1.1. driver package for Jetson AGX.
However, when I try to run glxgears, I get the following error:
$ LIBGL_DEBUG=verbose glxgears
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 154 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 31
Current serial number in output stream: 32
I’m running the docker container using the following script and adding a bunch of devices for GPU control. Perhaps I’m missing something here:
I found out that the docker container cannot access the GPU when running ./deviceQuery with user namespace remapping enabled.
If I disable docker user namespace remapping, CUDA-10.0 on Ubuntu-18.04 works. You should ensure that mesa-utils is also included in the image, so that for Ubuntu-18.04 it pulls in libglvnd0 as a dependency for deviceQuery to work.
glxgears still doesn’t run however.
Has anyone been able to get Docker OpenGL GPU apps working on Jetson AGX?
I went though your instructions once again and I noticed that I was missing the --net=host parameter in my docker run command. After I added that, glxgears works.
$ LIBGL_DEBUG=verbose glxinfo
name of display: :1
display: :1 screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
Here are the files for building a dockerimage for Jetson AGX using JetPack-4.1.1 and Ubuntu-18.04.
This Dockerfile includes several build tools because I’m using it as a base nvidia/opengl image for ROS development.
I’m mapping the /usr/local/cuda/lib64 folder, in this version of the Dockerfile, to the docker container. I plan on creating another nvidia/cudagl image later on, so I can have better control over the version of CUDA libraries included in the docker image to have better control when using specific versions of deep learning library frameworks.
The only issue I have with the current solution is that this doesn’t work with Docker user namespace remapping enabled.
build.sh
#!/bin/sh
BUILD_DATE=$(date -u +'%Y-%m-%d-%H:%M:%S')
CODE_NAME='bionic'
JETPACK_VERSION='4.4.1'
USER='developer'
USER_ID='1000'
TAG="jetpack-$JETPACK_VERSION-$CODE_NAME"
# use tar to dereference the symbolic links from the current directory,
# and then pipe them all to the docker build - command
tar -czh . | docker build - \
--build-arg REPOSITORY=arm64v8/ubuntu \
--build-arg TAG=$CODE_NAME \
--build-arg BUILD_VERSION=$JETPACK_VERSION \
--build-arg BUILD_DATE=$BUILD_DATE \
--build-arg USER=$USER \
--build-arg UID=$USER_ID \
--tag=jetson-agx/opengl:$TAG
Just came across this; thanks for putting this info out there. Is there a quick test you can propose that would verify that containers created from this image using this run script function as expected? I tried running glxgears and I received an error:
developer:~$ glxgears
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 154 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 27
Current serial number in output stream: 28
You mention that you are using this for ros development, which interests me as well. Do you have an example Dockerfile that extends the one you have already provided to allow running rviz in a container and viewing the gui on the host?
Edit: just saw the comments above about glxgears. I will add the --net=host option and retry
You’d need to use the --net=host option to get it to work.
This video shows a screen recording captured directly from an NVIDIA Jetson AGX Xavier, with ros running from within a docker container, with the AGX as the host.
You should be able to simply add the required ROS packages to your base OpenGL dockerfile and run rviz from a container session.
If you want to run docker container on the Jetson and get 3D accelerated desktop or window to appear on another desktop machine, take a look at these instructions here:
Read the section on setting up and using VirtualGL and TurboVNC.
Thank you for your response, though it still isn’t working as expected. Here are the files, for reference:
build.sh
#!/bin/sh
BUILD_DATE=$(date -u +'%Y-%m-%d-%H:%M:%S')
CODE_NAME='bionic'
JETPACK_VERSION='4.4.1'
USER='developer'
USER_ID='1000'
TAG="jetpack-$JETPACK_VERSION-$CODE_NAME"
# use tar to dereference the symbolic links from the current directory,
# and then pipe them all to the docker build - command
tar -czh . | docker build --network=host \
--build-arg REPOSITORY=arm64v8/ubuntu \
--build-arg TAG=$CODE_NAME \
--build-arg BUILD_VERSION=$JETPACK_VERSION \
--build-arg BUILD_DATE=$BUILD_DATE \
--build-arg USER=$USER \
--build-arg UID=$USER_ID \
--tag=jetson-agx/opengl:$TAG \
.
Please take a look at your scripts carefully. Just do a meld/diff of your files and some of the scripts that I originally posted here.
I did this at my end.
I noticed that you decided to add parameters to your scripts which are designed to work with nvidia-docker2 runtime on an x86_64 host, a package which is not yet available for aarch64. This is why you’re passing several gpu related device files to the container.