The solution to this problem is to force the operating system to start the graphics manager and make the GPU and CUDA available. There are two possible ways to achieve this.
The hardware solution is simple and minimally invasive. It involves inserting an emulator into the HDMI port that simulates the connection of a display, thus forcing the graphics engine to start.
You can find a "headless display emulator" device in all the most common online stores; we suggest getting an emulator that supports 4K resolution.
The software solution consists in forcing the starting of the X-server by modifying the file /etc/X11/xorg.conf.
Open a command-line terminal console and start editing the file with your favorite text editor, for example:
$ sudo gedit /etc/X11/xorg.conf # if you have a graphic interface
$ sudo nano /etc/X11/xorg.conf # if you do not have a graphic interface
$ sudo vi /etc/X11/xorg.conf # if you like old-style text editing
Search for the Section "Device" line and before the next EndSection line add the following:
Option "AllowEmptyInitialConfiguration" "true"
Save and reboot to apply the modification.