SHMEM_LONG_FADD(3)

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

πŸ’– 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 of target should 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 to target. again, its type should match what the SYNOPSIS section implies. periodt πŸŽ€
  • pe β€” an integer that indicates the PE number on which target is 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