#include <itkOpenCLDevice.h>
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
\table \row \o Default \o The default OpenCL device in the system. The default device cannot be a {CL_DEVICE_TYPE_CUSTOM} device. \row \o CPU \o An OpenCL device that is the host processor. The host processor runs the OpenCL implementations and is a single or multi-core CPU. \row \o GPU \o 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. \row \o Accelerator \o Dedicated OpenCL accelerators (for example the IBM CELL Blade). These devices communicate with the host processor using a peripheral interconnect such as PCIe. \row \o Custom \o Dedicated accelerators that do not support programs written in OpenCL C. \row \o All \o All OpenCL devices available in the system except
{CL_DEVICE_TYPE_CUSTOM} devices. \endtable
The GetDevices() function can be used to find all devices of a specific type, optionally constrained by the OpenCLPlatform they belong to.
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 } |
using | Self = OpenCLDevice |
Static Public Member Functions | |
static std::list< OpenCLDevice > | GetAllDevices () |
static std::list< OpenCLDevice > | GetDevices (const OpenCLDevice::DeviceType type, const OpenCLPlatform::VendorType vendor) |
static std::list< OpenCLDevice > | GetDevices (const OpenCLDevice::DeviceType types, const OpenCLPlatform &platform=OpenCLPlatform()) |
static OpenCLDevice | GetMaximumFlopsDevice (const OpenCLDevice::DeviceType type) |
static OpenCLDevice | GetMaximumFlopsDevice (const std::list< OpenCLDevice > &devices, 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< OpenCLDevice > | GetMaximumFlopsDevices (const OpenCLDevice::DeviceType type, const OpenCLPlatform &platform=OpenCLPlatform()) |
Private Attributes | |
cl_device_id | m_Id |
int | m_Version |
using itk::OpenCLDevice::Self = OpenCLDevice |
Standard class typedefs.
Definition at line 62 of file itkOpenCLDevice.h.
Enumerator | |
---|---|
NoCache | |
ReadOnlyCache | |
ReadWriteCache |
Definition at line 423 of file itkOpenCLDevice.h.
Enumerator | |
---|---|
Default | |
CPU | |
GPU | |
Accelerator | |
Custom | |
All |
Definition at line 85 of file itkOpenCLDevice.h.
Enumerator | |
---|---|
BigEndian | |
LittleEndian |
Definition at line 95 of file itkOpenCLDevice.h.
Enumerator | |
---|---|
NotSupported | |
Denorm | |
InfinityNaN | |
RoundNearest | |
RoundZero | |
RoundInfinity | |
FusedMultiplyAdd |
Definition at line 370 of file itkOpenCLDevice.h.
|
inline |
Constructs a default OpenCL device identifier.
Definition at line 65 of file itkOpenCLDevice.h.
|
inline |
Constructs an OpenCL device identifier that corresponds to the native OpenCL value id.
Definition at line 72 of file itkOpenCLDevice.h.
unsigned int itk::OpenCLDevice::GetAddressBits | ( | ) | const |
Returns the number of address bits used by the device, usually 32 or 64.
|
static |
Returns a list of all OpenCL devices on all platforms on this system.
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.
|
inline |
Returns the native OpenCL device identifier for this object.
Definition at line 110 of file itkOpenCLDevice.h.
|
static |
Returns a list of all OpenCL devices that match types on vendor on this system.
|
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.
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.
std::string itk::OpenCLDevice::GetDriverVersion | ( | ) | const |
Returns the driver version of this OpenCL device.
std::list< std::string > itk::OpenCLDevice::GetExtensions | ( | ) | const |
Returns a list of the extensions supported by this OpenCL device.
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.
unsigned long itk::OpenCLDevice::GetGlobalMemoryCacheSize | ( | ) | const |
Returns the size of the global memory cache in bytes.
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.
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.
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.
unsigned long itk::OpenCLDevice::GetMaximumAllocationSize | ( | ) | const |
Returns the maximum memory allocation size in bytes.
unsigned int itk::OpenCLDevice::GetMaximumConstantArguments | ( | ) | const |
Returns the maximum number of constant arguments that can be passed to a kernel.
unsigned long itk::OpenCLDevice::GetMaximumConstantBufferSize | ( | ) | const |
Returns the maximum size for a constant buffer allocation.
|
static |
Returns the device with maximal flops on this system that match type.
|
static |
Returns the device with maximal flops on this system that match type.
|
static |
Returns the device with maximal flops from the context that match types on platform on this system.
|
static |
Returns the device with maximal flops on this system that match types and vendor on this system.
|
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.
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.
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.
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.
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.
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.
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.
unsigned int itk::OpenCLDevice::GetMinimumAlignment | ( | ) | const |
Returns the minimum alignment for any data type in bytes.
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}.
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}.
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.
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}.
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.
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
.
std::vcl_size_t itk::OpenCLDevice::GetProfilingTimerResolution | ( | ) | const |
Returns the resolution of the device profiling timer in nanoseconds.
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().
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.
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.
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.
bool itk::OpenCLDevice::IsFullProfile | ( | ) | const |
Returns true if profile() is FULL_PROFILE
, false otherwise.
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.
|
inline |
Returns true if this OpenCL device identifier is null.
Definition at line 103 of file itkOpenCLDevice.h.
|
private |
Definition at line 579 of file itkOpenCLDevice.h.
|
mutableprivate |
Definition at line 580 of file itkOpenCLDevice.h.
Generated on 2024-07-17 for elastix by 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) |