On Fri, Jul 16, 2010 at 05:20:53PM -0400, Prentice Bisbal wrote: > > > 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.
Sorry, just to be absolutely clear, are you saying that even though only one process in the communicator is calling Bcast, the call will be made on all processes? Or are you saying I cannot put Bcast (or any other collective call) inside a "if (rank== ...) {} " construct? 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