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

:link(mws,http://mapreduce.sandia.gov)
:link(md,Manual.html)

:line

MapReduce clone() method :h3

uint64_t MapReduce::clone() :pre

This calls the clone() method of a MapReduce object, which converts a
KeyValue object directly into a KeyMultiValue object.  It simply turns
each key in KeyValue object into a key in the new KeyMultiValue
object, with the same value.  The method returns the total number of
key/value pairs in the KeyMultiValue object, which will be the same as
the number in the KeyValue object.

This method essentially enables a KeyValue object to be passed
directly to a reduce operation, which requires a KeyMultiValue object
as input.  Typically you would only do this if the keys in the
KeyValue object are already unique, to avoid the extra overhead of an
"aggregate()"_aggregate.html or "convert()"_convert.html or
"collate()"_collate.html, but this is not required.  If they are not,
then there will also be duplicate keys in the KeyMultiValue object.

Note that one of the "map()"_map.html methods allows an existing
KeyValue object to be passed as input to a user mymap() function,
generating a new Keyvalue object in the process.  Thus there is
typically no need to invoke clone() followed by
"reduce()"_reduce.html.

This method is an on-processor operation, requiring no communication.
When run in parallel, the key/value pairs of the new KeyMultiValue
object are stored on the same processor which owns the corresponding
KeyValue pairs.

:line

[Related methods]: "collapse()"_collapse.html, "collate"_collate.html,
"convert()"_convert.html
