Skip to content

Instantly share code, notes, and snippets.

@knzm
Last active June 25, 2016 10:11
Show Gist options
  • Save knzm/91f88e1703360a3904c7 to your computer and use it in GitHub Desktop.
Save knzm/91f88e1703360a3904c7 to your computer and use it in GitHub Desktop.
install CUDA 7.0 and cuDNN 6.5 v2 on Ubuntu 14.04
#!/bin/sh
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get install -y git subversion unzip
sudo apt-get install -y build-essential gfortran
sudo apt-get install -y python-virtualenv
sudo apt-get install -y python-dev
# For numpy and chainer
sudo apt-get install -y libatlas-base-dev libhdf5-dev
# For tensorflow building
sudo apt-get install -y default-jdk swig zip
git clone https://gist.github.com/91f88e1703360a3904c7.git
git clone https://bitbucket.org/knzm/wordembedding-experiments.git
cd 91f88e1703360a3904c7
sudo sh -e install.sh
cd ..
. /etc/profile.d/cuda.sh
HAS_CUDA=1
export HAS_CUDA
git clone https://[email protected]/knzm/wordembedding-experiments.git
cd wordembedding-experiments
(cd build; ./build_all.sh)
./install.sh
./setup_corpus.sh
# ./setup_venv.sh
./setup_venv_gensim.sh
./setup_venv_chainer.sh
./setup_venv_chainer_dev.sh master
./setup_venv_chainer_dev.sh improve-word2vec
./setup_venv_tensorflow_cpu.sh
cd ..
#!/bin/sh
cd wordembedding-experiments
HAS_CUDA=1 ./setup_venv_tensorflow_gpu.sh
cd ..
CUDA_PATH=/usr/local/cuda
PATH=${CUDA_PATH}/bin:${PATH}
LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH}
export CUDA_PATH
#!/bin/sh -e
### cuda
CUDA_VERSION=7.0
CUDA_PKG_VERSION=7-0
CUDA_REPO_VERSION=7.0-28
CUDA_DOWNLOAD_SUM=7570ef4b5cb5dd861b6e01732e20a0da3241c69f164bcb3348cfecba04230e85
curl -fsSL http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_${CUDA_REPO_VERSION}_amd64.deb -O
echo "${CUDA_DOWNLOAD_SUM} cuda-repo-ubuntu1404_7.0-28_amd64.deb" | sha256sum -c --strict -
dpkg -i cuda-repo-ubuntu1404_${CUDA_REPO_VERSION}_amd64.deb
apt-get update
apt-get install -y build-essential
apt-get install -y \
cuda-core-${CUDA_PKG_VERSION} \
cuda-license-${CUDA_PKG_VERSION} \
cuda-misc-headers-${CUDA_PKG_VERSION}
apt-get install -y \
cuda-nvrtc-${CUDA_PKG_VERSION} \
cuda-cusolver-${CUDA_PKG_VERSION} \
cuda-cublas-${CUDA_PKG_VERSION} \
cuda-cufft-${CUDA_PKG_VERSION} \
cuda-curand-${CUDA_PKG_VERSION} \
cuda-cusparse-${CUDA_PKG_VERSION} \
cuda-npp-${CUDA_PKG_VERSION} \
cuda-cudart-${CUDA_PKG_VERSION}
apt-get install -y \
cuda-driver-dev-${CUDA_PKG_VERSION} \
cuda-nvrtc-dev-${CUDA_PKG_VERSION} \
cuda-cusolver-dev-${CUDA_PKG_VERSION} \
cuda-cublas-dev-${CUDA_PKG_VERSION} \
cuda-cufft-dev-${CUDA_PKG_VERSION} \
cuda-curand-dev-${CUDA_PKG_VERSION} \
cuda-cusparse-dev-${CUDA_PKG_VERSION} \
cuda-npp-dev-${CUDA_PKG_VERSION} \
cuda-cudart-dev-${CUDA_PKG_VERSION}
apt-get install -y \
cuda-drivers \
cuda-command-line-tools-${CUDA_PKG_VERSION} \
nvidia-modprobe
ln -s cuda-${CUDA_VERSION} /usr/local/cuda
echo "/usr/local/cuda/lib" >> /etc/ld.so.conf.d/cuda.conf
echo "/usr/local/cuda/lib64" >> /etc/ld.so.conf.d/cuda.conf
ldconfig
cp cuda.env /etc/profile.d/cuda.sh
. /etc/profile.d/cuda.sh
### cuDNN
CUDNN_VERSION=6.5
CUDNN_PKG_VERSION=${CUDNN_VERSION}-linux-x64-v2
CUDNN_DOWNLOAD_SUM=4b02cb6bf9dfa57f63bfff33e532f53e2c5a12f9f1a1b46e980e626a55f380aa
curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v2/cudnn-${CUDNN_PKG_VERSION}.tgz -O
echo "${CUDNN_DOWNLOAD_SUM} cudnn-${CUDNN_PKG_VERSION}.tgz" | sha256sum -c --strict -
tar -xzf cudnn-${CUDNN_PKG_VERSION}.tgz
cp -a cudnn-${CUDNN_PKG_VERSION} /usr/local/cudnn-${CUDNN_VERSION}
ln -s cudnn-${CUDNN_VERSION} /usr/local/cudnn
ln -s /usr/local/cudnn/cudnn.h /usr/local/cuda/include/
ln -s /usr/local/cudnn/libcudnn* /usr/local/cuda/lib64/
ldconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment