Refer to the two-bit blog
http://caffe.berkeleyvision.org/official website
http://blog.csdn.net/u013476464/article/details/38071075 caffe+ubunutu14.04 +cuda 6.5 Installation Guide
http://blog.csdn.net/bebelemon/article/details/25567239 ubuntu12.04 under Configuration Caffe
Http://www.mintos.org/config/ubuntu-nvidia-prime.html (important for ubuntu14.04 's words)
Error while loading shared libraries:xxx.so.x "causes and workarounds for" errors
The 20+ has been installed in the system, and today finally put Caffe done. Recommended Ubuntu12.04+cuda (version of 5.0,5.5 or 6.0) +mkl+opencv+caffe
Graphics driver can not be installed, Cuda of the. Run File only install Toolkit and sample, the program will only run on the CPU, and only run the sample without GPU, the configuration file has a CPU and GPU selection
Http://developer.nvidia.com/cuda-gpus this site to see if you have GPU-enabled graphics
Premise
Do the following, and then verify that the hardware supports GPU CUDA, as long as the model exists in Https://developer.nvidia.com/cuda-gpus, there is no problem Lspci | Grep-i nvidia
ubnutu12.04 Display below:
NVIDIA Corporation gf119m [GeForce 610M]
GCC--version
If not, install it first, this is a must to compile Cuda Toolkit, or install the video driver when the problem will occur, but Ubuntu is the default, Ubuntu system recommended to install English.
(If the new Ubuntu, remember to change the source after update)
1, installing Cuda
Download the official cuda-toolkit,https://developer.nvidia.com/cuda-downloads,
Put the downloaded. Run installation file under home/yjy/, Yjy is my user name.
Mouveau is in conflict with the Nvidia module, so we're going to disable Nouveau.
sudo gedit/etc/modprobe.d/blacklist.conf
Add blacklist content to blacklist.conf:
Blacklist Lbm-nouveau
Blacklist nvidia-173
Blacklist nvidia-96
Blacklist nvidia-current
Blacklist nvidia-173-updates
Blacklist nvidia-96-updates
Alias Nvidia Nvidia_current_updates
Alias Nouveau off
Alias Lbm-nouveau off
After entering text mode tty,ctrl+alt+fn+f1,
(Uninstall already installed driver: sudo apt-get remove--purge nvidia*, reinstall the system do not do this step, this operation may lead to black screen, not into the desktop system. Couldnot Write Bytes:broken pipe may also be caused by it)
Then close LIGHTDM
sudo stop LIGHTDM
Then go to the Yjy folder to see the permissions for the installation file
[Email protected]:~$ ls
If the. run file that is displayed is named White, execute permissions are assigned to it
sudo chmod +x cuda_6.0.37_linux_64.run
Execute the. Run file
sudo./cuda_6.0.37_linux_64.run
When the installation is complete, start LIGHTDM
sudo start LIGHTDM
There may be only the desktop, there is no left menu bar,
Then re-enter the text mode restart can be sudo reboot
The missing recommend library will be prompted during the installation and must be installed after the reboot
sudo apt-get install Freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev LIBGL1-MESA-GLX Libglu1-mesa Libglu1-mesa-dev
Cuda Verification
Cd/home/yjy/nvidia_cuda-6.0_samples
Make
Run the compiled file to see the basic information of the device Cd/bin/x86_64/linux/release
./devicequery
2,MKL Installation
MKL download request: Https://registrationcenter.intel.com/RegCenter/NComForm.aspx? Productid=1461&pass=yes, will send you an email to download the link, you can download the trial version, put in the home folder. (Serial number nbjn-jh2s8x57)
After decompression, if there is no permission, add Execute permission (same method as Cuda):
To start the installation:
sudo./install_gui.sh
Environment settings for 3,:MKL and Cuda
Directly in the/ETC/LD.SO.CONF.D folder to add the configuration file, after the addition of the direct input can complete the LIB link work.
Create a new intel_mkl.conf, then write it inside:
/opt/intel/lib/intel64
/opt/intel/mkl/lib/intel64
Create a new cuda.conf with the following:
/usr/local/cuda/lib64
/lib
sudo ldconfig-v
4:OPENCV Installation
First download the great God script Https://github.com/jayrambhia/Install-OpenCV, continue to put in the home.
sudo./dependencies.sh
Since the habitual use of 2.4.8, so go to the 2.4 folder, and then execute the corresponding installation files, and then the installation is complete.
sudo./opencv2_4_8.sh
In the middle if the http://sourceforge.net/projects/opencvlibrary has not been linked, it means that the environment has already blocked the website address.
The plan is to copy an already installed put Opencv-2.4.8.zip (my 2.4.8) on your desktop first, and then perform the following operations in/home/yjy/install-opencv-master/ubuntu/2.4/opencv/,
sudo mv/home/yjy/desktop/opencv-2.4.8.zip/home/yjy/install-opencv-master/ubuntu/2.4/opencv/
Create a new aa.sh file under the 2.4 folder and write the first line to the CD OpenCV
In opencv2_4_8.sh, find echo "Installing OpenCV 2.4.8", from this line to the final copy of all the contents to aa.sh. Next run aa.sh to complete the installation.
sudo./aa.sh
5: Install Google Logging Library (glog)
Is https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz, then put the extracted glog-0.3.3 in the home Directory folder:
./configure
sudo make
sudo make install
Install additional dependencies: one cannot be less
[HTML]View Plaincopy
- sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev Libhdf5-serial-dev
6, install Caffe and test, Https://github.com/BVLC/caffe
Switch to the Caffe download folder, and then do the following:
CP Makefile.config.example Makefile.config
Modify the newly generated makefile.config file, modify "BLAS: = Mkl",
Modify the makefile file to change the Blas. = Atlas to Blas? = Mkl, or the subsequent compilation will give an error (such as the Red Font section below).
Make all
Make Test
Make Runtest
/usr/bin/g++ src/caffe/solver.cpp-pthread-fpic-dndebug-o2-i/usr/local/include/python2.7-i/usr/local/lib/ python2.7/dist-packages/numpy/core/include-i/usr/local/include-ibuild/src-i./src-i./include-i/usr/local/cuda/ Include-c-O BUILD/SRC/CAFFE/SOLVER.O
In file included from./include/caffe/util/math_functions.hpp:12:0,
From Src/caffe/solver.cpp:13:
./include/caffe/util/mkl_alternate.hpp:13:19:fatal error:cblas.h:no such file or directory
Compilation terminated.
Error example
7. Test with Mnist data set
CAFFE By default will be installed in $caffe_root, that is, to extract to that directory, for example: $ home/yjye/caffe-master. For specific settings, please refer to the official website: http://caffe.berkeleyvision.org/gathered/examples/mnist.html
Data preprocessing
Here's how:
CD Data/mnist
./get_mnist.sh
Rebuilding the LDB file is to process the data set identified by the binary data set for Caffe, and all subsequent data, including JPG files, will be processed into this format.
CD Examples/mnist
Export ld_library_path= $LD _library_path:/usr/local/cuda/lib64
./create_mnist.sh
Convert mnist datasets to leveldb files, generate mnist-train-leveldb/and mnist-test-leveldb/folders
.. /.. /build/examples/mnist/convert_mnist_data.bin:error while loading shared libraries:libglog.so.0:cannot open shared Object File:no such file or directory
[HTML]View Plaincopy
- sudo su
- Cat/etc/ld.so.conf
- echo "/usr/local/lib" >>/etc/ld.so.conf
- Ldconfig
Training Mnist
CD Examples/mnist
./train_lenet.sh
An error occurred while running the last step
[Email protected]:~/caffe-master/examples/mnist$./train_lenet.sh
.. /.. /build/tools/train_net.bin:error while loading shared libraries:libmkl_rt.so:cannot open shared object File:no such fi Le or directory.
Later found this file in/opt/intel/mkl/lib/intel64/, to add this path to the shared file library
Reference http://blog.chinaunix.net/uid-26212859-id-3256667.html
# cat/etc/ld.so.conf
Include ld.so.conf.d/*.conf
# echo "/opt/intel/mkl/lib/intel64/" >>/etc/ld.so.conf
# Ldconfig
Can. Final result drawings
The new caffe to add something.
[HTML]View Plaincopy
- sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev Libhdf5-serial-dev
Increase under ubuntu12.04
[HTML]View Plaincopy
- # Glog
- wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz
- Tar zxvf glog-0.3.3.tar.gz
- CD glog-0.3.3
- ./configure
- Make && make install
- # gflags
- wget Https://github.com/schuhschuh/gflags/archive/master.zip
- Unzip Master.zip
- CD Gflags-master
- mkdir Build && CD Build
- Export cxxflags="-fpic" && cmake: && make verbose=1
- Make && make install
- # Lmdb
- git clone git://gitorious.org/mdb/mdb.git
- CD Mdb/libraries/liblmdb
- Make && make install
Increase under ubuntu14.04
[HTML]View Plaincopy
- sudo apt-get install Libgflags-dev libgoogle-glog-dev liblmdb-dev Protobuf-compiler
Installation of Ubuntu12.04+cuda6.0+caffe (new version)