alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
MemFenceOmp2Blocks.hpp
Go to the documentation of this file.
1/* Copyright 2022 Jan Stephan, Bernhard Manfred Gruber, Andrea Bocci, Tapish Narwal
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
10
11#ifdef ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLED
12
13# if _OPENMP < 200203
14# error If ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLED is set, the compiler has to support OpenMP 2.0 or higher!
15# endif
16
17namespace alpaka
18{
19 //! The CPU OpenMP 2.0 block memory fence.
20 class MemFenceOmp2Blocks : public interface::Implements<ConceptMemFence, MemFenceOmp2Blocks>
21 {
22 };
23
24 namespace trait
25 {
26 template<>
28 {
30 static constexpr auto value = mem_order::acq_rel;
31 };
32
33 template<MemoryOrder TMemOrder>
34 struct MemFence<MemFenceOmp2Blocks, TMemOrder, memory_scope::Block>
35 {
36 static auto mem_fence(MemFenceOmp2Blocks const&, TMemOrder, memory_scope::Block const&)
37 {
38 // Only one thread per block allowed -> no memory fence required on block level
39 }
40 };
41
42 template<MemoryOrder TMemOrder>
43 struct MemFence<MemFenceOmp2Blocks, TMemOrder, memory_scope::Grid>
44 {
45 static auto mem_fence(MemFenceOmp2Blocks const&, TMemOrder order, memory_scope::Grid const&)
46 {
48 }
49 };
50
51 template<MemoryOrder TMemOrder>
52 struct MemFence<MemFenceOmp2Blocks, TMemOrder, memory_scope::Device>
53 {
54 static auto mem_fence(MemFenceOmp2Blocks const&, TMemOrder order, memory_scope::Device const&)
55 {
57 }
58 };
59 } // namespace trait
60} // namespace alpaka
61
62#endif
The CPU OpenMP 2.0 block memory fence.
auto flushOmp(TMemOrder)
static constexpr AcqRel acq_rel
The alpaka accelerator library.
Tag used in class inheritance hierarchies that describes that a specific interface (TInterface) is im...
Definition Interface.hpp:15
Memory fences are observed by all threads in the same block.
Definition Traits.hpp:25
Memory fences are observed by all threads on the device.
Definition Traits.hpp:35
Memory fences are observed by all threads in the same grid.
Definition Traits.hpp:30
static auto mem_fence(MemFenceOmp2Blocks const &, TMemOrder, memory_scope::Block const &)
static auto mem_fence(MemFenceOmp2Blocks const &, TMemOrder order, memory_scope::Device const &)
static auto mem_fence(MemFenceOmp2Blocks const &, TMemOrder order, memory_scope::Grid const &)
The mem_fence trait.
Definition Traits.hpp:47