So in the C function you just pass the integer returned by the handle as the stream?
On Nov 6, 2013, at 12:40 AM, Freddie Witherden <[email protected]> wrote: > On 05/11/13 23:30, Andreas Kloeckner wrote: >> Rok Roškar <[email protected]> writes: >>> wow that makes it pretty straightforward, thanks! >>> >>> I'm afraid I'm probably missing something obvious, but is there a similar >>> trick for streams? >> >> Nope, sorry. Patches welcome, although having this functionality is >> somewhat risky: A plain integer pointer-like value is not sufficient to >> tell Python that the object is still in use--it may thus get >> garbage-collected. > > In [3]: s = cuda.Stream() > > In [4]: s.handle > Out[4]: 32994256 > > Works a treat; although you do need to ensure that a reference to the > object is retained. Saying that, it is no more risky than having to > manually manage a stream using the C API. I've been using the above in > my ctypes cuBLAS wrappers for a while now. > > Regards, Freddie. > > _______________________________________________ > PyCUDA mailing list > [email protected] > http://lists.tiker.net/listinfo/pycuda _______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
