Visible to Intel only — GUID: GUID-12B5A09D-6D44-4317-9DA5-25E9DD20DCD8
Visible to Intel only — GUID: GUID-12B5A09D-6D44-4317-9DA5-25E9DD20DCD8
ATOMIC_FETCH_ADD
Atomic Intrinsic Subroutine (Generic): Performs atomic fetch and addition.
CALL ATOMIC_FETCH_ADD (atom, value, old [, stat])
atom |
(Input; output) Must be a scalar coarray or coindexed object and of type integer with kind ATOMIC_INT_KIND. It becomes defined with the value of atom + value if no error occurs. Otherwise, it becomes undefined. ATOMIC_INT_KIND is a named constant in the intrinsic module ISO_FORTRAN_ENV. |
value |
(Input) Must be a scalar integer. The value of value and value + atom must be representable as integers with kind ATOMIC_INT_KIND. |
old |
(Output) Must be a scalar of the same type as atom. It becomes undefined if an error occurs. Otherwise, it becomes defined with the value atom has at the beginning of the atomic operation. |
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 Atomic Subroutines. If stat is not present and an error condition occurs, error termination is initiated. |
Example
Consider the following:
CALL ATOMIC_FETCH_ADD (N[4], 8, M)
If the value of N on image 4 was 7 when the atomic operation is initiated, N on image 4 is defined with the value 15, and M becomes is defined with the value 7 when the operation completes and no error occurs during the subroutine reference.