]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/fortran/doc/gfortran/intrinsic-procedures/comax.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / comax.rst
CommitLineData
c63539ff
ML
1..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6.. _co_max:
7
8CO_MAX --- Maximal value on the current set of images
9*****************************************************
10
11.. index:: CO_MAX, Collectives, maximal value
12
13.. function:: CO_MAX(A, RESULT_IMAGE, STAT, ERRMSG)
14
15 ``CO_MAX`` determines element-wise the maximal value of :samp:`{A}` on all
16 images of the current team. If :samp:`{RESULT_IMAGE}` is present, the maximum
17 values are returned in :samp:`{A}` on the specified image only and the value
18 of :samp:`{A}` on the other images become undefined. If :samp:`{RESULT_IMAGE}` is
19 not present, the value is returned on all images. If the execution was
20 successful and :samp:`{STAT}` is present, it is assigned the value zero. If the
21 execution failed, :samp:`{STAT}` gets assigned a nonzero value and, if present,
22 :samp:`{ERRMSG}` gets assigned a value describing the occurred error.
23
24 :param A:
25 shall be an integer, real or character variable,
26 which has the same type and type parameters on all images of the team.
27
28 :param RESULT_IMAGE:
29 (optional) a scalar integer expression; if
30 present, it shall have the same value on all images and refer to an
31 image of the current team.
32
33 :param STAT:
34 (optional) a scalar integer variable
35
36 :param ERRMSG:
37 (optional) a scalar character variable
38
39 Standard:
40 Technical Specification (TS) 18508 or later
41
42 Class:
43 Collective subroutine
44
45 Syntax:
46 .. code-block:: fortran
47
48 CALL CO_MAX(A [, RESULT_IMAGE, STAT, ERRMSG])
49
50 Example:
51 .. code-block:: fortran
52
53 program test
54 integer :: val
55 val = this_image ()
56 call co_max (val, result_image=1)
57 if (this_image() == 1) then
58 write(*,*) "Maximal value", val ! prints num_images()
59 end if
60 end program test
61
62 See also:
63 :ref:`CO_MIN`,
64 :ref:`CO_SUM`,
65 :ref:`CO_REDUCE`,
3ed1b4ce 66 :ref:`CO_BROADCAST`