You don't want Xorg to use your NVIDIA gpu. Need to blacklist nouveau and nvidia-drm.
In the created file /etc/modprobe.d/blacklist-nouveau.conf
:
blacklist nouveau
options nouveau modeset=0
In the file /etc/modprobe.d/blacklist-nvidia-drm.conf
:
blacklist nvidia-drm
alias nvidia-drm off
Check the available drivers:
$ sudo apt-add-repository ppa:graphics-drivers
$ sudo apt update
$ ubuntu-drivers devices
Install recommended drivers (mine is nvidia-driver-396):
$ sudo apt install nvidia-driver-396
Now reboot your computer, then run nvidia-smi
to check if drivers were installed correctly
$ sudo ./cuda_9.0.176_384.81_linux-run --override --no-opengl-libs
Do you accept the previously read EULA?
accept
You are attempting to install on an unsupported configuration. Do you wish to continue?
yes
Install NVIDIA Accelerated Graphics Driver for Linux-...?
no
Install the CUDA 9.0 Toolkit?
yes
Enter Toolkit Location
[default]
Do you want to install a symbolic link at /usr/local/cuda?
yes
Install the CUDA 9.0 Samples?
yes
Enter CUDA Samples Location
/usr/local/cuda-9.0
Add following to .bashrc
:
export PATH=/usr/local/cuda-9.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH
copy cuDNN files to cuda location.
Here is a short summary for blacklist part:
Note:
You should run this commands with
sudo
.