42#ifdef ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLED
46 template<
typename TDim,
typename TIdx,
typename TKernelFnObj,
typename... TArgs>
47 class TaskKernelCpuThreads;
53 template<
typename TDim,
typename TIdx>
68# ifdef ALPAKA_DISABLE_VENDOR_RNG
77 sizeof(TIdx) >=
sizeof(
int),
78 "Index type is not supported, consider using int or a larger type.");
82 template<
typename TDim2,
typename TIdx2,
typename TKernelFnObj,
typename... TArgs>
83 friend class ::alpaka::TaskKernelCpuThreads;
91 template<
typename TWorkDiv>
94 , gb::
IdxGbRef<TDim, TIdx>(m_gridBlockIdx)
101 [
this]()
noexcept {
return (m_idMasterThread == std::this_thread::get_id()); })
102 , BlockSyncBarrierThread<TIdx>(getWorkDiv<Block, Threads>(workDiv).prod())
103 , m_gridBlockIdx(Vec<TDim, TIdx>::zeros())
109 std::mutex
mutable m_mtxMapInsert;
110 typename bt::IdxBtRefThreadIdMap<TDim, TIdx>::
111 ThreadIdToIdxMap
mutable m_threadToIndexMap;
112 Vec<TDim, TIdx>
mutable m_gridBlockIdx;
115 std::thread::id
mutable m_idMasterThread;
121 template<
typename TDim,
typename TIdx>
122 struct AccType<AccCpuThreads<TDim, TIdx>>
124 using type = AccCpuThreads<TDim, TIdx>;
128 template<
typename TDim,
typename TIdx>
129 struct IsSingleThreadAcc<AccCpuThreads<TDim, TIdx>> : std::false_type
134 template<
typename TDim,
typename TIdx>
135 struct IsMultiThreadAcc<AccCpuThreads<TDim, TIdx>> : std::true_type
140 template<
typename TDim,
typename TIdx>
141 struct GetAccDevProps<AccCpuThreads<TDim, TIdx>>
146 auto const blockThreadCountMax =
static_cast<TIdx
>(8);
151 auto const blockThreadCountMax = std::max(
152 static_cast<TIdx
>(1),
157 static_cast<TIdx
>(1),
159 Vec<TDim, TIdx>::all(std::numeric_limits<TIdx>::max()),
161 std::numeric_limits<TIdx>::max(),
169 std::numeric_limits<TIdx>::max(),
178 template<
typename TDim,
typename TIdx>
179 struct GetAccName<AccCpuThreads<TDim, TIdx>>
188 template<
typename TDim,
typename TIdx>
189 struct DevType<AccCpuThreads<TDim, TIdx>>
195 template<
typename TDim,
typename TIdx>
196 struct DimType<AccCpuThreads<TDim, TIdx>>
202 template<
typename TDim,
typename TIdx,
typename TWorkDiv,
typename TKernelFnObj,
typename... TArgs>
203 struct CreateTaskKernel<AccCpuThreads<TDim, TIdx>, TWorkDiv, TKernelFnObj, TArgs...>
206 TWorkDiv
const& workDiv,
207 TKernelFnObj
const& kernelFnObj,
210 return TaskKernelCpuThreads<TDim, TIdx, TKernelFnObj, TArgs...>(
213 std::forward<TArgs>(args)...);
218 template<
typename TDim,
typename TIdx>
219 struct PlatformType<AccCpuThreads<TDim, TIdx>>
221 using type = PlatformCpu;
225 template<
typename TDim,
typename TIdx>
226 struct IdxType<AccCpuThreads<TDim, TIdx>>
231 template<
typename TDim,
typename TIdx>
237 template<
typename TDim,
typename TIdx>
The CPU threads accelerator.
auto operator=(AccCpuThreads const &) -> AccCpuThreads &=delete
AccCpuThreads(AccCpuThreads &&)=delete
AccCpuThreads(AccCpuThreads const &)=delete
auto operator=(AccCpuThreads &&) -> AccCpuThreads &=delete
Dynamic block shared memory provider using fixed-size member array to allocate memory on the stack or...
auto staticMemBegin() const -> uint8_t *
auto staticMemCapacity() const -> std::uint32_t
The thread id map barrier block synchronization.
The default CPU memory fence.
ALPAKA_NO_HOST_ACC_WARNING static ALPAKA_FN_HOST_ACC constexpr auto all(TVal const &val) -> Vec< TDim, TVal >
Single value constructor.
A basic class holding the work division as grid block extent, block thread and thread element extent.
The threads accelerator index provider.
ALPAKA_FN_HOST IdxBtRefThreadIdMap(ThreadIdToIdxMap const &mThreadToIndices)
A IdxGbRef grid block index.
IdxGbRef(Vec< TDim, TIdx > const &gridBlockIdx)
The standard library math trait specializations.
"Tiny" state mersenne twister implementation
The single-threaded warp to emulate it on CPUs.
auto clipCast(V const &val) -> T
The alpaka accelerator library.
ALPAKA_FN_HOST auto getAccDevProps(TDev const &dev) -> AccDevProps< Dim< TAcc >, Idx< TAcc > >
ALPAKA_FN_HOST auto createTaskKernel(TWorkDiv const &workDiv, TKernelFnObj const &kernelFnObj, TArgs &&... args)
Creates a kernel execution task.
ALPAKA_FN_HOST auto getMemBytes(TDev const &dev) -> std::size_t
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_ACC auto syncBlockThreads(TBlockSync const &blockSync) -> void
Synchronizes all threads within the current block (independently for all blocks).
typename trait::AccToTag< TAcc >::type AccToTag
maps an acc type to a tag type
typename trait::TagToAcc< TTag, TDim, TIdx >::type TagToAcc
maps a tag type to an acc type
Tag used in class inheritance hierarchies that describes that a specific interface (TInterface) is im...
static ALPAKA_FN_HOST auto getAccName() -> std::string