SHMEM_LOCK(3)
π NAME π
Hiii bestie, welcome to the Open MPI page for SHMEM_LOCK(3) β itβs giving mutual-exclusion-lock realness. This page covers shmem_set_lock(3), shmem_clear_lock(3), and shmem_test_lock(3): releases, locks, and tests a mutual exclusion memory lock. Periodt. π
β¨ SYNOPSIS β¨
C or C++:
#include <mpp/shmem.h>
void shmem_clear_lock(volatile long *lock);
void shmem_set_lock(volatile long *lock);
int shmem_test_lock(volatile long *lock);
Fortran:
INCLUDE "mpp/shmem.fh"
INTEGER lock, SHMEM_TEST_LOCK
CALL SHMEM_CLEAR_LOCK(lock)
CALL SHMEM_SET_LOCK(lock)
I = SHMEM_TEST_LOCK(lock)
π¦ DESCRIPTION π¦
Okay so shmem_set_lock sets a mutual exclusion lock after waiting for the lock to be freed by any other PE currently holding the lock. Waiting PEs are assured of getting the lock in a first-come, first-served manner. No line-cutting, bestie. π
shmem_clear_lock releases a lock previously set by shmem_set_lock after ensuring that all local and remote stores initiated in the critical region are complete. Very βclean up your mess before you dipβ energy. β¨
shmem_test_lock sets a mutual exclusion lock only if it is currently cleared. By using this function, a PE can avoid blocking on a set lock. If the lock is currently set, the function returns without waiting. These routines are appropriate for protecting a critical region from simultaneous update by multiple PEs. They accept the following arguments:
lockβ a symmetric data object that is a scalar variable or an array of length 1. This data object must be set to0on all processing elements (PEs) prior to the first use.lockmust be of type integer. If you are using Fortran, it must be of default kind.
bestie, βset to 0 on all PEs before first useβ is not a suggestion, itβs the vibe check. β
πΈ NOTES πΈ
The term symmetric data object is defined on intro_shmem(3). Iykyk. π«Ά
π₯ RETURN VALUES π₯
The shmem_test_lock function returns 0 if the lock was originally cleared and this call was able to set the lock. A value of 1 is returned if the lock had been set and the call returned without waiting to set the lock.
π SEE ALSO π
intro_shmem(3) β go read it, bestie. π
xoxo, your Unix bestie π
β this page came from gitclone, source/version status Unreleased developer copy, and the footer has no date listed. SHMEM_LOCK(3) out! π«Ά
π¦ where this page comes from
- arch rolling: nvhpc-comm-libs 26.9-1 Β· LicenseRef-NVIDIA-HPC-SDK
- Copyright (c) 2015 University of Houston. All rights reserved
- Copyright (c) 2015 Mellanox Technologies, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms