SHMEM_INT_FINC(3)

✨ SHMEM_INT_FINC(3) β€” Open MPI ✨

okay bestie, welcome to the Open MPI manual, and buckle up because this one is genuinely a bop πŸ’–

🌸 NAME 🌸

shmem_int4_finc(3), shmem_int8_finc(3), shmem_int_finc(3), shmem_long_finc(3), shmem_longlong_finc(3) β€” Performs an atomic fetch-and-increment operation on a remote data object.

no cap, that's the whole vibe: grab a number off someone else's process, bump it by one, and do it so cleanly that nobody can sneak in between. it's giving main character energy at the memory-consistency level πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

C or C++

#include <mpp/shmem.h>

int shmem_int_finc(int *target, int pe)

long shmem_long_finc(long *target, int pe)

long long shmem_longlong_finc(long long *target, int pe)

Fortran

INCLUDE "mpp/shmem.fh"

INTEGER pe
INTEGER(KIND=4) SHMEM_INT4_FINC, target4
INTEGER(KIND=8) SHMEM_INT8_FINC, target8

ires4 = SHMEM_INT4_FINC(target4, pe)

ires8 = SHMEM_INT8_FINC(target8, pe)

πŸ’… DESCRIPTION πŸ’…

so the fetch-and-increment routines do two things and they do them together, which is the whole point. they retrieve the value sitting at address target on PE pe, and then they update target with the result of incrementing that retrieved value by one. πŸ“

and here's the part that matters, so like, don't skip it: the operation must be completed without the possibility of another process updating target between the time of the fetch and the update. that's the atomicity tea. no gaps, no window, no "oops someone else got there first". periodt. πŸ”₯

the arguments are, as follows:

  • target β€” the remotely accessible integer data object that's getting updated on the remote PE. the type of target should match the type implied up in the SYNOPSIS section, okay? don't mix and match, it's not that kind of party.
  • pe β€” an integer that indicates the PE number upon which target is to be updated. if you're writing Fortran, it must be a default integer value. ✨

πŸ¦‹ NOTES πŸ¦‹

the term remotely accessible is defined in intro_shmem(3). go peek if you're unsure, iykyk 🧚


🌈 RETURN VALUES 🌈

what you get back is the contents that had been at the target address on the remote PE prior to the increment. so like, the old value. the before picture. the glow-up is happening remotely and you just get the receipts πŸ’œ

See also:


2003-2026, The Open MPI Community


and that's the whole page, bestie 🫢 this was SHMEM_INT_FINC(3) from Open MPI, last touched Sep 10, 2026 β€” go forth, increment atomically, and slay πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from