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: 2005-02-19 00:50:56


On Feb 18, 2005, at 5:03 PM, Srinivasa Prade Patri wrote:

> Iam new to MPI and parallel programming and i want some clarifications
> on reading a input file and on MPI_BCAST subroutine.
>
> Q1) I know there are two ways to have each processor read the input
> file
> 1) Let all the processes read the input file on a shared file system
> 2) Let one processor(pbly node 0) read the input from the file and
> BROADCAST it to all other processors.
>
> I like to know which method is more efficient.

The MPI way would be to read the input file using MPI I/O. Of your two
options, I would use #1 if you are running on a small number of nodes
as it's pretty simple. NFS scales not so well for concurrent access to
the same file, so I'd be tempted to use MPI_Bcast in those cases.

But at 480MB, if you don't have a fat network and a big file server, I
might think about staging the data out to the nodes on local filesystem
before using MPI. But it's probably going to vary pretty widely on you
system. So some experimentation is probably going to be needed.

> Q2) Iam using MPI_BCAST to send the input file to all processors. But
> how does MPI_BCAST works internally. My input file is 480Mb file. Is
> MPI_BCAST is advisable for broadcasting such large chunks of data .
> If not what should be my best approach.

MPI_Bcast will move 480MB of data, it's just going to take a little
while :). MPI_Bcast uses a binomial tree of pt-2-pt messages (for
communicators of at least 4 nodes).

Hope this helps,

Brian

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