Hello, petsc-dev

When working with petsc4py, I realized that there was no way to access the
underlying device memory. The routine that PETSc provides is
VecCUSPGetArrayRead/Write, which of course, makes no sense in Python.

So I wrote a petsc4py extension that extracts and returns the raw device
pointer from the underlying CUSP array. With this raw pointer, I'm able to
construct a PyCUDA GPUArray, and apply my own kernels to the underlying
buffers. My code is available here:
https://github.com/ashwinsrnth/petsc-pycuda

After discussion with Lisandro Dalcin, I think that it might be a good idea
for PETSc to provide a routine `VecGetGPUArray` (in place of or in addition
to the current `VecCUSPGetArray`) which returns a raw pointer to device
memory, and lets the user decide what to do with it.

Do you think this can fit in to PETSc? If so, I already have an
implementation, but can use help with the interface.

Thank you
Ashwin

Reply via email to