升級caffe所對應cudnn到v5以上版本_caffe學習

來源:互聯網
上載者:User
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 <CpuOnlyBuild>false</CpuOnlyBuild>   <UseCuDNN>true</UseCuDNN>   <CudaVersion>8.0</CudaVersion>   另外,我的cudaarchitecture如下:

[html]  view plain  copy <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 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 //boost::regex exp("\"(null|true|false|-?[0-9]+(\\.[0-9]+)?)\"");  

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

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

[html]  view plain  copy //#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.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.