X server on NVIDIA card with no screen

Solution 1:

I don't know if this is 'the best way', but it's how I do it.

Use nvidia-settings GUI to make a edid file for a screen

Then in the terminal of your choice paste or write:

sudo nvidia-xconfig -a --allow-empty-initial-configuration \
--use-display-device="DFP-0" --connected-monitor="DFP-0" \
--custom-edid="DFP-0:/home/$USER/edid.txt" 

sudo reboot

To add GPU(s) and screens to xorg.conf.

If you want to be able to overclock and control the fan(s) as well, add '--cool-bits=12' (or whatever NVIDIA documentation says is applicable for your driver) to the 'nvidia-xconfig' line on the top.

If you don't have a way of making a edid file, or can't find one here is the one I use:

00 ff ff ff ff ff ff 00 1e 6d f5 56 71 ca 04 00 05 14 01 03 80 35 1e 78 0a ae c5 a2 57 4a 9c 25 12 50 54 21 08 00 b3 00 81 80 81 40 01 01 01 01 01 01 01 01 01 01 1a 36 80 a0 70 38 1f 40 30 20 35 00 13 2b 21 00 00 1a 02 3a 80 18 71 38 2d 40 58 2c 45 00 13 2b 21 00 00 1e 00 00 00 fd 00 38 3d 1e 53 0f 00 0a 20 20 20 20 20 20 00 00 00 fc 00 57 32 34 35 33 0a 20 20 20 20 20 20 20 01 3d 02 03 21 f1 4e 90 04 03 01 14 12 05 1f 10 13 00 00 00 00 23 09 07 07 83 01 00 00 65 03 0c 00 10 00 02 3a 80 18 71 38 2d 40 58 2c 45 00 13 2b 21 00 00 1e 01 1d 80 18 71 1c 16 20 58 2c 25 00 13 2b 21 00 00 9e 01 1d 00 72 51 d0 1e 20 6e 28 55 00 13 2b 21 00 00 1e 8c 0a d0 8a 20 e0 2d 10 10 3e 96 00 13 2b 21 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 26

Save to edid.txt in home directory of your user, or change location in configuration line.

If you enable overclocking and want to use a screen on your main GPU:

sudo nano /etc/X11/xorg.conf

Remove lines:

Option         "UseDisplayDevice" "DFP-0"
Option         "CustomEDID" "DFP-0:/home/nv/edid.bin"
Option         "ConnectedMonitor" "DFP-0"

from the 'Section "Screen"' that has your GPUID with screen attached and assigned to it.

Overclocking!

Power limit:

sudo nvidia-smi -i GPUID -pl WATTLIMIT

Core clock:

nvidia-settings -c :0 -a [gpu:GPUID]/GPUGraphicsClockOffset[3]=16

:0 is the X screen assigned to GPU, GPUID is as guessed the number of the GPU (counting from 0).

16 == offset.

Use negative numbers to underclock.

Memory clock:

nvidia-settings -c :0 -a [gpu:GPUID]/GPUMemoryTransferRateOffset[3]=1200

If you are used to Afterburner etc. you have to double the offset values in Linux(circa).

I always get more juice out of my cards on a Linux system(for my use)

Enable and control fan(s) manually:

nvidia-settings -c :0 -a [gpu:GPUID]/GPUFanControlState=1
nvidia-settings -c :0 -a [fan:GPUID]/GPUTargetFanSpeed=85

Set GPUFanControlState back to 0 to disable manual control.

GPUTargetFanSpeed takes an integer from 0 to 100 as input.

Check temperature, power usage etc.:

nvidia-smi

If process gets locked in a low power state by GPU, the only workaround I found was to create an application profile, there was/is no way to control P state. At least on consumer cards.

Here is the process:

cd ~/.nv
cat > nvidia-application-profiles-rc

Paste this template:

{
"rules": [
    {
        "pattern": {
            "feature": "procname",
            "matches": "NameOfRunningProcessThatWantsMorePriority"
        },
        "profile": "ProfileNameWhatever"
    }
],
"profiles": [
    {
        "name": "ProfileNameWhatever",
        "settings": []
    }
]
}

Press enter then CTRL + C before you edit with whatever suits your taste.

Start your process and type nvidia-smi to get the process name to use in the application profile.

Alternatively, if you have access to the GUI you can make the application profile there.

To keep custom power limit(s) across reboots "Persistence Mode" has to be enabled.

To enable it on all GPU's:

sudo nvidia-smi -pm 1

To enable it on a specific GPU:

sudo nvidia-smi -i GPUID -pm 1

Persistence Mode will help with speed if running headless and running several small processes after each other, as GPU does not go to sleep between jobs, this will reduce time to process many small tasks a good deal!
Will raise idle consumption when activated!

ADDITIONAL INFO WHEN USING lightdm !!
Regular methods produce problems on newer Ubuntu systems

Like everything else actually configuring stuff, use root account or sudo

Fan control:

# DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 nvidia-settings -c :0 -a [gpu:GPUID]/GPUFanControlState=1
# DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 nvidia-settings -c :0 -a [fan:GPUID]/GPUTargetFanSpeed=70

Over/underclock:

# DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 nvidia-settings -c :0 -a [gpu:GPUID]/GPUGraphicsClockOffset[3]=64
# DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 nvidia-settings -c :0 -a [gpu:GPUID]/GPUMemoryTransferRateOffset[3]=1100

# == root, or sudo

If problems arise when everything is running(or not), NVIDIA has posted some nice queries for troubleshooting:

Useful nvidia-smi Queries

Other;

ArchLinux Wiki's Tips and Tricks on NVIDIA

xconfig appendix NVIDIA driver 384.98

Just change driver version in URL to your driver version, and you'll be on the right track.