Check all path setting and configurations to see whether they are effective before compiling.
CUDA
- Add the card. 2 cables.
- Download and install Nvidia driver. Test with
nvidia-smi
- Dowlaod and install CUDA tool kit, consist with the versioin of driver. Test with
deviceQuery
Others
Try this first, if they are not properly installed, refer to tips below.
sudo yum install protobuf-devel leveldb-devel snappy-devel opencv-devel boost-devel hdf5-devel
sudo yum install gflags-devel glog-devel lmdb-devel
BLAS
sudo yum install blas-devel lapack-devel atlas-devel
BOOST
sudo yum install boost
Python
Caffe need Python>=2.7. But CentOS 6.5 used Python2.6 as default for core functions, such as yum.
Install Python 2.7 on CentOS 6
Then you have both python2.6 and python2.7. You have to specify python2.7 and pip2.7 in the command.
Change Caffe Makefile.configure
file according to the new path to python2.7.
51 PYTHON_INCLUDE := /usr/local/lib/python2.7 \
52 /usr/local/lib/python2.7/site-packages/numpy/core/include
openCV
Caffe need openCV>2.4, which can not be installed automatically by yum in CentOS 6.5.
Using whereis
and locate
to find out where Python2.7 is.
After download OpenCV 2.4 source file,
export PYTHON_EXECUTABLE=/usr/local/bin/python2.7
export PYTHON_INCLUDE_PATH=${PYTHON_EXECUTABLE%/*/*}/include/python2.7
export PYTHON_LIBRARY=${PYTHON_EXECUTABLE%/*/*}/lib/libpython2.7.a
export PYTHON_NUMPY_INCLUDE_DIR=${PYTHON_EXECUTABLE%/*/*}/lib/python2.7/site-packages/numpy/core/include/numpy
export PYTHON_PACKAGES_PATH=${PYTHON_EXECUTABLE%/*/*}/lib/python2.7/site-packages
cmake -D CUDA_GENERATION=Kepler -D PYTHON_EXECUTABLE=$PYTHON_EXECUTABLE -D PYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_PATH -D PYTHON_LIBRARY=$PYTHON_LIBRARY -D PYTHON_NUMPY_INCLUDE_DIR=$PYTHON_NUMPY_INCLUDE_DIR -D PYTHON_PACKAGES_PATH=$PYTHON_PACKAGES_PATH -D CMAKE_BUILD_TYPE=RELEASE ..
make -j 4
sudo make install
Several pits
nvcc fatal : Unsupported gpu architecture 'compute_11'
You should specify cmake -D CUDA_GENERATION=Kepler ..
/home/Simon/Work/dependence/opencv2.4/opencv-2.4.9/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp(121): error: a storage class is not allowed in an explicit specialization
You should download a new file NCVPixelOperations.hpp
to fix this bug.
If you find some bugs like Python.h: No such file.
, you should check the path settings above, making sure that they are effective.
Caffe Compile
cmake -D CUDA_GENERATION=Kepler -D PYTHON_EXECUTABLE=$PYTHON_EXECUTABLE -D PYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_PATH -D PYTHON_LIBRARY=$PYTHON_LIBRARY -D PYTHON_NUMPY_INCLUDE_DIR=$PYTHON_NUMPY_INCLUDE_DIR -D PYTHON_PACKAGES_PATH=$PYTHON_PACKAGES_PATH -D CMAKE_BUILD_TYPE=RELEASE ..
make -j 4
sudo make install
Mnist Example
According to tutorial, all should be done in $CAFFE_ROOT.
I try to manually compile the .cpp file, but encounter with include and link errors, such as file xx do not exist
or undefined reference to xxx:xxxx
. I try to fix them by using g++ -Ixxx/include -Lxxx/lib
, but it is too complex, and confusing. After yum install and make install all these packages, how can I suppose to know where to find those header files, library files and links?
Makefile
in $CAFFE_ROOT defined all those files needed for compilation.
Bugs log
/usr/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status
make: *** [.build_release/lib/libcaffe.so] Error 1
Solution
sudo ln -s /opt/maxcompiler-2014.1.1/lib/boost/lib/libboost_thread.so /usr/lib/libboost_thread.so
Or you could add atlas and boost to the link path LD_LIBRARY_PATH
.
pycaffe
要根据实际情况(locate Python.h)修改python_include_path, 然后Make pyCaffe
.
Model Training
1, No graceful way to exit, stop training with Ctrl-c. Need a tool for training curve plotting.
2, Saving snapshot for deploy and resuming training. But how?