Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document atomic_assign #595

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading