next up previous contents
Next: Pipelining Computation and Communication Up: Data Duplication and Consolidation Previous: Specialized copy

Reduce

    In many of our algorithms, one will notice that we do not necessarily maintain consistency of data in duplicated objects, like duplicated projected multivectors, or duplicated multiscalars. The reason for this is that often we will use the different copies of the duplicated object to accumulate contributions to a global result. Reducing these contribution to a single result is accomplished by a call to the PLA_Reduce routine: place HR here

figure5376

figure5380

figure5383

place HR here It is assumed that for the reduce, the input object is a duplicated object, i.e., a duplicated projected (multi)vector or a duplicated multiscalar. Naturally, the global dimensions of input and output must conform, and again, one may need to cast a matrix or annotate the orientation of a matrix, as for the copy. It will almost always be the case that the reduction operator is summation, indicated by op = MPI_SUM. The reduction is an element-wise operation.

In the PLA_Reduce, it is assumed that the output object does not play a role in the reduction. It is only used to store the result. If the data in the output object is to take part in the computation that is part of the reduction, one can call the routine place HR here

figure5409

figure5413

figure5416

place HR here It is assumed that the reduction performed by the PLA_Reduce_x routine is the summation. The shape parameter has the same meaning as in the PLA_Copy_x routine. The alpha parameter indicates that a multiple of the target object is to be summed to the result of summing the different instances of the input object together.

Notice that the call

PLA_Reduce( obj_from, MPI_SUM, obj_to );
is equivalent to the call
PLA_Obj_datatype( obj_from, &datatype );
PLA_Obj_template( obj_from, &template );
PLA_Mscalar_create( datatype, PLA_ALL_ROWS, PLA_ALL_COLS, 1, 1, template, &zero );
PLA_Obj_set_to_zero( zero );
PLA_Reduce_x( PLA_SHAPE_GENERAL, obj_from, zero, obj_to );

next up previous contents
Next: Pipelining Computation and Communication Up: Data Duplication and Consolidation Previous: Specialized copy

rvdg@cs.utexas.edu