alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
GridSyncCpuTbbBlocks.hpp
Go to the documentation of this file.
1/* Copyright 2026 Mykhailo Varvarin
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
11
12#ifdef ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLED
13
14namespace alpaka
15{
16 //! The thread id map barrier grid synchronization for TBB.
17 template<typename TIdx>
18 class GridSyncBarrierTbb : public interface::Implements<ConceptGridSync, GridSyncBarrierTbb<TIdx>>
19 {
20 public:
21 using Barrier = core::tbb::BarrierThread<TIdx>;
22
23 // Get reference to the barrier from the outside because we need it to be shared between blocks
24 ALPAKA_FN_HOST explicit GridSyncBarrierTbb(Barrier& barrier)
25 {
26 m_barrier = &barrier;
27 }
28
29 Barrier* m_barrier;
30 };
31
32 namespace trait
33 {
34 template<typename TIdx>
35 struct SyncGridThreads<GridSyncBarrierTbb<TIdx>>
36 {
37 ALPAKA_FN_HOST static auto syncGridThreads(GridSyncBarrierTbb<TIdx> const& gridSync) -> void
38 {
39 gridSync.m_barrier->wait();
40 }
41 };
42
43 } // namespace trait
44} // namespace alpaka
45
46#endif
#define ALPAKA_FN_HOST
Definition Common.hpp:43
The alpaka accelerator library.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_ACC auto syncGridThreads(TGridSync const &gridSync) -> void
Synchronizes all threads within the current grid. Works only for cooperative kernels....
Definition Traits.hpp:33