[petsc-users] fill matrix using dynamic load balancing code

Matthew Knepley knepley at gmail.com
Wed May 2 19:56:30 CDT 2012


On Wed, May 2, 2012 at 7:55 PM, Gao Bin <bin.gao at uit.no> wrote:

>  Hi, all
>
> (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?
>

It depends on the matrix.


> (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:
>
> (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?
>

It will raise the communication cost. This, of course, must be weighed
against the penalty for load imbalance in your case.


> (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?
>

Yes, there is a limit to the stash space:

http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Mat/MatStashSetInitialSize.html

    Matt


> Thank you in advance.
>
> Cheers
>
> Gao
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120502/5c729061/attachment.htm>


More information about the petsc-users mailing list