SHMEM_INT_FINC(3)

πŸ’… SHMEM_INT_FINC(3) β€” the Open MPI glow-up

ok so bestie, we're talking about shmem_int4_finc(3), shmem_int8_finc(3), shmem_int_finc(3), shmem_long_finc(3), and shmem_longlong_finc(3) β€” and what they do is literally "Performs an atomic fetch-and-increment operation on a remote data object". that's the whole vibe. atomic remote increment. she's iconic, she's tiny, she's doing the most. ✨


πŸŽ€ SYNOPSIS

C or C++, bestie:

#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 girlies, this one's for you:

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)

no cap, that's the whole call. 🫢


🌸 DESCRIPTION

okay so picture it: the fetch-and-increment routines go grab the value sitting at address target on PE pe, and then they update target with the result of incrementing that grabbed value by one. simple. clean. gorgeous. πŸ’…

but here's the part that matters β€” 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, that's the whole assignment, that's the point. no sneaky interleaving allowed. periodt. πŸ”₯

the arguments are as follows:

  • target β€” the remotely accessible integer data object to be updated on the remote PE. the type of target should match that implied in the SYNOPSIS section (iykyk β€” don't go mixing your ints up, bestie, it will not slay).
  • pe β€” an integer that indicates the PE number upon which target is to be updated. if you're using Fortran, it must be a default integer value. that's a whole requirement, not a suggestion. πŸ¦‹

⭐ NOTES

the term remotely accessible is defined in intro_shmem(3). she has her own lore page. go read it. πŸ’œ


πŸ‘‘ RETURN VALUES

the function gives you back 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 pre-increment realness. main character energy from the past. πŸ’–


🌈 SEE ALSO:

that's it, that's the list, but she's an important one. 🧚


2003-2026, The Open MPI Community


ngl bestie, that's the entire page β€” every function name, every type, every argument, every caveat, all of it accounted for. now go increment something remotely and atomically, you absolute legend. ✨

okay and for the cute sign-off: this whole thing is from Open MPI, and the page is dated May 14, 2026 β€” SHMEM_INT_FINC(3), forever and always. πŸ’œπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from