Newsgroups: comp.parallel.mpi
From: "Andrew Mc.Ghee" <mcghee@sun.mech.uq.edu.au>
Subject: Re: About MPI_Scatter
Organization: Mechanical Engineering, UQ
Date: Mon, 26 May 1997 11:29:12 +1000
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <3388E768.24D@sun.mech.uq.edu.au>

Eric,
We have used MPI_Gather, but never MPI_Scatter, but I beleive them to
have a same format.
From the following WWW site,

http://imhefwww.epfl.ch/lmf/manuals/mpi/node72.html#Node72

I have copied an example code for MPI_Scatter that you might find
useful. I assume the point is that you do not need to separate root and
slave processes from the same call to MPI_Scatter.


MPI_Comm comm; 
    int gsize,*sendbuf; 
    int root, rbuf[100]; 
    ... 
    MPI_Comm_size( comm, &gsize); 
    sendbuf = (int *)malloc(gsize*100*sizeof(int)); 
    ... 
    MPI_Scatter( sendbuf, 100, MPI_INT, rbuf, 100, MPI_INT, root, comm); 

figure=mycoll-fig7.ps,width=3.50in 
Figure 8: The root process scatters sets of 100  ints to each
process in the group. 

It may well be that your code is correct (because the slave processes
may ignore some of the variables passed to MPI_Scatter) - but I probably
wouldn't recommend it - however, we are new to MPI, so take our advice
as amateurs only!

regards,
Andrew Mc.Ghee
Mechanical Engineering
University of Queensland

