Ashwin Srinath
2014-10-13 23:54:39 UTC
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 :)
Thanks so much,
Ashwin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20141013/c1e65423/attachment.html>
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 :)
Thanks so much,
Ashwin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20141013/c1e65423/attachment.html>