You will be setting up the GPU, and I will keep the procedure as a memorandum. In this article, we have installed ** NVIDIA-driver, cuda, cudnn ** and created a Python virtual environment using ** pyenv, virtualenv **. I hope it will be helpful as much as possible.
$ sudo apt update
$ sudo apt install vim
I want to use jj with vim, so edit ~ / .vimrc. (Temporarily I will only do this setting.)
~/.vimrc
set number
inoremap<silent> jj <ESC>
First, disable Nouveau. When it comes to Nvidia graphics cards, a driver called Nouveau is set by default, so add Nouveau to the blacklist.
$ lsmod | grep -i nouveau
$ sudo vim /etc/modprobe.d/blacklist-nouveau.conf
/etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
OK if the display resolution is low
$ sudo update-initramfs -u
$ sudo reboot
If you do not fix the kernel version of the nvidia driver, it seems that the dependency with the driver may be broken when upgrading. So, fix the kernel.
$ sudo apt install aptitude
aptitude: A text-based interface to the Debian GNU / Linux package system that allows you to view a list of packages and perform package management tasks such as installing, updating, and removing packages.
$ aptitude show linux-generic
version
)$ cd /etc/apt/preferences.d
$ sudo vim linux-kernel.pref
.linux-kernel.pref
Package: linux-generic
Pin: version 4.15.0.64.66
Pin-Priority: 1001
Package: linux-headers-generic
Pin: version 4.15.0.64.66
Pin-Priority: 1001
Package: linux-image-generic
Pin: version 4.15.0.64.66
Pin-Priority: 1001
That's all for fixing the kernel.
$ lsmod | grep -i nouveau
If nothing is displayed, it can be disabled
$ sudo apt install build-essential
$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt update
$ ubuntu-drivers devices
$ sudo apt install nvidia-driver-430
$ sudo reboot
$ nvidia-smi
OK if the usage status of GPU etc. is displayed
I wrote an article before, so please refer to that. I installed the NVIDIA driver on Ubuntu 17.10.
Please download cuda from here (https://developer.nvidia.com/cuda-toolkit-archive). Be sure to check the version of cuda and driver.
$ sudo apt update
$ sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.105-418.39_1.0-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-10-1-local-10.1.105-418.39/7fa2af80.pub
$ sudo apt update
$ sudo apt install cuda-10-1
~/.bashrc
export PATH="/usr/local/cuda-10.1/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH"
$ source ~/.bashrc
$ nvcc -V
$ nvidia-smi
Please download the cudnn installation file from here (https://developer.nvidia.com/rdp/cudnn-download). You will need to register for an account.
$ tar xvf cudnn-10.1-linux-x64-v7.6.5.32.tgz
$ sudo cp -a cuda/include/cudnn.h /usr/local/cuda/include/
$ sudo cp -a cuda/lib64/libcudnn* /usr/local/cuda/lib64/
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
$ sudo reboot
$ sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb
$ cp -r /usr/src/cudnn_samples_v7/ $HOME
$ cd $HOME/cudnn_samples_v7/mnistCUDNN
$ make clean && make
$ ./mnistCUDNN
OK if Test passed!
Is displayed
$ cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
$ sudo apt --fix-broken install
$ sudo apt install git gcc make openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev zlib1g-dev
** pyenv **: A command line tool for Python version control that makes it easy to install and switch between multiple versions of Python.
$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ source ~/.bashrc
$ pyenv install -l
$ pyenv install 3.6.5
$ pyenv versions
$ pyenv global 3.6.5
(2) virtualenv
** virtualenv **: Software that can create a separate Python virtual environment in one system. You can easily create a virtual environment with commands.
$ pip install virtualenv
$ virtualenv --version
$ virtualenv (PJ name) --no-site-packages
$ . (PJ name)/bin/activate
$ deactivate
I installed from Ubuntu this time, but the installation screen did not appear at first. The following settings were required on the BIOS screen.
--Secure Boot: os type UEFI mode ⇒ non-UEFI mode --CSM: Start CSM ⇒ Enabled
It took a while, but it was a good experience to set up this time because I gained some knowledge.
Recommended Posts