Remove current nvidia driver and cuda
dpkg -l | grep nvidia
dpkg -l | grep cuda
sudo apt-get --purge remove nvidia-*
sudo apt-get --purge remove cuda-*
Install nvidia driver and cuda
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-driver-XXX (You can check the recommended version using this command : ubuntu-drivers devices after installing sudo apt install ubuntu-drivers-common)
Please go to the following web page: https://developer.nvidia.com/cuda-downloads and follow the Installation Instructions.
(this is an example for Ubuntu20.04, cuda11.0)
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.0.3/local_installers/cuda-repo-ubuntu2004-11-0-local_11.0.3-450.51.06-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-0-local_11.0.3-450.51.06-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-0-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
sudo reboot
Install cuDNN
echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64 /" | sudo tee /etc/apt/sources.list.d/nvidia-ml.list
sudo apt update
sudo apt install libcudnn8-dev
sudo reboot
or
go to https://developer.download.nvidia.com/compute/machine-learning/repos/ and download an appropriate version.
sudo dpkg -i libcudnn8_8.0.3.33-1+cuda11.0_amd64.deb
sudo dpkg -i libcudnn8-dev_8.0.3.33-1+cuda11.0_amd64.deb
or
go to https://developer.nvidia.com/rdp/cudnn-download and download an appropriate one.
sudo dpkg -i cudnn-local-repo-${OS}-8.x.x.x_1.0-1_amd64.deb
sudo apt-key add /var/cudnn-local-repo-*/7fa2af80.pub
sudo apt-get update
sudo apt-get install libcudnn8=8.x.x.x-1+cudaX.Y
sudo apt-get install libcudnn8-dev=8.x.x.x-1+cudaX.Y
To check if the installation is successful, please run the following command:
nvidia-smi
nvcc -V
cat /usr/include/cudnn.h | grep CUDNN_MAJOR - -A 2 or cat /usr/include/cudnn_version.h
(reference : https://qiita.com/daichildren98/items/acc1abcca37dfa521fea)
or follow the section "Verifying The Install On Linux" in here.
parted /dev/sdX
mklabel gpt
mkpart
Partition name? 1
File system type? ext4
Start? 0%
End? 100%
q
sudo mkfs -t ext4 /dev/sdX1
sudo mount /dev/sdX1 /mnt
pip uninstall numpy scipy
sudo apt install intel-mkl
create the following file at ~/numpy-site.cfg:
[mkl]
library_dirs = /usr/lib/x86_64-linux-gnu/
include_dirs = /usr/include/mkl
mkl_libs = mkl_rt
lapack_libs =
create the following file at ~/.config/pip/pip.conf:
[install]
no-binary = numpy,scipy
pip3 install --no-binary :all: numpy
pip3 install --no-binary :all: scipy
sudo apt-get install linux-image-4.4.0-93-generic
sudo apt-get install linux-headers-4.4.0-93
sudo apt-get install linux-headers-4.4.0-93-generic
sudo reboot
sudo apt-get remove nvidia* --purge
sudo apt-get autoremove
sudo apt-get update
(Download cuda driver like "NVIDIA-Linux-x86_64-384.111.run")
sudo service lightdm stop
sudo apt-get install linux-source
sudo bash ./NVIDIA-Linux-x86_64-384.111.run
sudo reboot now
古いカーネルの除去 (remove old kernels and headers)
uname -r で現状のバージョン確認
dpkg --get-selections | grep linux- でリスト表示
sudo apt-get autoremove --purge linux-headers-4.4.0-{128,130} で古いheader削除
sudo apt-get autoremove --purge linux-image-4.4.0-{128,130} で古いカーネル削除