[petsc-users] Can I use MAT_FINAL_ASSEMBLY instead of MAT_FLUSH_ASSEMBLY?
Rongliang Chen
rongliang.chan at gmail.com
Tue Nov 9 11:56:43 CST 2010
Yes, I know. So this is why I need to use MAT_FINAL_ASSEMBLY instead of
MAT_FLUSH_ASSEMBLY in the function MatAssemblyBegin/End when switching
between ADD_VALUES and INSERT_VALUES in MatSetValues().
But when I use the finally assembled matrix to multiply a vector using
MatMult. I find that the output of MatMult is wrong if I use
multiprocessors. So I doubt that the problem is come from
"MAT_FINAL_ASSEMBLY instead of MAT_FLUSH_ASSEMBLY", but I am not sure.
Thanks.
Regards,
Rongliang
On Tue, Nov 9, 2010 at 10:31 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> On Nov 9, 2010, at 11:27 AM, Rongliang Chen wrote:
>
> > Message: 2
> > Date: Mon, 8 Nov 2010 19:57:16 -0600
> > From: Barry Smith <bsmith at mcs.anl.gov>
> > Subject: Re: [petsc-users] Can I use MAT_FINAL_ASSEMBLY instead of
> > MAT_FLUSH_ASSEMBLY?
> > To: PETSc users list <petsc-users at mcs.anl.gov>
> > Message-ID: <52AFD8FB-17C1-4B51-97E9-C77112B69F3C at mcs.anl.gov>
> > Content-Type: text/plain; charset=us-ascii
> >
> >
> > On Nov 8, 2010, at 7:49 PM, Rongliang Chen wrote:
> >
> > > Hi everyone,
> > >
> > > Can I use MAT_FINAL_ASSEMBLY instead of MAT_FLUSH_ASSEMBLY in the
> function MatAssemblyBegin/End when switching between ADD_VALUES and
> INSERT_VALUES in MatSetValues()? Thank you!
> > >
> > > Regards,
> > >
> > > Rongliang
> >
> > Yes, but generally there is no reason to. It is best to use the flush
> until your final assembly because then it doesn't do any work that needs to
> be redone or prematurely free memory that may be needed later.
> >
> > Why do you want to do that?
> >
> > Barry
> >
> >
> >
> > Hi Barry,
> >
> > Thank you for your reply. I find that when I use MAT_FINAL_ASSEMBLY
> instead of MAT_FLUSH_ASSEMBLY in the function MatAssemblyBegin/End, it will
> > cause problem. I do not know why.
>
> "cause problem" is not very helpful. What does that mean? Send all
> output to petsc-maint at mcs.anl.gov if it doesn't work.
> >
> > The reason that I want to use it like this is that I first set the matrix
> with ADD_VALUES and then I need to zero some rows of the matrix using
> MatZeroRowsLocalIS(), at last I still need to set some elements of the
> matrix with INSERT_VALUES. Between MatSetValues() and MatZeroRowsLocalIS() I
> need to use MAT_FINAL_ASSEMBLY.
> > The order is:
> > ADD_VALUES--->MatZeroRowsLocalIS()--->INSERT_VALUES.
>
> You need to use FINAL_ASSEMLY before the zero rows calls. Flush is not
> enough in that case.
>
> Barry
>
> >
> > Thanks!
> >
> > Regards,
> >
> > Rongliang
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101109/5a96bd20/attachment.htm>
More information about the petsc-users
mailing list