Disable interactive mode on linux

I’m trying to profile my CUDA programs using nsight compute, but the process takes too long. I always the error the launch timed out and was terminated.

I found this link:
https://nvidia.custhelp.com/app/answers/detail/a_id/3029/~/using-cuda-and-x
I basically want to go for the fourth option and disable interactive mode.

I created an xorg.conf using the nvidia-xconfig command and added the line to disable interactive mode, my config file now looks as follows:
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 455.45.01

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option         "Interactive" "off"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

I then restarted my system, but the programs keep crashing because they take too long. Did I miss a step?

I eventually found the solution to my problem. There already existed an config file, although it was not in /etc/x11 where nvidia-xconfig creates the xorg.conf file. Editing the existing configuration worked just fine.

(The file on my machine was located in /etc/x11/xorg.conf.d and was called 90-mhwd.conf.)