alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
Traits.hpp
Go to the documentation of this file.
1/* Copyright 2024 Benjamin Worpitz, Bernhard Manfred Gruber, Andrea Bocci
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
11#include "alpaka/dev/Traits.hpp"
12#include "alpaka/dim/Traits.hpp"
13#include "alpaka/idx/Traits.hpp"
16
17#include <string>
18#include <type_traits>
19#include <typeinfo>
20
21namespace alpaka
22{
24 {
25 };
26
27 namespace concepts
28 {
29 template<typename T>
31 } // namespace concepts
32
33 //! True if TAcc is an accelerator, i.e. if it implements the InterfaceAcc concept.
34 template<typename TAcc>
35 [[deprecated("use the alpaka::concepts::Acc instead.")]] inline constexpr bool isAccelerator = concepts::Acc<TAcc>;
36
37 //! The accelerator traits.
38 namespace trait
39 {
40 //! The accelerator type trait.
41 template<typename T, typename TSfinae = void>
42 struct AccType;
43
44 //! The single thread accelerator trait.
45 //!
46 //! If TAcc is an accelerator that supports only a single thread per block, inherit from std::true_type.
47 //! If TAcc is not an accelerator, or an accelerator that supports multiple threads per block, inherit from
48 //! std::false_type.
49 template<typename TAcc, typename TSfinae = void>
50 struct IsSingleThreadAcc : std::false_type
51 {
52 };
53
54 //! The multi thread accelerator trait.
55 //!
56 //! If TAcc is an accelerator that supports multiple threads per block, inherit from std::true_type.
57 //! If TAcc is not an accelerator, or an accelerator that supports only a single thread per block, inherit from
58 //! std::false_type.
59 template<typename TAcc, typename TSfinae = void>
60 struct IsMultiThreadAcc : std::false_type
61 {
62 };
63
64 //! The device properties get trait.
65 template<concepts::Acc TAcc>
67
68 //! The accelerator name trait.
69 //!
70 //! The default implementation returns the mangled class name.
71 template<concepts::Acc TAcc>
73 {
74 ALPAKA_FN_HOST static auto getAccName() -> std::string
75 {
77 }
78 };
79 } // namespace trait
80
81 //! The accelerator type trait alias template to remove the ::type.
82 template<typename T>
83 using Acc = typename trait::AccType<T>::type;
84
85 //! True if TAcc is an accelerator that supports only a single thread per block, false otherwise.
86 template<typename TAcc>
88
89 //! True if TAcc is an accelerator that supports multiple threads per block, false otherwise.
90 template<typename TAcc>
92
93 //! \return The acceleration properties on the given device.
94 template<concepts::Acc TAcc, typename TDev>
100
101 //! \return The accelerator name
102 //!
103 //! \tparam TAcc The accelerator type.
104 template<concepts::Acc TAcc>
105 ALPAKA_FN_HOST auto getAccName() -> std::string
106 {
108 }
109
110 namespace trait
111 {
112 template<concepts::Acc TAcc, typename TProperty>
113 struct QueueType<TAcc, TProperty>
114 {
116 };
117
118 } // namespace trait
119
120} // namespace alpaka
#define ALPAKA_FN_HOST
Definition Common.hpp:40
auto clipCast(V const &val) -> T
Definition ClipCast.hpp:16
typename detail::ImplementationBaseType< TInterface, TDerived >::type ImplementationBase
Returns the type that implements the given interface in the inheritance hierarchy.
Definition Interface.hpp:66
The alpaka accelerator library.
typename trait::IdxType< T >::type Idx
Definition Traits.hpp:29
ALPAKA_FN_HOST auto getAccDevProps(TDev const &dev) -> AccDevProps< Dim< TAcc >, Idx< TAcc > >
Definition Traits.hpp:95
constexpr bool isAccelerator
True if TAcc is an accelerator, i.e. if it implements the InterfaceAcc concept.
Definition Traits.hpp:35
constexpr bool isSingleThreadAcc
True if TAcc is an accelerator that supports only a single thread per block, false otherwise.
Definition Traits.hpp:87
constexpr bool isMultiThreadAcc
True if TAcc is an accelerator that supports multiple threads per block, false otherwise.
Definition Traits.hpp:91
ALPAKA_FN_HOST auto getAccName() -> std::string
Definition Traits.hpp:105
typename trait::AccType< T >::type Acc
The accelerator type trait alias template to remove the ::type.
Definition Traits.hpp:83
The acceleration properties on a device.
Checks whether the interface is implemented by the given class.
Definition Interface.hpp:21
The accelerator type trait.
Definition Traits.hpp:42
The device properties get trait.
Definition Traits.hpp:66
The accelerator name trait.
Definition Traits.hpp:73
static ALPAKA_FN_HOST auto getAccName() -> std::string
Definition Traits.hpp:74
The multi thread accelerator trait.
Definition Traits.hpp:61
The single thread accelerator trait.
Definition Traits.hpp:51
typename QueueType< typename alpaka::trait::PlatformType< TAcc >::type, TProperty >::type type
Definition Traits.hpp:115
Queue for an accelerator.
Definition Traits.hpp:35