On Mon, Mar 21, 2011 at 10:27 AM, Jed Brown <span dir="ltr"><<a href="mailto:jed@59a2.org">jed@59a2.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">2011/3/21 Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
On Mar 21, 2011, at 10:14 AM, Alejandro Marcos Aragón wrote:<br>
<br>
> Hi Barry,<br>
><br>
> Thanks for your answer. I'll look into those functions, but instead of copying, do you know if there is a way to give the address of the arrays?<br></div></blockquote></div></div></blockquote><div><br></div><div>
I would encourage you to instead use the MatSetValues() interface for building your matrix directly, because:</div><div><br></div><div> 1) It works for arbitrary parallel layout, and does all communication for you automatically</div>
<div><br></div><div> 2) You can switch between formats to optimize for your architecture</div><div><br></div><div> 3) You can switch to higher performance block matrix classes without changing your code</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 class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
</div>MatCreateSeqAIJWithArrays() will not copy the arrays but just use them. In parallel MatCreateMPIAIJWithSplitArrays() will not copy the arrays, just use them but you need to have the correct format for the arrays (in parallel we use a "non-standard" parallel compressed sparse row format that likely you don't use but check the manual page <a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.0.0/docs/manualpages/Mat/MatCreateMPIAIJWithSplitArrays.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.0.0/docs/manualpages/Mat/MatCreateMPIAIJWithSplitArrays.html</a></blockquote>
<div><br></div></div><div>There is slightly more info in the more recent man page</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Mat/MatCreateMPIAIJWithSplitArrays.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Mat/MatCreateMPIAIJWithSplitArrays.html</a></div>
</div>
</blockquote></div><br><br clear="all"><br>-- <br>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<br>