Go to the documentation of this file.
18 #ifndef viskores_cont_DeviceAdapterTag_h
19 #define viskores_cont_DeviceAdapterTag_h
30 #ifdef VISKORES_DEVICE_ADAPTER
34 #error The VISKORES_DEVICE_ADAPTER define is no longer obeyed and needs to be removed
36 #ifdef VISKORES_DEFAULT_DEVICE_ADAPTER_TAG
40 #error The VISKORES_DEFAULT_DEVICE_ADAPTER_TAG define is no longer required and needs to be removed
43 #define VISKORES_DEVICE_ADAPTER_UNDEFINED -1
44 #define VISKORES_DEVICE_ADAPTER_SERIAL 1
45 #define VISKORES_DEVICE_ADAPTER_CUDA 2
46 #define VISKORES_DEVICE_ADAPTER_TBB 3
47 #define VISKORES_DEVICE_ADAPTER_OPENMP 4
48 #define VISKORES_DEVICE_ADAPTER_KOKKOS 5
50 #define VISKORES_MAX_DEVICE_ADAPTER_ID 8
51 #define VISKORES_DEVICE_ADAPTER_ANY 127
129 template <
typename DeviceAdapter>
137 #define VISKORES_VALID_DEVICE_ADAPTER(Name, Id) \
142 struct VISKORES_ALWAYS_EXPORT DeviceAdapterTag##Name : DeviceAdapterId \
144 constexpr DeviceAdapterTag##Name() \
145 : DeviceAdapterId(Id) \
148 static constexpr bool IsEnabled = true; \
151 struct DeviceAdapterTraits<viskores::cont::DeviceAdapterTag##Name> \
153 static DeviceAdapterNameType GetName() \
155 return DeviceAdapterNameType(#Name); \
164 #define VISKORES_INVALID_DEVICE_ADAPTER(Name, Id) \
169 struct VISKORES_ALWAYS_EXPORT DeviceAdapterTag##Name : DeviceAdapterId \
171 constexpr DeviceAdapterTag##Name() \
172 : DeviceAdapterId(Id) \
175 static constexpr bool IsEnabled = false; \
178 struct DeviceAdapterTraits<viskores::cont::DeviceAdapterTag##Name> \
180 static DeviceAdapterNameType GetName() \
182 return DeviceAdapterNameType(#Name); \
208 #define VISKORES_IS_DEVICE_ADAPTER_TAG(tag) \
209 static_assert(std::is_base_of<viskores::cont::DeviceAdapterId, tag>::value && \
210 !std::is_same<viskores::cont::DeviceAdapterId, tag>::value, \
211 "Provided type is not a valid Viskores device adapter tag.")
213 #endif //viskores_cont_DeviceAdapterTag_h
int8_t Int8
Base type to use for 8-bit signed integer numbers.
Definition: Types.h:173
constexpr bool operator==(DeviceAdapterId other) const
Definition: DeviceAdapterTag.h:68
constexpr bool operator!=(DeviceAdapterId other) const
Definition: DeviceAdapterTag.h:69
#define VISKORES_DEVICE_ADAPTER_ANY
Definition: DeviceAdapterTag.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:27
#define VISKORES_MAX_DEVICE_ADAPTER_ID
Definition: DeviceAdapterTag.h:50
#define VISKORES_DEVICE_ADAPTER_UNDEFINED
Definition: DeviceAdapterTag.h:43
constexpr bool IsValueValid() const
Return whether this object represents a valid type of device.
Definition: DeviceAdapterTag.h:81
#define VISKORES_VALID_DEVICE_ADAPTER(Name, Id)
Creates a tag named viskores::cont::DeviceAdapterTagName and associated MPL structures to use this ta...
Definition: DeviceAdapterTag.h:137
#define VISKORES_INVALID_DEVICE_ADAPTER(Name, Id)
Marks the tag named viskores::cont::DeviceAdapterTagName and associated structures as invalid to use.
Definition: DeviceAdapterTag.h:164
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
viskores::Int8 Value
Definition: DeviceAdapterTag.h:107
DeviceAdapterId make_DeviceAdapterId(const DeviceAdapterNameType &name)
Construct a device adapter id from a runtime string The string is case-insensitive.
constexpr bool operator<(DeviceAdapterId other) const
Definition: DeviceAdapterTag.h:70
DeviceAdapterNameType GetName() const
Return a name representing the device.
std::string DeviceAdapterNameType
Definition: DeviceAdapterTag.h:58
friend DeviceAdapterId make_DeviceAdapterId(viskores::Int8 id)
Construct a device adapter id a viskores::Int8.
Definition: DeviceAdapterTag.h:124
constexpr DeviceAdapterId(viskores::Int8 id)
Definition: DeviceAdapterTag.h:101
Definition: DeviceAdapterTag.h:130
constexpr viskores::Int8 GetValue() const
Returns the numeric value of the index.
Definition: DeviceAdapterTag.h:87