Thank you for your reply, Andreas, and for your work!
Keeping in mind that `array` is of type double*, would this be the right
way to do it? I realize this is more a Cython question:
cdef extern from "stdint.h":
ctypedef unsigned long long uint64_t
V_gpu = gpuarray.empty(V.getSizes(), dtype=np.float64,
gpudata=<uint64_t>array)
Thank you
Ashwin
On Tue, Oct 14, 2014 at 2:41 AM, Andreas Kloeckner <[email protected]>
wrote:
> Ashwin Srinath <[email protected]> writes:
>
> > Hello, PyCUDA users!
> >
> > I'm trying to construct a GPUArray from device memory allocated using
> > petsc4py. I've written some C code that extracts a raw pointer from a
> PETSc
> > "cusp" vector. Now, I am hoping to 'place' this memory into a gpuarray,
> > using PyCUDA and Cython in some way. Here's a Cython snippet that I hope
> > will make it clear:
> >
> > def getGPUArray(Vec V):
> > cdef double *array
> > VecGetGPUArray(V.vec, &array)
> > G = gpuarray.??? # how to construct this gpuarray?
> > print G.get()
> >
> > `VecGetGPUArray` is some C code that extracts the raw pointer from Vec.
> > `array` is the raw pointer from which I want to be able to construct a
> > gpuarray.
> >
> > I think this could be very useful to petsc4py users, and I'd be happy to
> > provide more information/code to make this work :)
>
> The GPUArray constructor has an undocumented data= keyword argument that
> you should be able to use.
>
> Andreas
>
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda