[PyCUDA] device pointer to cudaArray?

2015-10-22 Thread Luke Pfister
I'm trying to allocate a 3D cudaArray in PyCUDA, then pass the pointer to
this array through Cython.  T

This is easy to do with 'regular' memory on the device via the GPUarray
class;  I can just cast GPUarray.gpudata to long and then pass through
Cython.

Is there a way to do something similar with a pycuda.driver.Array?  I don't
see a way to get to the device pointer.

Thanks,
Luke
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] device pointer to cudaArray?

2015-10-22 Thread Andreas Kloeckner
Luke Pfister  writes:

> I'm trying to allocate a 3D cudaArray in PyCUDA, then pass the pointer to
> this array through Cython.  T
>
> This is easy to do with 'regular' memory on the device via the GPUarray
> class;  I can just cast GPUarray.gpudata to long and then pass through
> Cython.
>
> Is there a way to do something similar with a pycuda.driver.Array?  I don't
> see a way to get to the device pointer.

There isn't currently, but it's not hard to patch in.

Add a handle_int (or some such) function here:
https://github.com/inducer/pycuda/blob/0797e9390c8c85034cf71ccc46f54fa158da92c4/src/cpp/cuda.hpp#L1060

that returns the handle pointer cast to an integer. Realize that you
just assumed part of the responsibility for management of the lifetime
of the handle.

Wrap you new handle_int here:

https://github.com/inducer/pycuda/blob/master/src/wrapper/wrap_cudadrv.cpp#L1422

Leave handle_int undocumented. Submit a pull request.

HTH,
Andreas

___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda