<br><br><div class="gmail_quote">On Thu, Oct 25, 2012 at 8:43 AM, <span dir="ltr"><<a href="mailto:Gregor.Matura@dlr.de" target="_blank">Gregor.Matura@dlr.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="DE" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Hi!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span lang="EN-US">I'm rather new to PETSc and got along on my own so far. However, I've now run into the situation that the tutorial does not provide enough detail and on the other side going through every example found by grep with the
possibly right command would take almost forever. So I would be very happy to get some hints where to start.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">My problem: read in a matrix in a special format, partition and redistribute it, solve.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">So far, I've read in my matrix, transformed it according to the input of MatCreateMPIAIJWithSplitArrays() and finally, for a start, KSPSolve.</span></p></div></div></blockquote>
<div><br></div><div>Strongly recommend using MatSetValues[Blocked][Local]() instead of MatCreateMPIAIJWithSplitArrays(). Just preallocate and set the values from wherever you know them. This way, the same code will work immediately with different matrix formats and it's easier to transition to generating the matrix on-the-fly (rather than reading from disk which is always a bottleneck).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="DE" link="blue" vlink="purple"><div><p class="MsoNormal"><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Here comes the 'but': my matrix does have a "block" format:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">|a ... a|<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">|a ... a|<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">|b ... b|<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">|b ... b|<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">|c ... c|<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">|c ... c|<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">The matrix is sparse (by far not every x is set), every a, b, c, ... is a small 5x5 block, each 25 double data values of a block are saved consecutively, processor 1 holds every a, #2 every b and so on.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">PETSc tutorial says (as far as I understood) that PETSc's blocks are _logically_ different, but are stored just this way. </span></p></div></div></blockquote><div><br></div><div>
Not sure which routine you are looking at. MATMPI<b>B</b>AIJ is a good format for systems like this. When the method you intend to use is supported by BAIJ matrices, they are generally faster by 30% or more. By using MatSetValues-style matrix assembly, you can switch format a run-time.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="DE" link="blue" vlink="purple"><div><p class="MsoNormal"><span lang="EN-US">And: in some sense DMDA could be the right way to access matrix data layout as PETSc uses it (would
be good to achieve best possible performance).</span></p></div></div></blockquote><div><br></div><div>DMDA is a structured grid abstraction. Don't confuse 2D structured grids with matrices.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="DE" link="blue" vlink="purple"><div><p class="MsoNormal"><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">This said, my precise questions are: Is DMDACreate2D the right way to go? Does it match my data layout best with PETSc's layout? Which example file is suited best to read up on? Does this really speeds up time to solution
or should I stick with the transformed non-block variant?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal">TIA,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Gregor Matura<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:dimgray">——————————————————————————<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:dimgray">Deutsches Zentrum für Luft- und Raumfahrt</span></b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:dimgray">
e.V. (DLR)<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><a name="13a982a8358416d2_Institut"></a><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:dimgray">German Aerospace Center</span><span lang="EN-US"><u></u><u></u></span></p>
</div>
</div>
</blockquote></div><br>