"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

Create a MapReduce object :h3

MapReduce::MapReduce(MPI_Comm comm)
MapReduce::MapReduce()
MapReduce::MapReduce(double dummy) :pre

You can create a MapReduce object in any of the three ways shown, as
well as via the "copy()"_copy.html method.  The three creation methods
differ slightly in how MPI is initialized and finalized.

In the first case, you pass an MPI communicator to the constructor.
This means your program should initialize (and finalize) MPI, which
creates the MPI_COMM_WORLD communicator (all the processors you are
running on).  Normally this is what you pass to the MapReduce
constructor, but you can pass a communicator for a subset of your
processors if desired.  You can also instantiate multiple MapReduce
objects, giving them each a communicator for all the processors or
communicators for a subset of processors.

The second case can be used if your program does not use MPI at all.
The library will initialize MPI if it has not already been
initialized.  It will not finalize MPI, but this should be fine.
Worst case, your program may complain when it exits if MPI has not
been finalized.

The third case is the same as the second except that the library will
finalize MPI when the last instance of a MapReduce object is
destructed.  Note that this means your program cannot delete all its
MapReduce objects in a early phase of the program and then instantiate
more MapReduce objects later.  This limitation is why the second case
is provided.  The third case is invoked by passing a double to the
constructor.  If this is done for any instantiated MapReduce object,
then the library will finalize MPI.  The value of the double doesn't
matter as it isn't used.  The use of a double is simply to make it
different than the first case, since MPI_Comm is often implemented by
MPI libraries as a type cast to an integer.

As examples, any of these lines of code will create a MapReduce
object, where "mr" is either a pointer to the object or the object
itself:

MapReduce *mr = new MapReduce(MPI_COMM_WORLD);
MapReduce *mr = new MapReduce();
MapReduce *mr = new MapReduce(0.0);
MapReduce mr(MPI_COMM_WORLD);
MapReduce mr();
MapReduce mr;
MapReduce mr(0.0); :pre

:line

[Related methods]: "destroy"_destroy.html, "copy()"_copy.html

