SHMEM_LONG_ADD(3)

πŸ“¦
version 5.0.10 Β· 4 versions
, in ubuntu stonking

πŸ’– 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 Fortran include 'mpp/shmem.h' β€” yes it's literally mpp/shmem.h both 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 of target should 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 type integer with an element size of 4 bytes for SHMEM_INT4_ADD and 8 bytes for SHMEM_INT8_ADD. πŸ‘‘
  • value β€” the value being atomically added to target. C/C++ girlies: match the type implied in SYNOPSIS. Fortran girlies: it must be type integer with an element size of target. πŸŽ€
  • pe β€” an integer that says which PE number target is 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