MapReduce-MPI WWW Site - MapReduce-MPI Documentation

MapReduce scrunch() method

uint64_t MapReduce::scrunch(int nprocs, char *key, int keybytes) 

This calls the scrunch() method of a MapReduce object, which gathers a KeyValue object onto nprocs and collapses it into a KeyMultiValue object. This method is exactly the same as performing a gather() followed by a collapse(). The method returns the total number of key/value pairs in the KeyMultiValue object which should be one for each of the nprocs.

The nprocs argument is used by the gather() portion of the operation. See the gather() doc page for details. The key and keybytes arguments are used by the collapse() portion of the operation. See the collapse() doc page for details.

Note that if nprocs > 1, then the same key will be assigned to the collapsed key/multi-value pairs on each processor.

This method can be used to collect a set of key/value pairs to use in a reduce() method so that it can all be passed to a single invocation of your myreduce() function for output.

This method is a parallel operation (gather()), followed by an on-processor operation (collapse()).

Related methods: collapse(), gather()