SHMEM_INT_FADD(3)
SHMEM_INT_FADD(3) π
okay bestie, gather round, because today we're learning about the Open MPI page for shmem_int4_fadd(3), shmem_int8_fadd(3), shmem_int_fadd(3), shmem_long_fadd(3), and shmem_longlong_fadd(3) β they all do the same iconic thing: an atomic fetch-and-add operation on a remote data object. yes it's giving atomic. yes it's giving remote. slay. β¨
πΈ NAME πΈ
shmem_int4_fadd(3), shmem_int8_fadd(3), shmem_int_fadd(3), shmem_long_fadd(3), shmem_longlong_fadd(3) β performs an atomic fetch-and-add operation on a remote data object π
β¨ 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 what does that mean, you ask? it means they fetch the old target and add value to target β and there is no possibility of another process updating target between the time of the fetch and the update. like, zero. none. the door is locked, the vibe is sealed, nobody's cutting in. π₯
these routines add value to target on Processing Element (PE) pe and return the previous contents of target, all as an atomic operation. it's giving main character energy honestly. π
the arguments, bestie:
targetβ the remotely accessible integer data object to be updated on the remote PE. the type oftargetshould match what's implied in the SYNOPSIS section, no cap. π«Άvalueβ the value to be atomically added totarget. and yeah, the type ofvalueshould match what's implied in the SYNOPSIS section too. β¨peβ an integer that indicates the PE number on whichtargetis to be updated. hmm, if you're using Fortran, it must be a default integer value. don't try anything cute. π
π NOTES π
the term remotely accessible is defined in intro_shmem(3). go read it, i'll wait. π
β RETURN VALUES β
the contents that had been at the target address on the remote PE prior to the atomic addition operation. like, the before picture. the throwback. the old you. πΈ
See also:
fr fr, this is the most important part: it's atomic, so that fetch-then-update window is completely closed. no sneaky updates from other processes in between. that's the whole point, iykyk. πβ¨
Copyright 2003-2026, The Open MPI Community
and that's the whole page, bestie π this was Open MPI's take on SHMEM_INT_FADD(3), all fresh from Sep 10, 2026 β go forth, fetch, add, and stay atomic. mwah. π
π¦πΈ
π¦ 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