<div dir="ltr"><div>The eigen estimates are either very bad or the coarse grids have a problem. Everything<font color="#6aa84f"> looks fine </font>other than these <font color="#ff0000">bad estimates</font>  that are >> 2.</div><div><br></div><div>* Are these matrices not symmetric? Maybe from BCs. THat is not usually a problem, just checking.</div><div><br></div><div>* Are these stretched grids? If not you might try: -ampere_pc_gamg_square_graph <b>10</b></div><div><br></div><div>* GMRES is not a good estimator when you have SPD matrices, but it is robust. You might try </div><div><br></div><div><b style="color:rgb(0,0,0);font-family:Times;font-size:medium">-</b>ampere_mg_levels_esteig_<b style="color:rgb(0,0,0);font-family:Times;font-size:medium">ksp_monitor_singular_value</b></div><div>-ampere_mg_levels_esteig_ksp_max_it <b>50</b><br>-ampere_mg_levels_esteig_ksp_type <b>gmres</b><b style="color:rgb(0,0,0);font-family:Times;font-size:medium"><br></b></div><div><br></div><div>* And why are you using:</div><div><br></div><div>-ampere_ksp_type dgmres<br></div><div><br></div><div>?</div><div>If your problems are SPD then CG is great.</div><div><br></div><div>Mark</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 17, 2020 at 10:33 AM nicola varini <<a href="mailto:nicola.varini@gmail.com" target="_blank">nicola.varini@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Mark, this is the out of grep GAMG after I used -info:<br><div>=======</div><div>[0] PCSetUp_GAMG(): level 0) N=582736, n data rows=1, n data cols=1, nnz/row (ave)=9, np=12<br>[0] PCGAMGFilterGraph():         97.9676% nnz after filtering, with threshold 0., 8.95768 nnz ave. (N=582736)<br>[0] PCGAMGCoarsen_AGG(): Square Graph on level 1 of 1 to square<br>[0] PCGAMGProlongator_AGG(): New grid 38934 nodes<br>[0] PCGAMGOptProlongator_AGG(): Smooth P0: <font color="#6aa84f">max eigen=2.101683e+00 </font>min=4.341777e-03 PC=jacobi<br>[0] PCGAMGOptProlongator_AGG(): Smooth P0: level 0, cache spectra 0.00434178 2.10168<br>[0] PCSetUp_GAMG(): 1) N=38934, n data cols=1, nnz/row (ave)=18, 12 active pes<br>[0] PCGAMGFilterGraph():         97.024% nnz after filtering, with threshold 0., 17.9774 nnz ave. (N=38934)<br>[0] PCGAMGProlongator_AGG(): New grid 4459 nodes<br>[0] PCGAMGOptProlongator_AGG(): Smooth P0: <font color="#ff0000">max eigen=4.521607e+01</font> min=5.854294e-01 PC=jacobi<br>[0] PCGAMGOptProlongator_AGG(): Smooth P0: level 1, cache spectra 0.585429 45.2161<br>[0] PCSetUp_GAMG(): 2) N=4459, n data cols=1, nnz/row (ave)=29, 12 active pes<br>[0] PCGAMGFilterGraph():         99.6422% nnz after filtering, with threshold 0., 27.5481 nnz ave. (N=4459)<br>[0] PCGAMGProlongator_AGG(): New grid 345 nodes<br>[0] PCGAMGOptProlongator_AGG(): Smooth P0: <font color="#ff0000">max eigen=1.394069e+01 </font>min=1.086973e-01 PC=jacobi<br>[0] PCGAMGOptProlongator_AGG(): Smooth P0: level 2, cache spectra 0.108697 13.9407<br>[0] PCGAMGCreateLevel_GAMG(): Number of equations (loc) 29 with simple aggregation<br>[0] PCSetUp_GAMG(): 3) N=345, n data cols=1, nnz/row (ave)=31, 6 active pes<br>[0] PCGAMGFilterGraph():         99.6292% nnz after filtering, with threshold 0., 26.9667 nnz ave. (N=345)<br>[0] PCGAMGProlongator_AGG(): New grid 26 nodes<br>[0] PCGAMGOptProlongator_AGG(): Smooth P0: <font color="#ff0000">max eigen=1.463593e+02</font> min=1.469384e-01 PC=jacobi<br>[0] PCGAMGOptProlongator_AGG(): Smooth P0: level 3, cache spectra 0.146938 146.359<br>[0] PCGAMGCreateLevel_GAMG(): Number of equations (loc) 5 with simple aggregation<br>[0] PCSetUp_GAMG(): 4) N=26, n data cols=1, nnz/row (ave)=16, 1 active pes<br>[0] PCSetUp_GAMG(): 5 levels, grid complexity = 1.16304<br>PCGAMGGraph_AGG        4 1.0 8.4114e-02 1.0 1.02e+06 1.0 3.8e+02 1.3e+03 4.0e+01  0  0  0  0  0   0  0  0  0  0   145<br>PCGAMGCoarse_AGG       4 1.0 3.2107e-01 1.0 9.43e+06 1.0 7.3e+02 1.1e+04 3.5e+01  0  0  0  0  0   0  0  0  0  0   351<br>PCGAMGProl_AGG         4 1.0 2.8825e-02 1.0 0.00e+00 0.0 3.5e+02 2.8e+03 6.4e+01  0  0  0  0  0   0  0  0  0  0     0<br>PCGAMGPOpt_AGG         4 1.0 1.1570e-01 1.0 2.61e+07 1.0 1.2e+03 2.6e+03 1.6e+02  0  0  0  0  1   0  0  0  0  1  2692<br>GAMG: createProl       4 1.0 5.5680e-01 1.0 3.64e+07 1.0 2.7e+03 4.6e+03 3.0e+02  0  0  0  0  1   0  0  0  0  1   784<br>GAMG: partLevel        4 1.0 1.1628e-01 1.0 5.90e+06 1.0 1.1e+03 3.0e+03 1.6e+02  0  0  0  0  1   0  0  0  0  1   604<br>======<br></div><div>Nicola<br></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno lun 17 ago 2020 alle ore 15:40 Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 17, 2020 at 9:24 AM nicola varini <<a href="mailto:nicola.varini@gmail.com" target="_blank">nicola.varini@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Mark, I do confirm that hypre with boomeramg is working fine and is pretty fast. <br></div></div></blockquote><div><br></div><div>Good, you can send me the -info (grep GAMG) output and I try to see what is going on.</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 dir="ltr"><div></div><div>However, none of the GAMG option works.<br></div><div>Did anyone ever succeeded in usign hypre with petsc on gpu?<br></div></div></blockquote><div><br></div><div>We have gotten Hypre to run on GPUs but it has been fragile. The performance has been marginal (due to use of USM apparently), but it is being worked on by the hypre team.</div><div><br></div><div>The cude tools are changing fast and I am guessing this is a different version than what we have tested, perhaps. Maybe someone else can help with this, but I know we use cuda 10.2 and you are using cuda tools 10.1. </div><div><br></div><div>And you do want to use the most up-to-date PETSc.</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 dir="ltr"><div></div><div>I did manage to compile hypre on gpu but I do get the following error:<br></div><div>=======<br>          CC gpuhypre/obj/vec/vec/impls/hypre/vhyp.o<br>In file included from /opt/nvidia/cudatoolkit10/10.1.105_3.27-7.0.1.1_4.1__ga311ce7/include/thrust/detail/config.h:22,<br>                 from /opt/nvidia/cudatoolkit10/10.1.105_3.27-7.0.1.1_4.1__ga311ce7/include/thrust/execution_policy.h:23,<br>                 from /users/nvarini/hypre/include/_hypre_utilities.h:1129,<br>                 from /users/nvarini/hypre/include/_hypre_IJ_mv.h:14,<br>                 from /scratch/snx3000/nvarini/petsc-3.13.3/include/../src/vec/vec/impls/hypre/vhyp.h:6,<br>                 from /scratch/snx3000/nvarini/petsc-3.13.3/src/vec/vec/impls/hypre/vhyp.c:7:<br>/opt/nvidia/cudatoolkit10/10.1.105_3.27-7.0.1.1_4.1__ga311ce7/include/thrust/version.h:83:1: error: unknown type name 'namespace'<br> namespace thrust<br> ^~~~~~~~~<br>/opt/nvidia/cudatoolkit10/10.1.105_3.27-7.0.1.1_4.1__ga311ce7/include/thrust/version.h:84:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token<br> {<br> ^<br>In file included from /opt/nvidia/cudatoolkit10/10.1.105_3.27-7.0.1.1_4.1__ga311ce7/include/thrust/detail/config/config.h:28,<br>                 from /opt/nvidia/cudatoolkit10/10.1.105_3.27-7.0.1.1_4.1__ga311ce7/include/thrust/detail/config.h:23,<br>                 from /opt/nvidia/cudatoolkit10/10.1.105_3.27-7.0.1.1_4.1__ga311ce7/include/thrust/execution_policy.h:23,<br>                 from /users/nvarini/hypre/include/_hypre_utilities.h:1129,<br>                 from /users/nvarini/hypre/include/_hypre_IJ_mv.h:14,<br>                 from /scratch/snx3000/nvarini/petsc-3.13.3/include/../src/vec/vec/impls/hypre/vhyp.h:6,<br>                 from /scratch/snx3000/nvarini/petsc-3.13.3/src/vec/vec/impls/hypre/vhyp.c:7:<br>/opt/nvidia/cudatoolkit10/10.1.105_3.27-7.0.1.1_4.1__ga311ce7/include/thrust/detail/config/cpp_compatibility.h:21:10: fatal error: cstddef: No such file or directory<br> #include <cstddef><br>          ^~~~~~~~~<br>compilation terminated.<br><br>=======<br></div><div>Nicola<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno ven 14 ago 2020 alle ore 20:13 Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">You can try Hypre. If that fails then there is a problem with your system.<div><br><div>And you can run with -info and grep on GAMG and send the output and I can see if I see anything funny.</div><div><br></div><div>If this is just a Lapacian with a stable discretization and not crazy material parameters then stretched grids are about the only thing that can hurt the solver.</div></div><div><br></div><div>Do both of your solves fail in a similar way?</div><div><br></div><div>On the CPU you can try this with large subdomains, preferably (in serial ideally):</div><div>-ampere_mg_levels_ksp_type richardson<br>-ampere_mg_levels_pc_type sor<br></div><div><br></div><div>And check that there are no unused options with -options_left. GAMG can fail with bad eigen estimates, but these parameters look fine.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 14, 2020 at 5:01 AM nicola varini <<a href="mailto:nicola.varini@gmail.com" target="_blank">nicola.varini@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear Barry, yes it gives the same problems. <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 13 ago 2020 alle ore 23:22 Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><br></div>   Does the same thing work (with GAMG) if you run on the same problem on the same machine same number of MPI ranks but make a new PETSC_ARCH that does NOT use the GPUs?<div><br></div><div>   Barry</div><div><br></div><div>   Ideally one gets almost identical convergence with CPUs or GPUs (same problem, same machine) but a bug or numerically change "might" affect this.<br><div><br><blockquote type="cite"><div>On Aug 13, 2020, at 10:28 AM, nicola varini <<a href="mailto:nicola.varini@gmail.com" target="_blank">nicola.varini@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div><div><div>Dear Barry, you are right. The Cray argument checking is incorrect. It does work with download-fblaslapack.<br></div>However it does fail to converge. Is there anything obviously wrong with my petscrc? <br></div>Anything else am I missing?<br><br></div>Thanks<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 13 ago 2020 alle ore 03:17 Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><br></div>   The QR is always done on the CPU, we don't have generic calls to blas/lapack go to the GPU currently.<div><br></div><div>   The error message is:</div><div><br></div><div>   On entry to __cray_mgm_dgeqrf, parameter 7 had an illegal value (info = -7)</div><div><br></div><div>   argument 7 is &LWORK which is defined by</div><div><br></div><div>   PetscBLASInt   LWORK=N*bs;</div><div><br></div><div>   and</div><div><br></div><div>   N=nSAvec is the column block size of new P.</div><div><br></div><div>   Presumably this is a huge run with many processes so using the debugger is not practical?</div><div><br></div><div>   We need to see what these variables are</div><div><br></div><div>    N, bs, nSAvec  </div><div><br></div><div>    perhaps nSAvec is zero which could easily upset LAPACK. </div><div><br></div><div>    Crudest thing would be to just put a print statement in the code before the LAPACK call of if they are called many times add an error check like that</div><div>    generates an error if any of these three values are 0 (or negative).</div><div><br></div><div>   Barry</div><div><br></div><div><br></div><div>    It is not impossible that the Cray argument checking is incorrect and the value passed in is fine. You can check this by using --download-fblaslapack and see if the same or some other error comes up.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div><br><blockquote type="cite"><div>On Aug 12, 2020, at 7:19 PM, Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:</div><br><div><div dir="ltr">Can you reproduce this on the CPU? <div>The QR factorization seems to be failing. That could be from bad data or a bad GPU QR.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 12, 2020 at 4:19 AM nicola varini <<a href="mailto:nicola.varini@gmail.com" target="_blank">nicola.varini@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear all, following the suggestions I did resubmit the simulation with the petscrc below.<br></div>However I do get the following error:<br>========<br><div> 7362 [592]PETSC ERROR: #1 formProl0() line 748 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/impls/gamg/agg.c<br>  7363 [339]PETSC ERROR: Petsc has generated inconsistent data<br>  7364 [339]PETSC ERROR: xGEQRF error<br>  7365 [339]PETSC ERROR: See <a href="https://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">https://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>  7366 [339]PETSC ERROR: Petsc Release Version 3.13.3, Jul 01, 2020<br>  7367 [339]PETSC ERROR: /users/nvarini/gbs_test_nicola/bin/gbs_daint_gpu_gnu on a  named nid05083 by nvarini Wed Aug 12 10:06:15 2020<br>  7368 [339]PETSC ERROR: Configure options --with-cc=cc --with-fc=ftn --known-mpi-shared-libraries=1 --known-mpi-c-double-complex=1 --known-mpi-int64_t=1 --known-mpi-long-double=1 --with-batch=1 --known-64-bit-blas-indices=0 --LIBS=-lstdc++ --with-cxxlib-autodetect=0 --with-scalapa       ck=1 --with-cxx=CC --with-debugging=0 --with-hypre-dir=/opt/cray/pe/tpsl/19.06.1/GNU/8.2/haswell --prefix=/scratch/snx3000/nvarini/petsc3.13.3-gpu --with-cuda=1 --with-cuda-c=nvcc --with-cxxlib-autodetect=0 --COPTFLAGS=-I/opt/cray/pe/mpt/7.7.10/gni/mpich-intel/16.0/include -       -with-cxx=CC --CXXOPTFLAGS=-I/opt/cray/pe/mpt/7.7.10/gni/mpich-intel/16.0/include<br>  7369 [592]PETSC ERROR: #2 PCGAMGProlongator_AGG() line 1063 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/impls/gamg/agg.c<br>  7370 [592]PETSC ERROR: #3 PCSetUp_GAMG() line 548 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/impls/gamg/gamg.c<br>  7371 [592]PETSC ERROR: #4 PCSetUp() line 898 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/interface/precon.c<br>  7372 [592]PETSC ERROR: #5 KSPSetUp() line 376 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/ksp/interface/itfunc.c<br>  7373 [592]PETSC ERROR: #6 KSPSolve_Private() line 633 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/ksp/interface/itfunc.c<br>  7374 [316]PETSC ERROR: #3 PCSetUp_GAMG() line 548 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/impls/gamg/gamg.c<br>  7375 [339]PETSC ERROR: #1 formProl0() line 748 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/impls/gamg/agg.c<br>  7376 [339]PETSC ERROR: #2 PCGAMGProlongator_AGG() line 1063 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/impls/gamg/agg.c<br>  7377 [339]PETSC ERROR: #3 PCSetUp_GAMG() line 548 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/impls/gamg/gamg.c<br>  7378 [339]PETSC ERROR: #4 PCSetUp() line 898 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/interface/precon.c<br>  7379 [339]PETSC ERROR: #5 KSPSetUp() line 376 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/ksp/interface/itfunc.c<br>  7380 [592]PETSC ERROR: #7 KSPSolve() line 853 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/ksp/interface/itfunc.c<br>  7381 [339]PETSC ERROR: #6 KSPSolve_Private() line 633 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/ksp/interface/itfunc.c<br>  7382 [339]PETSC ERROR: #7 KSPSolve() line 853 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/ksp/interface/itfunc.c<br>  7383 On entry to __cray_mgm_dgeqrf, parameter 7 had an illegal value (info = -7)<br>  7384 [160]PETSC ERROR: #3 PCSetUp_GAMG() line 548 in /scratch/snx3000/nvarini/petsc-3.13.3/src/ksp/pc/impls/gamg/gamg.c<br>========<br></div><div><br></div><div>I did try other pc_gamg_type but they fails as well.<br></div><div><br></div><div><br>#PETSc Option Table entries:<br>-ampere_dm_mat_type aijcusparse<br>-ampere_dm_vec_type cuda<br>-ampere_ksp_atol 1e-15<br>-ampere_ksp_initial_guess_nonzero yes<br>-ampere_ksp_reuse_preconditioner yes<br>-ampere_ksp_rtol 1e-7<br>-ampere_ksp_type dgmres<br>-ampere_mg_levels_esteig_ksp_max_it 10<br>-ampere_mg_levels_esteig_ksp_type cg<br>-ampere_mg_levels_ksp_chebyshev_esteig 0,0.05,0,1.05<br>-ampere_mg_levels_ksp_type chebyshev<br>-ampere_mg_levels_pc_type jacobi<br>-ampere_pc_gamg_agg_nsmooths 1<br>-ampere_pc_gamg_coarse_eq_limit 10<br>-ampere_pc_gamg_reuse_interpolation true<br>-ampere_pc_gamg_square_graph 1<br>-ampere_pc_gamg_threshold 0.05<br>-ampere_pc_gamg_threshold_scale .0<br>-ampere_pc_gamg_type agg<br>-ampere_pc_type gamg<br>-dm_mat_type aijcusparse<br>-dm_vec_type cuda<br>-log_view<br>-poisson_dm_mat_type aijcusparse<br>-poisson_dm_vec_type cuda<br>-poisson_ksp_atol 1e-15<br>-poisson_ksp_initial_guess_nonzero yes<br>-poisson_ksp_reuse_preconditioner yes<br>-poisson_ksp_rtol 1e-7<br>-poisson_ksp_type dgmres<br>-poisson_log_view<br>-poisson_mg_levels_esteig_ksp_max_it 10<br>-poisson_mg_levels_esteig_ksp_type cg<br>-poisson_mg_levels_ksp_chebyshev_esteig 0,0.05,0,1.05<br>-poisson_mg_levels_ksp_max_it 1<br>-poisson_mg_levels_ksp_type chebyshev<br>-poisson_mg_levels_pc_type jacobi<br>-poisson_pc_gamg_agg_nsmooths 1<br>-poisson_pc_gamg_coarse_eq_limit 10<br>-poisson_pc_gamg_reuse_interpolation true<br>-poisson_pc_gamg_square_graph 1<br>-poisson_pc_gamg_threshold 0.05<br>-poisson_pc_gamg_threshold_scale .0<br>-poisson_pc_gamg_type agg<br>-poisson_pc_type gamg<br><div>-use_mat_nearnullspace true</div><div>#End of PETSc Option Table entries<br></div></div><div><br></div><div>Regards,<br><br></div><div>Nicola<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mar 4 ago 2020 alle ore 17:57 Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 4, 2020 at 6:35 AM Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div>Nicola,</div><div><br></div><div>You are actually not using the GPU properly, since you use HYPRE preconditioning, which is CPU only. One of your solvers is actually slower on “GPU”.</div><div>For a full AMG GPU, you can use PCGAMG, with cheby smoothers and with Jacobi preconditioning. Mark can help you out with the specific command line options.</div><div>When it works properly, everything related to PC application is offloaded to the GPU, and you should expect to get the well-known and branded 10x (maybe more) speedup one is expecting from GPUs during KSPSolve</div><div><br></div></div></blockquote><div><br></div><div>The speedup depends on the machine, but on SUMMIT, using enough CPUs to saturate the memory bus vs all 6 GPUs the speedup is a function of problem subdomain size. I saw 10x at about 100K equations/process.</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><div></div><div>Doing what you want to do is one of the last optimization steps of an already optimized code before entering production. Yours is not even optimized for proper GPU usage  yet.</div><div>Also, any specific reason why you are using dgmres and fgmres?</div><div><br></div><div>PETSc has not been designed with multi-threading in mind. You can achieve “overlap” of the two solves by splitting the communicator. But then you need communications to let the two solutions talk to each other.</div><div><br></div><div>Thanks</div><div>Stefano</div><div><br><div><br><blockquote type="cite"><div>On Aug 4, 2020, at 12:04 PM, nicola varini <<a href="mailto:nicola.varini@gmail.com" target="_blank">nicola.varini@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div><div><div><div><div>Dear all, thanks for your replies. The reason why I've asked if it is possible to overlap poisson and ampere is because they roughly<br></div>take the same amount of time. Please find in attachment the profiling logs for only CPU  and only GPU.<br></div>Of course it is possible to split the MPI communicator and run each solver on different subcommunicator, however this would involve more communication.<br></div>Did anyone ever tried to run 2 solvers with hyperthreading? <br></div><div>Thanks<br></div></div><div><div><div><div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno dom 2 ago 2020 alle ore 14:09 Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I suspect that the Poisson and Ampere's law solve are not coupled. You might be able to duplicate the communicator and use two threads. You would want to configure PETSc with threadsafty and threads and I think it could/should work, but this mode is never used by anyone.<br><div><br></div><div>That said, I would not recommend doing this unless you feel like playing in computer science, as opposed to doing application science. The best case scenario you get a speedup of 2x. That is a strict upper bound, but you will never come close to it. Your hardware has some balance of CPU to GPU processing rate. Your application has a balance of volume of work for your two solves. They have to be the same to get close to 2x speedup and that ratio(s) has to be 1:1. To be concrete, from what little I can guess about your applications let's assume that the cost of each of these two solves is about the same (eg, Laplacians on your domain and the best case scenario). But, GPU machines are configured to have roughly 1-10% of capacity in the GPUs, these days, that gives you an upper bound of about 10% speedup. That is noise. Upshot, unless you configure your hardware to match this problem, and the two solves have the same cost, you will not see close to 2x speedup. Your time is better spent elsewhere.</div><div><br></div><div>Mark</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 1, 2020 at 3:24 PM Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You can use MPI and split the communicator so n-1 ranks create a DMDA for one part of your system and the other rank drives the GPU in the other part.  They can all be part of the same coupled system on the full communicator, but PETSc doesn't currently support some ranks having their Vec arrays on GPU and others on host, so you'd be paying host-device transfer costs on each iteration (and that might swamp any performance benefit you would have gotten).<br>
<br>
In any case, be sure to think about the execution time of each part.  Load balancing with matching time-to-solution for each part can be really hard.<br>
<br>
<br>
Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> writes:<br>
<br>
>   Nicola,<br>
><br>
>     This is really viable or practical at this time with PETSc. It is not impossible but requires careful coding with threads, another possibility is to use one half of the virtual GPUs for each solve, this is also not trivial. I would recommend first seeing what kind of performance you can get on the GPU for each type of solve and revist this idea in the future.<br>
><br>
>    Barry<br>
><br>
><br>
><br>
><br>
>> On Jul 31, 2020, at 9:23 AM, nicola varini <<a href="mailto:nicola.varini@gmail.com" target="_blank">nicola.varini@gmail.com</a>> wrote:<br>
>> <br>
>> Hello, I would like to know if it is possible to overlap CPU and GPU with DMDA.<br>
>> I've a machine where each node has 1P100+1Haswell.<br>
>> I've to resolve Poisson and Ampere equation for each time step.<br>
>> I'm using 2D DMDA for each of them. Would be possible to compute poisson <br>
>> and ampere equation at the same time? One on CPU and the other on GPU?<br>
>> <br>
>> Thanks<br>
</blockquote></div>
</blockquote></div>
<span id="m_2883508291549829615m_-322691894527690541m_1385562204412439704gmail-m_44692061863610022gmail-m_3522463187220974147gmail-m_-3970811253325583833gmail-m_-287257760015557249gmail-m_7295191563877526157gmail-m_7509251495650781420gmail-m_3795355602041451874gmail-m_-2894221877128162253gmail-m_-630451931610969904gmail-m_5452938391528559121gmail-m_-3233498012180817199cid:f_kdfro0bi0"><out_gpu></span><span id="m_2883508291549829615m_-322691894527690541m_1385562204412439704gmail-m_44692061863610022gmail-m_3522463187220974147gmail-m_-3970811253325583833gmail-m_-287257760015557249gmail-m_7295191563877526157gmail-m_7509251495650781420gmail-m_3795355602041451874gmail-m_-2894221877128162253gmail-m_-630451931610969904gmail-m_5452938391528559121gmail-m_-3233498012180817199cid:f_kdfro8hf1"><out_nogpu></span></div></blockquote></div><br></div></div></blockquote></div></div>
</blockquote></div>
</blockquote></div>
</div></blockquote></div><br></div></div></blockquote></div>
<span id="m_2883508291549829615m_-322691894527690541m_1385562204412439704gmail-m_44692061863610022gmail-m_3522463187220974147gmail-m_-3970811253325583833gmail-m_-287257760015557249gmail-m_7295191563877526157gmail-m_7509251495650781420gmail-m_3795355602041451874cid:f_kdsygc0w0"><out_miniapp_f_poisson></span></div></blockquote></div><br></div></div></blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div></div>