Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

CO_MAX

Collective Intrinsic Subroutine (Generic): Calculates the maximum value across images.

CALL CO_MAX (a [, result_image, stat, errmsg])

a

(Input; output) Must be of type real, integer, or charater, and have the same shape, type, and type parameter values in corresponding references across all images of the current team. It cannot be a coindexed object. If it is scalar, the computed value is the maximum value of a in all corresponding references. If it is an array, each element of the computed value is equal to the maximum value of the corresponding element of a in all corresponding references.

If no error occurs, the computed value is assigned to a on all images of the current team if result_image is not present, or on the executing image if the executing image is the image identified by result_image. Otherwise, a becomes undefined.

result_image

(Input; optional) Must be a scalar integer. If present, it must be present with the same value in all corresponding references and be a valid image index in the current team. If result_image is not present, it cannot be present in any corresponding reference.

stat

(Output; optional) Must be a non-coindexed integer scalar with a decimal exponent range of at least four (KIND=2 or greater). The value assigned to stat is specified in Overview of Collective Subroutines. If stat is not present and an error condition occurs, error termination is initiated.

errmsg

(Input; output; optional) Must be a non-coindexed default character scalar variable. The semantics of errmsg is described in Overview of Collective Subroutines.

Example

Consider the following:

CALL CO_MAX (R)

If there are two images and R is a four-element array defined with the value [5, 10, 20, 15] on image one and [10, 15, 20, 5] on image two when the subroutine is referenced, R becomes defined with the value [10, 15, 20, 15] on both images if no error occurs during the subroutine reference, and CALL CO_MAX (R, 2) causes R on image to become defined with the values [10, 15, 20, 15] on image 2; R on image 1 becomes undefined.