<div class="gmail_extra">On Wed, May 2, 2012 at 7:55 PM, Gao Bin <span dir="ltr">&lt;<a href="mailto:bin.gao@uit.no" target="_blank">bin.gao@uit.no</a>&gt;</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>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi, all<br>
<br>
(1) I am using PETSc to perform, for instance matrix-matrix multiplication. But the numerical values of the matrix are calculated from my integral code. I guess, for matrix-matrix multiplication, it might be better to distribute the rows of matrix uniformly
 on processors, right?<br></div></div></blockquote><div><br></div><div>It depends on the matrix.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">
(2) If yes, I have a problem in my integral code. Since I need dynamic load balancing to calculate the matrix elements and then put them into correct places by using MatSetValues. But I have two questions regarding MatSetValues:<br>

<br>
(2.1) If one processor calculated a lot of elements belong to another remote processor, will this become a problem for the performance? Should I make all processors calculate as many local elements as possible?<br></div>
</div></blockquote><div><br></div><div>It will raise the communication cost. This, of course, must be weighed against the penalty for load imbalance in your case.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="direction:ltr;font-size:10pt;font-family:Tahoma">
(2.2) From the manual, I see MatSetValues only caches the values, but MatAssemblyBegin() and MatAssemblyEnd() assembles the matrix. Therefore, is there any memory limit for MatSetValues, or in other words, will it cost a lot of memory before assembling?<br>
</div></div></blockquote><div><br></div><div>Yes, there is a limit to the stash space:</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Mat/MatStashSetInitialSize.html">http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Mat/MatStashSetInitialSize.html</a></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><div style="direction:ltr;font-size:10pt;font-family:Tahoma">
Thank you in advance.<br>
<br>
Cheers<span class="HOEnZb"><font color="#888888"><br>
<br>
Gao<br>
</font></span></div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <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>
</div>