1.安装依赖项
sudo apt-get install -y build-essential
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
sudo apt-get install -y freeglut3-dev libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
2.安装CUDA
3.安装atlas
sudo apt-get install -y libatlas-base-dev
4.安装OpenCV
5.Python
sudo apt-get install -y python-pip
sudo apt-get install -y cython python-numpy python-scipy python-skimage python-protobuf
sudo apt-get install -y python-matplotlib python-h5py python-leveldb python-networkx
sudo apt-get install -y python-pandas python-sympy python-nose python-dateutil python-gflags
pip install ipython==5.0.0
pip install --upgrade pip
sudo pip install argparse
6.安装Caffe
git clone git@github.com:BVLC/caffe.git
cd caffe
sudo pip install -r python/requirements.txt
cp Makefile.config.example Makefile.config
gedit Makefile.config 将其中的"-gencode arch=compute_20, code=sm_20"和
"-gencode arch=compute_20, code=sm_21"这两行删掉,并依照需要设置USE_CUDNN,PYTHON_INCLUDE等
make all -j8
make test -j8
make runtest -j8
make pycaffe -j8
gedit ~/.bashrc 添加 export PYTHONPATH=< path-to-caffe >/caffe/python
source ~/.bashrc 即可在Python中使用Caffe模块
7.mnist数据测试
cd caffe
sh data/mnist/get_mnist.sh
sh examples/mnist/create_mnist.sh
vim examples/mnist/lenet_solver.prototxt
./examples/mnist/train_lenet.sh
8.问题及办法(使用Anaconda导致的)
- (1) undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.0’
sudo apt-get install libtiff4-dev
也可能是权限问题,使用sudo make
- (2) libcudart.so.8.0: cannot open shared object file: No such file or directory
sudo ldconfig /usr/local/cuda/lib64