diff --git a/docs/source/API/core/atomics/atomic_fetch_op.md b/docs/source/API/core/atomics/atomic_fetch_op.md deleted file mode 100644 index 13dffaba5..000000000 --- a/docs/source/API/core/atomics/atomic_fetch_op.md +++ /dev/null @@ -1,161 +0,0 @@ -# `atomic_fetch_[op]` - -Header File: `Kokkos_Core.hpp` - -Usage: -```c++ -old_value = atomic_fetch_[op](ptr_to_value,update_value); -``` - -Atomically updates the variable at the address given by `ptr_to_value` with `update_value` according to the relevant operation, -and returns the previous value found at that address.. - -## Synopsis - -```c++ -template -T atomic_fetch_add(T* const ptr_to_value, const T value); - -template -T atomic_fetch_and(T* const ptr_to_value, const T value); - -template -T atomic_fetch_div(T* const ptr_to_value, const T value); - -template -T atomic_fetch_lshift(T* const ptr_to_value, const unsigned shift); - -template -T atomic_fetch_max(T* const ptr_to_value, const T val); - -template -T atomic_fetch_min(T* const ptr_to_value, const T val); - -template -T atomic_fetch_mod(T* const ptr_to_value, const T value); - -template -T atomic_fetch_mul(T* const ptr_to_value, const T value); - -template -T atomic_fetch_or(T* const ptr_to_value, const T value); - -template -T atomic_fetch_rshift(T* const ptr_to_value, const unsigned shift); - -template -T atomic_fetch_sub(T* const ptr_to_value, const T value); - -template -T atomic_fetch_xor(T* const ptr_to_value, const T value); -``` - -## Description - -* ```c++ - template - T atomic_fetch_add(T* const ptr_to_value, const T value); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value += value; return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value to be added. - -* ```c++ - template - T atomic_fetch_and(T* const ptr_to_value, const T value); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value &= value; return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value with which to combine the original value. - -* ```c++ - template - T atomic_fetch_div(T* const ptr_to_value, const T value); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value /= value; return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value by which to divide the original value.. - -* ```c++ - template - T atomic_fetch_lshift(T* const ptr_to_value, const unsigned shift); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value << shift; return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `shift`: value by which to shift the original variable. - -* ```c++ - template - T atomic_fetch_max(T* const ptr_to_value, const T value); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value = max(*ptr_to_value, value); return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value which to take the maximum with. - -* ```c++ - template - T atomic_fetch_min(T* const ptr_to_value, const T value); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value = min(*ptr_to_value, value); return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value which to take the minimum with. - -* ```c++ - template - T atomic_fetch_mul(T* const ptr_to_value, const T value); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value *= value; return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value by which to multiply the original value. - -* ```c++ - template - T atomic_fetch_mod(T* const ptr_to_value, const T value); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value %= value; return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value with which to combine the original value. - -* ```c++ - template - T atomic_fetch_or(T* const ptr_to_value, const T value); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value |= value; return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value with which to combine the original value. - -* ```c++ - template - T atomic_fetch_rshift(T* const ptr_to_value, const unsigned shift); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value >> shift; return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `shift`: value by which to shift the original variable. - -* ```c++ - template - T atomic_fetch_sub(T* const ptr_to_value, const T value); - ``` - - Atomically executes `*ptr_to_value -= value`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value to be substracted.. - -* ```c++ - template - T atomic_fetch_xor(T* const ptr_to_value, const T value); - ``` - - Atomically executes `tmp = *ptr_to_value; *ptr_to_value ^= value; return tmp;`. - * `ptr_to_value`: address of the to be updated value. - * `value`: value with which to combine the original value. diff --git a/docs/source/API/core/atomics/atomic_fetch_op.rst b/docs/source/API/core/atomics/atomic_fetch_op.rst new file mode 100644 index 000000000..46bfa37a3 --- /dev/null +++ b/docs/source/API/core/atomics/atomic_fetch_op.rst @@ -0,0 +1,185 @@ +``atomic_fetch_[op]`` +===================== + +.. role::cpp(code) + :language: cpp + +Header File: ``Kokkos_Core.hpp`` + +Usage: + +.. code-block:: cpp + + old_value = atomic_fetch_[op](ptr_to_value,update_value); + +Atomically updates the variable at the address given by ``ptr_to_value`` with ``update_value`` according to the relevant operation, +and returns the previous value found at that address.. + +Synopsis +-------- + +.. code-block:: cpp + + template + T atomic_fetch_add(T* const ptr_to_value, const T value); + + template + T atomic_fetch_and(T* const ptr_to_value, const T value); + + template + T atomic_fetch_div(T* const ptr_to_value, const T value); + + template + T atomic_fetch_lshift(T* const ptr_to_value, const unsigned shift); + + template + T atomic_fetch_max(T* const ptr_to_value, const T val); + + template + T atomic_fetch_min(T* const ptr_to_value, const T val); + + template + T atomic_fetch_mod(T* const ptr_to_value, const T value); + + template + T atomic_fetch_mul(T* const ptr_to_value, const T value); + + template + T atomic_fetch_or(T* const ptr_to_value, const T value); + + template + T atomic_fetch_rshift(T* const ptr_to_value, const unsigned shift); + + template + T atomic_fetch_sub(T* const ptr_to_value, const T value); + + template + T atomic_fetch_xor(T* const ptr_to_value, const T value); + +Description +----------- + +- .. code-block:: cpp + + template + T atomic_fetch_add(T* const ptr_to_value, const T value); + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value += value; return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value to be added. + +- .. code-block:: cpp + + template + T atomic_fetch_and(T* const ptr_to_value, const T value); + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value &= value; return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value with which to combine the original value. + +- .. code-block:: cpp + + template + T atomic_fetch_div(T* const ptr_to_value, const T value); + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value /= value; return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value by which to divide the original value.. + +- .. code-block:: cpp + + template + T atomic_fetch_lshift(T* const ptr_to_value, const unsigned shift); + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value << shift; return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``shift``: value by which to shift the original variable. + +- .. code-block:: cpp + + template + T atomic_fetch_max(T* const ptr_to_value, const T value); + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value = max(*ptr_to_value, value); return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value which to take the maximum with. + +- .. code-block:: cpp + + template + T atomic_fetch_min(T* const ptr_to_value, const T value); + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value = min(*ptr_to_value, value); return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value which to take the minimum with. + +- .. code-block:: cpp + + template + T atomic_fetch_mul(T* const ptr_to_value, const T value); + + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value *= value; return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value by which to multiply the original value. + +- .. code-block:: cpp + + template + T atomic_fetch_mod(T* const ptr_to_value, const T value); + + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value %= value; return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value with which to combine the original value. + +- .. code-block:: cpp + + template + T atomic_fetch_or(T* const ptr_to_value, const T value); + + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value |= value; return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value with which to combine the original value. + +- .. code-block:: cpp + + template + T atomic_fetch_rshift(T* const ptr_to_value, const unsigned shift); + + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value >> shift; return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``shift``: value by which to shift the original variable. + +- .. code-block:: cpp + + template + T atomic_fetch_sub(T* const ptr_to_value, const T value); + + + Atomically executes ``*ptr_to_value -= value``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value to be substracted.. + +- .. code-block:: cpp + + template + T atomic_fetch_xor(T* const ptr_to_value, const T value); + + Atomically executes ``tmp = *ptr_to_value; *ptr_to_value ^= value; return tmp;``. + + - ``ptr_to_value``: address of the to be updated value. + - ``value``: value with which to combine the original value.