Skip to content

Commit

Permalink
Document atomic_assign (#595)
Browse files Browse the repository at this point in the history
* Fix typo retur[n]s

* Document atomic_assign

* Fiddle with atomics TOC

* Remove old doc for atomic_assign
  • Loading branch information
dalg24 authored Nov 11, 2024
1 parent 80b9989 commit eca4fb5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
7 changes: 4 additions & 3 deletions docs/source/API/core/atomics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ Atomics
.. toctree::
:maxdepth: 1

./atomics/atomic_load
./atomics/atomic_store
./atomics/atomic_exchange
./atomics/atomic_compare_exchange
./atomics/atomic_compare_exchange_strong
./atomics/atomic_exchange
./atomics/atomic_assign
./atomics/atomic_fetch_op
./atomics/atomic_load
./atomics/atomic_op
./atomics/atomic_op_fetch
./atomics/atomic_store
37 changes: 37 additions & 0 deletions docs/source/API/core/atomics/atomic_assign.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
``atomic_assign``
=================

.. warning::
Deprecated since Kokkos 4.5,
use `atomic_store <atomic_store.html>`_ instead.

.. role:: cppkokkos(code)
:language: cppkokkos

Defined in header ``<Kokkos_Atomic.hpp>`` which is included from ``<Kokkos_Core.hpp>``

Usage
-----

.. code-block:: cpp
atomic_assign(&obj, desired);
// ^^^^^^
// deprecated since Kokkos 4.5,
// use atomic_store(&obj, desired) instead
Atomically replaces the current value of ``obj`` with ``desired``.

Description
-----------

.. cppkokkos:function:: template<class T> void atomic_assign(T* ptr, std::type_identity_t<T> val);
Atomically writes ``val`` into ``*ptr``.

``{ *ptr = val; }``

:param ptr: address of the object whose value is to be replaced
:param val: the value to store in the referenced object
:returns: (nothing)

2 changes: 1 addition & 1 deletion docs/source/API/core/atomics/atomic_exchange.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Usage
auto old = atomic_exchange(&obj, desired);
Atomically replaces the value of ``obj`` with ``desired`` and returs the value before the call.
Atomically replaces the value of ``obj`` with ``desired`` and returns the value before the call.

Description
-----------
Expand Down
8 changes: 0 additions & 8 deletions docs/source/API/core/atomics/atomic_op.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ Description

* ``value``: value with which to combine the original value.

.. cppkokkos:function:: template<class T> void atomic_assign(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``: new value.

.. cppkokkos:function:: template<class T> void atomic_decrement(T* const ptr_to_value);
Atomically executes ``(*ptr_to_value)--`` or calls ``atomic_fetch_sub(ptr_to_value, T(-1))``.
Expand Down

0 comments on commit eca4fb5

Please sign in to comment.