"MapReduce-MPI WWW Site"_mws - "MapReduce-MPI Documentation"_md :c

:link(mws,http://www.cs.sandia.gov/~sjplimp/mapreduce.html)
:link(md,Manual.html)

:line

MapReduce gather() method :h3

uint64_t MapReduce::gather(int nprocs) :pre

This calls the gather() method of a MapReduce object, which collects
the key/value pairs of a KeyValue object spread across all processors
to form a new KeyValue object on a subset (nprocs) of processors.
Nprocs can be 1 or any number smaller than P, the total number of
processors.  The gathering is done to the lowest ID processors, from 0
to nprocs-1.  Processors with ID >= nprocs end up with an empty
KeyValue object containing no key/value pairs.  The method returns the
total number of key/value pairs in the new KeyValue object, which will
be the same as in the original KeyValue object.

This method can be used to collect the results of a
"reduce()"_reduce.html to a single processor for output.  See the
"collapse()"_collapse.html and "scrunch()"_scrunch.html methods for
related ways to collect key/value pairs for output.  A gather() may
also be useful before a "reduce()"_reduce.html if the number of unique
key/value pairs is small enough that you wish to perform the reduce
tasks on fewer processors.

This method requires parallel point-to-point communication as
processors send their key/value pairs to other processors.

:line

[Related methods]: "scrunch()"_scrunch.html,
"broadcast()"_broadcast.html
