<div dir="ltr"><div dir="ltr">On Wed, Feb 11, 2026 at 5:55 AM feng wang <<a href="mailto:snailsoar@hotmail.com">snailsoar@hotmail.com</a>> wrote:</div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-7196078059610615373">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Junchao,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks for your reply. Probably I did not phrase it in a clear way.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I am using openACC to port the CFD code to the GPU, so the CPU and the GPU version essentially share the same source code. For the original CPU version, it uses Jacobi (hand-coded) or GMRES+ILU(0) (with pestc) to solve the sparse linear system.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
The current GPU version of the code only port the Jacobi solver to the GPU, now I want to port GMRES+ILU(0) to the GPU. What changes do I need to make to the existing CPU version of GMRES+ILU(0) to achieve this goal? </div></div></div></blockquote><div><br></div><div>I think what Junchao is saying, is that if you use the GPU vec and mat types, this should be running on the GPU already. Does that not work?</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-7196078059610615373"><div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
BTW: For performance the GPU version of the CFD code has minimum communication between the CPU and GPU, so for Ax=b, A, x and b are created in the GPU directly</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Feng</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="m_-7196078059610615373appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_-7196078059610615373divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>><br>
<b>Sent:</b> 11 February 2026 3:00<br>
<b>To:</b> feng wang <<a href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>>; Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>><br>
<b>Subject:</b> Re: [petsc-users] Port existing GMRES+ILU(0) implementation to GPU</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Sorry, I don't understand your question. What blocks you from running your GMRES+ILU(0)<span style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif;font-size:16px"> on GPUs?<b> </b></span> I Cc'ed Barry, who knows better about the algorithms.</div>
<div><br>
</div>
<div>
<div dir="ltr">
<div dir="ltr">--Junchao Zhang</div>
</div>
</div>
<br>
</div>
<br>
<div>
<div dir="ltr">On Tue, Feb 10, 2026 at 3:57 PM feng wang <<a href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Junchao,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
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.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
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.
<b>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?</b></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Feng</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_-7196078059610615373x_m_-6901202929570229040divRplyFwdMsg">
<div style="direction:ltr;font-family:Calibri,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<b>From:</b> Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>><br>
<b>Sent:</b> 09 February 2026 23:18<br>
<b>To:</b> feng wang <<a href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] Port existing GMRES+ILU(0) implementation to GPU</div>
<div style="direction:ltr"> </div>
</div>
<div style="direction:ltr">Hi Feng,<br>
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. <br>
</div>
<div style="direction:ltr"> Thanks!</div>
<div style="direction:ltr">--Junchao Zhang</div>
<div style="direction:ltr"><br>
</div>
<div><br>
</div>
<div style="direction:ltr">On Mon, Feb 9, 2026 at 4:31 PM feng wang <<a id="m_-7196078059610615373x_m_-6901202929570229040OWAe390fc60-96cb-ebcc-fd45-7742ee2e3dec" href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>> wrote:</div>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left:1px solid rgb(204,204,204)">
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Junchao,</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Many thanks for your reply.</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
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?</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thanks,</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Feng</div>
<hr style="direction:ltr;display:inline-block;width:98%">
<div id="m_-7196078059610615373x_m_-6901202929570229040x_m_-6845830625879680973divRplyFwdMsg">
<div style="direction:ltr;font-family:Calibri,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<b>From:</b> Junchao Zhang <<a id="m_-7196078059610615373x_m_-6901202929570229040OWA9554fddb-78d7-69c8-6fcb-57624941dac9" href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>><br>
<b>Sent:</b> 09 February 2026 1:55<br>
<b>To:</b> feng wang <<a id="m_-7196078059610615373x_m_-6901202929570229040OWA52c3fa9a-47d9-e9ba-7394-8801d9590804" href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>><br>
<b>Cc:</b> <a id="m_-7196078059610615373x_m_-6901202929570229040OWA39cd01ac-1268-655d-75ca-72a8eef84d08" href="mailto:petsc-users@mcs.anl.gov" target="_blank">
petsc-users@mcs.anl.gov</a> <<a id="m_-7196078059610615373x_m_-6901202929570229040OWAb6289a58-9e52-2d6f-6c91-1eb3704340a9" href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] Port existing GMRES+ILU(0) implementation to GPU</div>
<div style="direction:ltr"> </div>
</div>
<div style="direction:ltr">Hello Feng,<br>
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}.<br>
But triangular solve is not GPU friendly and the performance might be poor. But you should try it, I think. <br>
<br>
Thanks!<br>
--Junchao Zhang</div>
<div style="direction:ltr"><br>
</div>
<div style="direction:ltr">On Sun, Feb 8, 2026 at 5:46 PM feng wang <<a id="m_-7196078059610615373x_m_-6901202929570229040OWA99c52158-b7b5-0ebf-024c-1f173456565c" href="mailto:snailsoar@hotmail.com" target="_blank">snailsoar@hotmail.com</a>> wrote:</div>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left:1px solid rgb(204,204,204)">
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Dear All,</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
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?</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Many thanks for your help in advance,</div>
<div style="direction:ltr;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Feng</div>
</blockquote>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div></blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!f7i0WZFkMTRDMqONYUCeDNn9XDQjXS7bps7XWsgAlnO54oH90yfmvfuu-0QJAbxqCNYSof3G34TuqDSTsgpM$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>