Headless with monitor connected (but ignored/disabled) and 'nvidia-settings' available

Hi folks, I am trying to achieve some complex settings with ‘xorg.conf’:

  1. Using the Intel GPU to display, and NVIDIA GPU to compute;
  2. With 'nvidia-settings' available (access to settings not configurable by 'nvidia-smi'); and
  3. With a monitor connected to the NVIDIA GPU via HDMI (HDMI-0), while it should be ignored/disabled.

I managed to achieve 1 & 2 with no monitor connected to NVIDIA GPU:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel" 
    Screen 1 "nvidia" 
EndSection

Section "Screen"
    Identifier     "intel"
    Device         "intel"
EndSection

Section "Device"
    Identifier     "intel"
    Driver         "intel"
    BusID          "PCI:0@0:2:0"
EndSection

Section "Screen"
    Identifier     "nvidia"
    Device         "nvidia"
    Option         "AllowEmptyInitialConfiguration" "on"
    Option         "RenderAccel" "off"
    Option         "Accel" "off"
    Option         "Coolbits" "24"
EndSection

Section "Device"
    Identifier     "nvidia"
    Driver         "nvidia"
    BusID          "PCI:1@0:0:0"
EndSection

I can also achieve 1 & 3 by simply removing or ‘Inactive’ the line ‘Screen 1 “nvidia”’. But then modifying settings that are unique in ‘nvidia-settings’ becomes very inconvenient.

The monitor is “double connected”: it is connected to NVIDIA GPU via HDMI (used on Windows), and connected to the Intel GPU (motherboard) via DisplayPort (used on Ubuntu). Therefore the monitor is active (or I need to crawl under the desk to disconnect it everytime).

Now I am trying to make the HDMI-connected monitor on NVDIA GPU disabled/ignored, while the NVIDIA (X) driver being loaded. I have tried Option “IgnoreDisplayDevices” “CRT, DFP, TV” and Option “UseHotplugEvents” “off” under the nvidia Screen Section, but they didn’t help. Currently the connected monitor causes 27% gpu utilisation, and also the cursor will be trapped by the “nvidia X Screen 1” when it moves out of the “intel Screen 0” (although I tried Option “ConstrainCursor” “off”, and “on”).

The system is Ubuntu 18.04. Driver is CUDA/Driver 418.67, installed with deb package. GPU is Titan Black.

PS. I have tried installing CUDA/Driver by runfile, but the --no-opengl-lib (or --no-opengl-files in driver runfile) doesn’t seem to stop the X server running on NVIDIA GPU (Option “Accel” “off” does, no matter runfile or deb). But if this is actually the correct way to go, I will try again.

Cheers