Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] do all processors have to execute MPI_Bcast?
From: Anton Shterenlikht (mexas_at_[hidden])
Date: 2010-07-16 14:39:54


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?

many thanks
anton

-- 
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 331 5944
Fax: +44 (0)117 929 4423