alpaka
Abstraction Library for Parallel Kernel Acceleration
AtomicNoOp.hpp
Go to the documentation of this file.
1 /* Copyright 2022 Axel Huebl, Benjamin Worpitz, Matthias Werner, RenĂ© Widera, Jan Stephan, Bernhard Manfred Gruber
2  * SPDX-License-Identifier: MPL-2.0
3  */
4 
5 #pragma once
6 
8 
9 namespace alpaka
10 {
11  //! The NoOp atomic ops.
12  class AtomicNoOp
13  {
14  };
15 
16  namespace trait
17  {
18  //! The NoOp atomic operation.
19  template<typename TOp, typename T, typename THierarchy>
20  struct AtomicOp<TOp, AtomicNoOp, T, THierarchy>
21  {
22  ALPAKA_FN_HOST static auto atomicOp(AtomicNoOp const& /* atomic */, T* const addr, T const& value) -> T
23  {
24  return TOp()(addr, value);
25  }
26 
27  ALPAKA_FN_HOST static auto atomicOp(
28  AtomicNoOp const& /* atomic */,
29  T* const addr,
30  T const& compare,
31  T const& value) -> T
32  {
33  return TOp()(addr, compare, value);
34  }
35  };
36  } // namespace trait
37 } // namespace alpaka
The NoOp atomic ops.
Definition: AtomicNoOp.hpp:13
#define ALPAKA_FN_HOST
Definition: Common.hpp:40
The alpaka accelerator library.
static ALPAKA_FN_HOST auto atomicOp(AtomicNoOp const &, T *const addr, T const &value) -> T
Definition: AtomicNoOp.hpp:22
static ALPAKA_FN_HOST auto atomicOp(AtomicNoOp const &, T *const addr, T const &compare, T const &value) -> T
Definition: AtomicNoOp.hpp:27
The atomic operation trait.
Definition: Traits.hpp:60