centos 安装 MatConvNet (gpu)
生活随笔
收集整理的這篇文章主要介紹了
centos 安装 MatConvNet (gpu)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1. 安裝準備
- ? matlab2017a ,參考:《centos 安裝matlab2017a(無root權限)》
- ? GCC 4.8(支持c++11) ? ?? 鍵入:sudo yum install gcc gcc-c++ ? (建議sudo裝)
- ? 至少CUDA 7.5,(本人選擇cuda8.0)
- ? CuDNN v4 (與cuda8對應,選擇cudnn v5.0)
- ? LibJPEG ? ? ? ? 鍵入:sudo yum install ? libjpeg-turbo-devel (建議sudo裝)
首先需要下載matconvenet,然后打開matlab進入到matconvnet-1.0-beta25/matlab
目錄下,即vl_compilenn的目錄下。
2. ?開始安裝
1). 先設置mex ,即: mex -setup mex -setup C++結果:>> mex -setup MEX configured to use 'gcc' for C language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLABvariables with more than 2^32-1 elements. You will be requiredto update your code to utilize the new API.You can find more information about this at:http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.To choose a different language, select one from the following:mex -setup C++ mex -setup FORTRAN MEX configured to use 'g++' for C++ language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLABvariables with more than 2^32-1 elements. You will be requiredto update your code to utilize the new API.You can find more information about this at:http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html. >> 2).設置gpu支持
? ?為了增加gpu加速,你需要NVIDIA GPU,且運算能力在2.0以上 你也可以使用?gpuDevice在matlab中查找合適的cuda版本
顯然我的是cuda8.0.?
3).如果只裝了一個cuda,且匹配matlab的版本,此時可以運行如下命令編譯:
vl_compilenn('enableGpu', true)但如果裝了好幾個cuda,此時需要指定cuda的位置,即:
vl_compilenn('enableGpu', true, 'cudaRoot', '/Developer/NVIDIA/CUDA-8.0')
4).編譯cuDNN支持
- ?一般編譯:
- 使用CUDA編譯:?
- 使用cudnn編譯(路徑名需要根據實際情況設置):
3. 測試
進入到xtest目錄下,執行 vl_testnn 如果測試gpu支持的話,執行: vl_testnn('gpu', true)運行結束,會有一個總結,如果沒有錯誤實例,則表明安裝成功。?
如果要在matlab指定使用gpu的話,可以提前使用gpuDevice ,參考:https://cn.mathworks.com/help/distcomp/gpudevice.html
4. 參考文獻
總結
以上是生活随笔為你收集整理的centos 安装 MatConvNet (gpu)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 停用词过滤
- 下一篇: git 提交遇到error:fail t