Skip to content

Instantly share code, notes, and snippets.

@dusenberrymw
Last active August 24, 2017 00:38
Show Gist options
  • Save dusenberrymw/9c5d7734056139cc5fdc67b272cb70dc to your computer and use it in GitHub Desktop.
Save dusenberrymw/9c5d7734056139cc5fdc67b272cb70dc to your computer and use it in GitHub Desktop.
Cuda + cuDNN Tips & Tricks

Cuda + cuDNN Tips & Tricks

Installation

CUDA + cuDNN Installation:

  • Install Cuda (2 options):

    • Download from NVIDIA website. Will install to /Developer/NVIDIA/CUDA=#-# (macOS / OS X), with symlinks in /usr/local/cuda/.
    • Alternatively, use brew cask install cuda.
  • Download CuDNN from NVIDIA website into local_cudnn_path, then:

    • sudo mkdir /usr/local/cudnn
    • sudo cp -r local_cudnn_path/* /usr/local/cudnn/
  • Setup paths in ~/.bash_profile:

    • export CUDA_HOME=/usr/local/cuda
    • export CUDNN_HOME=/usr/local/cudnn
    • macOS / OS X:
      • export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$CUDA_HOME/lib:$CUDNN_HOME/lib
    • Linux:
      • sudo apt-get install libcupti-dev
      • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64:$CUDNN_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64
  • Test:

    cp -r /usr/local/cuda/samples ~/cuda-samples
    pushd ~/cuda-samples
    make
    popd
    ~/cuda-samples/bin/x86_64/darwin/release/deviceQuery
    
  • Troubleshoot Failed to initialize NVML: Driver/library version mismatch error (via https://stackoverflow.com/a/45319156):

    sudo rmmod nvidia_drm
    sudo rmmod nvidia_modeset
    sudo rmmod nvidia_uvm
    sudo rmmod nvidia
    nvidia-smi
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment