Freddie Witherden <freddie@...> writes:

> 
> On 05/11/13 23:45, Rok Roškar wrote:
> > So in the C function you just pass the integer returned by the handle
> > as the stream?
> 
> Yes; the integer is a CUstream (which CUDA typedef's to be a pointer).
> You can pass this integer to any C function expecting a CUstream.
> 
> Regards, Freddie.
> 
> 
> 
> On 05/11/13 23:45, Rok Roškar wrote:
> > So in the C function you just pass the integer returned by the handle
> > as the stream?
> 
> Yes; the integer is a CUstream (which CUDA typedef's to be a pointer).
> You can pass this integer to any C function expecting a CUstream.
> 
> Regards, Freddie.
> 
> 

Hi all

I've got similar questions with passing PyCUDA  types such as streams and
device pointers to CUDA calls within the Python C API. Specifically, I'm
trying to make calls to the moderngpu (http://nvlabs.github.io/moderngpu/)
library.

I've got the passing of device pointers and stream id's through to the C API.

Howe,ver the issue I'm facing is that, as far as I can tell, a new context
gets created by the moderngpu calling cudaGetDevice(), so I can't pass the
stream associated with the PyCUDA context to the moderngpu code. Has anyone
here run into a similar situation?

I did some investigation and it seems the best way to handle this, would be
to pass the pycuda.autoinit.context object to the C API, extract the
CUcontext and use cuCtxPushCurrent and cuCtxPopCurrent to encourage
cudaGetDevice() to pick up PyCUDA's context? Or am I completely off track here?

best
  Simon





_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to