MatGetSubMatrix performance

Barry Smith bsmith at mcs.anl.gov
Tue Jul 7 15:33:55 CDT 2009


    I've found that it is generally much faster than the numerical  
parts of the code (for example if you use a MatGetSubmatrix to select  
a big chunk of the matrix and then solve a linear system on that chunk  
the get submatrix may take 5 percent of the time to solve the system).  
So, in general, I don't think there is a reason to avoid it.

   Are you getting a huge difference in time for the exact same  
submatrix? This would surprise me. A cluster with gigabyte ethernet  
will also be slow.

   The performance will get bad for a poor load balance of the gotten  
submatrix. For example if some processes get huge chunks of other  
processes values it will be slow. Generally you want most of the  
gotten rows to live on the same process they are gotten from.

    Barry

On Jul 7, 2009, at 3:20 PM, John Fettig wrote:

> What kind of performance should one expect with MatGetSubMatrix on a
> MPIAIJ matrix, and is there anything that I need to know to get the
> best performance?  Or is this routine best avoided?  I currently use
> it, but find that performance varies widely from call to call.  One
> time it will take 0.25 seconds, another time it will take 185 seconds,
> and I can't figure out what would cause such a disparity.
>
> John



More information about the petsc-users mailing list