[petsc-users] questions about matrix preallocation

Dominik Szczerba dominik at itis.ethz.ch
Thu Nov 24 07:14:25 CST 2011


In any case, I use KSPSetOperators(ksp, A, A, SAME_NONZERO_PATTERN).

1) If I provide only approximation for number of zeros per row (d_nz
and o_nz) and I overshoot - will the extra memory still be there or is
automatically freed?

2) Do I need to MatMPIAIJSetPreallocation() after MatZeroEntries(A)?
MatZeroEntries man page says:

If the matrix was not preallocated then a default, likely poor
preallocation will be set in the matrix, so this should be called
after the preallocation phase.

A was preallocated during creation, but unless I call
MatMPIAIJSetPreallocation after MatZeroEntries, I get a lot of unneded
mallocs.

Many thanks for any clarifications.

Dominik


More information about the petsc-users mailing list