I doubt this level of rigor will be actually necessary, but here’s how I would approach it:
- Familiarize yourself with the linux install guide: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
- Remove both NVIDIA GPUs from the system.
- Reinstall a clean copy of Ubuntu 16.04. Do not upgrade to the latest kernel, in fact do not upgrade anything, at all. If the kernel version is 4.10 or earlier, proceed. If it is 4.13, or later, stop, don’t use these instructions.
- Get the GUI working the way you want it.
- Remove nouveau entirely from the system:
sudo apt-get purge xserver-xorg-video-nouveau nouveau
- remove nouveau from the initrd image:
sudo update-initramfs -u
6a. It’s probably a good idea at this point to force your Linux install to use the intel integrated graphics. To do so, it may be necessary to create a xorg.conf file that calls out the integrated graphics specifically. The exact method to do this will vary by system and linux distro, but see continuing thread below. If things don’t work in step 9, it’s possible that this step 6a was not done correctly.
- power down
- install the NVIDIA GPUs
- power up. verify that the GUI is still working correctly through the intel graphics. If it is not, stop, do not follow these instructions.
- get the CUDA 9.1 local runfile installer from http://www.nvidia.com/getcuda Do not get the network installer. Do not get any .deb installer.
- run the runfile installer using sudo, and append the following switch to the command line:
- During runfile install, if prompted to install any kind of openGL libs, select no. If prompted to install any 32-bit compatibility libs, select no. If prompted to make any changes to xorg, or run nvidia-xconfig, select no.
- Perform the necessary post-install actions covered in the linux install guide. (update PATH and LD_LIBRARY_PATH)
That should work.
If things are working, and you at some time later choose to update or upgrade anything, and you don’t know what you are doing, the results may be not what you want. If you allow Ubuntu to install automatic updates or upgrades, that is a recipe for disaster. If you want to have things like automatic kernel upgrades, you’ll need to familiarize yourself a lot more with how the NVIDIA driver installation works, as well as related technologies like DKMS. Until I had things working, I would consider turning off any sort of automatic install or updating by Ubuntu, of anything, in step 2.