Zehan
Zehan

Reputation: 166

import theano (0.6) on Windows 8 with device= gpu (and visual studios 12.0)

I'm having an compilation issue when I try to use Theano with the GPU device (it works fine with the CPU). I'm getting almost exactly the same problem to that already reported here, however following the solution provided does not work for me. Following the original solution, I can get as far as verifying that pycuda has been installed successfully, but importing theano still throws the same error:

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')

I have Python 2.7.8 32bit and MinGW set up and CUDA 6.5. I'm using the following .theanorc config:

[global]
device = gpu
floatX = float32

[nvcc]
compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin

In order to get the pycuda example to work, I had to add visual studio 12.0 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin to my user path. It doesn't work with visual studios 10.0 for some reason, despite using the visual studio 10 command prompt to build pycuda.

Incidentally, if I try compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin, I get an error saying that version of visual studio is no good:

nvcc fatal: nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions 2010, 2012, and 2013 are supported

(I have visual studio express 2010 and 2013 installed)

I understand that the Theano+GPU support for Windows is still somewhat experimental, but it seems like it does work for some people. Any suggestions as to what try next?

Upvotes: 3

Views: 822

Answers (1)

Zehan
Zehan

Reputation: 166

I found a bit of hack to fix it here

Essentially it entails finding the cuda_ndarray.cuh file in the <install-dir>/andbox\cuda and adding #include <algorithm>.

It still leaves a warning warning C4273: 'round' : inconsistent dll linkage.

Which according to this reported issue is due to a conflict between Python and CUDA and both providing an round functionality. This could perhaps be fixed by defining the macro HAVE_ROUND when linking with CUDA to tell Python not to try to redefine round.

Not sure if this is a general fix that's applicable for everyone, but seemed to have worked for me - as far as enabling me to use the GPU with theano.

Upvotes: 1

Related Questions