升级caffe所对应cudnn到v5以上版本

1.配置环境

1. 本文在windows7+vs2013的环境下编译 ,CUDA版本8.0,cudnn版本5.1

2. CUDA下载地址:https://developer.nvidia.com/cuda-toolkit,cudnn:cudnn-8.0-windows7-x64-v5.1 下载地址:https://developer.nvidia.com/cudnn 

3. 安装CUDA8.0(需要在安装vs2013之后)

4. 解压下载的cudnn压缩包,将文件分别拷贝到CUDA文件夹下的include、bin和lib目录下

2.编译GPU版本的SSD

1. 接上次编译成功的CPU版本,配置CommonSettings.props

[html]  view plain  copy
  1. <CpuOnlyBuild>false</CpuOnlyBuild>  
  2. <UseCuDNN>true</UseCuDNN>  
  3. <CudaVersion>8.0</CudaVersion>  
另外,我的cudaarchitecture如下:

[html]  view plain  copy
  1. <CudaArchitecture>compute_35,sm_35;compute_52,sm_52</CudaArchitecture>  

2. 编译libcaffe, 报错:Dtype expval = exp(min(in_data[index], Dtype(kBNLL_THRESHOLD)));修改bnll_layer.cu如下:

[html]  view plain  copy
  1. Dtype expval = exp(min(in_data[index], Dtype(52)));  
Dtype(52)这边根据自己显卡的计算能力填写。

3.在工程的cu目录下,分别添加layers,solve和util下的所有cu文件 (layers下除roi_pooling_layer.cu)

4.修改bbox_util.cu,注释掉所有带thrust的语句

5.修改detection_output_layer.cu和detection_output_layer.cpp文件,注释掉所有regex和rv的语句

[html]  view plain  copy
  1. //boost::regex exp("\"(null|true|false|-?[0-9]+(\\.[0-9]+)?)\"");  

[html]  view plain  copy
  1. //std::string rv = boost::regex_replace(ss.str(), exp, "$1");  
  2. //outfile << rv.substr(rv.find("["), rv.rfind("]") - rv.find("["))  
  3. //    << std::endl << "]" << std::endl;  

f.修改detection_output_layer.hpp,注释#include“boost/regex.hpp”

[html]  view plain  copy
  1. //#include <boost/regex.hpp>  

6.caffe中与cudnn相关文件替换

如果当前应用的caffe对应的cudnn代码是基于cudnnv3或cudnnv4,要升级到cudnnv5,则需要将最新官方caffe中相应cudnn_conv_layer.hpp、cudnn_lcn_layer.hpp、cudnn_lrn_layer.hpp、cudnn_pooling_layer.hpp、cudnn_relu_layer.hpp、cudnn_sigmoid_layer.hpp、cudnn_softmax_layer.hpp、cudnn_tanh_layer.hpp以及它们各自的.cpp和.cu文件进行替换。

7. caffe中cudnn.h文件替换

如果当前应用的caffe对应的cudnn代码是基于cudnnv3或cudnnv4,要升级到cudnnv5,则需要将最新官方caffe中相应util/cudnn.hpp文件替换。

8. 编译libcaffe,编译caffe,编译classification.


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值