Following on from the previous mail, if I try to run pyCUDA code that
uses an ElementwiseKernel or GPUArray then I get the following error
from nvcc (but using a SourceModule is fine):
...
C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(299):
error: c
alling a __device__ function from a __host__ function is not allowed
...
C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(437):
error: c
alling a __device__ function from a __host__ function is not allowed
...
and a whole pile of warnings.

This builds on my previous error report:
http://www.mail-archive.com/pycuda@tiker.net/msg00919.html

The workaround is simply to comment out lines 299 and 437 of pycuda-complex.hpp:
//_div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); // line 299
//_div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); // line 437
and then rebuild the project (or edit the <site-packages> version in
place when you're debugging).

I don't actualy know what these lines are supposed to be doing and
fiddling with __device__ or __host__ doesn't fix the problem (but
that's just random fiddling on my part). The only reference I found to
the error via Google was:
http://forums.nvidia.com/index.php?showtopic=77428

I'm not submitting a patch as hacking lines out is unlikely to be the
right solution, but it does me for now. Does MSVC with the latest
master work for anyone else?

I can now run my pyCUDA Mandelbrot example on Windows - the complex
branch ran fine on my Mac before, it was just MSVC that complained.

Cheers,
Ian.

On 3 March 2010 15:55, Ian Ozsvald <i...@ianozsvald.com> wrote:
> With the latest master on WinXP with MSVC 9 I get the errors seen
> below. I've attached a patch (it just re-orders 4 variable
> declarations to make MSVC happy). There is a further problem that I've
> yet to solve (see end of post).
>
> Does anyone else have the latest master compiling and running with
> MSVC? I'm wondering if this is a show stopper for anyone else?
>
> C:\Panalytical\pycuda_git\pycuda_master>python setup.py install
> ...
> running build_ext
> building '_pvt_struct' extension
> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo
> /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python26\include -I
> C:\Python26\PC /Tcsrc/wrapper/_pycuda_struct.c
> /Fobuild\temp.win32-2.6\Release\src/wrapper/_pycuda_struct.obj
> _pycuda_struct.c
> src/wrapper/_pycuda_struct.c(663) : error C2143: syntax error :
> missing ';' before 'type'
> src/wrapper/_pycuda_struct.c(664) : error C2143: syntax error :
> missing ';' before 'type'
> src/wrapper/_pycuda_struct.c(665) : error C2065: 're' : undeclared identifier
> src/wrapper/_pycuda_struct.c(665) : error C2065: 're' : undeclared identifier
> src/wrapper/_pycuda_struct.c(666) : error C2065: 're' : undeclared identifier
> src/wrapper/_pycuda_struct.c(666) : error C2065: 'im' : undeclared identifier
> src/wrapper/_pycuda_struct.c(666) : error C2065: 'im' : undeclared identifier
> src/wrapper/_pycuda_struct.c(679) : error C2143: syntax error :
> missing ';' before 'type'
> src/wrapper/_pycuda_struct.c(680) : error C2143: syntax error :
> missing ';' before 'type'
> src/wrapper/_pycuda_struct.c(681) : error C2065: 're' : undeclared identifier
> src/wrapper/_pycuda_struct.c(681) : error C2065: 're' : undeclared identifier
> src/wrapper/_pycuda_struct.c(682) : error C2065: 're' : undeclared identifier
> src/wrapper/_pycuda_struct.c(682) : error C2065: 'im' : undeclared identifier
> src/wrapper/_pycuda_struct.c(682) : error C2065: 'im' : undeclared identifier
> error: command '"C:\Program Files\Microsoft Visual Studio
> 9.0\VC\BIN\cl.exe"' failed with exit status 2
>
> This error is described here:
> http://andre.stechert.org/urwhatu/2006/01/error_c2143_syn.html
> MSVC doesn't like C99-style variable declarations in the middle of the
> function and wants C89 declarations at the start of the function (or
> so the author states).
>
> I can't run any code yet though, I'm still constrained by:
> error: calling a __device__ function from a __host__ function is not allowed
> as described before from the earlier complex branch:
> http://www.mail-archive.com/pycuda@tiker.net/msg00919.html
> I'm looking into this.
>
> Cheers,
> i.
>
>
> --
> Ian Ozsvald (A.I. researcher, screencaster)
> i...@ianozsvald.com
>
> http://IanOzsvald.com
> http://morconsulting.com/
> http://TheScreencastingHandbook.com
> http://ProCasts.co.uk/examples.html
> http://twitter.com/ianozsvald
>



-- 
Ian Ozsvald (A.I. researcher, screencaster)
i...@ianozsvald.com

http://IanOzsvald.com
http://morconsulting.com/
http://TheScreencastingHandbook.com
http://ProCasts.co.uk/examples.html
http://twitter.com/ianozsvald

_______________________________________________
PyCUDA mailing list
pyc...@host304.hostmonster.com
http://host304.hostmonster.com/mailman/listinfo/pycuda_tiker.net

Reply via email to