[petsc-users] zero pattern of result of matmatmult
Barry Smith
bsmith at mcs.anl.gov
Tue Sep 17 08:15:30 CDT 2013
When the linear system is fairly easy it is possible for the construction of the matrix to take a significant portion of the total time. Run with -log_summary and send the output, from this we may be able to make suggestions as to what further improvements can be made.
Is any part of the matrix constant? If so you can use MatStoreValues() and MatRetrieveValues() so that part does not have to be recomputed each time.
Are you calling MatSetValuesStencil() for each single entry or once per row or block row? Row or block row will be faster than for each entry.
Since you are using MatSetValuesStencil() I assume you are using a DA? How many degrees of freedom do you have per grid point? If it is more than one then
MatSetValuesBlockedStencil() might be faster, also you might you use MatType BAIJ instead of AIJ. Or if the blocks are not dense then use AIJ but use DMDASetBlockFills() to eliminate all the entries that actually zero.
Barry
On Sep 17, 2013, at 7:59 AM, Frederik Treue <frtr at fysik.dtu.dk> wrote:
> On Fri, 2013-09-06 at 08:36 -0500, Jed Brown wrote:
>> Frederik Treue <frtr at fysik.dtu.dk> writes:
>>>> Multiplying difference operators together is really brittle
>
> I have done this, but the problem still is that it takes too much time
> to recreate the matrix in each timestep (the time it takes to construct
> the matrix is roughly equivalent to the time it takes to solve it using
> CG with ~50 iterations), so: What is the fastest way to change the
> entries in a matrix? Right now I'm reduced to recreating the whole thing
> with MatSetValuesStencil in a for loop with MatAssembly afterwards. How
> would one ideally do this?
>
> /Frederik
>
More information about the petsc-users
mailing list