[petsc-users] a naive question about assembly

Matthew Knepley knepley at gmail.com
Mon May 5 20:24:50 CDT 2014


On Mon, May 5, 2014 at 8:22 PM, huaibao zhang <paulhuaizhang at gmail.com>wrote:

>
> Matt,
>
> THanks for the answer.
> I think my question is why have to do assembly?
> In the piece of my code, 2 processors are inserting the dada to a public
> vector soon_n.
>

This is explained very well in the book Using MPI:
http://www.mcs.anl.gov/research/projects/mpi/usingmpi/

If process 0 inserts a value for process 1, then somehow process 1 must be
told. That happens in VecAssembly().

   Matt


> Paul
>
>
>
> On May 5, 2014, at 9:18 PM, Matthew Knepley <knepley at gmail.com> wrote:
>
> On Mon, May 5, 2014 at 8:14 PM, huaibao zhang <paulhuaizhang at gmail.com>wrote:
>
>>
>>  Hello,
>>
>> I looked up the manual, but still felt  quite confused about why have to
>> do assembly. Does it have to do with parallelization? Since all of the
>> processors are loading the data at the same time, they need to a pause
>> before one can use the whole vector?
>>
>
> If one process sets a value owned by another process, it has to tell it.
>
>    Matt
>
>
>>  See a piece of code:
>>
>>                         for (int c=0;c<grid[gid].cellCount;++c) {
>>                                 row=grid[gid].myOffset+c;
>>                                 value=p;
>>
>> VecSetValues(soln_n,1,&row,&value,INSERT_VALUES);
>>                         }
>>                         VecAssemblyBegin(soln_n); VecAssemblyEnd(soln_n);
>>
>>
>> Thanks,
>> Paul
>>
>
>
>
> --
> 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
>
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140505/d377439e/attachment.html>


More information about the petsc-users mailing list