[petsc-dev] Backend independent VecGetArray for GPUs
Ashwin Srinath
ashwinsrnth at gmail.com
Fri Oct 17 09:21:21 CDT 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20141017/a628d06c/attachment.html>
More information about the petsc-dev
mailing list