[petsc-users] Should I synchronize processes explicitly, for instance using MPI_Barrier?

Matthew Knepley knepley at gmail.com
Fri Aug 16 06:54:30 CDT 2013


On Fri, Aug 16, 2013 at 6:31 AM, Cong Li <solvercorleone at gmail.com> wrote:

> Hi, Matthew
> Thank you very much for the answer.
>
> And I met a new problem.
> When there some PetscScalar type data operations before the VecWAXPY call,
> for example
>
> PetscScalar, a,b, c;
> .....
> .....
> c=a+b;
> ierr = VecWAXPY(r, c, Ax, b);CHKERRQ(ierr);
>
> , should I add MPI_Barrier call right before VecWAXPY call ?
>

Never put in a barrier.

   Matt


> Best regards
>
> Cong
>
>
> On Fri, Aug 16, 2013 at 7:56 PM, Matthew Knepley <knepley at gmail.com>wrote:
>
>> On Fri, Aug 16, 2013 at 2:11 AM, Cong Li <solvercorleone at gmail.com>wrote:
>>
>>> Hi
>>>
>>> I am a rookie to PETSc, and I am wondering about whether I should call
>>> MPI_Barrier to explicitly synchronize processes between PETSc calls.
>>> For example, a piece of code like below
>>>
>>>   ierr = MatMult(A,x,Ax); CHKERRQ(ierr);
>>>   ierr = VecWAXPY(r, neg_one, Ax, b);CHKERRQ(ierr);
>>>
>>> Should I add MPI_Barrier inbetween MatMult call and VecWAXPY call ?
>>>
>>
>> No
>>
>>    Matt
>>
>>
>>> My guess is that it is unnecessary. However, I am not so confident in
>>> this guess, for I don't have much experience on using PETSc.
>>>
>>> Thanks in advance.
>>>
>>> Cong Li
>>>
>>
>>
>>
>> --
>> 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/20130816/10a52a1d/attachment.html>


More information about the petsc-users mailing list