ubuntu14.04安装cuda
http://blog.csdn.net/xizero00/article/details/43227019/
(16.04.02可用)
cudnn
http://blog.csdn.net/lixintong1992/article/details/51141900
cuDNN download(需要注册)(考虑用winscp传文件),下载完毕后执行
tar xvzf cudnn-7.0-Linux-x64-v4.0-prod.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
安装时注意软连接问题:
http://www.cnblogs.com/platero/p/4118139.html、
OpenCV
http://www.cnblogs.com/xuanxufeng/p/6150593.html
download OpenCV from github (打不开官网的下载链接)
cd ~/opencv
mkdir build
cd build
sudo apt install cmake
sudo cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make
Caffe
error1:
import caffe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named caffe
解决方法
在home目录下输入
export PYTHONPATH=/home/username/caffe/python
error2:
fatal error: pyconfig.h: No such file or directory
解决方法
http://blog.csdn.net/u010900574/article/details/52877346 通过locate
pyconfig.h发现系统中其实很多位置都有这个文件,应该是当前环境变量找不到这个文件导致。 给环境变量一个路径就可以了:export
CPLUS_INCLUDE_PATH=/usr/include/python2.7
error3:
/usr/local/cuda-8.0/bin/nvcc -ccbin=/usr/bin/g++ -Xcompiler -fPIC -DDEBUG -g -O0 -I/usr/local/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/lo cal/include -I/usr/local/cuda-8.0/targets/x86_64-linux/include -I/usr/include/hdf5/serial -Ibuild/src -I./src -I./include -I/usr/local/cuda-8.0/include -gencode arch=compute_20,code=sm_20 -gencode arch=compute_20,code=sm_21 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_50,code=compute_50 -c src/caffe/layers/power_layer.cu -o build/src/caffe/layers/power_layer.cuo
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
g++: error trying to exec 'as': execvp: No such file or directory
Makefile:337: recipe for target 'build/src/caffe/layers/power_layer.cuo' failed
make: *** [build/src/caffe/layers/power_layer.cuo] Error 1
解决方法
还没找到
error4:
/usr/bin/ld: /usr/local/lib/libcblas.a(cblas_sgemv.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libcblas.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:285: recipe for target 'build/lib/libcaffe.so' failed
make: *** [build/lib/libcaffe.so] Error 1
解决方法:
删除了/usr/local/lib的libcblas.a
但是不建议啊,我删的莫名其妙的TAT,删完后出现了error5
error5:
build/lib/libcaffe.a(image_io.o): In function caffe::ReadVideoToVolumeDatum(char const*, int, int, int, int, int, int, caffe::VolumeDatum*)':
解决方法:
在Makefile里面的LIBRARIES加入:
LIBRARIES += opencv_imgcodecs opencv_videoio
然后问题就解决了,也编译通过了,error3莫名其妙消失了