Today I installed on the computer Cuda, for small white, a naïve time is very long, a simple record, in the future to facilitate the installation of their own. You are operating according to the installation files on the official website. Http://developer.nvidia.com/cuda-downloads.
The model for the official web site map:
The installation steps are as follows:
1. Pre-preparation
(1) Determine the GPU used by Cuda, you can use the following command to view:
$ LSPCI | Grep-i nvidia
If you do not see any settings, use the command Update-pciids to upgrade the PCI hardware database, and then rerun the LSPCI command above.
The GPU version appears on my Computer as follows:
(2) Viewing the system version
$ uname-m && cat/etc/*release
You can see information similar to the following:
x86_64
Red Hat Enterprise Linux Workstation Release 6.0 (Santiago)
It can be seen from x86_64 that 64 bits are used.
My Computer display results as shown in the figure below:
(3) Verifying GCC
To verify the GCC version using the command:
$ gcc--version
From the beginning of the article you can know that the ubuntu16.04 system requires 5.3.1 more gcc. If you do not have GCC on your computer, you need to install it, and then you need to debug your Cuda code using GCC. The installation code is as follows:
sudo apt-get Install
(4) Verify that the system has the correct kernel header and installation package
Use the following command to view the kernel version number:
Uname-r
For Ubuntu systems, you can install the kernel header with the development package using the following command:
$ sudo apt-get install linux-headers-$ (uname-r)
(5) Select the installation method
A time-independent, one is distributed. I didn't do a lot of research here, because I didn't understand it, so I didn't think too much about it.
The above is the preparatory work.
2. Installation
I use the time Deb file. So the next introduction is the Deb file installation method, you can also download the sh file.
Download the Cuda deb file from the website first.
(1) Run the Deb file
$ sudo dpkg-i cuda-repo-<distro>_<version>_<architecture>.deb
(2) Upgrade
$ sudo apt-get update
(3) Cuda installation
$ sudo apt-get install Cuda
3, the operation after installation
(1) Modifying environment variables
To open the BASHRC file using a command:
Gedit ~/.BASHRC
Add the following Cuda path on the last side of the BASHRC file:
$ Export Path=/usr/local/cuda-8.0/bin${path:+:${path}}
Second, you need to add a dependent library address to the last side of the BASHRC file.
64-bit users add the following dependent library addresses:
$ Export Ld_library_path=/usr/local/cuda-8.0/lib64${ld_library_path:+:${ld_library_path}}
32-bit users add the following dependent library addresses:
$ Export Ld_library_path=/usr/local/cuda-8.0/lib${ld_library_path:+:${ld_library_path}}
Note: The address is best written in one line, otherwise the path error is indicated when the terminal is opened.
The result is shown in the following figure:
if the format shown in the image below, open terminal will prompt the path error :
(2) Verification
A, to modify, compile, and run the sample, you must install an example with write permission. Provides a convenient installation script:
$ cuda-install-samples-8.0.sh <dir>
Where dir is the destination address.
After you have done this, you need to restart the computer to do the following.
B. Verify the driver version
$ cat/proc/driver/nvidia/version
Then perform the following actions in turn:
To verify the Cuda version:
Nvcc-v
The result is the following figure:
Nvidia-smi
C, running examples
Enter the directory where the routine is located:
cd/usr/local/cuda/samples/7_cudalibraries/batchcublas/
View current directory:
Ls
Contains five files:
BatchCUBLAS.cpp batchCUBLAS.h Makefile nsighteclipse.xml Readme.txt
Compiling directly using make
Make
The following information is displayed:
/USR/LOCAL/CUDA-8.0/BIN/NVCC -ccbin g++ -I.. /.. /common/inc -m64 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_52,code=compute_52- o BATCHCUBLAS.O -C batchXUBLAS.cpp
/USR/LOCAL/CUDA-8.0/BIN/NVCC -ccbin g++ - M64 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_52,code=compute_52- o BATCHCUBLAS.O -lcublas
View the files under the folder again
Ls
Folders include the following:
Batchcublas batchcublas.o batchCUBLAS.cpp batchCUBLAS.h Makefile nsighteclipse.xml Readme.txt
2 more files than before. The results of the compilation are placed in the/usr/local/cuda/samples/bin/x86_64/linux/release.
This can be done under the/usr/local/cuda/samples/bin/x86_64/linux/release directory:
./devicequery
The following results will appear:
/usr/local/cuda/samples/7_cudalibraries/batchcublas/under the Batchcublas implementation of the matrix multiplication operation, you can run the following code in this directory:
$./batchcublas-m4096-n4096-k4096
Installing CUDNN
Installing the CUDNN is a lot more simple than installing the CUDN, so don't take out an article alone to introduce it. Very simple.
CUDNN is a set of GPU acceleration solutions specifically designed for the deep learning framework, and currently supports DL libraries including caffe,convnet, TORCH7, etc. CUDNN can be obtained free of charge on the official website, after the registration account can be downloaded. The official website did not find the installation instructions, the downloaded compression package also has no README. However, Google will find a lot of instructions. The basic principle is to add the Lib file to the system can find the Lib folder, the head file added to the system can be found in the Include folder can be.
Reference: http://www.cnblogs.com/platero/p/4118139.html
1. Download
Download "on website HTTPS://DEVELOPER.NVIDIA.COM/CUDNN CuDNN v** Library for linux"
2. Execute the following command
TAR-XZVF cudnn-8.0-linux-x64-v5.1.tgz
CD cudnn-8.0-linux-x64-v5.1 into the extracted files, the name will be different, so when the decompression should be noted. And sometimes it could be cuda.
Copy related information
sudo cp lib*/usr/local/cuda/lib64/
sudo cp cudnn.h/usr/local/cuda/include/
Cudnn.h may sometimes be within the Include folder and need to be copied into the Include folder for Cudnn.h.
3, modify the Caffe configuration file
Enter the Caffe directory, open the Makefile.config file, and comment the USE_CUDNN solution.
CD Caffe
gedit makefile.config
To modify a configuration file:
4. Verification
The Caffe is recompiled and if the Cudnn Lib library is successfully loaded, the compilation succeeds or the addition fails.
An error occurred after validation:
/USR/BIN/LD:-lcudnn not found
My workaround is to copy the compressed files to the specified folder individually:
sudo cp libcudnn.so/usr/local/cuda/lib64/
sudo cp libcudnn.so.5/usr/local/cuda/lib64/
sudo cp libcudnn.so.5.1.10/usr/local/cuda/lib64/
sudo cp libcudnn_static.a/usr/local/cuda/lib64/
Then compile the Caffe,