kokkos-execution 0.0.1
Loading...
Searching...
No Matches
atomic.hpp File Reference
#include "Kokkos_Core.hpp"

Go to the source code of this file.

Namespaces

namespace  Tests
namespace  Tests::Utils

Functions

template<typename T>
void Tests::Utils::atomic_add (T *ptr, const T val)
 Atomically add val to *ptr using system scope and relaxed memory order.

Detailed Description

System-scope atomic operations

Kokkos uses desul for atomics and defaults to device scope on all backends. That is sufficient when only GPU threads (of the same device) share a memory location, but yields undefined behaviour when both CPU and GPU threads atomically access the same address (e.g. a Kokkos::View in Kokkos::SharedSpace).

This file provides a portable, system-scope atomic add with relaxed memory order.

For more information:

Definition in file atomic.hpp.