LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: Heiko Bauke (heiko.bauke_at_[hidden])
Date: 2005-05-20 08:48:36


Hi,

On Thu, 19 May 2005 12:32:02 -0700 (PDT)
ThanhVu Nguyen <tvn_email-debianml_at_[hidden]> wrote:

check with MPI_Probe and MPI_Get_count the number of elements before
calling MPI_Recv.

> vector<int> data; //unknown size
>
> if (taskID == Sender){
> data.push_back(1);
> data.push_back(2);
>
> MPI_Send(&data[0],data.size(),MPI_INT .... ); // send
> }
> if (taskId == Receiver){
> // QUESTION here -> how to receive the sending data ? the
> receiver

   MPI_Probe(0, tag, MPI_COMM_WORLD, &status);
   MPI_Get_count(&status, MPI_INT, &count);
   data.resize(count);
   MPI_Recv(&data[0],data.size(),MPI_INT .... ); // recv

> }

        Heiko

-- 
-- Der Poet versteht die Natur besser als der wissenschaftliche Kopf.
-- (Novalis)
-- Supercomputing in Magdeburg @ http://tina.nat.uni-magdeburg.de
--                 Heiko Bauke @ http://www.uni-magdeburg.de/bauke