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

本文介绍了解决CUDA与高版本GCC不兼容的问题,包括如何禁用版本检查、配置环境路径以及调整Makefile以适配不同版本的GCC。

1  gcc版本过高

安装cuda

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

需要强制取消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)

into

NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

For me this was on line 415





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值