[petsc-users] Port existing GMRES+ILU(0) implementation to GPU

Junchao Zhang junchao.zhang at gmail.com
Tue Feb 10 21:00:38 CST 2026


Sorry, I don't understand your question.  What blocks you from running your
GMRES+ILU(0) on GPUs?  I Cc'ed Barry, who knows better about the algorithms.

--Junchao Zhang


On Tue, Feb 10, 2026 at 3:57 PM feng wang <snailsoar at hotmail.com> wrote:

> Hi Junchao,
>
> I have managed to configure Petsc for GPU, also managed to run ksp/ex15
> using -mat_type aijcusparse -vec_type cuda.  It seems runs much faster
> compared to the scenario if I don't use " -mat_type aijcusparse -vec_type
> cuda". so I believe it runs okay for GPUs.
>
> I have an existing CFD code that runs natively on GPUs. so all the data is
> offloaded to GPU at the beginning and some data are copied back to the cpu
> at the very end. It got a hand-coded Newton-Jacobi that runs in GPUs for
> the implicit solver.  *My question is:  my code also has a GMRES+ILU(0)
> implemented with Petsc but it only runs on cpus (which I implemented a few
> years ago). How can I replace the existing Newton-Jacobi (which runs in
> GPUs) with GMRES+ILU(0) which should run in GPUs. Could you please give
> some advice?*
>
> Thanks,
> Feng
>
> ------------------------------
> *From:* Junchao Zhang <junchao.zhang at gmail.com>
> *Sent:* 09 February 2026 23:18
> *To:* feng wang <snailsoar at hotmail.com>
> *Cc:* petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
> *Subject:* Re: [petsc-users] Port existing GMRES+ILU(0) implementation to
> GPU
>
> Hi Feng,
>   At the first step, you don't need to change your CPU implementation.
> Then do profiling to see where it is worth putting your effort.  Maybe you
> need to assemble your matrices and vectors on GPUs too, but decide that at
> a later stage.
>
>   Thanks!
> --Junchao Zhang
>
>
> On Mon, Feb 9, 2026 at 4:31 PM feng wang <snailsoar at hotmail.com> wrote:
>
> Hi Junchao,
>
> Many thanks for your reply.
>
> This is great!  Do I need to change anything for my current CPU
> implementation? or I just link to a version of Petsc that is configured
> with  cuda and make sure the necessary data are copied to the "device",
> then Petsc will do the rest magic for me?
>
> Thanks,
> Feng
> ------------------------------
> *From:* Junchao Zhang <junchao.zhang at gmail.com>
> *Sent:* 09 February 2026 1:55
> *To:* feng wang <snailsoar at hotmail.com>
> *Cc:* petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
> *Subject:* Re: [petsc-users] Port existing GMRES+ILU(0) implementation to
> GPU
>
> Hello Feng,
>   It is possible to run GMRES with ILU(0) on GPUs.  You may need to
> configure PETSc with CUDA (--with-cuda --with-cudac=nvcc) or Kokkos (with
> extra --download-kokkos  --download-kokkos-kernels).  Then run with
> -mat_type {aijcusparse or aijkokkos}  -vec_type {cuda or kokkos}.
>   But triangular solve is not GPU friendly and the performance might be
> poor.  But you should try it, I think.
>
> Thanks!
> --Junchao Zhang
>
> On Sun, Feb 8, 2026 at 5:46 PM feng wang <snailsoar at hotmail.com> wrote:
>
> Dear All,
>
> I have an existing implementation of GMRES with ILU(0), it works well for
> cpu now. I went through the Petsc documentation, it seems Petsc has some
> support for GPUs. is it possible for me to run GMRES with ILU(0) in GPUs?
>
> Many thanks for your help in advance,
> Feng
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260210/86cd24e4/attachment-0001.html>


More information about the petsc-users mailing list