Running graphical CUDA sample over ssh from within l4t docker container

Have anyone managed to get graphical inputs over ssh from l4t docker container?
Running CUDA sample?
e.g. nbody?

In my case, I can run it from within the docker container in a way it plays on the monitor attached to Xavier directly.
However, the objective is to play the simulation on a remote computer’s display from where ssh session is executed.

Upd: It seems that it won’t work unless Host PC has gpu/CUDA
Reference:

I’m not sure why running an Xwindow via ssh that is using Jetson resources would require your local system have a GPU (as all the processing would be running on the Jetson and you would just be receiving graphical output.

Perhaps the sample program prevents opening remote windows?

D

The design of X is that events are sent to the X server, and rendering or use of the GPU driver is an interpretation of the X events. If you are logged in locally, then the events are automatically bound to the X server you are running in. If you run remotely, without forwarding, then X events will fail since it doesn’t know which server. If you run remotely, with forwarding, then what you are forwarding are the events to your local computer’s X server.

Note that once you forward events to the PC’s X server it is no longer the Jetson’s driver/GPU doing the work. If the host PC is instead doing the work, then that PC must have the right CUDA libraries, the right OpenGL libraries, so on.

The purpose of a virtual X server is to have the interface and bindings locally on a system without actually rendering to a monitor. CUDA and other X applications will happily talk to a virtual X server and won’t care about whether or not there is a monitor attached to that server.

Remote desktop software differs from forwarding software in that remote desktop software does not forward events…remote desktop software instead sends an actual compressed desktop image (changes to the buffer representing the desktop) instead of events being redirected. The ultimate headless Jetson consists of a virtual X server and remote desktop software.

Even if you have a regular user desktop on a Jetson you can still also have a remote desktop software installed…the best of both worlds. Even more interesting is the fact that you can have more than one X server, and so one can have both a virtual X server and an actual local monitor attached via a separate X server. The local physical monitor X server could use remote desktop software to view the virtual X server if desired.

NOTE: In all cases forwarding X events has many security restrictions. Special setups are required if one X session is to interact with a different X server. This is such a common practice under ssh that the “ssh -X” and “ssh -Y” options handle all of this for you. Even so, this is still just event forwarding, and not the GPU buffer being forwarded. Virtual desktop setup does something much like “ssh -X” or “ssh -Y”, but it does so with the results of events and not the actual events.

Think of the X server as an ABI for various events triggering GPU functionality.

Learn something new every day. 0]

Great writeup! Thanks!

D

@linuxdev:

Thank you for your inputs.

@linuxdev

What a fantastic writeup. That corrects a lot of what I used to know about X-forwarding! Thanks!