go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
itk::OpenCLDevice Class Reference

#include <itkOpenCLDevice.h>

Detailed Description

The OpenCLDevice class represents the collection of OpenCL devices to be used by the host.

The OpenCL framework allows applications to use a host and one or more OpenCL devices as a single heterogeneous parallel computer system. The GetDeviceType() can be used to query specific OpenCL devices or all OpenCL devices available. The valid values for GetDeviceType() are

Default The default OpenCL device in the system. The default device cannot be a {CL_DEVICE_TYPE_CUSTOM} device. CPU An OpenCL device that is the host processor. The host processor runs the OpenCL implementations and is a single or multi-core CPU. GPU An OpenCL device that is a GPU. By this we mean that the device can also be used to accelerate a 3D API such as OpenGL or DirectX. Accelerator Dedicated OpenCL accelerators (for example the IBM CELL Blade). These devices communicate with the host processor using a peripheral interconnect such as PCIe. Custom Dedicated accelerators that do not support programs written in OpenCL C. All All OpenCL devices available in the system except {CL_DEVICE_TYPE_CUSTOM} devices.

The GetDevices() function can be used to find all devices of a specific type, optionally constrained by the OpenCLPlatform they belong to.

See also
OpenCLPlatform, OpenCLContext

Definition at line 58 of file itkOpenCLDevice.h.

Public Types

enum  CacheType { NoCache = 0, ReadOnlyCache = 1, ReadWriteCache = 2 }
 
enum  DeviceType {
  Default = ( 1 << 0 ), CPU = ( 1 << 1 ), GPU = ( 1 << 2 ), Accelerator = ( 1 << 3 ),
  Custom = ( 1 << 4 ), All = 0xFFFFFFFF
}
 
enum  Endian { BigEndian, LittleEndian }
 
enum  FloatCapability {
  NotSupported = 0x0000, Denorm = 0x0001, InfinityNaN = 0x0002, RoundNearest = 0x0004,
  RoundZero = 0x0008, RoundInfinity = 0x0010, FusedMultiplyAdd = 0x0020
}
 
typedef OpenCLDevice Self
 

Public Member Functions

unsigned int GetAddressBits () const
 
OpenCLDevice::Endian GetByteOrder () const
 
unsigned int GetClockFrequency () const
 
unsigned int GetComputeUnits () const
 
unsigned int GetDefaultAlignment () const
 
cl_device_id GetDeviceId () const
 
OpenCLDevice::DeviceType GetDeviceType () const
 
FloatCapability GetDoubleCapabilities () const
 
std::string GetDriverVersion () const
 
std::list< std::string > GetExtensions () const
 
FloatCapability GetFloatCapabilities () const
 
unsigned int GetGlobalMemoryCacheLineSize () const
 
unsigned long GetGlobalMemoryCacheSize () const
 
CacheType GetGlobalMemoryCacheType () const
 
unsigned long GetGlobalMemorySize () const
 
FloatCapability GetHalfFloatCapabilities () const
 
std::string GetLanguageVersion () const
 
unsigned long GetLocalMemorySize () const
 
unsigned long GetMaximumAllocationSize () const
 
unsigned int GetMaximumConstantArguments () const
 
unsigned long GetMaximumConstantBufferSize () const
 
OpenCLSize GetMaximumImage2DSize () const
 
OpenCLSize GetMaximumImage3DSize () const
 
std::vcl_size_t GetMaximumParameterBytes () const
 
unsigned int GetMaximumReadImages () const
 
unsigned int GetMaximumSamplers () const
 
OpenCLSize GetMaximumWorkItemSize () const
 
std::vcl_size_t GetMaximumWorkItemsPerGroup () const
 
unsigned int GetMaximumWriteImages () const
 
unsigned int GetMinimumAlignment () const
 
std::string GetName () const
 
unsigned int GetNativeCharVectorSize () const
 
unsigned int GetNativeDoubleVectorSize () const
 
unsigned int GetNativeFloatVectorSize () const
 
unsigned int GetNativeHalfFloatVectorSize () const
 
unsigned int GetNativeIntVectorSize () const
 
unsigned int GetNativeLongVectorSize () const
 
unsigned int GetNativeShortVectorSize () const
 
OpenCLVersion GetOpenCLVersion () const
 
OpenCLPlatform GetPlatform () const
 
unsigned int GetPreferredCharVectorSize () const
 
unsigned int GetPreferredDoubleVectorSize () const
 
unsigned int GetPreferredFloatVectorSize () const
 
unsigned int GetPreferredHalfFloatVectorSize () const
 
unsigned int GetPreferredIntVectorSize () const
 
unsigned int GetPreferredLongVectorSize () const
 
unsigned int GetPreferredShortVectorSize () const
 
std::string GetProfile () const
 
std::vcl_size_t GetProfilingTimerResolution () const
 
std::string GetVendor () const
 
unsigned int GetVendorId () const
 
std::string GetVersion () const
 
bool HasCompiler () const
 
bool HasDouble () const
 
bool HasErrorCorrectingMemory () const
 
bool HasExtension (const std::string &name) const
 
bool HasHalfFloat () const
 
bool HasImage2D () const
 
bool HasImage3D () const
 
bool HasNativeKernels () const
 
bool HasOutOfOrderExecution () const
 
bool HasUnifiedMemory () const
 
bool HasWritableImage3D () const
 
bool IsAvailable () const
 
bool IsEmbeddedProfile () const
 
bool IsFullProfile () const
 
bool IsLocalMemorySeparate () const
 
bool IsNull () const
 
 OpenCLDevice ()
 
 OpenCLDevice (cl_device_id id)
 

Static Public Member Functions

static std::list< OpenCLDeviceGetAllDevices ()
 
static std::list< OpenCLDeviceGetDevices (const OpenCLDevice::DeviceType types, const OpenCLPlatform &platform=OpenCLPlatform())
 
static std::list< OpenCLDeviceGetDevices (const OpenCLDevice::DeviceType type, const OpenCLPlatform::VendorType vendor)
 
static OpenCLDevice GetMaximumFlopsDevice (const std::list< OpenCLDevice > &devices, const OpenCLDevice::DeviceType type)
 
static OpenCLDevice GetMaximumFlopsDevice (const OpenCLDevice::DeviceType type)
 
static OpenCLDevice GetMaximumFlopsDeviceByPlatform (const OpenCLDevice::DeviceType types, const OpenCLPlatform &platform=OpenCLPlatform())
 
static OpenCLDevice GetMaximumFlopsDeviceByVendor (const OpenCLDevice::DeviceType type, const OpenCLPlatform::VendorType vendor)
 
static std::list< OpenCLDeviceGetMaximumFlopsDevices (const OpenCLDevice::DeviceType type, const OpenCLPlatform &platform=OpenCLPlatform())
 

Private Attributes

cl_device_id m_Id
 
int m_Version
 

Member Typedef Documentation

Standard class typedefs.

Definition at line 63 of file itkOpenCLDevice.h.

Member Enumeration Documentation

Enumerator
NoCache 
ReadOnlyCache 
ReadWriteCache 

Definition at line 360 of file itkOpenCLDevice.h.

Enumerator
Default 
CPU 
GPU 
Accelerator 
Custom 
All 

Definition at line 80 of file itkOpenCLDevice.h.

Enumerator
BigEndian 
LittleEndian 

Definition at line 89 of file itkOpenCLDevice.h.

Enumerator
NotSupported 
Denorm 
InfinityNaN 
RoundNearest 
RoundZero 
RoundInfinity 
FusedMultiplyAdd 

Definition at line 314 of file itkOpenCLDevice.h.

Constructor & Destructor Documentation

itk::OpenCLDevice::OpenCLDevice ( )
inline

Constructs a default OpenCL device identifier.

Definition at line 66 of file itkOpenCLDevice.h.

itk::OpenCLDevice::OpenCLDevice ( cl_device_id  id)
inline

Constructs an OpenCL device identifier that corresponds to the native OpenCL value id.

Definition at line 70 of file itkOpenCLDevice.h.

Member Function Documentation

unsigned int itk::OpenCLDevice::GetAddressBits ( ) const

Returns the number of address bits used by the device, usually 32 or 64.

static std::list< OpenCLDevice > itk::OpenCLDevice::GetAllDevices ( )
static

Returns a list of all OpenCL devices on all platforms on this system.

See also
GetDevices()
OpenCLDevice::Endian itk::OpenCLDevice::GetByteOrder ( ) const

Returns the byte order of the device, indicating little endian or big endian.

unsigned int itk::OpenCLDevice::GetClockFrequency ( ) const

Returns the maximum clock frequency for this device in MHz.

unsigned int itk::OpenCLDevice::GetComputeUnits ( ) const

Returns the number of parallel compute units on the device.

unsigned int itk::OpenCLDevice::GetDefaultAlignment ( ) const

Returns the default alignment for allocated memory in bytes.

See also
GetMinimumAlignment()
cl_device_id itk::OpenCLDevice::GetDeviceId ( ) const
inline

Returns the native OpenCL device identifier for this object.

Definition at line 98 of file itkOpenCLDevice.h.

static std::list< OpenCLDevice > itk::OpenCLDevice::GetDevices ( const OpenCLDevice::DeviceType  types,
const OpenCLPlatform platform = OpenCLPlatform() 
)
static

Returns a list of all OpenCL devices that match types on platform on this system. If platform is null, then the first platform that has devices matching types will be used.

See also
GetAllDevices()
static std::list< OpenCLDevice > itk::OpenCLDevice::GetDevices ( const OpenCLDevice::DeviceType  type,
const OpenCLPlatform::VendorType  vendor 
)
static

Returns a list of all OpenCL devices that match types on vendor on this system.

See also
GetAllDevices()
OpenCLDevice::DeviceType itk::OpenCLDevice::GetDeviceType ( ) const

Returns the type of this device. It is possible for a device to have more than one type.

FloatCapability itk::OpenCLDevice::GetDoubleCapabilities ( ) const

Returns a set of flags that describes the floating-point capabilities of the {double} type on this device. Returns OpenCLDevice::NotSupported if operations on {double} are not supported by the device.

See also
HasDouble()
std::string itk::OpenCLDevice::GetDriverVersion ( ) const

Returns the driver version of this OpenCL device.

See also
GetVersion()
std::list< std::string > itk::OpenCLDevice::GetExtensions ( ) const

Returns a list of the extensions supported by this OpenCL device.

See also
HasExtension()
FloatCapability itk::OpenCLDevice::GetFloatCapabilities ( ) const

Returns a set of flags that describes the floating-point capabilities of the {float} type on this device.

unsigned int itk::OpenCLDevice::GetGlobalMemoryCacheLineSize ( ) const

Returns the size of a single global memory cache line in bytes.

See also
GetGlobalMemoryCacheSize()
unsigned long itk::OpenCLDevice::GetGlobalMemoryCacheSize ( ) const

Returns the size of the global memory cache in bytes.

See also
GetGlobalMemorySize(), GetGlobalMemoryCacheLineSize()
CacheType itk::OpenCLDevice::GetGlobalMemoryCacheType ( ) const

Returns the type of global memory cache that is supported by the device.

unsigned long itk::OpenCLDevice::GetGlobalMemorySize ( ) const

Returns the number of bytes of global memory in the device.

See also
GetGlobalMemoryCacheSize(), localMemorySize()
FloatCapability itk::OpenCLDevice::GetHalfFloatCapabilities ( ) const

Returns a set of flags that describes the floating-point capabilities of the {half} type on this device. Returns OpenCLDevice::NotSupported if operations on {half} are not supported by the device.

See also
HasHalfFloat()
std::string itk::OpenCLDevice::GetLanguageVersion ( ) const

Returns the highest version of the OpenCL language supported by this device's compiler. For example, {OpenCL 1.1}.

unsigned long itk::OpenCLDevice::GetLocalMemorySize ( ) const

Returns the number of bytes of local memory in the device.

See also
GetGlobalMemorySize(), IsLocalMemorySeparate()
unsigned long itk::OpenCLDevice::GetMaximumAllocationSize ( ) const

Returns the maximum memory allocation size in bytes.

See also
GetGlobalMemorySize()
unsigned int itk::OpenCLDevice::GetMaximumConstantArguments ( ) const

Returns the maximum number of constant arguments that can be passed to a kernel.

See also
GetMaximumConstantBufferSize()
unsigned long itk::OpenCLDevice::GetMaximumConstantBufferSize ( ) const

Returns the maximum size for a constant buffer allocation.

See also
GetMaximumConstantArguments()
static OpenCLDevice itk::OpenCLDevice::GetMaximumFlopsDevice ( const std::list< OpenCLDevice > &  devices,
const OpenCLDevice::DeviceType  type 
)
static

Returns the device with maximal flops on this system that match type.

See also
GetAllDevices()
static OpenCLDevice itk::OpenCLDevice::GetMaximumFlopsDevice ( const OpenCLDevice::DeviceType  type)
static

Returns the device with maximal flops on this system that match type.

See also
GetAllDevices(), GetMaximumFlopsDevices()
static OpenCLDevice itk::OpenCLDevice::GetMaximumFlopsDeviceByPlatform ( const OpenCLDevice::DeviceType  types,
const OpenCLPlatform platform = OpenCLPlatform() 
)
static

Returns the device with maximal flops from the context that match types on platform on this system.

See also
GetMaximumFlopsDevice(), GetAllDevices()
static OpenCLDevice itk::OpenCLDevice::GetMaximumFlopsDeviceByVendor ( const OpenCLDevice::DeviceType  type,
const OpenCLPlatform::VendorType  vendor 
)
static

Returns the device with maximal flops on this system that match types and vendor on this system.

See also
GetAllDevices(), GetMaximumFlopsDevices()
static std::list< OpenCLDevice > itk::OpenCLDevice::GetMaximumFlopsDevices ( const OpenCLDevice::DeviceType  type,
const OpenCLPlatform platform = OpenCLPlatform() 
)
static

Returns the devices with maximal flops on this system, sorted according to maximal flops. The device with maximal flops will be the first element in the list container.

See also
GetAllDevices(), GetMaximumFlopsDevice()
OpenCLSize itk::OpenCLDevice::GetMaximumImage2DSize ( ) const

Returns the maximum size of 2D images that are supported by this device; or an empty SizeType2D if images are not supported.

See also
GetMaximumImage3DSize(), HasImage2D()
OpenCLSize itk::OpenCLDevice::GetMaximumImage3DSize ( ) const

Returns the maximum size of 3D images that are supported by this device; or (0, 0, 0) if images are not supported.

See also
GetMaximumImage2DSize(), HasImage3D()
std::vcl_size_t itk::OpenCLDevice::GetMaximumParameterBytes ( ) const

Returns the maximum number of parameter bytes that can be passed to a kernel.

unsigned int itk::OpenCLDevice::GetMaximumReadImages ( ) const

Returns the maximum number of image objects that can be read simultaneously by a kernel; 0 if images are not supported.

See also
GetMaximumWriteImages()
unsigned int itk::OpenCLDevice::GetMaximumSamplers ( ) const

Returns the maximum number of image samplers that can be used in a kernel at one time; 0 if images are not supported.

OpenCLSize itk::OpenCLDevice::GetMaximumWorkItemSize ( ) const

Returns the maximum work size for this device.

See also
GetMaximumWorkItemsPerGroup()
std::vcl_size_t itk::OpenCLDevice::GetMaximumWorkItemsPerGroup ( ) const

Returns the maximum number of work items in a work group executing a kernel using data parallel execution.

See also
GetMaximumWorkItemSize()
unsigned int itk::OpenCLDevice::GetMaximumWriteImages ( ) const

Returns the maximum number of image objects that can be written simultaneously by a kernel; 0 if images are not supported.

See also
maximumReadImages()
unsigned int itk::OpenCLDevice::GetMinimumAlignment ( ) const

Returns the minimum alignment for any data type in bytes.

See also
GetDefaultAlignment()
std::string itk::OpenCLDevice::GetName ( ) const

Returns the name of this OpenCL device.

unsigned int itk::OpenCLDevice::GetNativeCharVectorSize ( ) const

Returns the native size for vectors of type {char} in the device. For example, 4 indicates that 4 {char} values can be packed into a vector and operated on as a unit for optimal performance. Returns zero on OpenCL 1.0.

unsigned int itk::OpenCLDevice::GetNativeDoubleVectorSize ( ) const

Returns the native size for vectors of type {double} in the device. For example, 2 indicates that 2 {double} values can be packed into a vector and operated on as a unit for optimal performance. Returns zero on OpenCL 1.0, or if the device does not support {double}.

See also
HasDouble()
unsigned int itk::OpenCLDevice::GetNativeFloatVectorSize ( ) const

Returns the native size for vectors of type {float} in the device. For example, 4 indicates that 4 {float} values can be packed into a vector and operated on as a unit for optimal performance. Returns zero on OpenCL 1.0.

unsigned int itk::OpenCLDevice::GetNativeHalfFloatVectorSize ( ) const

Returns the native size for vectors of type {half} in the device. For example, 2 indicates that 2 {half} values can be packed into a vector and operated on as a unit for optimal performance. Returns zero on OpenCL 1.0, or if the device does not support {half}.

See also
HasHalfFloat()
unsigned int itk::OpenCLDevice::GetNativeIntVectorSize ( ) const

Returns the native size for vectors of type {int} in the device. For example, 4 indicates that 4 {int} values can be packed into a vector and operated on as a unit for optimal performance. Returns zero on OpenCL 1.0.

unsigned int itk::OpenCLDevice::GetNativeLongVectorSize ( ) const

Returns the native size for vectors of type {long} in the device. For example, 2 indicates that 2 {long} values can be packed into a vector and operated on as a unit for optimal performance. Returns zero on OpenCL 1.0.

unsigned int itk::OpenCLDevice::GetNativeShortVectorSize ( ) const

Returns the native size for vectors of type {short} in the device. For example, 4 indicates that 4 {short} values can be packed into a vector and operated on as a unit for optimal performance. Returns zero on OpenCL 1.0.

OpenCLVersion itk::OpenCLDevice::GetOpenCLVersion ( ) const

Returns the OpenCL versions supported by this device.

See also
GetVersion(), OpenCLPlatform::GetOpenCLVersion()
OpenCLPlatform itk::OpenCLDevice::GetPlatform ( ) const

Returns the platform identifier for this device.

unsigned int itk::OpenCLDevice::GetPreferredCharVectorSize ( ) const

Returns the preferred size for vectors of type {char} in the device. For example, 4 indicates that 4 {char} values can be packed into a vector and operated on as a unit for optimal performance.

unsigned int itk::OpenCLDevice::GetPreferredDoubleVectorSize ( ) const

Returns the preferred size for vectors of type {double} in the device. For example, 2 indicates that 2 {double} values can be packed into a vector and operated on as a unit for optimal performance. Returns zero if the device does not support {double}.

See also
HasDouble()
unsigned int itk::OpenCLDevice::GetPreferredFloatVectorSize ( ) const

Returns the preferred size for vectors of type {float} in the device. For example, 4 indicates that 4 {float} values can be packed into a vector and operated on as a unit for optimal performance.

unsigned int itk::OpenCLDevice::GetPreferredHalfFloatVectorSize ( ) const

Returns the preferred size for vectors of type {half} in the device. For example, 2 indicates that 2 {half} values can be packed into a vector and operated on as a unit for optimal performance. Returns zero if the device does not support {half}, or the device does not support OpenCL 1.1.

See also
HasHalfFloat()
unsigned int itk::OpenCLDevice::GetPreferredIntVectorSize ( ) const

Returns the preferred size for vectors of type {int} in the device. For example, 4 indicates that 4 {int} values can be packed into a vector and operated on as a unit for optimal performance.

unsigned int itk::OpenCLDevice::GetPreferredLongVectorSize ( ) const

Returns the preferred size for vectors of type {long} in the device. For example, 2 indicates that 2 {long} values can be packed into a vector and operated on as a unit for optimal performance.

unsigned int itk::OpenCLDevice::GetPreferredShortVectorSize ( ) const

Returns the preferred size for vectors of type {short} in the device. For example, 4 indicates that 4 {short} values can be packed into a vector and operated on as a unit for optimal performance.

std::string itk::OpenCLDevice::GetProfile ( ) const

Returns the profile that is implemented by this OpenCL device, usually FULL_PROFILE or EMBEDDED_PROFILE.

See also
isFullProfile(), isEmbeddedProfile()
std::vcl_size_t itk::OpenCLDevice::GetProfilingTimerResolution ( ) const

Returns the resolution of the device profiling timer in nanoseconds.

See also
OpenCLEvent::GetFinishTime()
std::string itk::OpenCLDevice::GetVendor ( ) const

Returns the vendor of this OpenCL device.

unsigned int itk::OpenCLDevice::GetVendorId ( ) const

Returns the vendor's identifier for this device.

std::string itk::OpenCLDevice::GetVersion ( ) const

Returns the OpenCL version that is implemented by this OpenCL device, usually something like {OpenCL 1.0}. The versionFlags() function parses the version into flag bits that are easier to test than the string returned by version().

See also
GetOpenCLVersion(), GetDriverVersion()
bool itk::OpenCLDevice::HasCompiler ( ) const

Returns true if this device has a compiler available, false otherwise.

bool itk::OpenCLDevice::HasDouble ( ) const

Returns true if this device supports the {double} type via the {cl_khr_fp64} extension, false otherwise.

bool itk::OpenCLDevice::HasErrorCorrectingMemory ( ) const

Returns true if the device implements error correction on its memory areas, false otherwise.

bool itk::OpenCLDevice::HasExtension ( const std::string &  name) const

Returns true if this device has an extension called name, false otherwise. This function is more efficient than checking for name in the return value from extensions(), if the caller is only interested in a single extension. Use extensions() to check for several extensions at once.

See also
GetExtensions()
bool itk::OpenCLDevice::HasHalfFloat ( ) const

Returns true if this device supports operations on the {half} type via the {cl_khr_fp16} extension, false otherwise. Note: {half} is supported by the OpenCL 1.0 core specification for data storage even if this function returns false. However, kernels can only perform arithmetic operations on {half} values if this function returns true.

bool itk::OpenCLDevice::HasImage2D ( ) const

Returns true if this device has 2D image support, false otherwise.

bool itk::OpenCLDevice::HasImage3D ( ) const

Returns true if this device has 3D image support, false otherwise.

bool itk::OpenCLDevice::HasNativeKernels ( ) const

Returns true if this device has support for executing native kernels, false otherwise.

bool itk::OpenCLDevice::HasOutOfOrderExecution ( ) const

Returns true if this device supports out of order execution of commands on a OpenCLCommandQueue, false otherwise.

See also
OpenCLCommandQueue::IsOutOfOrder()
bool itk::OpenCLDevice::HasUnifiedMemory ( ) const

Returns true if the device and the host share a unified memory address space, false otherwise.

bool itk::OpenCLDevice::HasWritableImage3D ( ) const

Returns true if this device supports writing to 3D images via the {cl_khr_3d_image_writes} extension, false otherwise.

bool itk::OpenCLDevice::IsAvailable ( ) const

Returns true if this device is available, false otherwise.

bool itk::OpenCLDevice::IsEmbeddedProfile ( ) const

Returns true if profile() is EMBEDDED_PROFILE, false otherwise.

See also
IsFullProfile()
bool itk::OpenCLDevice::IsFullProfile ( ) const

Returns true if profile() is FULL_PROFILE, false otherwise.

See also
IsEmbeddedProfile()
bool itk::OpenCLDevice::IsLocalMemorySeparate ( ) const

Returns true if the local memory on this device is in a separate dedicated storage area from global memory; false if local memory is allocated from global memory.

See also
GetLocalMemorySize()
bool itk::OpenCLDevice::IsNull ( ) const
inline

Returns true if this OpenCL device identifier is null.

Definition at line 95 of file itkOpenCLDevice.h.

Field Documentation

cl_device_id itk::OpenCLDevice::m_Id
private

Definition at line 494 of file itkOpenCLDevice.h.

int itk::OpenCLDevice::m_Version
mutableprivate

Definition at line 495 of file itkOpenCLDevice.h.



Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo