S3L_reduce performs a predefined reduction function over all elements of a parallel array. The array is described by the S3L array handle argument A. The argument op specifiesthe type of reduction operations, which can be one of the following:
S3L_OP_SUM - Finds the sum of all the elements.
S3L_OP_MIN - Finds the smallest value among all the elements.
S3L_OP_MAX - Finds the largest value among all the elements.
The C and Fortran syntax for S3L_reduce are shown below.
#include <s3l/s3l-c.h> #include <s3l/s3l_errno-c.h> int S3L_reduce(A, op, res) S3L_array_t A S3L_op_type op void *res |
include `s3l/s3l-f.h' include `s3l/s3l_errno-f.h' subroutine S3L_reduce(A, op, res, ier) integer*8 A integer*4 op <type> res integer*4 ier |
where <type> is one of: real*4, real*8, complex*8, or complex*16.
S3L_reduce accepts the following arguments as input:
A - Array handle for the parallel array to be reduced.
op - Specifies the type of operation to be performed; it can be one of:
S3L_OP_SUM
S3L_OP_MIN
S3L_OP_MAX
S3L_reduce uses the following arguments for output:
res - Contains the result of the reduction function.
ier (Fortran only) - When called from a Fortran program, S3L_reduce returns error status in ier.
On success, S3L_reduce returns S3L_SUCCESS.
S3L_reduce performs generic checking of the validity of the arrays it accepts as arguments. If an array argument contains an invalid or corrupted value, the function terminates and an error code indicating which value of the array handle was invalid is returned. See Appendix A of this manual for a detailed list of these error codes.
In addition, the following conditions will cause the function to terminate and return the associated error code.
S3L_ERR_ARG_OP - Requested operation is not supported.
S3L_ERR_ARG_DTYPE - Invalid data type.
../examples/s3l/utils/cshift_reduce.c ../examples/s3l/utils-f/cshift_reduce.f
S3L_reduce_axis(3)