Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] do all processors have to execute MPI_Bcast?
From: Prentice Bisbal (prentice_at_[hidden])
Date: 2010-07-16 17:20:53

Eugene Loh wrote:
> Anton Shterenlikht wrote:
>> Will this bit of code work:
>> if (rank .eq. <somerank>) then
>> *change var*
>> call MPI_Bcast(var, 1, MPI_INTEGER, rank, &
>> MPI_COMM_WORLD, errstat)
>> end if
>> call MPI_Barrier(MPI_COMM_WORLD, errstat)
>> I'm using a int variable on all processors.
>> At some point some process can change its
>> value of this variable.
>> I then need to let all other
>> processes know the new value. So I tried
>> to use MPI_Bcast for this. But I think
>> MPI waits indefinitely at MPI_Barrier.
>> I'm now wondering if MPI_Bcast must
>> be executed by all processes, similar
>> to MPI_Barrier. Is this correct?
> All processes in the communicator must make the collective call...
> Bcast, Barrier, Allreduce, etc.

Therefore, following a Bcast with a Barrier is redundant in this example.