<div dir="ltr"><div><div><div><div><div>Hi Stefano,<br><br></div>When using MATSELL for a PFLOTRAN simulation of a variably-saturated flow problem (Richards equation) on a KNL box and running in MCDRAM, I see about a 2X speedup in MatMult() vs. MATAIJ (using double-precision). This problem has only one degree of freedom in each grid cell, and is using a first-order finite volume spatial discretization, with a regular grid of cuboid elements -- so the Jacobian basically has a 7-point stencil structure. This is the sort of short row-length matrix for which I expect MATSELL to do well.<br><br></div>If I run something like a reactive chemistry problem on the same grid with, say, 12 primary chemical species -- so 12 degrees of freedom per grid cell -- then MATSELL doesn't provide any benefit, and MATBAIJ is the thing to use, as one would expect.<br><br></div>I haven't experimented very thoroughly with it (hmm... should probably do such experiments), but I believe that, once matrix rows become sufficiently long, then SELL doesn't provide an advantage over AIJ. This mattered more for older vector processors that had much longer vector lengths (something like 64 doubles) compared to the "long" vectors that KNL or Skylake server has (8 doubles).<br><br></div>Best regards,<br></div>Richard<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 13, 2018 at 3:40 AM, Stefano Zampini <span dir="ltr"><<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">Richard,
<div><br>
</div>
<div>what are the performances you get with MATSELL in PFLOTRAN?</div>
<div><br>
</div>
<div>Today, I run the SELL matrix for the first time on a KNL with different problems (using PetIGA) and got the results attached.</div>
<div>It seems that SELL is faster then AIJ for 2D Poisson, and slightly faster for 3D Poisson. However, for multi-component problems (i.e. Elasticity and Cahn-Hilliard in mixed formulation) it has comparable performances or slower.</div>
<div>in these cases AIJ is faster since it uses the inodes routines.</div>
<div><br>
</div>
<div>Is this expected?</div>
<div>These are the flags I used to compile PETSc on KNL --COPTFLAGS=-xMIC-AVX512 -O3 -mP2OPT_hpo_vec_remainder=F; </div>
<div><br>
</div>
</div>
<div class="gmail_extra"><div><div class="h5"><br>
<div class="gmail_quote">2018-02-12 21:04 GMT+03:00 Richard Tran Mills <span dir="ltr">
<<a href="mailto:rtmills@anl.gov" target="_blank">rtmills@anl.gov</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Mon, Feb 12, 2018 at 8:47 AM, Smith, Barry F. <span dir="ltr">
<<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><span><br>
<br>
> On Feb 12, 2018, at 10:25 AM, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>> wrote:<br>
><br>
> Barry,<br>
><br>
> for sure Amat,Pmat is the right approach; however, with complicated user codes, we are not always in control of having a different Jacobian matrix.<br>
> Since Mat*SELL does not currently support any preconditioning except PCSOR and PCJACOBI, we ask the user to put codes like<br>
><br>
> if (type is SELL)<br>
> create two matrices (and maybe modify the code in many other parts)<br>
> else<br>
> ok with the previous code<br>
<br>
</span></span><span> I don't disagree with what you are saying and am not opposed to the proposed work.<br>
<br>
Perhaps we need to do a better job with making the mat,pmat approach simpler or better documented so more people use it naturally in their applications.<br>
</span></blockquote>
<div><br>
</div>
<div>I wrote some code like that in some of the Jacobian/function routines in PFLOTRAN to experiment with MATSELL, and it works, but looks and feels pretty hacky. And if I wanted to support it for all of the different systems that PFLOTRAN can model, then I'd
have to reproduce that it in many different Jacobian and function evaluation routines. I also don't like that it makes it awkward to play with the many combinations of matrix types and preconditioners that PETSc allows: The above pseudocode should really say
"if (type is SELL) and (preconditioner is not PCSOR or PCJACOBI)". I do think that Amat,Pmat is a good approach in many situations, but it's easy to construct scenarios in which it falls short.<br>
<br>
</div>
<div>In some situations, what I'd like to have happen is what Stefano is talking about, with an automatic conversion to AIJ happening if SELL doesn't support an operation. But, ideally, I think this sort of implicit format conversion shouldn't be something
hard-coded into the workings of SELL. Instead, there should be some general mechanism by which PETSc recognizes that a particular operation is unsupported for a given matrix format, and then it can (optionally) copy/convert to a different matrix type (probably
default to AIJ, but it shouldn't have to be AIJ) that supports the operation. This sort of implicit data rearrangement game may actually become more important if future computer architectures strongly prefer different data layouts different types of operations
(though let's not get ahead of ourselves).<br>
<br>
</div>
<div>--Richard<br>
</div>
<div> <br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="m_6967541139375486437m_3098572156046804253HOEnZb"><font color="#888888"><br>
Barry<br>
</font></span><span>
<div class="m_6967541139375486437m_3098572156046804253HOEnZb">
<div class="m_6967541139375486437m_3098572156046804253h5"><br>
><br>
> Just my two cents.<br>
><br>
><br>
> 2018-02-12 19:10 GMT+03:00 Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>>:<br>
><br>
><br>
> > On Feb 12, 2018, at 9:59 AM, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>> wrote:<br>
> ><br>
> > FYI, I just checked and MatSOR_*SELL does not use any vectorized instruction.<br>
> > Why just not converting to SeqAIJ, factor and then use the AIJ implementation for MatSolve for the moment?<br>
><br>
> Why not use the mat, pmat feature of the solvers to pass in both matrices and have the solvers handle using two formats simultaneously instead of burdening the MatSELL code with tons of special code for automatically converting to AIJ for solvers etc?<br>
><br>
><br>
> ><br>
> > 2018-02-12 18:06 GMT+03:00 Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>>:<br>
> ><br>
> ><br>
> > 2018-02-12 17:36 GMT+03:00 Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>>:<br>
> > Karl Rupp <<a href="mailto:rupp@iue.tuwien.ac.at" target="_blank">rupp@iue.tuwien.ac.at</a>> writes:<br>
> ><br>
> > > Hi Stefano,<br>
> > ><br>
> > >> Is there any plan to write code for native ILU/ICC etc for SeqSELL, at least to have BJACOBI in parallel?<br>
> > ><br>
> > > (imho) ILU/ICC is a pain to do with SeqSELL. Point-Jacobi should be<br>
> > > possible, yes. SELL is really just tailored to MatMults and a pain for<br>
> > > anything that is not very similar to a MatMult...<br>
> ><br>
> > There is already MatSOR_*SELL. MatSolve_SeqSELL wouldn't be any harder.<br>
> > I think it would be acceptable to convert to SeqAIJ, factor, and convert<br>
> > the factors back to SELL.<br>
> ><br>
> > Yes, this was my idea. Today I have started coding something. I'll push the branch whenever I have anything working<br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Stefano<br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Stefano<br>
><br>
><br>
><br>
><br>
> --<br>
> Stefano<br>
<br>
</div>
</div>
</span></blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
<div class="m_6967541139375486437gmail_signature" data-smartmail="gmail_signature">Stefano</div>
</font></span></div>
</div>
</blockquote></div><br></div>