Some background on how the GPU is used with both a graphical desktop and CUDA might help you, so read on if ambitious…
Under Linux the video display (the GUI) is separate from the kernel. Even command line text-only login is separate from the operating system. The “shell” is the text only interface to the “kernel”, and all operating systems have a kernel, but some integrate graphics or other features directly into the kernel and thus are not separable. In Linux the operating system can be functioning perfectly even without any GUI or text interface.
The GUI on Linux is performed by a server known as the “X server”, and uses the X11 protocol (there are alternatives, but this is the default in most installations, e.g., you might see references to Wayland/Vulkan, but it isn’t unusual these are just layers adapting to X11 protocols). There is an environment variable which identifies the X server in use, the “DISPLAY” environment variable. A user ID and “DISPLAY” are associated together to allow GUI access.
The NVIDIA hardware-accelerated driver plugs in dynamically to the X server, and the X protocols adapt to the binary driver. People often think that X is a GUI, but it isn’t…it is simply a predefined set of protocols for talking to a buffer with certain properties, and almost always that buffer has a computer monitor attached to it. For hardware-acceleration, it is really the NVIDIA driver performing the buffer access. In the case of CUDA, this is also true…CUDA tends to talk to the NVIDIA driver, but usually via talking to the X server and the X server binds to the driver.
No X server, then no GUI. And no CUDA. There are exceptions, but for almost everything you see there won’t be an exception. If you have an X server, but nobody is logged in to it, then you don’t have an X server because a session requires a user ID. If you have a user, but that user isn’t logged in to the server which the DISPLAY environment variable points at, then you don’t have a GUI, and you don’t have CUDA. Ssh may talk to the remote system, but if the command you issue does not name a valid combination of user ID and DISPLAY, then it won’t work.
X is very flexible, in that one Linux system can run an X server (call it the PC), and the remote system can relay X11 protocol messages from a system without a GUI (call it the Nano) to the current system. If the Nano has been given permission, then it can relay the X11 protocol to the host and whatever you run on the Nano will pop up on the host PC. This is not always what you want and may have results you don’t expect, but to start with Windows does not have an X server unless you’ve installed something like a Cygwin emulation. This isn’t what you want (explained later).
When one Linux system forwards X11 protocols to another, then it is this other system doing the actual CUDA or hardware accelerated GUI rendering. So if you run a GUI or CUDA command on a Nano, but display it to the PC, then the Nano never uses its GPU, and the Nano won’t require a display…all of those requirements fall to the displaying PC.
The X server has both “physical” and “virtual” versions available. The physical version, with a user logged in, would display anything the ssh command runs if the the ssh is logged in to the same user name and if the DISPLAY variable is pointed at the Jetson’s display. If you want to operate “headless” (without a real monitor), then you need a virtual X server. The X server does not care if the buffer associated with it is being examined by a real monitor, or by RAM emulating a monitor. If you are not displaying something (or perhaps even if you are), then there is no reason to attach a monitor. The side effects of the CUDA might end up streaming over a web server or to a file and you wouldn’t care about physical display. The virtual X server is perfect for that.
Desktop sharing protocols, such as various VNC servers you hear about, even the ones on Windows, can talk to a virtual server and then even Windows can have a GUI up from the Jetson. Your remote ssh commands would be run on the Nano by associating a user and DISPLAY to the virtual server, and then some custom virtual desktop sharing software can become the desktop on Windows or another Linux system without any CUDA or X server being required on the PC viewing the desktop.
So on your Nano, log in to the GUI. Open a text console, and see what DISPLAY it is like this:
Probably it will be “:0” (the traditional first X server…you can run more than one), or maybe “:1” (some of the recent L4T releases use that). If the user you logged in to is named “ubuntu”, and if DISPLAY is “:0”, then from ssh you can run a command like this:
...any GUI command...
The first form stores the environment variable for future commands as well as current. The latter form exists for only one command.
So about X11Forwarding…if Windows doesn’t have an X server, then you can’t forward…well you can forward, but Windows doesn’t know what it is.
One choice: Install a virtual server on the Nano, and a remote desktop client on Windows.
Another choice: Log in to the Nano GUI, and run commands with that associated DISPLAY.
This is a lot less complicated under Linux because by default all of the desktop distributions come with X.