SHMEM_LONGLONG_FINC(3)
π SHMEM_LONGLONG_FINC(3) π
ok so bestie. welcome to the Open MPI section 3 manual, and today's main character is a whole family of fetch-and-increment girlies: shmem_int4_finc(3), shmem_int8_finc(3), shmem_int_finc(3), shmem_long_finc(3), and shmem_longlong_finc(3). together they perform an atomic fetch-and-increment operation on a remote data object. no cap. so iconic of them.
β¨ 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 π
ok so the fetch and increment routines are giving very specific energy: they grab the value sitting at address target on PE pe, and then they update target with the result of incrementing that retrieved value by one. yes, both. the fetch and the increment. she does it all π
and the way that this must be completed without the possibility of another process updating target between the time of the fetch and the update? that's the whole point, that's the atomicity, that's the vibe check passing. no interlopers, no sneaky second writer, periodt.
the arguments are as follows:
targetβ the remotely accessible integer data object that's gonna get updated on the remote PE. the type oftargetshould match that implied in the SYNOPSIS section (so like, don't be out here mismatching, bestie π).peβ an integer that indicates the PE number upon whichtargetis to be updated. if you're using Fortran, it must be a default integer value. fr fr.
π NOTES π
the term remotely accessible is defined over in intro_shmem(3). go read her, she explains everything. iykyk.
π RETURN VALUES π
she hands you back the contents that had been at the target address on the remote PE prior to the increment. so you get the old number, and the remote object gets the new one. teamwork, babes. π«Ά
See also:
π and that's the whole page, bestie! now go increment something atomically, you absolute legend π
big love and eternal copyright to 2003-2026, The Open MPI Community π and this lil masterpiece was dated Sep 10, 2026 β shout out to SHMEM_LONGLONG_FINC(3), you ate and left no crumbs πβ¨
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms