Viskores  1.0
Classes | Namespaces | Macros | Typedefs | Functions
DeviceAdapterTag.h File Reference
#include <viskores/StaticAssert.h>
#include <viskores/Types.h>
#include <viskores/internal/Configure.h>
#include <viskores/internal/ExportMacros.h>
#include <viskores/cont/viskores_cont_export.h>
#include <string>

Go to the source code of this file.

Classes

struct  viskores::cont::DeviceAdapterId
 An object used to specify a device. More...
 
struct  viskores::cont::DeviceAdapterTraits< DeviceAdapter >
 
struct  viskores::cont::DeviceAdapterTagAny
 Tag for a device adapter used to specify that any device may be used for an operation. More...
 
struct  viskores::cont::DeviceAdapterTraits< viskores::cont::DeviceAdapterTagAny >
 
struct  viskores::cont::DeviceAdapterTagUndefined
 Tag for a device adapter used to avoid specifying a device. More...
 
struct  viskores::cont::DeviceAdapterTraits< viskores::cont::DeviceAdapterTagUndefined >
 

Namespaces

 viskores
 Groups connected points that have the same field value.
 
 viskores::cont
 Viskores Control Environment.
 

Macros

#define VISKORES_DEVICE_ADAPTER_UNDEFINED   -1
 
#define VISKORES_DEVICE_ADAPTER_SERIAL   1
 
#define VISKORES_DEVICE_ADAPTER_CUDA   2
 
#define VISKORES_DEVICE_ADAPTER_TBB   3
 
#define VISKORES_DEVICE_ADAPTER_OPENMP   4
 
#define VISKORES_DEVICE_ADAPTER_KOKKOS   5
 
#define VISKORES_MAX_DEVICE_ADAPTER_ID   8
 
#define VISKORES_DEVICE_ADAPTER_ANY   127
 
#define VISKORES_VALID_DEVICE_ADAPTER(Name, Id)
 Creates a tag named viskores::cont::DeviceAdapterTagName and associated MPL structures to use this tag. More...
 
#define VISKORES_INVALID_DEVICE_ADAPTER(Name, Id)
 Marks the tag named viskores::cont::DeviceAdapterTagName and associated structures as invalid to use. More...
 
#define VISKORES_IS_DEVICE_ADAPTER_TAG(tag)
 Checks that the argument is a proper device adapter tag. More...
 

Typedefs

using viskores::cont::DeviceAdapterNameType = std::string
 

Functions

DeviceAdapterId viskores::cont::make_DeviceAdapterId (const DeviceAdapterNameType &name)
 Construct a device adapter id from a runtime string The string is case-insensitive. More...
 
DeviceAdapterId viskores::cont::make_DeviceAdapterId (viskores::Int8 id)
 Construct a device adapter id a viskores::Int8. More...
 

Macro Definition Documentation

◆ VISKORES_DEVICE_ADAPTER_ANY

#define VISKORES_DEVICE_ADAPTER_ANY   127

◆ VISKORES_DEVICE_ADAPTER_CUDA

#define VISKORES_DEVICE_ADAPTER_CUDA   2

◆ VISKORES_DEVICE_ADAPTER_KOKKOS

#define VISKORES_DEVICE_ADAPTER_KOKKOS   5

◆ VISKORES_DEVICE_ADAPTER_OPENMP

#define VISKORES_DEVICE_ADAPTER_OPENMP   4

◆ VISKORES_DEVICE_ADAPTER_SERIAL

#define VISKORES_DEVICE_ADAPTER_SERIAL   1

◆ VISKORES_DEVICE_ADAPTER_TBB

#define VISKORES_DEVICE_ADAPTER_TBB   3

◆ VISKORES_DEVICE_ADAPTER_UNDEFINED

#define VISKORES_DEVICE_ADAPTER_UNDEFINED   -1

◆ VISKORES_INVALID_DEVICE_ADAPTER

#define VISKORES_INVALID_DEVICE_ADAPTER (   Name,
  Id 
)
Value:
namespace viskores \
{ \
namespace cont \
{ \
struct VISKORES_ALWAYS_EXPORT DeviceAdapterTag##Name : DeviceAdapterId \
{ \
constexpr DeviceAdapterTag##Name() \
: DeviceAdapterId(Id) \
{ \
} \
static constexpr bool IsEnabled = false; \
}; \
template <> \
struct DeviceAdapterTraits<viskores::cont::DeviceAdapterTag##Name> \
{ \
static DeviceAdapterNameType GetName() \
{ \
return DeviceAdapterNameType(#Name); \
} \
}; \
} \
}

Marks the tag named viskores::cont::DeviceAdapterTagName and associated structures as invalid to use.

Always use this macro (in the base namespace) when creating a device adapter.

◆ VISKORES_IS_DEVICE_ADAPTER_TAG

#define VISKORES_IS_DEVICE_ADAPTER_TAG (   tag)
Value:
static_assert(std::is_base_of<viskores::cont::DeviceAdapterId, tag>::value && \
!std::is_same<viskores::cont::DeviceAdapterId, tag>::value, \
"Provided type is not a valid Viskores device adapter tag.")

Checks that the argument is a proper device adapter tag.

This is a handy concept check for functions and classes to make sure that a template argument is actually a device adapter tag. (You can get weird errors elsewhere in the code when a mistake is made.)

◆ VISKORES_MAX_DEVICE_ADAPTER_ID

#define VISKORES_MAX_DEVICE_ADAPTER_ID   8

◆ VISKORES_VALID_DEVICE_ADAPTER

#define VISKORES_VALID_DEVICE_ADAPTER (   Name,
  Id 
)
Value:
namespace viskores \
{ \
namespace cont \
{ \
struct VISKORES_ALWAYS_EXPORT DeviceAdapterTag##Name : DeviceAdapterId \
{ \
constexpr DeviceAdapterTag##Name() \
: DeviceAdapterId(Id) \
{ \
} \
static constexpr bool IsEnabled = true; \
}; \
template <> \
struct DeviceAdapterTraits<viskores::cont::DeviceAdapterTag##Name> \
{ \
static DeviceAdapterNameType GetName() \
{ \
return DeviceAdapterNameType(#Name); \
} \
}; \
} \
}

Creates a tag named viskores::cont::DeviceAdapterTagName and associated MPL structures to use this tag.

Always use this macro (in the base namespace) when creating a device adapter.

viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::DeviceAdapterNameType
std::string DeviceAdapterNameType
Definition: DeviceAdapterTag.h:58