alpaka
Abstraction Library for Parallel Kernel Acceleration
Tag.hpp
Go to the documentation of this file.
1 /* Copyright 2023 Simeon Ehrig, Jan Stephan, Andrea Bocci
2  * SPDX-License-Identifier: MPL-2.0
3  */
4 
5 #pragma once
6 
8 
9 #include <iostream>
10 #include <type_traits>
11 
12 #define CREATE_ACC_TAG(tag_name) \
13  struct tag_name \
14  { \
15  static std::string get_name() \
16  { \
17  return #tag_name; \
18  } \
19  }
20 
21 namespace alpaka
22 {
34 
35  namespace trait
36  {
37  template<typename TAcc>
38  struct AccToTag;
39 
40  template<typename TTag, typename TDim, typename TIdx>
41  struct TagToAcc;
42  } // namespace trait
43 
44  /// @brief maps an acc type to a tag type
45  /// @tparam TAcc alpaka acc type
46  template<typename TAcc>
48 
49  /// @brief maps a tag type to an acc type
50  /// @tparam TTag alpaka tag type
51  /// @tparam TDim dimension of the mapped acc type
52  /// @tparam TIdx index type of the mapped acc type
53  template<typename TTag, typename TDim, typename TIdx>
55 
56  template<typename TAcc, typename... TTag>
57  inline constexpr bool accMatchesTags = (std::is_same_v<alpaka::AccToTag<TAcc>, TTag> || ...);
58 } // namespace alpaka
#define CREATE_ACC_TAG(tag_name)
Definition: Tag.hpp:12
The alpaka accelerator library.
constexpr bool accMatchesTags
Definition: Tag.hpp:57
typename trait::AccToTag< TAcc >::type AccToTag
maps an acc type to a tag type
Definition: Tag.hpp:47
typename trait::TagToAcc< TTag, TDim, TIdx >::type TagToAcc
maps a tag type to an acc type
Definition: Tag.hpp:54