SHMEM_LONG_FADD(3)
π SHMEM_LONG_FADD π
okay bestie, gather round, because today we're talking about shmem_int4_fadd(3), shmem_int8_fadd(3), shmem_int_fadd(3), shmem_long_fadd(3), and shmem_longlong_fadd(3) β the Open MPI girlies that perform an atomic fetch-and-add operation on a remote data object. no cap, this is the group chat you wanna be in. π«Ά
β¨ SYNOPSIS β¨
C or C++
#include <mpp/shmem.h>
int shmem_int_fadd(int *target, int value, int pe)
long shmem_long_fadd(long *target, long value, int pe)
long long shmem_longlong_fadd(long long *target, longlong value,
int pe)
Fortran
INCLUDE "mpp/shmem.fh"
INTEGER pe
INTEGER(KIND=4) SHMEM_INT4_FADD, ires, target, value
ires = SHMEM_INT4_FADD(target, value, pe)
INTEGER(KIND=8) SHMEM_INT8_FADD, ires, target, value
ires = SHMEM_INT8_FADD(target, value, pe)
πΈ DESCRIPTION πΈ
so the shmem_fadd functions do an atomic fetch-and-add operation, and it's giving main character energy fr fr. what that means: it fetches the old target and adds value to target β and there is no possibility of another process updating target between the time of the fetch and the update. like, nobody's gonna slide in and mess with your math mid-keystroke. π
these routines add value to target on Processing Element (PE) pe and return the previous contents of target, all as one atomic operation. iconic behaviour honestly β¨
now the arguments, bestie, listen up:
targetβ the remotely accessible integer data object that's getting updated on the remote PE. the type oftargetshould match whatever the SYNOPSIS section implies, so don't be out here mismatching types, that's not the vibe πvalueβ the value being atomically added totarget. again, its type should match what the SYNOPSIS section implies. periodt πpeβ an integer that indicates the PE number on whichtargetis to be updated. if you're using Fortran, it must be a default integer value. don't argue with me, that's just the rules π
π NOTES π
the term remotely accessible is defined in intro_shmem(3). go read it, i'll wait π¦
π RETURN VALUES π
it returns the contents that had been at the target address on the remote PE prior to the atomic addition operation. so like, the old vibe. the before-times. the pre-add era β
also see: intro_shmem(3) β your homework, bestie, no skipping π
Copyright
2003-2026, The Open MPI Community
and that's the whole page, bestie π mwah. Open MPI dropped this one on Sep 10, 2026, so jot that down in your notes alongside SHMEM_LONG_FADD(3). slay, stay atomic, and don't let anyone update your target mid-fetch πβ¨
π¦ 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