I followed the advanced instructions provided on this Gist but it failed. Therefore I ran the following commands
sudo apt purge nvidia*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-381
#sudo systemctl stop lightdm
#sudo systemctl start lightdm
This requires to disable secure boot. Reboot without secure boot.
Check whether it works with
nvidia-smi
You must see a table with driver informations.
Go to this page. Download the .deb
file corresponding to your system and follow the instructions.
Make sure to still use the driver "nvidia-381" after Cuda installation (go to "Softwares and Updates", then "additional drivers"). You may have to reboot (in insecure mode) your computer. Check that nvidia-smi
is still working.
In your .bashrc
(or .zshrc
...) add the following lines
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
Download cudnn binding here and put the lib64
folder into your LD_LIBRARY_PATH
: (I named the downloaded folder cuda-cudnn
)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-cudnn/lib64
If Torch is not yet installed on your system, go to the Torch installation page and follow the instructions. Normally the installation process will detect CUDA and install cutorch, cunn and cudnn.
Otherwise if Torch is already installed, run
luarocks install cutorch cunn cudnn
To see if it worked launch Torch and import cutorch
, cunn
and cudnn
:
Run th
and
require 'cutorch'
require 'cunn'
require 'cudnn'