您的位置:首页 > Web前端

ubuntu 16.04 安装caffe GPU版本时遇到的问题

2017-12-21 21:07 806 查看
1  gcc版本过高

安装cuda

sudo apt-get install nvidia-cuda-toolkit

cuda是7.5.18版,安装完后重启,在终端输入nivdia-smi,有结果则驱动和cuda安装成功。
但是cuda只支持gcc5.0以下,即使后续用cmake编译opencv成功,gpu还是无法调用

[/code]
需要强制取消cuda的gcc版本检查

注释掉host_config.h中关于gcc版本的检查,版本大于5则返回错误

//#if __GNUC__ > 5
//#error -- unsupported GNU version! gcc versions later than 5 are not supported!
//#endif /* __GNUC__ > 5 */

通过nvidia-cuda-toolkit安装的,host_config.h在 /usr/include/下,如果通过cuda的run文件安装,也会因为gcc版本检查提示错误,也要修改对应位置的host_config.h

2 usr/local/下没有cuda文件夹

ln -sf /usr/lib/nvidia-cuda-toolkit /usr/local/cuda


3  Error
when Building GPU docker image for caffe: Unsupported gpu architecture 'compute_60'




In the Makefile.example, try commenting out the *_60 and *_61 lines (for compatibility with CUDA < 8.0).

CUDA_ARCH := -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_52,code=sm_52 \
#-gencode arch=compute_60,code=sm_60 \
#-gencode arch=compute_61,code=sm_61 \
#-gencode arch=compute_61,code=compute_61




4 error /usr/include/string.h:652:42: error: ‘memcpy’
was not declared in this scope while building caffe

vim the Makefile and changing the line

NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
[/code]
into

NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
[/code]
For me this was on line
415
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: