Installation of Nvidia Cuda Toolkit (CUDA)
PS: Especially recommended *.deb method, currently available offline version of the Deb file, the method is relatively simple, do not need to switch to TTY mode, so no longer provide the original *.run installation method, here in Cuda 7.5 for example.
One, CUDA Repository
1.1 Installing the required dependency packages
sudo apt-get install build-Essential # Basic Requirement # sudo apt-get Install Libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev Libgflags-dev Libgoogle-glog-dev Liblmdb-dev Protobuf-compiler #required by Caffe
To obtain CUDA installation package, please go to NVIDIA official website to download the installation package yourself. (https://developer.nvidia.com/cuda-downloads)
CD to the file location where the installation package is located, execute the following command.
$ sudo dpkg-i cuda-repo-ubuntu1504-7-5-local_7. 5-18_amd64$ sudo apt-get update$ sudo apt-get install Cuda
After the installation, you can restart the computer, the resolution will automatically adjust, but not necessarily become fully adapted to the screen. If there is no problem with the input signal when installing Ubuntu at first, there is no problem of automatic resolution adjustment.
1.2 Setting Environment variables:
(Setting the environment variable, first determine the Cuda installation path and location, this step is very important, when the installation does not need to modify the following location, the system will automatically establish a connection)
Add CUDA environment variables in/etc/profile (preferably using VIM, do not use gedit, just install the system gedit will cause keyboard confusion, increase unnecessary trouble)
sudo gedit/etc/profile
Add content to the last line:
Export path=/usr/local/cuda/bin: $PATH export Ld_library_path=/usr/local/cuda/lib64: $LD _library_path
Once saved, execute the following command to make the environment variable effective immediately
Source/etc/profile
Also need to add Lib Library path: in/etc/ld.so.conf.d/to join file cuda.conf,
sudo vim/etc/ld.so.conf.d/cuda.conf
The contents are as follows
/usr/local/cuda//Lib/usr/Lib/usr/lib32
Here we have all the Lib libraries.
Once saved, execute the following command to make it effective immediately
sudo ldconfig-v
2.2 Installing Cuda SAMPLE:
Enter/usr/local/cuda/samples and execute the following command to build samples
sudo make all-j8
Once the compilation is complete, go to/usr/local/cuda/samples/1_utilities/devicequery$./devicequery, Run Devicequery
/usr/local/cuda/samples/1_utilities/devicequery$./devicequery
If the video card information appears, the driver and the video card installation is successful:
CUDA Device Query (Runtime API) version (CudartStaticlinking) Detected1CUDA capable device (s) device0:"GeForce GTX 960"CUDA Driver Version/Runtime Version7.5/7.5CUDA Capability Major/minor Version Number:5.2Total amount ofGlobalMemory4095MBytes (4294246400bytes) ( 8) Multiprocessors, ( -) CUDA CORES/MP:1024x768CUDA Coresgpu Max Clock rate:1329MHz (1.33GHz) Memory Clock Rate:3600mhzmemory Bus Width: --bitL2 Cache Size:1048576bytesmaximum Texture Dimension Size (x, Y, z) 1D=(65536), 2d= (65536,65536), 3d= (4096,4096,4096) Maximum layered 1D Texture Size, (num) layers 1D=(16384),2048layersmaximum layered 2D Texture Size, (num) layers 2D=(16384,16384),2048layerstotal amount of constant memory:65536bytestotal amount of shared memory per block:49152bytestotal number of registers available per block:65536Warp Size: +Maximum Number of threads per multiprocessor:2048Maximum Number of threads per block:1024x768Max dimension size of a thread block (x, Y, z): (1024x768,1024x768, -) Max dimension size of a grid size (x, Y, z): (2147483647,65535,65535) Maximum memory pitch:2147483647bytestexture Alignment: +bytesconcurrent Copy and kernel Execution:yes with2copy engine (s) Run time limit on kernels:yesintegrated GPU sharing host Memory:nosupport host page-locked Memory mapping:yesalignment requirement forSurfaces:yesdevice has ECC Support:disableddevice supports Unified Addressing (UVA): Yesdevice PCI Domain ID/Bus id/location ID:0/1/0Compute Mode:< Default (multiple host threads can use:: Cudasetdevice () with device simultaneously) >devicequery, CUDA Driver= Cudart, CUDA Driver Version =7.5, CUDA Runtime Version =7.5, Numdevs =1, Device0 = GeForce GTX960Result= PASS
installation of Nvidia CUDA Toolkit (cudnn)
Second, CUDNN Repository
This part is relatively simple, first of all to register the NVIDIA Development Account, then can download CUDNN.
To put it simply, a few files are copied: library files and header files. Copy the CUDNN header file to/usr/local/cuda/lib64 and copy the CUDNN library file to/usr/local/cuda/include.
After downloading the CD into the file package directory, unzip the file:
TAR-ZXF cudnn-7.0-linux-x64-v4. 0-prod.tgzcd cuda
#链接到cuda的库里
sudo cp lib64/* /usr/local/cuda/lib64/sudo CP include/cudnn.h/usr/local/cuda/include/
要不要链接cuDNN的库文件:http://www.cnblogs.com/empty16/p/4793404.html (要,必须要!!)
$ sudo ln-sf/usr/local/lib/libcudnn.so. 4.0. 7 /usr/local/lib/libcudnn.so. 4 -sf/usr/local/lib/libcudnn.so. 4 /usr/local/lib/libcudnn.so
#链接完config更新
Completion of Cuda and CUDNN installation
Ubuntu Configuration Machine learning Environment (ii) CUDA and CUDNN installation