[petsc-users] Question about preallocation and getOwnership functions

Barry Smith bsmith at mcs.anl.gov
Thu Dec 4 13:35:00 CST 2014


> On Dec 4, 2014, at 9:43 AM, Young, Matthew, Adam <may at bu.edu> wrote:
> 
> Is there an advantage to using MatXAIJSetPreallocation (as Jed suggested) or either of the SEQ/MPI preallocation routines (as Hui originally considered) instead of calling MatSetUp to cover all cases?

  Yes, from the manual page:

MatSetUp - Sets up the internal matrix data structures for the later use.

   Collective on Mat

   Input Parameters:
.  A - the Mat context

   Notes:
   If the user has not set preallocation for this matrix then a default preallocation that is likely to be inefficient is used.



> -------------------------------------------
> Matthew Young
> Graduate Student
> Boston University Dept. of Astronomy
> -------------------------------------------
> 
> 
> ________________________________________
> From: petsc-users-bounces at mcs.anl.gov [petsc-users-bounces at mcs.anl.gov] on behalf of Jed Brown [jed at jedbrown.org]
> Sent: Thursday, December 04, 2014 10:35 AM
> To: Sun, Hui; petsc-users at mcs.anl.gov
> Subject: Re: [petsc-users] Question about preallocation and     getOwnership    functions
> 
> "Sun, Hui" <hus003 at ucsd.edu> writes:
> 
>> After reading some documentation, I figured it out myself. MATAIJ can
>> be MATSEQAIJ or MATMPIAIJ, depending on the number of processors
>> involved. Thus, I need to include the command
>> MatSeqAIJSetPreallocation as well, to cover both cases.
> 
> Or call MatXAIJSetPreallocation and be done with it for all *AIJ
> formats.



More information about the petsc-users mailing list