C Library Functions  - atomic_or (3)

NAME

ATOMIC_OR(3) - [ATOMIC:BIT MANIPULATION] Atomically perform a bitwise OR operation

SYNOPSIS

call atomic_or(atom, value [,stat] )

         subroutine atomic_or(atom,value,stat)

integer(atomic_int_kind) :: atom[*] integer(atomic_int_kind),intent(in) :: value integer,intent(out),intent(out) :: stat

CHARACTERISTICS

o ATOM is a scalar coarray or coindexed variable of integer type with atomic_int_kind kind.
o VALUE is a scalar of the same type as ATOM. If the kind is different, the value is converted to the kind of ATOM.
o STAT is a Scalar default-kind integer variable.

DESCRIPTION

ATOMIC_OR(ATOM, VALUE, STAT) atomically performs a bitwise OR operation between the value of ATOM and VALUE, storing the result in ATOM.

When STAT is present and the invocation was successful, it is assigned the value 0. If it is present and the invocation has failed, it is assigned a positive value; in particular, for a coindexed ATOM, if the remote image has stopped, it is assigned the value of ISO_FORTRAN_ENV’s STAT_STOPPED_IMAGE and if the remote image has failed, the value STAT_FAILED_IMAGE.

Unlike ATOMIC_FETCH_OR, this does not return the previous value.

Use for setting bits without needing the prior state.

OPTIONS

o ATOM : Scalar coarray or coindexed variable of integer type with atomic_int_kind kind.
o VALUE : Scalar of the same type as ATOM. If the kind is different, the value is converted to the kind of ATOM.
o STAT : (optional) Scalar default-kind integer variable. Set to 0 on success, or a positive value on failure.

EXAMPLES

Sample program:

    program demo_atomic_or
      use iso_fortran_env
      implicit none
      integer(atomic_int_kind) :: flags[*]
      integer :: stat, me

if (this_image() == 1) flags = int(b’1000’, atomic_int_kind) sync all

me = this_image() call atomic_or(flags[1], int(b’0011’, atomic_int_kind), stat)

if (stat /= 0) print *, "Image", me, ": Failed with STAT =", stat sync all

if (this_image() == 1) print *, "Final flags:", flags end program demo_atomic_or

Expected Output (4 images)

        > Final flags: 11

STANDARD

TS 18508

SEE ALSO

ATOMIC_DEFINE(3), ATOMIC_FETCH_OR(3),

ISO_FORTRAN_ENV(3), ATOMIC_ADD(3), ATOMIC_OR(3),

ATOMIC_XOR(3)

See ISO_FORTRAN_ENV for constants like ATOMIC_INT_KIND, STAT_STOPPED_IMAGE, and STAT_FAILED_IMAGE.

Fortran intrinsic descriptions


Nemo Release 3.1 atomic_or (3) June 29, 2025
Generated by manServer 1.08 from e3a875b0-8477-4206-9594-11087d1bc690 using man macros.