39#ifdef __cpp_lib_format
46#ifdef ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLED
50 template<
typename TDim,
typename TIdx,
typename TKernelFnObj,
typename... TArgs>
51 class TaskKernelCpuThreads;
57 template<
typename TDim,
typename TIdx>
73# ifdef ALPAKA_DISABLE_VENDOR_RNG
82 sizeof(TIdx) >=
sizeof(int),
83 "Index type is not supported, consider using int or a larger type.");
87 template<
typename TDim2,
typename TIdx2,
typename TKernelFnObj,
typename... TArgs>
88 friend class ::alpaka::TaskKernelCpuThreads;
96 template<
typename TWorkDiv>
99 , gb::
IdxGbRef<TDim, TIdx>(m_gridBlockIdx)
106 [
this]()
noexcept {
return (m_idMasterThread == std::this_thread::get_id()); })
115 std::mutex
mutable m_mtxMapInsert;
116 typename bt::IdxBtRefThreadIdMap<TDim, TIdx>::
117 ThreadIdToIdxMap
mutable m_threadToIndexMap;
118 Vec<TDim, TIdx>
mutable m_gridBlockIdx;
121 std::thread::id
mutable m_idMasterThread;
127 template<
typename TDim,
typename TIdx>
134 template<
typename TDim,
typename TIdx>
140 template<
typename TDim,
typename TIdx>
146 template<
typename TDim,
typename TIdx>
152 auto const blockThreadCountMax =
static_cast<TIdx
>(8);
157 auto const blockThreadCountMax = std::max(
158 static_cast<TIdx
>(1),
163 static_cast<TIdx
>(1),
167 std::numeric_limits<TIdx>::max(),
175 std::numeric_limits<TIdx>::max(),
186 template<
typename TDim,
typename TIdx>
191# if ALPAKA_COMP_CLANG
192# pragma clang diagnostic push
193# pragma clang diagnostic ignored "-Wexit-time-destructors"
195 using namespace std::literals;
196 static std::string
const accName =
197# ifdef __cpp_lib_format
203# if ALPAKA_COMP_CLANG
204# pragma clang diagnostic pop
210 template<
typename TDim,
typename TIdx>
217 template<
typename TDim,
typename TIdx>
224 template<
typename TDim,
typename TIdx,
typename TWorkDiv,
typename TKernelFnObj,
typename... TArgs>
228 TWorkDiv
const& workDiv,
229 TKernelFnObj
const& kernelFnObj,
235 std::forward<TArgs>(args)...);
240 template<
typename TDim,
typename TIdx,
typename TWorkDiv,
typename TKernelFnObj,
typename... TArgs>
244 TWorkDiv
const& workDiv,
245 TKernelFnObj
const& kernelFnObj,
249 if(gridBlockExtent.prod() !=
static_cast<TIdx
>(1u))
251 throw std::runtime_error(
252 "The std::thread accelerator supports only a single block operation with cooperative kernel!\n"
253 "Consider useing a different CPU accelerator.");
259 std::forward<TArgs>(args)...);
264 template<
typename TDim,
typename TIdx>
271 template<
typename TDim,
typename TIdx>
277 template<
typename TDim,
typename TIdx>
283 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.
ALPAKA_FN_HOST BlockSyncBarrierThread(TIdx const &blockThreadCount)
The thread id map barrier grid synchronization.
ALPAKA_FN_HOST GridSyncBarrierThread(TIdx const &blockThreadCount)
The default CPU memory fence.
The CPU threads execution task.
ALPAKA_NO_HOST_ACC_WARNING static ALPAKA_FN_HOST_ACC constexpr auto zeros() -> Vec< TDim, TVal >
Zero value constructor.
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
constexpr std::string_view demangled
auto clipCast(V const &val) -> T
The alpaka accelerator library.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto getWorkDiv(TWorkDiv const &workDiv) -> Vec< Dim< TWorkDiv >, Idx< TWorkDiv > >
Get the extent requested.
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).
The acceleration properties on a device.
Tag used in class inheritance hierarchies that describes that a specific interface (TInterface) is im...
The accelerator type trait.
static ALPAKA_FN_HOST auto createTaskCooperativeKernel(TWorkDiv const &workDiv, TKernelFnObj const &kernelFnObj, TArgs &&... args)
The cooperative kernel execution task creation trait.
static ALPAKA_FN_HOST auto createTaskKernel(TWorkDiv const &workDiv, TKernelFnObj const &kernelFnObj, TArgs &&... args)
The kernel execution task creation trait.
The dimension getter type trait.
static ALPAKA_FN_HOST auto getAccDevProps(DevCpu const &dev) -> AccDevProps< TDim, TIdx >
The device properties get trait.
static ALPAKA_FN_HOST auto getAccName() -> std::string
The accelerator name trait.
The multi thread accelerator trait.
The single thread accelerator trait.
The single-threaded warp to emulate it on CPUs.