There is a way to manage the CUDA Toolkit by using nvidia-docker, but this time I installed the CUDA Toolkit directly without using it.
I used runfile (cuda_8.0.44_linux.run) to install the CUDA Toolkit.
If Secure Boot is enabled, disable it beforehand. Go to tty1 with Ctrl + Alt + F1 and install the nvidia-smi command and driver. On the way, you will be asked if you want to rewrite the X11 settings. If you rewrite it, the screen will not be displayed, so we recommend that you do not rewrite it. Please reboot once after the installation is completed.
sudo service lightdm stop #Drop X11
sudo ./NVIDIA-Linux-x86_64-<version>.run # nvidia-The smi command should be installed
sudo reboot
If the output of the nvidia-smi
command looks like this, the GPU has been detected.
$nvidia-smi
Mon Aug 15 15:31:22 2016
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 361.77 Driver Version: 361.77 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce 940M Off | 0000:01:00.0 Off | N/A |
| N/A 59C P0 N/A / N/A | 254MiB / 2003MiB | 8% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 4105 G /usr/lib/xorg/Xorg 165MiB |
| 0 4988 G fcitx-qimpanel 7MiB |
| 0 5310 G ...ves-passed-by-fd --v8-snapshot-passed-by- 67MiB |
| 0 5598 G ...DocWrittenScriptsInMainFrame --force-fiel 13MiB |
+-----------------------------------------------------------------------------+
If it is unstable, install the driver with ʻapt-get` and it may work. However, we do not recommend it because the system will try to run X11 on the GPU and the X11 will be unstable.
sudo apt-get install nvidia-361
sudo reboot
Run the following command on tty1. __Note: You will be asked if you want to install the driver when you run runfile, but do not install it here. __
sudo service lightdm stop
sudo ./cuda_8.0.44_linux.run --override #Caution:Do not install the driver here
In Ubuntu 16.04, the version of gcc seems to be different from the one recommended by CUDA, but I forcibly installed the Toolkit with the --override
option.
If the installation is successful, / usr / local / cuda-8.0
should exist.
If you're having trouble running Chainer, install gcc 5.2 and try again
sudo service lightdm stop
sudo ./cuda_8.0.44_linux.run #Caution:The driver is not installed here. gcc5.Install 2 in advance.
Please.
Expand cuDNN and copy the file.
tar xvf cudnn-8.0-linux-x64-v5.1.tgz
sudo cp cuda/include/* /usr/local/cuda-8.0/include
sudo cp cuda/lib64/* /usr/local/cuda-8.0/lib64
Add this to .bashrc
and source ~ / .bashrc
.
export CUDA_PATH=/usr/local/cuda-8.0
export PATH=$CUDA_PATH/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_PATH/lib64:$LD_LIBRARY_PATH
export CPATH=$CUDA_PATH/include:$CPATH
export LIBRARY_PATH=$CUDA_PATH/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDA_PATH/lib64:$LD_LIBRARY_PATH
It is usually put in with pip3.
sudo pip3 install chainer
If ʻimport cupy` passes, it is successful.
$python3
>>> import cupy
The MNIST sample included in the Chainer source code also works.
git clone [email protected]:pfnet/chainer.git
cd chainer/examples/mnist
python3 train_mnist.py --gpu=0
Drivers will no longer be accessible once the kernel is updated. If a new kernel is installed, please install the driver 1 again.
Recommended Posts