cuda-convnet windows8下編譯


編譯環境:
windows8.1
Anaconda python2.7
Visual studio 2012
CUDA6.0
Pthread for windows
Intel Math Kernel Library
 
cuda-convnet 原始文件下載地址:
 
其中用到的一些庫:

PThread 下載鏈接:

Intel® Math Kernel Library 下載鏈接:(下載windows版本)
cuda-convnet 工程文件下載鏈接:
其他一些有用的工具:(下載x64的版本,調試的時候可能用到)
 
因為cuda-convnet需要python27,所以必須下載python27的庫安裝上. 我用的是Anaconda自帶的python庫.
 
第一步:
把下載下來的cuda工程文件解壓至trunk目錄下,然后用記事本打開pyconvnet.vcxproj文件
然后把版本號修改為正確的版本號,我的是把cuda4.0  修改為cuda6.0
 
第二步:
編譯時會遇到以下問題,那是頭文件沒包含對的緣故,不用擔心
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomizations\CUDA 6.0.targets(597,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2012 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin"  -I./ -I../../../common/inc -I../../../../shared/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -I./ -I../../common/inc -I../../../shared/inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MTd  " -o Win32/Debug/convnet.cu.obj "E:\synchronize folder\Koder Quelle\deep learning\cuda-convnet\trunk\src\convnet.cu"" exited with code 2.
針對這些錯誤只要設置好相應的依賴庫就可以了.
 
第三步:
最后編譯生成的是dll,后綴名為pyd, 這樣方便python調用.
 
第四步:
從下面的地址下載cifar-10圖片數據
 
第五步:
在VS環境中設置環境變量
 
第六步:
在命令行中輸入如下命令:
python convnet.py --data-path=./storage2/tiny/cifar-10-batches-py-colmajor/ --save-path=./storage2/tmp --test-range=6 --train-range=1-5 --layer-def=./example-layers/layers-19pct.cfg --layer-params=./example-layers/layer-params-19pct.cfg --data-provider=cifar --test-freq=13 --epoch=200
 
訓練的時候發現一個比較坑的問題就是這兩個錯誤:
1.raise UnpickleError("Path '%s' does not exist." % filename)
util.UnpickleError: Path 'D:/cuda-convnet/storage2/tiny/cifar-10-batches-py-colmajor/data_batch_6' does not exist.
2.self.data_mean = self.batch_meta['data_mean']
KeyError: 'data_mean'
原因是batches_meta文件格式不對,這個必須去下載對應的cifar-10的數據,而且帶有合乎要求格式的文件,下面給上鏈接:
 
即使找到合適的數據,還可能出現以下的錯誤:
self.libmodel = __import__(lib_name)
ImportError: No module named convnet_
解決方案就是在convnet.py的46行把'convnet_'庫改成對應的'pyconvnet'
 
 
解決了以上的問題以后差不多應該能夠順利的運行程序了.
 
 
編譯時遇到的錯誤及解決方案:
 
fatal error C1083: Cannot open include file: 'cblas.h': No such file or directory
解決方案:
屬性頁/C++/Preprocessor/Preprocessor definitions/加入USE_MKL;
 
neuron.cuh(104): error : identifier "PyObject" is undefined
解決方案:
屬性頁/C++/Preprocessor/Preprocessor definitions/加入NUMPY_INTERFACE;
 
編譯的時候提示找不到pthread.h文件:
解決方案:
在trunk中加入下載好的pthread文件夾,並正確的包含頭文件和庫文件
 
編譯的時候報error : identifier "pthread_mutex_t" is undefined錯誤:
解決方案:
在nvmatrix.cuh文件里加上<pthread.h>
 
LINK : fatal error LNK1104: cannot open file 'cutil64D.lib'
解決方案:
去掉cutil64D.lib
 
LINK : fatal error LNK1104: cannot open file 'shrUtils64D.lib'
解決方案:
去掉shrUtils64D.lib
 
一些參考來源:
http://vision.group.shef.ac.uk/wordpress/?p=1
http://personal.ie.cuhk.edu.hk/~xy012/others/install_cudaconvnet.html
https://code.google.com/p/cuda-convnet/wiki/TrainingNet


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM