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(). <br>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.<br>
<br>
Regards,<br>
<br>
Rongliang<br><br><div class="gmail_quote">On Tue, Nov 9, 2010 at 10:31 AM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><br>
On Nov 9, 2010, at 11:27 AM, Rongliang Chen wrote:<br>
<br>
> Message: 2<br>
> Date: Mon, 8 Nov 2010 19:57:16 -0600<br>
> From: Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>><br>
> Subject: Re: [petsc-users] Can I use MAT_FINAL_ASSEMBLY instead of<br>
> MAT_FLUSH_ASSEMBLY?<br>
> To: PETSc users list <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
> Message-ID: <<a href="mailto:52AFD8FB-17C1-4B51-97E9-C77112B69F3C@mcs.anl.gov">52AFD8FB-17C1-4B51-97E9-C77112B69F3C@mcs.anl.gov</a>><br>
> Content-Type: text/plain; charset=us-ascii<br>
><br>
><br>
> On Nov 8, 2010, at 7:49 PM, Rongliang Chen wrote:<br>
><br>
> > Hi everyone,<br>
> ><br>
> > 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!<br>
> ><br>
> > Regards,<br>
> ><br>
> > Rongliang<br>
><br>
> 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.<br>
><br>
> Why do you want to do that?<br>
><br>
> Barry<br>
><br>
><br>
><br>
> Hi Barry,<br>
><br>
> 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<br>
> cause problem. I do not know why.<br>
<br>
</div> "cause problem" is not very helpful. What does that mean? Send all output to <a href="mailto:petsc-maint@mcs.anl.gov">petsc-maint@mcs.anl.gov</a> if it doesn't work.<br>
<div class="im">><br>
> 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.<br>
> The order is:<br>
> ADD_VALUES--->MatZeroRowsLocalIS()--->INSERT_VALUES.<br>
<br>
</div> You need to use FINAL_ASSEMLY before the zero rows calls. Flush is not enough in that case.<br>
<br>
Barry<br>
<br>
><br>
> Thanks!<br>
><br>
> Regards,<br>
><br>
> Rongliang<br>
<br>
</blockquote></div><br>