[petsc-users] MatSetValues is expensive

Jed Brown jed at 59A2.org
Thu Feb 24 16:59:19 CST 2011


On Thu, Feb 24, 2011 at 23:49, M. Scot Breitenfeld <brtnfld at uiuc.edu> wrote:

> I would not say it's zero to compute the entries (I guess it takes about
> 3.5ms per particle for the calculations). This is a fairly small case,
> only 8000 particles.
>

With 300 to 900 interactions per particle, times 3 for each component, times
two for lower and upper triangular piece. So we're looking at half a
microsecond per insertion. That still seems like a lot, but perhaps the
access pattern is very irregular because the particles have an essentially
random ordering. Did you build --with-debugging=0? That should make a
reasonable difference.

Also, since the matrix is symmetric, you might consider using the SBAIJ
matrix format. That will cut your storage costs almost in half and should
speed up insertion because all interactions for a given particle will be in
the same block-row, thus nearby in memory.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110224/0075e7a1/attachment.htm>


More information about the petsc-users mailing list