<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 29, 2018 at 1:48 AM, TAY wee-beng <span dir="ltr"><<a href="mailto:zonexo@gmail.com" target="_blank">zonexo@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 text="#000000" bgcolor="#FFFFFF">
    <br>
    <div class="m_7647832711676883853moz-cite-prefix">On 28/3/2018 5:45 PM, Matthew Knepley
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Tue, Mar 27, 2018 at 10:17 PM, TAY
            wee-beng <span dir="ltr"><<a href="mailto:zonexo@gmail.com" target="_blank">zonexo@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 text="#000000" bgcolor="#FFFFFF">
                <p>Hi Dave,<br>
                  <br>
                  I looked at the output using log_view and re-compile.
                  However, although I use the same options "-xHost -g
                  -O3 -openmp" (some filenames and dir names are now
                  different but they are actually the same), I still get
                  different results timing. I have attach both, fast and
                  slow. So what else can I do to pinpoint the
                  differences?</p>
              </div>
            </blockquote>
            <div>The solver options must be different. In Fast, there is
              almost no time in LUFactor, but in Slow its half the time.</div>
            <div><br>
            </div>
            <div>   Matt <br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    Hi Matt,<br>
    <br>
    Finally found that it was because I was using KSPRICHARDSON in the
    new code. KSPGMRES in the old code is much faster.<br>
    <br>
    I also tried cg, lsqr, fgmres. CG and GMRES seem similar in term of
    best performance. Are there any other recommendations to try? The
    Poisson eqn is symmetric.<br></div></blockquote><div><br></div><div>Krylov solvers fundamentally do not matter for solving elliptic problems. It comes down to your preconditioner.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
    I also tried -pc_type mg -pc_mg_nlevels 2 instead of
    -poisson_pc_type gamg -poisson_pc_gamg_agg_nsmooths 1.<br>
    <br>
    It reduces the runtime from 2.25 to 1.46min.<br></div></blockquote><div><br></div><div>Yes, GMG has faster setup time than AMG. The solve time should be similar.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
    However, I found that my subroutine is very similar to my momentum
    subroutine, which is based on KSPSolve:<br>
    <br>
    0. DMDACreate, DMDACreate3d etc<br>
    1. Assemble matrix<br>
    2. KSPSetOperators, KSPSetType etc<br>
    3. KSPSolve<br>
    <br>
    However, the 2D Poisson example in ex5f.F90 uses SNESSetDM,
    SNESSolve etc. So does it matter if I use SNESSolve or KSPSolve if
    I'm using -pc_type mg?<br></div></blockquote><div><br></div><div>Not really.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div text="#000000" bgcolor="#FFFFFF">
                <pre class="m_7647832711676883853m_-6652733264220142091moz-signature" cols="72">Thank you very much.

Yours sincerely,

==============================<wbr>==================
TAY Wee-Beng (Zheng Weiming) 郑伟明
Personal research webpage: <a class="m_7647832711676883853m_-6652733264220142091moz-txt-link-freetext" href="http://tayweebeng.wixsite.com/website" target="_blank">http://tayweebeng.wixsite.com/<wbr>website</a>
Youtube research showcase: <a class="m_7647832711676883853m_-6652733264220142091moz-txt-link-freetext" href="https://www.youtube.com/channel/UC72ZHtvQNMpNs2uRTSToiLA" target="_blank">https://www.youtube.com/channe<wbr>l/UC72ZHtvQNMpNs2uRTSToiLA</a>
linkedin: <a class="m_7647832711676883853m_-6652733264220142091moz-txt-link-abbreviated" href="http://www.linkedin.com/in/tay-weebeng" target="_blank">www.linkedin.com/in/tay-weeben<wbr>g</a>
==============================<wbr>==================</pre>
                <div class="m_7647832711676883853m_-6652733264220142091moz-cite-prefix">On
                  27/3/2018 5:22 PM, Dave May wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr"><br>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On 27 March 2018 at
                        10:16, TAY wee-beng <span dir="ltr"><<a href="mailto:zonexo@gmail.com" target="_blank">zonexo@gmail.com</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
                          <br>
                          I have been compiling and building different
                          version of my CFD with the intel 2016, 2018
                          compilers, and also different compiling
                          options.<br>
                          <br>
                          I tested a version of my a.out and it is much
                          faster than the other a.out, using only 3 min
                          instead of more than 10min to solve a certain
                          case using GAMG.<br>
                          <br>
                          However, I can't recall how it was compiled. I
                          only know that I used the intel 2016 compiler.<br>
                          <br>
                          So is there any way I can find out how the
                          a.out was compiled? Like what options were
                          used?</blockquote>
                        <div><br>
                        </div>
                        <div>Since you posted to the list I presume
                          "a.out" links against petsc...</div>
                        <div>If so, run your code with </div>
                        <div>  -log_view</div>
                        <div><br>
                        </div>
                        <div>Upon calling PetscFinalize(), you will get
                          all the options given to PETSc configure, plus
                          the CFLAGS, link lines, etc.</div>
                        <div><br>
                        </div>
                      </div>
                    </div>
                  </div>
                </blockquote>
                <br>
              </div>
            </blockquote>
          </div>
          <br>
          <br clear="all"><span class="HOEnZb"><font color="#888888">
          <div><br>
          </div>
          -- <br>
          <div class="m_7647832711676883853gmail_signature" data-smartmail="gmail_signature">
            <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="http://www.caam.rice.edu/%7Emk51/" target="_blank">https://www.cse.buffalo.edu/~<wbr>knepley/</a><br>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </font></span></div>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><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="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>