Discussion:
[theano-users] CUDA problems on Windows: cuda_ndarray.cuh(17) : warning C4005: 'PyString_Check' : macro redefinition and crtdefs.h(496):
David Rudel
2016-07-27 06:09:56 UTC
Permalink
Hello,
I have largely gotten my WinPython/Theano/CUDA orchestra running, I think,
but I ran into a problem when I tried to compile the theanets mnist example
at http://theanets.readthedocs.io/en/stable/examples/mnist-classifier.html.


First, let me indicate what works correctly.
The check_blas.py test runs correctly and is linking against the gpu.
The specific test program
on http://deeplearning.net/software/theano/install_windows.html to
determine whether the GPU is being used runs without problems and indicates
the GPU is running.

I have also been able to run the lasagne mnist program
[https://github.com/Lasagne/Lasagne/blob/master/examples/mnist.py] on the
GPU.

So I think the above means that lots of things are working properly...

...but when I tried to run the theanets mnist example
at http://theanets.readthedocs.io/en/stable/examples/mnist-classifier.html
or one of the other theanets examples I get errors being thrown by File
"C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\theano-0.7.0-py3.4.egg\theano\sandbox\cuda\nvcc_compiler.py"

[Note, I've tried the bleeding edge version as well, same errors.]

At first I got the error that crtdefs.h was missing. I fixed this by
modifying my INCLUDE statement on my nvcc.profile to include C:\Program
Files (x86)\Microsoft Visual Studio 12.0\VC\include

Then I got an error saying that basetsd.h was missing, so I
added C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include to the
include file as well.

Now all hell breaks loose when I try to run the program. First I get some
warnings like:
C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\theano-0.7.0-py3.4.egg\theano\sandbox\cuda\cuda_ndarray.cuh(17)
: warning C4005: 'PyString_Check' : macro redefinition

C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\numpy\core\include\numpy/npy_3kcompat.h(63)
: see previous definition of 'PyString_Check'

Later I see this:
C:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v7.5\include\crtdefs.h(496): error: invalid redeclaration of
type name "size_t"

And then there are a bunch of errors all related to size_t.

The base call in the traceback is

File
"C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\theano-0.7.0-py3.4.egg\theano\sandbox\cuda\nvcc_compiler.py",
line 423, in compile_str
'for cmd', ' '.join(cmd))

This appears to have something to do with unsigned integers.

And I get this note:

Exception: ('The following error happened while compiling the node',
Shape_i{1}(out.w), '\n', 'nvcc return status', 2, 'for cmd', 'nvcc -shared
-O3 --use-local-env --cl-version=2013 -arch=sm_52 -Xlinker /DEBUG -D
HAVE_ROUND -m64 -Xcompiler
-DCUDA_NDARRAY_CUH=m11b90075e2397c684f9dc0f7276eab8f,-D
NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD
-IC:\\Users\\David\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.4-64\\cuda_ndarray
-INone\\include
-IC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\lib\\site-packages\\numpy\\core\\include
-IC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\include
-IC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\lib\\site-packages\\theano-0.7.0-py3.4.egg\\theano\\sandbox\\cuda
-o
C:\\Users\\David\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.4-64\\tmp4rrj8mgl\\me2fb8274f75ca25753e818dfaeeb725b.pyd
mod.cu -LC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\libs
-LC:\\Users\\David\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.4-64\\cuda_ndarray
-LC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64 -lpython34
-lcudart -lcublas -lcuda_ndarray', '[Shape_i{1}(out.w)]')


Any help is appreciated!

My theanorc file is

[global]
device = gpu
floatX = float32

[nvcc]
flags = --use-local-env --cl-version=2013
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kiran Randhawa
2017-11-25 21:03:55 UTC
Permalink
I am having the same problem! did you manage to get a fix?
Post by David Rudel
Hello,
I have largely gotten my WinPython/Theano/CUDA orchestra running, I think,
but I ran into a problem when I tried to compile the theanets mnist example
at http://theanets.readthedocs.io/en/stable/examples/mnist-classifier.html
.
First, let me indicate what works correctly.
The check_blas.py test runs correctly and is linking against the gpu.
The specific test program on
http://deeplearning.net/software/theano/install_windows.html to determine
whether the GPU is being used runs without problems and indicates the GPU
is running.
I have also been able to run the lasagne mnist program [
https://github.com/Lasagne/Lasagne/blob/master/examples/mnist.py] on the
GPU.
So I think the above means that lots of things are working properly...
...but when I tried to run the theanets mnist example at
http://theanets.readthedocs.io/en/stable/examples/mnist-classifier.html
or one of the other theanets examples I get errors being thrown by File
"C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\theano-0.7.0-py3.4.egg\theano\sandbox\cuda\nvcc_compiler.py"
[Note, I've tried the bleeding edge version as well, same errors.]
At first I got the error that crtdefs.h was missing. I fixed this by
modifying my INCLUDE statement on my nvcc.profile to include C:\Program
Files (x86)\Microsoft Visual Studio 12.0\VC\include
Then I got an error saying that basetsd.h was missing, so I
added C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include to the
include file as well.
Now all hell breaks loose when I try to run the program. First I get some
C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\theano-0.7.0-py3.4.egg\theano\sandbox\cuda\cuda_ndarray.cuh(17)
: warning C4005: 'PyString_Check' : macro redefinition
C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\numpy\core\include\numpy/npy_3kcompat.h(63)
: see previous definition of 'PyString_Check'
C:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v7.5\include\crtdefs.h(496): error: invalid redeclaration of
type name "size_t"
And then there are a bunch of errors all related to size_t.
The base call in the traceback is
File
"C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\site-packages\theano-0.7.0-py3.4.egg\theano\sandbox\cuda\nvcc_compiler.py",
line 423, in compile_str
'for cmd', ' '.join(cmd))
This appears to have something to do with unsigned integers.
Exception: ('The following error happened while compiling the node',
Shape_i{1}(out.w), '\n', 'nvcc return status', 2, 'for cmd', 'nvcc -shared
-O3 --use-local-env --cl-version=2013 -arch=sm_52 -Xlinker /DEBUG -D
HAVE_ROUND -m64 -Xcompiler
-DCUDA_NDARRAY_CUH=m11b90075e2397c684f9dc0f7276eab8f,-D
NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD
-IC:\\Users\\David\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.4-64\\cuda_ndarray
-INone\\include
-IC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\lib\\site-packages\\numpy\\core\\include
-IC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\include
-IC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\lib\\site-packages\\theano-0.7.0-py3.4.egg\\theano\\sandbox\\cuda
-o
C:\\Users\\David\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.4-64\\tmp4rrj8mgl\\me2fb8274f75ca25753e818dfaeeb725b.pyd
mod.cu -LC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\libs
-LC:\\Users\\David\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.4-64\\cuda_ndarray
-LC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64 -lpython34
-lcudart -lcublas -lcuda_ndarray', '[Shape_i{1}(out.w)]')
Any help is appreciated!
My theanorc file is
[global]
device = gpu
floatX = float32
[nvcc]
flags = --use-local-env --cl-version=2013
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Rudel
2017-11-25 23:33:50 UTC
Permalink
I managed to get my setup working. Here are the notes I made at the time:

It appears that the problem was a 64-bit/32-bit confusion issue. The
problem goes away entirely if I follow the procedures below:
1. Open a cmd terminal.
2. Type CALL %VSFORPYTHON%\vcvarsall.bat amd64 [where VSFORPYTHON is
the appropriate Virtual studio folder]
3. Launch my IDE from that cmd environment rather than using a windows
shortcut.
Post by Kiran Randhawa
I am having the same problem! did you manage to get a fix?
Post by David Rudel
Hello,
I have largely gotten my WinPython/Theano/CUDA orchestra running, I
think, but I ran into a problem when I tried to compile the theanets mnist
example at http://theanets.readthedocs.io/en/stable/examples/mnist-
classifier.html.
First, let me indicate what works correctly.
The check_blas.py test runs correctly and is linking against the gpu.
The specific test program on http://deeplearning.net/sof
tware/theano/install_windows.html to determine whether the GPU is being
used runs without problems and indicates the GPU is running.
I have also been able to run the lasagne mnist program [
https://github.com/Lasagne/Lasagne/blob/master/examples/mnist.py] on the
GPU.
So I think the above means that lots of things are working properly...
...but when I tried to run the theanets mnist example at
http://theanets.readthedocs.io/en/stable/examples/mnist-classifier.html
or one of the other theanets examples I get errors being thrown by File
"C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib
\site-packages\theano-0.7.0-py3.4.egg\theano\sandbox\cuda\
nvcc_compiler.py"
[Note, I've tried the bleeding edge version as well, same errors.]
At first I got the error that crtdefs.h was missing. I fixed this by
modifying my INCLUDE statement on my nvcc.profile to include C:\Program
Files (x86)\Microsoft Visual Studio 12.0\VC\include
Then I got an error saying that basetsd.h was missing, so I
added C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include to the
include file as well.
Now all hell breaks loose when I try to run the program. First I get some
C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\
site-packages\theano-0.7.0-py3.4.egg\theano\sandbox\cuda\cuda_ndarray.cuh(17)
: warning C4005: 'PyString_Check' : macro redefinition
C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\
site-packages\numpy\core\include\numpy/npy_3kcompat.h(63) : see previous
definition of 'PyString_Check'
error: invalid redeclaration of type name "size_t"
And then there are a bunch of errors all related to size_t.
The base call in the traceback is
File "C:\Winpython\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib
\site-packages\theano-0.7.0-py3.4.egg\theano\sandbox\cuda\nvcc_compiler.py",
line 423, in compile_str
'for cmd', ' '.join(cmd))
This appears to have something to do with unsigned integers.
Exception: ('The following error happened while compiling the node',
Shape_i{1}(out.w), '\n', 'nvcc return status', 2, 'for cmd', 'nvcc -shared
-O3 --use-local-env --cl-version=2013 -arch=sm_52 -Xlinker /DEBUG -D
HAVE_ROUND -m64 -Xcompiler -DCUDA_NDARRAY_CUH=m11b90075e2397c684f9dc0f7276eab8f,-D
NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD
-IC:\\Users\\David\\AppData\\Local\\Theano\\compiledir_Windo
ws-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.4-64\\cuda_ndarray
-INone\\include -IC:\\Winpython\\WinPython-64b
it-3.4.4.2\\python-3.4.4.amd64\\lib\\site-packages\\numpy\\core\\include
-IC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\include
-IC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64
\\lib\\site-packages\\theano-0.7.0-py3.4.egg\\theano\\sandbox\\cuda -o
C:\\Users\\David\\AppData\\Local\\Theano\\compiledir_Windows
-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineI
ntel-3.4.4-64\\tmp4rrj8mgl\\me2fb8274f75ca25753e818dfaeeb725b.pyd mod.cu
-LC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64\\libs
-LC:\\Users\\David\\AppData\\Local\\Theano\\compiledir_Windo
ws-10-10.0.10586-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.4-64\\cuda_ndarray
-LC:\\Winpython\\WinPython-64bit-3.4.4.2\\python-3.4.4.amd64 -lpython34
-lcudart -lcublas -lcuda_ndarray', '[Shape_i{1}(out.w)]')
Any help is appreciated!
My theanorc file is
[global]
device = gpu
floatX = float32
[nvcc]
flags = --use-local-env --cl-version=2013
--
---
You received this message because you are subscribed to a topic in the
Google Groups "theano-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/theano-users/B2NVrt8by50/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
"A false conclusion, once arrived at and widely accepted is not dislodged
easily, and the less it is understood, the more tenaciously it is held." -
Cantor's Law of Preservation of Ignorance.
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...