Simon Perkins <[email protected]> writes:
> 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?

This example on the wiki does driver-runtime interop and should do
roughly what you are asking about:

http://wiki.tiker.net/PyCuda/Examples/ThrustInterop

Andreas

Attachment: pgpPYOzMBxwhV.pgp
Description: PGP signature

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

Reply via email to