Newsgroups: comp.parallel.pvm
From: donato@cs.utk.edu (June Donato)
Subject: Re: pvm_reduce() ???
Summary: pvm_reduce, further documentation
Keywords: PVM, reduce
Organization: CS Department, University of Tennessee, Knoxville
Date: 30 Jan 1995 16:58:01 -0500
Message-ID: <3gjnd9INNt78@thud.cs.utk.edu>

In article <3gat97$q8@enst.enst.fr> cabrera@news.enst.fr (Rocio Cabrera) writes:
>Hi,
>	Has any body used the function "pvm_reduce()". I feel it is very
>	usefull but I, how are the results stored in the root task?
>	Does the array length has to be equal to the number of created
>	workers?
>
>	Thanks, Rocio.
>

------------------------  PVM_REDUCE further documentation

Each group member calls reduce with the same size data array.
This array can have one or more entries in it.

The inner workings of the reduce call are implementation dependent,
however, when the "root" returns from the reduce, its data array
is now equal to the specified function, func, applied elementwise to
the data arrays of all the group members.

If all the members need the result then the root should broadcast it.

The following example illustrates what happens.
Suppose you have three group members (instance numbers 0, 1, 2)
with an array called X with 5 values as specified:

instance       the 5 values in the integer array
0                1,   2,   3,   4,   5
1               10,  20,  30,  40,  50
2              100, 200, 300, 400, 500

Consider the following calls to reduce where the root member is the
member with instance value of 1:
   C:
      root = 1;
      info = pvm_reduce(PvmSum, &data, 5, PVM_INT, msgtag, "workers", root);
   Fortran:
      root = 1
      call pvmfreduce(PvmSum, data, 5, INTEGER4, msgtag, "workers", root, info)


The result will be 

instance       the 5 values in the integer array
0                1,   2,   3,   4,   5
1              111, 222, 333, 444, 555
2              100, 200, 300, 400, 500

------------------------

I hope this helps you and others.  The pvm_recduce (pvmfreduce) manual page
will be updated also.

-- June Donato

 /-------------------------------------------------------------------------\
|*   Dr. June M. Donato           phone: (615) 576-7928                    *|
|    Oak Ridge National Lab       email: donato@msr.epm.ornl.gov            |
|    P.O. Box 2008, Bldg. 6010    FAX:    (615) 574-6211                    |
|    Oak Ridge, TN 37831-6414     WEB:    http://www.epm.ornl.gov/~donato/  |
|                                                                           |
|    Computer Science Department  University of TN, Knoxville               | 
|    Adjunct Assistant Professor                                            |
|                                                                           |
|*   physical office:             ORNL, X-10, Bldg. 6010, room 108         *|
 \-------------------------------------------------------------------------/

