LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Brian Barrett (brbarret_at_[hidden])
Date: 2006-03-24 11:00:34


On Mar 24, 2006, at 10:17 AM, Peeyush Jain wrote:

> hi all,
> I want to know the function by which i can broadcast a message from
> one processor without even accesed by some other processor. I mean to
> say
>
> some code change v,
> if(v == -1)
> MPI_Bcast();
>
> May be this v is changed by only one processor, then how can some
> other processor enters into the MPI_Bcast function. Is there any other
> function exist to solve this.

You're going to have to share the value of v with all processes if
you want to use v as a decision about whether or not a broadcast
occurs. There are a number of ways of doing this, including doing
some sort of gather or reduce to share the different values before
the decision is made. I might take a look at the functions
MPI_Allreduce and MPI_Alltoall, depending on what v is.

This is actually a fairly basic point of MPI - that data is "owned"
by a process and only shared explicitly through communication calls.
You might want to have a look at some of the many high quality MPI
tutorials available on the web. We have links to a number of them on
our website:

     http://www.lam-mpi.org/tutorials/

While we always welcome questions both about LAM/MPI and using MPI in
general on this mailing list, it might serve you better to work
through some of the tutorials first.

Hope this helps,

Brian

-- 
   Brian Barrett
   LAM/MPI developer and all around nice guy
   Have a LAM/MPI day: http://www.lam-mpi.org/