alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
include
alpaka
onAcc
tag.hpp
Go to the documentation of this file.
1
/* Copyright 2024 René Widera
2
* SPDX-License-Identifier: MPL-2.0
3
*/
4
5
#pragma once
6
7
#include "
alpaka/core/PP.hpp
"
8
#include "
alpaka/core/Tag.hpp
"
9
#include "
alpaka/core/util.hpp
"
10
11
#include <cassert>
12
#include <tuple>
13
14
namespace
alpaka::onAcc
15
{
16
/** Origin of index domains
17
*
18
* An origin is used to query the index domain within a block or grid.
19
*/
20
namespace
origin
21
{
22
ALPAKA_TAG
(thread);
23
ALPAKA_TAG
(
warp
);
24
ALPAKA_TAG
(block);
25
ALPAKA_TAG
(grid);
26
}
// namespace origin
27
28
/** Unit of index domains
29
*
30
* A unit is used to describe the quantity of the index domain with respect to an origin
31
*/
32
namespace
unit
33
{
34
ALPAKA_TAG
(warps);
35
ALPAKA_TAG
(threads);
36
ALPAKA_TAG
(blocks);
37
}
// namespace unit
38
39
namespace
trait
40
{
41
template
<
typename
T>
42
struct
IsOrigin
: std::false_type
43
{
44
};
45
46
template
<>
47
struct
IsOrigin
<
ALPAKA_TYPEOF
(
origin
::
warp
)> : std::true_type
48
{
49
};
50
51
template
<>
52
struct
IsOrigin
<
ALPAKA_TYPEOF
(
origin
::block)> : std::true_type
53
{
54
};
55
56
template
<>
57
struct
IsOrigin
<
ALPAKA_TYPEOF
(
origin
::grid)> : std::true_type
58
{
59
};
60
61
template
<>
62
struct
IsOrigin
<
ALPAKA_TYPEOF
(
origin
::thread)> : std::true_type
63
{
64
};
65
66
template
<
typename
T>
67
struct
IsUnit
: std::false_type
68
{
69
};
70
71
template
<>
72
struct
IsUnit
<
ALPAKA_TYPEOF
(
unit
::threads)> : std::true_type
73
{
74
};
75
76
template
<>
77
struct
IsUnit
<
ALPAKA_TYPEOF
(
unit
::warps)> : std::true_type
78
{
79
};
80
81
template
<>
82
struct
IsUnit
<
ALPAKA_TYPEOF
(
unit
::blocks)> : std::true_type
83
{
84
};
85
}
// namespace trait
86
87
template
<
typename
T>
88
constexpr
bool
isOrigin_v
=
trait::IsOrigin<T>::value
;
89
90
template
<
typename
T>
91
constexpr
bool
isUnit_v
=
trait::IsUnit<T>::value
;
92
93
namespace
concepts
94
{
95
template
<
typename
T>
96
concept
Origin
=
isOrigin_v<T>
;
97
98
template
<
typename
T>
99
concept
Unit
=
isUnit_v<T>
;
100
}
// namespace concepts
101
102
}
// namespace alpaka::onAcc
PP.hpp
Tag.hpp
ALPAKA_TAG
#define ALPAKA_TAG(name)
Definition
Tag.hpp:16
ALPAKA_TYPEOF
#define ALPAKA_TYPEOF(...)
Get the type of instance.
Definition
common.hpp:154
alpaka::onAcc::concepts::Origin
Definition
tag.hpp:96
alpaka::onAcc::concepts::Unit
Definition
tag.hpp:99
util.hpp
alpaka::onAcc::concepts
Definition
Acc.hpp:112
alpaka::onAcc::origin
Origin of index domains.
Definition
tag.hpp:21
alpaka::onAcc::trait
Definition
executor.hpp:38
alpaka::onAcc::unit
Unit of index domains.
Definition
tag.hpp:33
alpaka::onAcc::warp
Definition
warp.hpp:16
alpaka::onAcc
functionality which is usable on the accelerator compute device from within a kernel.
Definition
executor.hpp:38
alpaka::onAcc::isUnit_v
constexpr bool isUnit_v
Definition
tag.hpp:91
alpaka::onAcc::isOrigin_v
constexpr bool isOrigin_v
Definition
tag.hpp:88
alpaka::onAcc::trait::IsOrigin
Definition
tag.hpp:43
alpaka::onAcc::trait::IsUnit
Definition
tag.hpp:68
Generated on
for alpaka by
1.16.1