GPU Cuda and CuDNN

GPU

  • look up GPU information: lspci or lshw -C display

  • NVIDIA system management interface, monitor GPU usage: nvidia-smi

GPU Driver

  • check the latest driver information on http://www.nvidia.com/Download/index.aspx. Then, look up driver information on local machine: cat /proc/driver/nvidia/version

  • Install NVIDIA GPU driver using GUI: Software & Updates -> Additional Drivers

  • Install NVIDIA GPU driver using apt-get

    1
    2
    3
    sudo add-apt-repository ppa:Ubuntu-x-swat/x-updates
    sudo apt-get update
    sudo apt-get install nvidia-current nvidia-current-modaliases nvidia-settings
  • Install NVIDIA GPU driver using *.run file downloaded from http://www.nvidia.com/Download/index.aspx

    1. Hit CTRL+ALT+F1 and login using your credentials.
    2. Stop your current X server session by typing sudo service lightdm stop
    3. Enter runlevel 3 by typing sudo init 3 and install your *.run file.
    4. You might be required to reboot when the installation finishes. If not, run sudo service lightdm start or sudo start lightdm to start your X server again.

CUDA

When using anaconda to install deep learning platform, sometimes it is unnecessary to install CUDA by yourself.

  1. Preprocessing

    • uninstall the GPU driver first: sudo /usr/bin/nvidia-uninstall or sudo apt-get remove --purge nvidia* and sudo apt-get autoremove; sudo reboot
    • blacklist nouveau: add “blacklist nouveau” and “options nouveau modeset=0” at the end of /etc/modprobe.d/blacklist.conf; sudo update-initramfs -u; sudo reboot
    • Stop your current X server session: sudo service lightdm stop
  2. Install Cuda

    Download the *.run file from NVIDIA website

  3. check Cuda version after installation: nvcc -V. Compile and run the cuda samples.

CuDNN

CuDNN is to accelerate Cuda, from https://developer.nvidia.com/rdp/form/cudnn-download-survey, just download compressed package.

1
2
3
cd $CUDNN_PATH	
sudo cp include/* /usr/local/cuda/include/
sudo cp -P lib64/* /usr/local/cuda/lib64/ #use -P to retain symbolic links