<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/4.6.6">
</HEAD>
<BODY>
Barry,<BR>
<BR>
I attached ksp_view and log_summary for two different setups:<BR>
<BR>
1) Plain MG on 5 levels + LU at the coarse level (files ending in mg5)<BR>
2) Plain MG on 5 levels + custom PC + LU at the coarse level (files ending in mg7)<BR>
<BR>
The custom PC works on a subset of processes, thus allowing to use two more levels of MG, for a total of 7.<BR>
Case 1) is extremely slow ( ~ 20 sec per solve ) and converges in 21 iterations.<BR>
Case 2) is way faster ( ~ 0.25 sec per solve ) and converges in 29 iterations.<BR>
<BR>
Thanks for your help!<BR>
<BR>
Michele<BR>
<BR>
<BR>
On Fri, 2015-07-24 at 13:56 -0500, Barry Smith wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
The coarse problem for the PCMG (geometric multigrid) is
Mat Object: 8192 MPI processes
type: mpiaij
rows=8192, cols=8192
then it tries to solve it with algebraic multigrid on 8192 processes (which is completely insane). A lot of the time is spent in setting up the algebraic multigrid (not surprisingly).
8192 is kind of small to parallelize. Please run the same code but with the default coarse grid problem instead of PCGAMG and send us the -log_summary again
Barry
<FONT COLOR="#737373">> On Jul 24, 2015, at 1:35 PM, Michele Rosso <<A HREF="mailto:mrosso@uci.edu">mrosso@uci.edu</A>> wrote:</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> Hi Mark and Barry,</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> I am sorry for my late reply: it was a busy week!</FONT>
<FONT COLOR="#737373">> I run a test case for a larger problem with as many levels (i.e. 5) of MG I could and GAMG as PC at the coarse level. I attached the output of info ( after grep for "gmag"), ksp_view and log_summary.</FONT>
<FONT COLOR="#737373">> The solve takes about 2 seconds on 8192 cores, which is way too much. The number of iterations to convergence is 24.</FONT>
<FONT COLOR="#737373">> I hope there is a way to speed it up.</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> Thanks,</FONT>
<FONT COLOR="#737373">> Michele</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> On Fri, 2015-07-17 at 09:38 -0400, Mark Adams wrote:</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> On Thu, Jul 16, 2015 at 8:18 PM, Michele Rosso <<A HREF="mailto:mrosso@uci.edu">mrosso@uci.edu</A>> wrote:</FONT>
<FONT COLOR="#737373">>> Barry,</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> thank you very much for the detailed answer. I tried what you suggested and it works.</FONT>
<FONT COLOR="#737373">>> So far I tried on a small system but the final goal is to use it for very large runs. How does PCGAMG compares to PCMG as far as performances and scalability are concerned?</FONT>
<FONT COLOR="#737373">>> Also, could you help me to tune the GAMG part ( my current setup is in the attached ksp_view.txt file )? </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> I am going to add this to the document today but you can run with -info. This is very noisy so you might want to do the next step at run time. Then grep on GAMG. This will be about 20 lines. Send that to us and we can go from there.</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> Mark</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> I also tried to use superlu_dist for the LU decomposition on mg_coarse_mg_sub_</FONT>
<FONT COLOR="#737373">>> -mg_coarse_mg_coarse_sub_pc_type lu</FONT>
<FONT COLOR="#737373">>> -mg_coarse_mg_coarse_sub_pc_factor_mat_solver_package superlu_dist</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> but I got an error:</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> ****** Error in MC64A/AD. INFO(1) = -2 </FONT>
<FONT COLOR="#737373">>> ****** Error in MC64A/AD. INFO(1) = -2</FONT>
<FONT COLOR="#737373">>> ****** Error in MC64A/AD. INFO(1) = -2</FONT>
<FONT COLOR="#737373">>> ****** Error in MC64A/AD. INFO(1) = -2</FONT>
<FONT COLOR="#737373">>> ****** Error in MC64A/AD. INFO(1) = -2</FONT>
<FONT COLOR="#737373">>> ****** Error in MC64A/AD. INFO(1) = -2</FONT>
<FONT COLOR="#737373">>> ****** Error in MC64A/AD. INFO(1) = -2</FONT>
<FONT COLOR="#737373">>> symbfact() error returns 0</FONT>
<FONT COLOR="#737373">>> symbfact() error returns 0</FONT>
<FONT COLOR="#737373">>> symbfact() error returns 0</FONT>
<FONT COLOR="#737373">>> symbfact() error returns 0</FONT>
<FONT COLOR="#737373">>> symbfact() error returns 0</FONT>
<FONT COLOR="#737373">>> symbfact() error returns 0</FONT>
<FONT COLOR="#737373">>> symbfact() error returns 0</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> Thank you,</FONT>
<FONT COLOR="#737373">>> Michele</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> On Thu, 2015-07-16 at 18:07 -0500, Barry Smith wrote:</FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> > On Jul 16, 2015, at 5:42 PM, Michele Rosso <<A HREF="mailto:mrosso@uci.edu">mrosso@uci.edu</A>> wrote:</FONT>
<FONT COLOR="#737373">>>> > </FONT>
<FONT COLOR="#737373">>>> > Barry,</FONT>
<FONT COLOR="#737373">>>> > </FONT>
<FONT COLOR="#737373">>>> > thanks for your reply. So if I want it fixed, I will have to use the master branch, correct?</FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> Yes, or edit mg.c and remove the offending lines of code (easy enough). </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> > </FONT>
<FONT COLOR="#737373">>>> > On a side note, what I am trying to achieve is to be able to use how many levels of MG I want, despite the limitation imposed by the local number of grid nodes.</FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> I assume you are talking about with DMDA? There is no generic limitation for PETSc's multigrid, it is only with the way the DMDA code figures out the interpolation that causes a restriction.</FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> > So far I am using a borrowed code that implements a PC that creates a sub communicator and perform MG on it.</FONT>
<FONT COLOR="#737373">>>> > While reading the documentation I found out that PCMGSetLevels takes in an optional array of communicators. How does this work?</FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> It doesn't work. It was an idea that never got pursued.</FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> > Can I can simply define my matrix and rhs on the fine grid as I would do normally ( I do not use kspsetoperators and kspsetrhs ) and KSP would take care of it by using the correct communicator for each level?</FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> No.</FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> You can use the PCMG geometric multigrid with DMDA for as many levels as it works and then use PCGAMG as the coarse grid solver. PCGAMG automatically uses fewer processes for the coarse level matrices and vectors. You could do this all from the command line without writing code. </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> For example if your code uses a DMDA and calls KSPSetDM() use for example -da_refine 3 -pc_type mg -pc_mg_galerkin -mg_coarse_pc_type gamg -ksp_view </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> Barry</FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> > </FONT>
<FONT COLOR="#737373">>>> > Thanks,</FONT>
<FONT COLOR="#737373">>>> > Michele</FONT>
<FONT COLOR="#737373">>>> > </FONT>
<FONT COLOR="#737373">>>> > </FONT>
<FONT COLOR="#737373">>>> > </FONT>
<FONT COLOR="#737373">>>> > </FONT>
<FONT COLOR="#737373">>>> > On Thu, 2015-07-16 at 17:30 -0500, Barry Smith wrote:</FONT>
<FONT COLOR="#737373">>>> >> Michel,</FONT>
<FONT COLOR="#737373">>>> >> </FONT>
<FONT COLOR="#737373">>>> >> This is a very annoying feature that has been fixed in master </FONT>
<FONT COLOR="#737373">>>> >> <A HREF="http://www.mcs.anl.gov/petsc/developers/index.html">http://www.mcs.anl.gov/petsc/developers/index.html</A></FONT>
<FONT COLOR="#737373">>>> >> I would like to have changed it in maint but Jed would have a shit-fit :-) since it changes behavior.</FONT>
<FONT COLOR="#737373">>>> >> </FONT>
<FONT COLOR="#737373">>>> >> Barry</FONT>
<FONT COLOR="#737373">>>> >> </FONT>
<FONT COLOR="#737373">>>> >> </FONT>
<FONT COLOR="#737373">>>> >> > On Jul 16, 2015, at 4:53 PM, Michele Rosso <<A HREF="mailto:mrosso@uci.edu">mrosso@uci.edu</A>> wrote:</FONT>
<FONT COLOR="#737373">>>> >> > </FONT>
<FONT COLOR="#737373">>>> >> > Hi,</FONT>
<FONT COLOR="#737373">>>> >> > </FONT>
<FONT COLOR="#737373">>>> >> > I am performing a series of solves inside a loop. The matrix for each solve changes but not enough to justify a rebuilt of the PC at each solve.</FONT>
<FONT COLOR="#737373">>>> >> > Therefore I am using KSPSetReusePreconditioner to avoid rebuilding unless necessary. The solver is CG + MG with a custom PC at the coarse level.</FONT>
<FONT COLOR="#737373">>>> >> > If KSP is not updated each time, everything works as it is supposed to. </FONT>
<FONT COLOR="#737373">>>> >> > When instead I allow the default PETSc behavior, i.e. updating PC every time the matrix changes, the coarse level KSP , initially set to PREONLY, is changed into GMRES </FONT>
<FONT COLOR="#737373">>>> >> > after the first solve. I am not sure where the problem lies (my PC or PETSc), so I would like to have your opinion on this.</FONT>
<FONT COLOR="#737373">>>> >> > I attached the ksp_view for the 2 successive solve and the options stack.</FONT>
<FONT COLOR="#737373">>>> >> > </FONT>
<FONT COLOR="#737373">>>> >> > Thanks for your help,</FONT>
<FONT COLOR="#737373">>>> >> > Michel</FONT>
<FONT COLOR="#737373">>>> >> > </FONT>
<FONT COLOR="#737373">>>> >> > </FONT>
<FONT COLOR="#737373">>>> >> > </FONT>
<FONT COLOR="#737373">>>> >> > <ksp_view.txt><petsc_options.txt></FONT>
<FONT COLOR="#737373">>>> >> </FONT>
<FONT COLOR="#737373">>>> >> </FONT>
<FONT COLOR="#737373">>>> >> </FONT>
<FONT COLOR="#737373">>>> > </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> <info.txt><ksp_view.txt><log_gamg.txt></FONT>
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>