First make sure you have the restricted repositories enabled.
they are in /etc/apt/sources.list, and probably commented out with a #. Delete the # at the beginning of the line. You may have a few like:
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main universe multiverse restricted #Added by software-properties
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main universe multiverse restricted #Added by software-properties
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb-src http://security.ubuntu.com/ubuntu xenial-security main universe multiverse restricted #Added by software-properties
Then update your package index:
sudo apt-get update
The nvidia 375 pacakges are the ones which are the latest available in the standard repositories, but 381 is available if you want to try -- it fixes some sleep induced artifacts, but is not as well tested.
My setup is a quadro 1000M, and the nvidia 375 packages I have are:
Clean out all the previous nvidia package you installed, and check that there are no blacklist lines for nvidia in any file in /etc/modprobe.d
Install all the above with:
sudo apt-get install nvidia-375 nvidia-375-dev nvidia-modprobe nvidia-opencl-icd-375 nvidia-prime nvidia-settings
Reboot and see if the nvidia driver is being used:
sudo lshw -C video
You should have in /etc/modprobe.d two files, nvidia-375_hybrid.conf and nvidia-375_hybrid.conf which have a lines which blacklist the nouveau driver and remove any alias. Check that no nouveau is in /etc/modules and that there is nothing in /etc/rc.local that loads nouveau. Finally, check the dmesg output, no nouveau should be seen:
dmesg |grep nouveau
The dmesg output for nvidia should look something like:
$ dmesg |fgrep -i nvidia
[ 1.145050] nvidia: module license 'NVIDIA' taints kernel.
[ 1.150438] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[ 1.154278] nvidia 0000:01:00.0: enabling device (0000 -> 0003)
[ 1.154407] nvidia-nvlink: Nvlink Core is being initialized, major device number 244
[ 1.154417] NVRM: loading NVIDIA UNIX x86_64 Kernel Module 375.39 Tue Jan 31 20:47:00 PST 2017 (using threaded interrupts)
[ 1.155859] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms 375.39 Tue Jan 31 19:41:48 PST 2017
[ 1.156840] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[ 14.454118] nvidia-uvm: Loaded the UVM driver in 8 mode, major device number 240
[ 35.821752] nvidia-modeset: Allocated GPU:0 (GPU-821d0db5-a56d-9fdf-72cc-d0eab575873a) @ PCI:0000:01:00.0
Finally, lsmod should contain several nvidia modules and no nouveau.
With the nvidia driver installed, you should be able to install the Intel cuda .deb package. with
Then using apt-get install the cuda and cuda-toolkit, those should bring in many other cuda packages.
Read the Intel instructions, adding the CUDA location to your PATH and LD_LIBRARY_PATH
Copy the samples from the cuda install directory to your home or any place you have write permission, so you can run the make to build the samples. Also, I assume you have your g++ installed, and maybe build-essential The gcc should be present by default, and 16.04 has the right versions (5) for the compilers.