当我尝试将Theano与GPU设备配合使用时(在CPU上工作正常),我遇到了编译问题。我遇到的问题与此处已报告的问题几乎完全相同,但是遵循提供的解决方案对我不起作用。按照原始解决方案,我可以验证pycuda是否已成功安装,但是导入theano仍会引发相同的错误:
c:\python\python27\include\pymath.h(22): warning: dllexport/dllimport conflict with "round"
c:\program files\nvidia gpu computing toolkit\cuda\v6.5\include\math_functions.h(2455): here; dllimport/dllexport dropped
mod.cu(954): warning: statement is unreachable
mod.cu(1114): error: namespace "std" has no member "min"
... *lots more of the same error at different lines* ...
mod.cu(4604): error: namespace "std" has no member "min"
31 errors detected in the compilation of "C:/Users/Zehan/AppData/Local/Temp/tmpxft_0000317c_00000000-10_mod.cpp1.ii".
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return status', 2, 'for cmd', 'nvcc -shared -g -O3 --compiler-bindir C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin -Xlinker /DEBUG -m32 -Xcompiler -LC:\\Python\\Python27\\libs,-DCUDA_NDARRAY_CUH=d67f7c8a21306c67152a70a88a837011,/Zi,/MD -IC:\\Python\\Python27\\lib\\site-packages\\theano\\sandbox\\cuda -IC:\\Python\\Python27\\lib\\site-packages\\numpy\\core\\include -IC:\\Python\\Python27\\include -o C:\\Users\\Zehan\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-2.7.8-32\\cuda_ndarray\\cuda_ndarray.pyd mod.cu -LC:\\Python\\Python27\\libs -LNone\\lib -LNone\\lib64 -LC:\\Python\\Python27 -lpython27 -lcublas -lcudart')
我安装了Python 2.7.8 32bit和MinGW以及CUDA 6.5。我正在使用以下.theanorc配置:
[global]
device = gpu
floatX = float32
[nvcc]
compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
为了使pycuda示例正常工作,我必须在C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
用户路径中添加Visual Studio 12.0 。尽管使用了Visual Studio 10命令提示符来构建pycuda,但由于某种原因,它不能与Visual Studio 10.0一起使用。
顺便说一句,如果我尝试compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
,我会收到一条错误消息,指出Visual Studio版本不好:
nvcc fatal: nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions 2010, 2012, and 2013 are supported
(我安装了Visual Studio Express 2010和2013)
我了解Windows对Theano + GPU的支持仍处于试验阶段,但似乎确实对某些人有效。关于下一步尝试有什么建议吗?
我在这里找到了一些修复方法
从本质上讲,它需要在中找到cuda_ndarray.cuh
文件<install-dir>/andbox\cuda
并添加#include <algorithm>
。
它仍然发出警告warning C4273: 'round' : inconsistent dll linkage
。
根据此报告的问题,这是由于Python和CUDA之间存在冲突,并且两者都提供了round
功能。可以通过在与CUDA链接时定义宏HAVE_ROUND来告诉Python不要尝试重新定义回合来解决此问题。
不知道这是否是适用于每个人的常规修补程序,但似乎对我有用-就使我能够将GPU与theano一起使用而言。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句