SHMEM_INT_ADD(3)
π NAME π
okay bestie, gather round, because these five functions are literally the atomic-add queens of Open MPI: shmem_int_add(3), shmem_int4_add(3), shmem_int8_add(3), shmem_long_add(3), shmem_longlong_add(3) β they perform an atomic add operation. that's the whole vibe. no cap.
β¨ SYNOPSIS β¨
C or C++, my love:
#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 girlies, this one's for you:
include 'mpp/shmem.h'
INTEGER pe
CALL SHMEM_INT4_ADD(target, value, pe)
CALL SHMEM_INT8_ADD(target, value, pe)
πΈ DESCRIPTION πΈ
so the atomic add routines add value to the data sitting at address target on PE pe. and the way it completes β okay this is the iconic part β it does so without the possibility of another process updating target between the time of the fetch and the update. atomicity slay. π
nobody can jump in mid-update, periodt.
the arguments are giving:
targetβ the remotely accessible integer data object that's getting updated on the remote PE. if you're in C/C++ land, the type oftargetshould match that implied in the SYNOPSIS section. if you're compiling Fortran, it must be of typeintegerwith an element size of4bytes forSHMEM_INT4_ADDand8bytes forSHMEM_INT8_ADD. πvalueβ the value being atomically added totarget. C/C++ besties: the type ofvalueshould match that implied in the SYNOPSIS section. Fortran besties: it must be of typeintegerwith an element size oftarget. π«Άpeβ an integer that indicates the PE number upon whichtargetis to be updated. if you're using Fortran, it must be a defaultintegervalue. π
π NOTES π
the term remotely accessible is defined in intro_shmem(3) β go read it, it's the lore. β¨
also see:
intro_shmem(3)shmem_cache(3)
and that's the page, babe π this one's brought to you by the Open MPI girlies, dated Sep 10, 2026, and the copyright is held tight by 2003-2026, The Open MPI Community. go forth and add atomically, you're doing amazing sweetie π¦π
π¦ 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