SHMEM_LONG_ADD(3)
π SHMEM_LONG_ADD(3) β the Open MPI girlies' atomic add moment π
okay bestie, welcome to the group chat π«Ά today's topic: shmem_int_add, shmem_int4_add, shmem_int8_add, shmem_long_add, and shmem_longlong_add β yes that one is literally shmem_longlong_add <#shmem-longlong-add>(3) in the docs, and yes, shmem_int_add <#shmem-int-add>(3) too, anchors and all, we do not edit the sacred texts β¨
anyway. these five icons perform an atomic add operation. that's the whole vibe: add, but make it un-interruptible π
πΈ SYNOPSIS πΈ
C or C++:
#include <mpp/shmem.h>
void shmem_int_add(int *target, int value, int pe)
void shmem_long_add(long *target, long value, int pe)
void shmem_longlong_add(long long *target, long long value,
int pe)
Fortran:
include 'mpp/shmem.h'
INTEGER pe
CALL SHMEM_INT4_ADD(target, value, pe)
CALL SHMEM_INT8_ADD(target, value, pe)
note the Fortraninclude 'mpp/shmem.h'β yes it's literallympp/shmem.hboth times, no I will not be explaining that, that's just how it is π
β¨ DESCRIPTION β¨
so the atomic add routines add value to the data at address target on PE pe. and here's the slay part: the operation completes without the possibility of another process updating target between the time of the fetch and the update. no race conditions, no β¨dramaβ¨, just atomicity. main character energy fr fr π₯
the arguments, bestie:
targetβ the remotely accessible integer data object that's gonna get updated on the remote PE. if you're in C/C++, the type oftargetshould match whatever the SYNOPSIS section implies (it's giving match it exactly, no cap). if you're on a Fortran compiler, it has to be typeintegerwith an element size of 4 bytes forSHMEM_INT4_ADDand 8 bytes forSHMEM_INT8_ADD. πvalueβ the value being atomically added totarget. C/C++ girlies: match the type implied in SYNOPSIS. Fortran girlies: it must be typeintegerwith an element size oftarget. πpeβ an integer that says which PE numbertargetis getting updated on. Fortran besties, heads up: it must be a default integer value. π¦
π NOTES π
the term remotely accessible is defined in intro_shmem(3) β go read it, it's required lore iykyk π
See also: intro_shmem(3) shmem_cache(3)
and that's the whole page, periodt π
Copyright β 2003-2026, The Open MPI Community π«Ά
signing off from Sep 10, 2026 β SHMEM_LONG_ADD(3), Open MPI, that's the tea ππ§π
π¦ 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