So I just setup my new dev box with the integrated graphics driving the display. This is important since you generally don’t want to debug on the same gpu as is driving the display and your system UI wont get bogged down when running gpu kernels. This is also known as a “headless” gpu config. I figured I’d share this knowledge as it was non-trivial to figure out.
I installed linux without any gpu cards installed and with the display connected to the Intel integrated graphics.
You can now install your gpus, but make sure the bios is configured to specifically use the integrated graphics (not in auto mode).
Download the latest runfile graphics driver (and not a package install).
Run it like this:
sudo ./NVIDIA-Linux-x86_64-370.28.run --no-opengl-files --no-x-check --disable-nouveau
–no-opengl-files is the key option that makes this work. We don’t want to overwrite the Intel opengl setup which is important for compiz.
–no-x-check allows us to install the driver without stopping X.
–disable-nouveau is there just in case you do want to drive the display from a gpu at some point.
When prompted don’t configure X (we don’t want to mess with the current X config).
If you’re under UEFI have the installer generate a key pair for you and save those for future driver updates. Put the pub key on a usb stick and append it to the DB store in your bios.
Now with the driver installed, you need some way to load it that isn’t through X. You can use an nvidia-docker instance, but a much lighter weight option is to use the persistence daemon:
There’s a super simple installer contained in /usr/share/doc/NVIDIA_GLX-1.0/sample/nvidia-persistenced-init.tar.bz2. I’d also add the --persistence-mode to the daemon init script. That extra flag seems to make the driver a bit snappier to engage. The persistence daemon works just fine with consumer GPUs (despite the claim otherwise).
Now you can install cuda, but don’t install the driver included in that package.