[petsc-dev] Matshell with PETSs solvers using GPU

Jed Brown jed at jedbrown.org
Fri Nov 4 10:06:16 CDT 2022

Yes, this is supported. You can use VecGetArrayAndMemType() to get access to device memory. You'll often use DMGlobalToLocalBegin/End() or VecScatter to communicate, but that will use GPU-aware MPI if your Vec is a device vector.

Han Tran <hantran at cs.utah.edu> writes:

> Hi,
> I am aware that PETSc recently supports solvers on GPU. I wonder whether PETSc supports MatShell with GPU solvers, i.e., I have a user-defined MatMult() function residing on the device, and I want to use MatShell directly with PETSc GPU solvers without any transfer back and forth between host and device. If this is possible, could you let me know how to do this (an example, if any, would be very appreciated)?
> Thank you!
> Han

More information about the petsc-dev mailing list