SHMEM_ADD(3)

πŸ’… SHMEM_ADD(3) πŸ’…

okay so this is the Open MPI manual page for the atomic add besties, and it's lowkey iconic when you need one PE to update another PE's integer without any messy race drama. ✨

🌸 NAME 🌸

β€” these do an atomic add operation. periodt. πŸ’–

✨ 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)

πŸ¦‹ DESCRIPTION πŸ¦‹

The atomic add routines add value to the data at address target on PE pe. The operation finishes with no chance of another process updating target between the time of the fetch and the update. πŸŽ€

The arguments are as follows:

  • target β€” the remotely accessible integer data object that's getting updated on the remote PE. If you're using C/C++, the type of target should match what the SYNOPSIS section implies. If you're using the Fortran compiler, it must be of type integer with an element size of 4 bytes for SHMEM_INT4_ADD and 8 bytes for SHMEM_INT8_ADD. πŸ’…
  • value β€” the value to be atomically added to target. If you're using C/C++, the type of value should match what the SYNOPSIS section implies. If you're using Fortran, it must be of type integer with an element size of target. 🌟
  • pe β€” an integer that indicates the PE number upon which target is to be updated. If you're using Fortran, it must be a default integer value. 🫢

🧚 NOTES 🧚

The term remotely accessible is defined in intro_shmem(3). no cap, go read that if you need the lore. πŸ“–

πŸ’œ SEE ALSO πŸ’œ

mwah πŸ’‹ β€” this page came from the gitclone source, version Unreleased developer copy, and the footer stamps it SHMEM_ADD(3). πŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: nvhpc-comm-libs 26.9-1 Β· LicenseRef-NVIDIA-HPC-SDK
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms