SHMEM_LONG_FINC(3)
NAME β¨
shmem_int4_finc, shmem_int8_finc, shmem_int_finc, shmem_long_finc, shmem_longlong_finc β bestie, this is an atomic fetch-and-increment on a remote data object π
No cap, that's the whole vibe. You reach over into somebody else's PE, grab the number that's sitting there, hand it back to yourself, and bump it by one on the way out β all in one indivisible little moment. π«Ά
(This page lives in the Open MPI manual, section 3. Hiiii.)
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 π¦
Okay so here's what the fetch-and-increment routines do, step by step, and the order genuinely matters:
- They fetch the value sitting at address
targeton PEpe. π - They update
targetwith the result of incrementing that fetched value by one. - And this whole thing must complete without the possibility of another process updating
targetbetween the time of the fetch and the update. That's the atomic part β it's giving main character energy, no interruptions allowed, periodt. β¨
The arguments, explained with love π
targetβ the remotely accessible integer data object that's getting updated on the remote PE. The type oftargetshould match that implied in the SYNOPSIS section, bestie. Don't be out here passing the wrong type, the compiler will simply not be having it. πpeβ an integer that indicates the PE number upon whichtargetis to be updated. If you're doing Fortran, it has to be a default integer value. That's it, that's the rule. π
NOTES π
The term remotely accessible is defined in intro_shmem(3). If you're like "wait, remotely accessible??" β go read that one, iykyk. π§
RETURN VALUES β
It returns the contents that had been at the target address on the remote PE prior to the increment. So: the old value. The pre-increment value. The before picture. The number as it was, not as it now is. π
See also:
intro_shmem(3)πΈ
Copyright 2003-2026, The Open MPI Community.
This iconic little page was born Sep 10, 2026, straight out of the Open MPI crew, and it lives at SHMEM_LONG_FINC(3). Slay, go increment something atomically, and stay safe out there. ππβ¨
π¦ 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