S3L_reduce_axis applies a predefined reduction operation along a given axis of a parallel S3L array. If n is the rank (number of dimensions) of a, the result b is a parallel array of rank n-1. The argument op specifies the operation to be performed. The value of op must be one of:
S3L_OP_SUM - The sum reduction operation is applied.
S3L_OP_MIN - The minimum reduction operation is applied.
S3L_OP_MAX - The maximum reduction operation is applied.
The C and Fortran syntax for S3L_reduce_axis are shown below.
#include <s3l/s3l-c.h> #include <s3l/s3l_errno-c.h> int S3L_reduce_axis(a, op, axis, b) S3L_array_t a S3L_op_type op int axis S3L_array_t b |
include `s3l/s3l-f.h' include `s3l/s3l_errno-f.h' subroutine S3L_reduce_axis(a, op, axis, b, ier) integer*8 a integer*4 op integer*4 axis integer*8 b integer*4 ier |
S3L_reduce_axis accepts the following arguments as input:
a - S3L array handle for the parallel array on which the operation will be applied.
op - Predefined constant specifying the operation to be applied.
axis - Specifies the axis along which the reduction will be performed. When S3L_reduce_axis is called from a C program, this value must reflect zero-based indexing of the array axes. If called from a Fortran program, it must reflect one-based indexing.
S3L_reduce_axis uses the following arguments for output:
b - S3L array handle for the parallel array that will contain the result of the reduction.
ier (Fortran only) - When called from a Fortran program, S3L_reduce_axis returns error status in ier.
On success, S3L_reduce_axis returns S3L_SUCCESS.
S3L_reduce_axis 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 - An illegal operation was requested.
S3L_ERR_MATCH_EXTENTS - The extents of a and b do not match. For example, if a is a 4D array with extents n1 x n2 x n3 x n4, and axis is equal to 2 (Fortran interface), b must be a 3D array with extents n1 x n3 x n4.
S3L_ERR_MATCH_RANK - The rank of b is not equal to rank of a minus 1.
S3L_ERR_ARG_AXISNUM - The axis specified is not valid; that is, it is either larger than the rank of the array or smaller than 1 (Fortran interface). For the C interface, the axis value would be equal to or larger than the rank of the array or smaller than 0.
../examples/s3l/utils/cshift_reduce.c ../examples/s3l/utils-f/cshift_reduce.f
S3L_reduce(3)