Skip to content

Instantly share code, notes, and snippets.

@ashokpant
Last active October 15, 2024 08:56
Show Gist options
  • Save ashokpant/5c4e9481615f54af4025ab2085f85869 to your computer and use it in GitHub Desktop.
Save ashokpant/5c4e9481615f54af4025ab2085f85869 to your computer and use it in GitHub Desktop.
Install CUDA Toolkit v9.0 and cuDNN v7.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v9.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb)
CUDA_REPO_PKG="cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb"
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda-9-0
CUDA_PATCH1="cuda-repo-ubuntu1604-9-0-local-cublas-performance-update_1.0-1_amd64-deb"
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/patches/1/${CUDA_PATCH1}
sudo dpkg -i ${CUDA_PATCH1}
sudo apt-get update
# install cuDNN v7.0
CUDNN_PKG="libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb"
wget https://github.com/ashokpant/cudnn_archive/raw/master/v7.0/${CUDNN_PKG}
sudo dpkg -i ${CUDNN_PKG}
sudo apt-get update
# install NVIDIA CUDA Profile Tools Interface ( libcupti-dev v9.0)
sudo apt-get install cuda-command-line-tools-9-0
# set environment variables
export PATH=${PATH}:/usr/local/cuda-9.0/bin
export CUDA_HOME=${CUDA_HOME}:/usr/local/cuda:/usr/local/cuda-9.0
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-9.0/lib64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64
@UmerImran
Copy link

I have set the Environment variables correct but still nvcc --version is giving the result that it is not installed

@a5tr1
Copy link

a5tr1 commented May 15, 2018

thanks, i can use tensorflow in ubuntu 16.04 now

@ahundt
Copy link

ahundt commented May 30, 2018

This worked for me, thanks!

@Ohmat-Robotics
Copy link

Best!

@lychrel
Copy link

lychrel commented Jun 15, 2018

bless this

@jkh911208
Copy link

thanks

@amarv3142
Copy link

This is great. Thanks.

@IAMLYCHEE
Copy link

really good post, thanks a lot

@FriedRonaldo
Copy link

How surprise... really good. thx a lot

@waral
Copy link

waral commented Sep 5, 2018

thanks

@dwleeKAIST
Copy link

Awesome! Thanks.

@saber-zero
Copy link

Great! Thanks.

@Abdelrahman995
Copy link

Great!

@Pluckypan
Copy link

good job!

@Ferch42
Copy link

Ferch42 commented Apr 4, 2019

Thanks! It worked

@husnejahan
Copy link

The following packages have unmet dependencies:
cuda-9-0 : Depends: cuda-runtime-9-0 (>= 9.0.176) but it is not going to be installed
Depends: cuda-demo-suite-9-0 (>= 9.0.176) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I m getting error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment