The value of largest element in the array for which the corresponding element of the mask array is non-zero is written to *val. The global subscripts of the first occurrence of this element are written to the vector pos. If the maximum value occurs more than once in the unmasked part of the array, ``first occurence'' is defined by ordering the set of global subscripts with first subscript least significant (Fortran-like array-element ordering).
The result values written to *val and pos are broadcast to all members of the active process group.