Re: [PyCUDA] Patch for error C2143: syntax error : missing '; ' before 'type' on latest master for MSVC

2010-03-04 Thread Ian Ozsvald
Andreas - the patches work, cheers. Both of my tests (which failed
yesterday) work first time, no warning messages are shown either
(yesterday there were heaps of them).
Much obliged,
Ian.

On 3 March 2010 21:58, Andreas Klöckner li...@informa.tiker.net wrote:
 On Mittwoch 03 März 2010, Ian Ozsvald wrote:
 lude/pycuda\pycuda-complex.hpp(299): error: c
 alling a __device__ function from a __host__ function is not allowed

 I've added a few more fixes to git master. Can you please try it and
 report back? If it doesn't work, please post the entire error message.

 Andreas





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


Re: [PyCUDA] Patch for error C2143: syntax error : missing '; ' before 'type' on latest master for MSVC

2010-03-04 Thread Ian Ozsvald
Scratch the last - the same errors occur with the latest master as
listed below. In my haste I didn't remove the already-compiled kernels
(I cleared the wrong cache directory sigh).

The fix is to comment out lines 312 and 457 of pycuda-complex.hpp and
recompile, I still get a ton of warning messages (the same declspec
ones as below) but I can run my examples.

i.

In [4]: %run mandelbrot_gpu.py
kernel.cu
C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(209):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(214):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(218):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(222):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(227):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(244):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(251):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(258):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(265):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(274):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(283):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(289):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(295):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(301):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(309):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(312):
error: calling 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(348):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(354):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(359):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(364):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(370):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(387):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(394):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(401):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(408):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(417):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(428):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(434):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(440):
warning: __declspec attributes ignored

C:/Python26/lib/site-packages/pycuda-0.94beta-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex.hpp(446):
warning: __declspec attributes 

[PyCUDA] Int detection in function kernel invocation

2010-03-04 Thread Fabrizio Milo aka misto
Hi,

I had to add the patch in attachment to make work a kernel like

void kernel( float* out, int size){

}

I am not 100% sure it's corret. PTAL

Fabrizio
--
Luck favors the prepared mind. (Pasteur)


0001-added-int-detection.patch
Description: Binary data
___
PyCUDA mailing list
pyc...@host304.hostmonster.com
http://host304.hostmonster.com/mailman/listinfo/pycuda_tiker.net


Re: [PyCUDA] Int detection in function kernel invocation

2010-03-04 Thread Andreas Klöckner
On Donnerstag 04 März 2010, Fabrizio Milo aka misto wrote:
 Hi,
 
 I had to add the patch in attachment to make work a kernel like
 
 void kernel( float* out, int size){
 
 }

Unless you're using prepared invocation, you have to use Numpy's sized
integers/floats:
http://documen.tician.de/pycuda/driver.html#pycuda.driver.Function.param_set

I don't think it's advisable to change that.

Andreas


signature.asc
Description: This is a digitally signed message part.
___
PyCUDA mailing list
pyc...@host304.hostmonster.com
http://host304.hostmonster.com/mailman/listinfo/pycuda_tiker.net


Re: [PyCUDA] Int detection in function kernel invocation

2010-03-04 Thread Fabrizio Milo aka misto
 Unless you're using prepared invocation, you have to use Numpy's sized
 integers/floats:
I see.

Did the patch with the decorators, get trough or got lost yesterday?

Fabrizio
--
Luck favors the prepared mind. (Pasteur)

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


Re: [PyCUDA] Patch for error C2143: syntax error : missing '; ' before 'type' on latest master for MSVC

2010-03-04 Thread Andreas Klöckner
On Donnerstag 04 März 2010, Ian Ozsvald wrote:
 Scratch the last - the same errors occur with the latest master as
 listed below. In my haste I didn't remove the already-compiled kernels
 (I cleared the wrong cache directory sigh).
 
 The fix is to comment out lines 312 and 457 of pycuda-complex.hpp and
 recompile, I still get a ton of warning messages (the same declspec
 ones as below) but I can run my examples.

Try now. (Believe it or not, the warning messages actually helped. It
appears that the __device__ must appear before the return type to be
meaningful... maybe...)

Andreas


signature.asc
Description: This is a digitally signed message part.
___
PyCUDA mailing list
pyc...@host304.hostmonster.com
http://host304.hostmonster.com/mailman/listinfo/pycuda_tiker.net


Re: [PyCUDA] More Patches, and cuda.init() elimination

2010-03-04 Thread Imran Haque

Fabrizio Milo aka misto wrote:

b) Imports with side effects are bad. (pycuda.autoinit is the only
module with side-effects in PyCUDA--and the side effect is its only
purpose.)

I agree side effects are bad!! I don't think this is a side effect.
This is how you would use the cuda driver.
any and I say any function you want from the cuda drivers needs as
prerequisite the cuInit().


I disagree. It's important to know if the CUDA libraries are getting 
reinitialized; particularly on multi-GPU systems, there can be 
significant overhead in calling cuInit. We have a bunch of quad-GPU 
machines here where the CUDA initialization takes nearly 3-4 seconds. 
Needless to say, that's a cost I only want to pay once, not every time I 
have to import pycuda. In particular, if your program uses libraries 
that depend on pycuda, they shouldn't all be reinitializing CUDA unless 
you ask them to.


Cheers,

Imran

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


Re: [PyCUDA] More Patches, and cuda.init() elimination

2010-03-04 Thread J-Pascal Mercier
On Thursday 04 March 2010 07:59:34 pm Imran Haque wrote:
 I disagree. It's important to know if the CUDA libraries are getting 
 reinitialized; particularly on multi-GPU systems, there can be 
 significant overhead in calling cuInit. 
Agreed, 

 In particular, if your program uses libraries 
 that depend on pycuda, they shouldn't all be reinitializing CUDA unless 
 you ask them to.

Python only import modules once, it reuse already imported module so the 
initialization procedure would only be called at the first import.

That being said, i don't think pycuda should hide the cuinit call and the 
context creation. For that matter, the autoinit is probably the most 
transparent way to deal with it.

cheers, 

J-Pascal 


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


Re: [PyCUDA] More Patches, and cuda.init() elimination

2010-03-04 Thread Fabrizio Milo aka misto
does anyone has an example of a program where doesn't use the
cuda.autoimport before using any of the pycuda.* ?

I can't think to an example. Also in multi thread, cuInit should be
called only once.

Fabrizio
--
Luck favors the prepared mind. (Pasteur)

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


Re: [PyCUDA] More Patches, and cuda.init() elimination

2010-03-04 Thread Imran Haque

Fabrizio Milo aka misto wrote:

does anyone has an example of a program where doesn't use the
cuda.autoimport before using any of the pycuda.* ?
  
Yes, my library (shameless plug: https://simtk.org/home/siml) manually 
handles CUDA initialization, because just getting some context from 
autoinit is not sufficient - I want to be able to select which device I 
get a context on, and potentially have multiple contexts on multiple 
devices (the library supports context-switching to simultaneously use 
multiple GPUs from a single thread).


Imran

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


Re: [PyCUDA] More Patches, and cuda.init() elimination

2010-03-04 Thread Andreas Klöckner
On Donnerstag 04 März 2010, Imran Haque wrote:
 Fabrizio Milo aka misto wrote:
  does anyone has an example of a program where doesn't use the
  cuda.autoimport before using any of the pycuda.* ?
 
 Yes, my library (shameless plug: https://simtk.org/home/siml)

Cool--I've added that to 
http://wiki.tiker.net/PyCuda/ShowCase

Hope you don't mind.

Also: Everyone, if you have an application of PyCUDA that the world
should know about, please click that link up there and hit edit! :)


 manually
 handles CUDA initialization, because just getting some context from
 autoinit is not sufficient - I want to be able to select which device I
 get a context on, and potentially have multiple contexts on multiple
 devices (the library supports context-switching to simultaneously use
 multiple GPUs from a single thread).

Same here--my PDE solver also needs to handle init itself. For example,
forking can become strangely dangerous after cuInit(). Therefore my code
needs to control carefully when CUDA is initialized.

Andreas


signature.asc
Description: This is a digitally signed message part.
___
PyCUDA mailing list
pyc...@host304.hostmonster.com
http://host304.hostmonster.com/mailman/listinfo/pycuda_tiker.net


Re: [PyCUDA] More Patches, and cuda.init() elimination

2010-03-04 Thread Andreas Klöckner
On Donnerstag 04 März 2010, Fabrizio Milo aka misto wrote:
 The work around should simple be to import pycuda after the fork.
 Importing before would be useless, because for sure you can't
 initialize cuInit and thus can't use any cu* function..
 
 Or I am missing something ?

Imports might happen at module scope, not just where PyCUDA is actively
used. Yes, it can all be worked around.  But no, the behavior is not
going to change.

Andreas



signature.asc
Description: This is a digitally signed message part.
___
PyCUDA mailing list
pyc...@host304.hostmonster.com
http://host304.hostmonster.com/mailman/listinfo/pycuda_tiker.net