This repository has been archived by the owner on Apr 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Kokkos::atomic_compare_exchange
Daniel Arndt edited this page May 1, 2020
·
4 revisions
Header File: Kokkos_Core.hpp
Usage:
old_val = atomic_compare_exchange(ptr_to_value,comparison_value, new_value);
Atomically sets the value at the address given by ptr_to_value
to new_value
if the current value at ptr_to_value
is equal to comparison_value
, and returns the previously stored value at the address independent on whether
the exchange has happened.
template<class T>
T atomic_compare_exchange(T* const ptr_to_value, const T comparison_value, const T new_value);
-
template<class T> T atomic_compare_exchange(T* const ptr_to_value, const T comparison_value, const T new_value);
Atomically executes
old_value = *ptr_to_value; if(old_value==comparison_value) *ptr_to_value = new_value; return old_value;
.-
ptr_to_value
: address of the to be updated value. -
comparison_value
: value to be compared to. -
new_value
: new value. -
old_value
: value at addressptr_to_value
before doing the exchange.
-
Home:
- Introduction
- Machine Model
- Programming Model
- Compiling
- Initialization
- View
- Parallel Dispatch
- Hierarchical Parallelism
- Custom Reductions
- Atomic Operations
- Subviews
- Interoperability
- Kokkos and Virtual Functions
- Initialization and Finalization
- View
- Data Parallelism
- Execution Policies
- Spaces
- Task Parallelism
- Utilities
- STL Compatibility
- Numerics
- Detection Idiom