<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 29, 2018, at 5:33 PM, Vaclav Hapla <<a href="mailto:vaclav.hapla@erdw.ethz.ch" class="">vaclav.hapla@erdw.ethz.ch</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">22. 6. 2018 v 17:47, Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>>:<br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 22, 2018, at 5:43 AM, Pierre Jolivet <<a href="mailto:pierre.jolivet@enseeiht.fr" class="">pierre.jolivet@enseeiht.fr</a>> wrote:<br class=""><br class="">Hello,<br class="">I’m solving a system using a MATSHELL and PCGAMG.<br class="">The MPIAIJ Mat I’m giving to GAMG has a specific structure (inherited from the MATSHELL) I’d like to exploit during the solution phase when the smoother on the finest level is doing MatMults.<br class=""><br class="">Is there some way to:<br class="">1) decouple in -log_view the time spent in the MATSHELL MatMult and in the smoothers MatMult<br class=""></blockquote><br class=""> You can register a new event and then inside your MATSHELL MatMult() call PetscLogEventBegin/End on your new event.<br class=""><br class=""> Note that the MatMult() like will still contain the time for your MatShell mult so you will need to subtract it off to get the time for your non-shell matmults.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">In PERMON, we sometimes have quite complicated hierarchy of wrapped matrices and want to measure MatMult{,Transpose,Add,TransposeAdd} separately for particular ones. Think e.g. of having additive MATCOMPOSITE wrapping multiplicative MATCOMPOSITE wrapping MATTRANSPOSE wrapping MATAIJ. You want to measure this MATAIJ instance's MatMult separately but you surely don't want to rewrite implementation of MatMult_Transpose or force yourself to use MATSHELL just to hang the events on MatMult*.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">We had a special wrapper type just adding some prefix to the events for the given object but this is not nice. What about adding a functionality to PetscLogEventBegin/End that would distinguish based on the first PetscObject's name or option prefix? Of course optionally not to break guys relying on current behavior - e.g. under something like -log_view_by_name. To me it's quite an elegant solution working for any PetscObject and any event.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div>The issue with this sort of “dynamic” logging is that now PETSc requires PetscLogEvent created during the registration of the class, so that all the ranks in PETSC_COMM_WORLD have the same events registered.</div><div>What you propose is not generally supported for this specific reason.</div><div><br class=""></div><div>Your “log_name” may work if users register their own classes (with their own LogEvents created properly), and currently we don’t have support (maybe I’m wrong) to add an “InitializePackage” method for the users’ registered classes.</div><div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I can do that if I get some upvotes.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Vaclav</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class=""><blockquote type="cite" class="">2) hardwire a specific MatMult implementation for the smoother on the finest level<br class=""></blockquote><br class=""> In the latest release you do MatSetOperation() to override the normal matrix vector product with anything else you want.<span class="Apple-converted-space"> </span><br class=""><br class=""><blockquote type="cite" class=""><br class="">Thanks in advance,<br class="">Pierre<br class=""><br class="">PS : here is what I have right now,<br class="">MatMult 118 1.0 1.0740e+02 1.6 1.04e+13 1.6 1.7e+06 6.1e+05 0.0e+00 47100 90 98 0 47100 90 98 0 81953703<br class="">[…]<br class="">PCSetUp 2 1.0 8.6513e+00 1.0 1.01e+09 1.7 2.6e+05 4.0e+05 1.8e+02 5 0 14 10 66 5 0 14 10 68 94598<br class="">PCApply 14 1.0 8.0373e+01 1.1 9.06e+12 1.6 1.3e+06 6.0e+05 2.1e+01 45 87 72 78 8 45 87 72 78 8 95365211 // I’m guessing a lot of time here is being wasted in doing inefficient MatMults on the finest level but this is only speculation<br class=""><br class="">Same code with -pc_type none -ksp_max_it 13,<br class="">MatMult 14 1.0 1.2936e+01 1.7 1.35e+12 1.6 2.0e+05 6.1e+05 0.0e+00 15100 78 93 0 15100 78 93 0 88202079<br class=""><br class="">The grid itself is rather simple (two levels, extremely aggressive coarsening),<br class=""> type is MULTIPLICATIVE, levels=2 cycles=v<br class=""> KSP Object: (mg_coarse_) 1024 MPI processes<br class="">linear system matrix = precond matrix:<br class=""> Mat Object: 1024 MPI processes<br class=""> type: mpiaij<br class=""> rows=775, cols=775<br class=""> total: nonzeros=1793, allocated nonzeros=1793<br class=""><br class="">linear system matrix followed by preconditioner matrix:<br class="">Mat Object: 1024 MPI processes<br class=""> type: shell<br class=""> rows=1369307136, cols=1369307136<br class="">Mat Object: 1024 MPI processes<br class=""> type: mpiaij<br class=""> rows=1369307136, cols=1369307136<br class=""> total: nonzeros=19896719360, allocated nonzeros=19896719360</blockquote></blockquote></div></blockquote></div><br class=""></body></html>