Newsgroups: comp.parallel.mpi From: Luc.Vereecken@chem.kuleuven.ac.be (Vereecken Luc) Subject: Re: MPI_Bcast Organization: KULeuvenNet Date: Fri, 21 Nov 1997 17:48:56 GMT Message-ID: <880129754.218383@marvin.kulnet.kuleuven.ac.be> kokliang@nsrc.nus.sg (Heng Kok Liang) wrote: >Hi, > Can we use MPI_Bcast for MPMD program? I have two files called 'master.f' >and 'slave.f', and I call MPI_Bcast(x, 1, MPI_INTEGER, 0, comm, ierr) in the >file 'master.f', but I can't refer x in my 'slave.f', how can I solve this >problem? > Thanks in advance. >Best Regards, >Heng Kok Liang The broadcast on the master will send 'x' to your slave. The broadcast on the slave will accept the value of 'x' and store it in a variable somewhere, which could be y or z. The fact that you are broadcasting 'x' probably means the slave needs the value of 'x', so store it in the corresponding variable. If the slave does not need 'x' (e.g. when you are broadcasting between two master) you can either create a more limited communicator, or create a dummy variable on the slaves that temporarely receives the value of 'x', but disregards it afterwards. Luc Vereecken