alpaka
Abstraction Library for Parallel Kernel Acceleration
Traits.hpp
Go to the documentation of this file.
1 /* Copyright 2022 Benjamin Worpitz, Erik Zenker, Matthias Werner, RenĂ© Widera, Bernhard Manfred Gruber
2  * SPDX-License-Identifier: MPL-2.0
3  */
4 
5 #pragma once
6 
7 #include "alpaka/core/Common.hpp"
9 
10 #include <type_traits>
11 
12 namespace alpaka
13 {
15  {
16  };
17 
18  //! The block shared static memory operation trait.
19  namespace trait
20  {
21  //! The block shared static memory variable allocation operation trait.
22  template<typename T, std::size_t TuniqueId, typename TBlockSharedMemSt, typename TSfinae = void>
24  //! The block shared static memory free operation trait.
25  template<typename TBlockSharedMemSt, typename TSfinae = void>
27  } // namespace trait
28 
29  //! Declare a block shared variable.
30  //!
31  //! The variable is uninitialized and not default constructed!
32  //! The variable can be accessed by all threads within a block.
33  //! Access to the variable is not thread safe.
34  //!
35  //! \tparam T The element type.
36  //! \tparam TuniqueId id those is unique inside a kernel
37  //! \tparam TBlockSharedMemSt The block shared allocator implementation type.
38  //! \param blockSharedMemSt The block shared allocator implementation.
39  //! \return Uninitialized variable stored in shared memory.
41  template<typename T, std::size_t TuniqueId, typename TBlockSharedMemSt>
42  ALPAKA_FN_ACC auto declareSharedVar(TBlockSharedMemSt const& blockSharedMemSt) -> T&
43  {
46  }
47 
48  //! Frees all memory used by block shared variables.
49  //!
50  //! \tparam TBlockSharedMemSt The block shared allocator implementation type.
51  //! \param blockSharedMemSt The block shared allocator implementation.
53  template<typename TBlockSharedMemSt>
54  ALPAKA_FN_ACC auto freeSharedVars(TBlockSharedMemSt& blockSharedMemSt) -> void
55  {
58  }
59 } // namespace alpaka
#define ALPAKA_FN_ACC
All functions that can be used on an accelerator have to be attributed with ALPAKA_FN_ACC or ALPAKA_F...
Definition: Common.hpp:38
#define ALPAKA_NO_HOST_ACC_WARNING
Disable nvcc warning: 'calling a host function from host device function.' Usage: ALPAKA_NO_HOST_ACC_...
Definition: Common.hpp:82
typename detail::ImplementationBaseType< TConcept, TDerived >::type ImplementationBase
Returns the type that implements the given concept in the inheritance hierarchy.
Definition: Concepts.hpp:66
The alpaka accelerator library.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_ACC auto freeSharedVars(TBlockSharedMemSt &blockSharedMemSt) -> void
Frees all memory used by block shared variables.
Definition: Traits.hpp:54
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_ACC auto declareSharedVar(TBlockSharedMemSt const &blockSharedMemSt) -> T &
Declare a block shared variable.
Definition: Traits.hpp:42
The block shared static memory variable allocation operation trait.
Definition: Traits.hpp:23
The block shared static memory free operation trait.
Definition: Traits.hpp:26