centos 安装 MatConvNet (gpu)
生活随笔
收集整理的這篇文章主要介紹了
centos 安装 MatConvNet (gpu)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1. 安裝準(zhǔn)備
- ? matlab2017a ,參考:《centos 安裝matlab2017a(無root權(quán)限)》
- ? GCC 4.8(支持c++11) ? ?? 鍵入:sudo yum install gcc gcc-c++ ? (建議sudo裝)
- ? 至少CUDA 7.5,(本人選擇cuda8.0)
- ? CuDNN v4 (與cuda8對應(yīng),選擇cudnn v5.0)
- ? LibJPEG ? ? ? ? 鍵入:sudo yum install ? libjpeg-turbo-devel (建議sudo裝)
首先需要下載matconvenet,然后打開matlab進(jìn)入到matconvnet-1.0-beta25/matlab
目錄下,即vl_compilenn的目錄下。
2. ?開始安裝
1). 先設(shè)置mex ,即: mex -setup mex -setup C++結(jié)果:>> 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).設(shè)置gpu支持
? ?為了增加gpu加速,你需要NVIDIA GPU,且運(yùn)算能力在2.0以上 你也可以使用?gpuDevice在matlab中查找合適的cuda版本
顯然我的是cuda8.0.?
3).如果只裝了一個(gè)cuda,且匹配matlab的版本,此時(shí)可以運(yùn)行如下命令編譯:
vl_compilenn('enableGpu', true)但如果裝了好幾個(gè)cuda,此時(shí)需要指定cuda的位置,即:
vl_compilenn('enableGpu', true, 'cudaRoot', '/Developer/NVIDIA/CUDA-8.0')
4).編譯cuDNN支持
- ?一般編譯:
- 使用CUDA編譯:?
- 使用cudnn編譯(路徑名需要根據(jù)實(shí)際情況設(shè)置):
3. 測試
進(jìn)入到xtest目錄下,執(zhí)行 vl_testnn 如果測試gpu支持的話,執(zhí)行: vl_testnn('gpu', true)運(yùn)行結(jié)束,會(huì)有一個(gè)總結(jié),如果沒有錯(cuò)誤實(shí)例,則表明安裝成功。?
如果要在matlab指定使用gpu的話,可以提前使用gpuDevice ,參考:https://cn.mathworks.com/help/distcomp/gpudevice.html
4. 參考文獻(xiàn)
總結(jié)
以上是生活随笔為你收集整理的centos 安装 MatConvNet (gpu)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 停用词过滤
- 下一篇: git 提交遇到error:fail t