alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
executor.hpp
Go to the documentation of this file.
1/* Copyright 2024 René Widera, Mehmet Yusufoglu
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
12#include "alpaka/tag.hpp"
13
14#include <string>
15
16namespace alpaka
17{
18 namespace exec
19 {
20 struct CpuSerial
21 {
22 static std::string getName()
23 {
24 return "CpuSerial";
25 }
26 };
27
29
31 {
32 static std::string getName()
33 {
34 return "CpuOmpBlocks";
35 }
36 };
37
39
41 {
42 static std::string getName()
43 {
44 return "CpuTbbBlocks";
45 }
46 };
47
49
50 namespace trait
51 {
52 template<>
53 struct IsSeqExecutor<CpuSerial> : std::true_type
54 {
55 };
56
57 template<>
58 struct IsSeqExecutor<CpuOmpBlocks> : std::true_type
59 {
60 };
61
62 template<>
63 struct IsSeqExecutor<CpuTbbBlocks> : std::true_type
64 {
65 };
66 } // namespace trait
67 } // namespace exec
68
69 namespace trait
70 {
71 template<>
72 struct IsExecutor<exec::CpuSerial> : std::true_type
73 {
74 };
75
76 template<>
77 struct IsExecutor<exec::CpuOmpBlocks> : std::true_type
78 {
79 };
80
81 template<>
82 struct IsExecutor<exec::CpuTbbBlocks> : std::true_type
83 {
84 };
85
86 } // namespace trait
87} // namespace alpaka
88
90{
91 template<typename T_AtomicScope>
93 {
94 constexpr decltype(auto) operator()(alpaka::exec::CpuSerial const, T_AtomicScope const) const
95 {
96 return alpaka::onAcc::internal::stlAtomic;
97 }
98 };
99
100 template<>
102 {
103 constexpr decltype(auto) operator()(alpaka::exec::CpuSerial const, onAcc::scope::Block const) const
104 {
105 return alpaka::onAcc::internal::nonAtomic;
106 }
107 };
108
109 template<typename T_AtomicScope>
111 {
112 constexpr decltype(auto) operator()(alpaka::exec::CpuOmpBlocks const, T_AtomicScope const) const
113 {
114 return alpaka::onAcc::internal::stlAtomic;
115 }
116 };
117
118 template<>
120 {
121 constexpr decltype(auto) operator()(alpaka::exec::CpuOmpBlocks const, onAcc::scope::Block const) const
122 {
123 return alpaka::onAcc::internal::nonAtomic;
124 }
125 };
126
127 template<typename T_AtomicScope>
129 {
130 constexpr decltype(auto) operator()(alpaka::exec::CpuTbbBlocks const, T_AtomicScope const) const
131 {
132 return alpaka::onAcc::internal::stlAtomic;
133 }
134 };
135
136 template<>
138 {
139 constexpr decltype(auto) operator()(alpaka::exec::CpuTbbBlocks const, onAcc::scope::Block const) const
140 {
141 return alpaka::onAcc::internal::nonAtomic;
142 }
143 };
144} // namespace alpaka::onAcc::trait
constexpr CpuTbbBlocks cpuTbbBlocks
Definition executor.hpp:48
constexpr CpuOmpBlocks cpuOmpBlocks
Definition executor.hpp:38
constexpr CpuSerial cpuSerial
Definition executor.hpp:28
main alpaka namespace.
Definition alpaka.hpp:76
static std::string getName()
Definition executor.hpp:32
static std::string getName()
Definition executor.hpp:22
static std::string getName()
Definition executor.hpp:42
Scope for atomic and fence operations visible only within the same thread block.
Definition scope.hpp:44