On Mon, Jan 11, 2021 at 3:00 PM Sam Guo <[email protected]> wrote:
> Dear PETSc Dev Team,
> The documentation recommends calling both of the above preallocation
> routines for simplicity. Do we waste memory by calling both?
>
No. Only one will function, depending on the matrix type.
Thanks,
Matt
> Thanks,
> Sam
> MATAIJMATAIJ
> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MATAIJ.html#MATAIJ>
> =
> "aij" - A matrix type to be used for sparse matrices. This matrix type is
> identical to MATSEQAIJ
> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MATSEQAIJ.html#MATSEQAIJ>
> when
> constructed with a single process communicator, and MATMPIAIJ
> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MATMPIAIJ.html#MATMPIAIJ>
> otherwise.
> As a result, for single process communicators, MatSeqAIJSetPreallocation
> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSeqAIJSetPreallocation.html#MatSeqAIJSetPreallocation>
> is
> supported, and similarly MatMPIAIJSetPreallocation
> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMPIAIJSetPreallocation.html#MatMPIAIJSetPreallocation>()
> is supported for communicators controlling multiple processes. It is
> recommended that you call both of the above preallocation routines for
> simplicity.
>
--
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
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>