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
pgpVCYBVOZNum.pgp
Description: PGP signature
_______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
