Abstract
This thorn implement processor-local reduction operations.
A reduction operation can be defined as an operation on arrays (tuples) of variables resulting in a single number. Typical reduction operations are sum, minimum/maximum value, and boolean operations. A typical application is, for example, finding the minimum value in an -dimensional array.
This thorn provides processor-local reduction operations only. Global reduction operations can make use of these local reduction operations by providing the necessary inter-processor communication.
The new local reduce thorn has several new features including index strides and offsets for array indexing and full complex number support. Pending request, weight support can be enabled (there are some issues that a mask is essentially a weight with 1 or 0 value).
Modifying or extending this thorn is quite a simple matter. The heart of all the reduction operations is the large iterator macro in local_reductions.h. This iterator supports n-dimensional arrays with offsets and strides. The iterator is used in all local reduction operators in this thorn. To add a reduction operator, or change an existing one, all that needs to be done is to change the actual reduction operation definition which is called from within the iterator to perform the reduction.
To use a custom local reduction operator from the new global reduction implementation, some values must be returned to the global reduction implementation, such as the type of MPI reduction operation that needs to be performed (MPI_SUM, MPI_MIN, MPI_MAX) and if the final result should include a division by the total number of points used in the reduction. These are set in the parameter table with keys: mpi_operation and perform_division.
Please refer to the TestLocalReduce thorn in the CactusTest arrangement.
The following reduction operations are imlemented. are the values that are reduced, .
Note that the above definitions are for both real and complex values. For , the result of the reduction operation is , except for , which is , , which is , and , which is . We define the minimum of complex values by
and define the maximum equivalently.
The following high-level reduction operations are also implemented. They can be defined in terms of the basic reduction operations above.
It is often convenient to assign a weight to each value . In this case, the basic reduction operations are redefined as follows.