dlb_next Subroutine

public subroutine dlb_next(counter)

Get next work unit atomically

Atomically increments counter on rank 0 and returns old value. Each call returns a unique value across all ranks.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(out) :: counter

Output: unique counter value (0-indexed)


Calls

proc~~dlb_next~~CallsGraph proc~dlb_next dlb_next proc~win_fetch_and_add_i64 win_t%win_fetch_and_add_i64 proc~dlb_next->proc~win_fetch_and_add_i64 mpi_fetch_and_op mpi_fetch_and_op proc~win_fetch_and_add_i64->mpi_fetch_and_op

Variables

Type Visibility Attributes Name Initial
integer(kind=int64), private :: increment

Source Code

   subroutine dlb_next(counter)
      integer(int64), intent(out) :: counter
      integer(int64) :: increment

      increment = 1_int64

      call counter_win%lock(0)
      call counter_win%fetch_and_add_i64(0, 0_MPI_ADDRESS_KIND, increment, counter)
      call counter_win%flush(0)
      call counter_win%unlock(0)
   end subroutine dlb_next