Skip to content

Instantly share code, notes, and snippets.

@oitsjustjose
Last active August 1, 2019 16:40
Show Gist options
  • Save oitsjustjose/36c82a5c67084c21ae4b72475139aeae to your computer and use it in GitHub Desktop.
Save oitsjustjose/36c82a5c67084c21ae4b72475139aeae to your computer and use it in GitHub Desktop.
Setting up CUDA Toolkit & CUDNN

Installation Process:

  1. Download and install CUDA toolkit 10.0 - get the runfile if on linux If you have an issue the first time running with an error such as "Unsupported compiler", run using the --override switch, for example:

    sh cuda_10.0.130_410.48_linux.run --override

    Do not install the driver

  2. Download cuDNN v7.6.2 for CUDA 10.0 -- but do not download the .deb variants if on Linux.

  3. Extract the cuDNN tarball anywhere, then CD into it, then use the following command:

    sudo cp -r * /usr/local/cuda-10.0/

  4. Add the relevant CUDA folders to your PATH via (on Unix / Linux):

    export CUDA_HOME=/usr/local/cuda

    export LD_LIBRARY_PATH=${CUDA_HOME}/lib64

    export PATH=${CUDA_HOME}/bin:${PATH}

    To make these persist, add these to your ~/.bashrc, ~/.zshrc, ~/.bash_profile, etc.

  5. Install Tensorflow for GPU (tensorflow-gpu) or PyTorch (torch) and test:

TF:

import tensorflow as tf
sess = tf.Session()

PyTorch:

import torch
# Returns true if CUDA is working
torch.cuda.is_available()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment