Newsgroups: comp.parallel.mpi
From: gropp@godzilla.mcs.anl.gov (William Gropp)
Subject: Re: How to do this on MPI nicely
Organization: Math and Computer Science, Argonne National Laboratory
Date: Sat, 25 Nov 1995 18:28:42 GMT
Message-ID: <81732412212368@godzilla.mcs.anl.gov>

In article <pikus.817249225@sbphy.physics.ucsb.edu>,
Fedor G. Pikus <pikus@sbphy.physics.ucsb.edu> wrote:
>I want to do the following two things on MPI:
>1) Each node holds a real number and 2 interger numbers; I need to find
>the node which has the smallest real number and broadcast its numbers (both
>real and integer) to all nodes. The numbers which other nodes held
>should be discarded and overwritten by the numbers from the selected
>node.

MPI_Allreduce can be used here, with a user-defined function.

>2) There is an array, each node computes few elements of it, then I need
>each node to have the entire array.

MPI_Gather (if the parts of the vector are contiguous or known to all);
another simple approach is to set the destination to 0, set the local
value, and do MPI_Allreduce with MPI_BOR (bitwise or).

Bill


