com.jogamp.opencl
Class CLDevice

java.lang.Object
  extended by com.jogamp.opencl.CLDevice
All Implemented Interfaces:
AutoCloseable

public final class CLDevice
extends Object

This object represents an OpenCL device.

Author:
Michael Bien
See Also:
CLPlatform.listCLDevices(com.jogamp.opencl.CLDevice.Type...), CLPlatform.getMaxFlopsDevice(com.jogamp.opencl.CLDevice.Type...), CLContext.getDevices(), CLContext.getMaxFlopsDevice(com.jogamp.opencl.CLDevice.Type)

Nested Class Summary
static class CLDevice.Capabilities
          Enumeration for the execution capabilities of the device.
static class CLDevice.FPConfig
          Describes floating-point capability of the device.
static class CLDevice.GlobalMemCacheType
          Type of global memory cache supported.
static class CLDevice.LocalMemType
          Type of local memory cache supported.
static class CLDevice.Type
          Enumeration for the type of a device.
 
Field Summary
protected  CL cl
           
protected  CLContext context
           
 long ID
          The OpenCL object handle.
 
Method Summary
 void close()
          Deprecated. This method is not intended to be called from client code.
 CLCommandQueue createCommandQueue()
           
 CLCommandQueue createCommandQueue(CLCommandQueue.Mode... properties)
           
 CLCommandQueue createCommandQueue(CLCommandQueue.Mode property)
           
 CLCommandQueue createCommandQueue(long properties)
           
 boolean equals(Object obj)
           
 int getAddressBits()
          The default compute device address space size specified in bits.
 CLContext getContext()
          Returns the context for this OpenCL object.
 CLVersion getCVersion()
          Returns the OpenCL-C version supported by the device.
 EnumSet<CLDevice.FPConfig> getDoubleFPConfig()
          Returns the optional double precision floating-point capability of the device.
 String getDriverVersion()
          Returns OpenCL software driver version string in the form major_number.minor_number.
 EnumSet<CLDevice.Capabilities> getExecutionCapabilities()
          Returns the execution capabilities as EnumSet.
 Set<String> getExtensions()
          Returns all device extension names as unmodifiable Set.
 long getGlobalMemCachelineSize()
          Returns the size of global memory cache line in bytes.
 long getGlobalMemCacheSize()
          Returns the size of global memory cache in bytes.
 CLDevice.GlobalMemCacheType getGlobalMemCacheType()
          Returns the type of global memory cache supported.
 long getGlobalMemSize()
          Returns the global memory size in bytes.
 EnumSet<CLDevice.FPConfig> getHalfFPConfig()
          Returns the optional half precision floating-point capability of the device.
 long getID()
          Returns the OpenCL object handle
 long getLocalMemSize()
          Returns the local memory size in bytes.
The minimum OpenCL 1.0 value is 16 KB.
The minimum OpenCL 1.1 value is 32 KB.
 CLDevice.LocalMemType getLocalMemType()
          Returns the local memory type.
 int getMaxClockFrequency()
          Returns the maximum configured clock frequency of the device in MHz.
 int getMaxComputeUnits()
          Returns the number of parallel compute cores on the OpenCL device.
 long getMaxConstantArgs()
          Returns the max number of arguments declared with the constant qualifier in a kernel.
 long getMaxConstantBufferSize()
          Returns the max size in bytes of a constant buffer allocation.
 int getMaxImage2dHeight()
          Returns the max height of 2D image in pixels.
 int getMaxImage2dWidth()
          Returns the max width of 2D image in pixels.
 int getMaxImage3dDepth()
          Returns the max depth of 3D image in pixels.
 int getMaxImage3dHeight()
          Returns the max height of 3D image in pixels.
 int getMaxImage3dWidth()
          Returns the max width of 3D image in pixels.
 long getMaxMemAllocSize()
          Returns the maximal allocatable memory on this device.
 long getMaxParameterSize()
          Returns the max size in bytes of the arguments that can be passed to a kernel.
The minimum OpenCL 1.0 value is 256.
The minimum OpenCL 1.1 value is 1024.
 int getMaxReadImageArgs()
          Returns the max number of simultaneous image objects that can be read by a kernel.
 int getMaxSamplers()
          Returns the maximum number of samplers that can be used in a kernel.
 int getMaxWorkGroupSize()
          Returns the maximum number of work-items in a work-group executing a kernel using the data parallel execution model.
 int getMaxWorkItemDimensions()
          Returns the maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model.
 int[] getMaxWorkItemSizes()
          Returns the maximum number of work-items that can be specified in each dimension of the work-group.
 int getMaxWriteImageArgs()
          Returns the max number of simultaneous image objects that can be written by a kernel.
 String getName()
          Returns the name of this device.
 int getNativeCharVectorWidth()
          Native vector width size for built-in char vectors.
 int getNativeDoubleVectorWidth()
          Native vector width size for built-in double vectors.
 int getNativeFloatVectorWidth()
          Native vector width size for built-in float vectors.
 int getNativeHalfVectorWidth()
          Native vector width size for built-in half vectors.
 int getNativeIntVectorWidth()
          Native vector width size for built-in int vectors.
 int getNativeLongVectorWidth()
          Native vector width size for built-in long vectors.
 int getNativeShortVectorWidth()
          Native vector width size for built-in short vectors.
 CLPlatform getPlatform()
          Returns the platform for this OpenCL object.
 int getPreferredCharVectorWidth()
          Preferred native vector width size for built-in char vectors.
 int getPreferredDoubleVectorWidth()
          Preferred native vector width size for built-in double vectors.
 int getPreferredFloatVectorWidth()
          Preferred native vector width size for built-in float vectors.
 int getPreferredIntVectorWidth()
          Preferred native vector width size for built-in int vectors.
 int getPreferredLongVectorWidth()
          Preferred native vector width size for built-in long vectors.
 int getPreferredShortVectorWidth()
          Preferred native vector width size for built-in short vectors.
 String getProfile()
          Returns the OpenCL profile of this device.
 long getProfilingTimerResolution()
          Returns the resolution of device timer.
 Map<String,String> getProperties()
          Returns a Map of device properties with the enum names as keys.
 EnumSet<CLCommandQueue.Mode> getQueueProperties()
          Returns the command-queue properties supported by the device.
 EnumSet<CLDevice.FPConfig> getSingleFPConfig()
          Returns the single precision floating-point capability of the device.
 CLDevice.Type getType()
          Returns the type of this device.
 String getVendor()
          Returns the vendor of this device.
 long getVendorID()
          Returns the vendor id of this device.
 CLVersion getVersion()
          Returns the OpenCL version supported by the device.
 int hashCode()
           
 boolean isAvailable()
          Returns true if this device is available.
 boolean isCompilerAvailable()
          Returns false if the implementation does not have a compiler available to compile the program source.
 boolean isDoubleFPAvailable()
          Returns isExtensionAvailable(java.lang.String)("cl_khr_fp64").
 boolean isErrorCorrectionSupported()
          Returns true if the device implements error correction for the memories, caches, registers etc.
 boolean isExtensionAvailable(String extension)
          Returns true if the extension is supported on this device.
 boolean isGLMemorySharingSupported()
          Returns isExtensionAvailable(java.lang.String)("cl_khr_gl_sharing") || isExtensionAvailable(java.lang.String)("cl_apple_gl_sharing").
 boolean isHalfFPAvailable()
          Returns isExtensionAvailable(java.lang.String)("cl_khr_fp16").
 boolean isImageSupportAvailable()
          Returns true if images are supported by the OpenCL device and false otherwise.
 boolean isLittleEndian()
          Returns true if the OpenCL device is a little endian device and false otherwise.
 boolean isMemoryUnified()
          Returns true if the device and the host have a unified memory subsystem.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public final long ID
The OpenCL object handle.


context

protected CLContext context

cl

protected final CL cl
Method Detail

createCommandQueue

public CLCommandQueue createCommandQueue()

createCommandQueue

public CLCommandQueue createCommandQueue(CLCommandQueue.Mode property)

createCommandQueue

public CLCommandQueue createCommandQueue(CLCommandQueue.Mode... properties)

createCommandQueue

public CLCommandQueue createCommandQueue(long properties)

getPlatform

public CLPlatform getPlatform()
Returns the platform for this OpenCL object.


getName

public String getName()
Returns the name of this device.


getProfile

public String getProfile()
Returns the OpenCL profile of this device.


getVendor

public String getVendor()
Returns the vendor of this device.


getVendorID

public long getVendorID()
Returns the vendor id of this device.


getVersion

public CLVersion getVersion()
Returns the OpenCL version supported by the device.


getCVersion

public CLVersion getCVersion()
Returns the OpenCL-C version supported by the device.


getDriverVersion

public String getDriverVersion()
Returns OpenCL software driver version string in the form major_number.minor_number.


getType

public CLDevice.Type getType()
Returns the type of this device.


getAddressBits

public int getAddressBits()
The default compute device address space size specified in bits. Currently supported values are 32 or 64 bits.


getPreferredShortVectorWidth

public int getPreferredShortVectorWidth()
Preferred native vector width size for built-in short vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getPreferredCharVectorWidth

public int getPreferredCharVectorWidth()
Preferred native vector width size for built-in char vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getPreferredIntVectorWidth

public int getPreferredIntVectorWidth()
Preferred native vector width size for built-in int vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getPreferredLongVectorWidth

public int getPreferredLongVectorWidth()
Preferred native vector width size for built-in long vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getPreferredFloatVectorWidth

public int getPreferredFloatVectorWidth()
Preferred native vector width size for built-in float vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getPreferredDoubleVectorWidth

public int getPreferredDoubleVectorWidth()
Preferred native vector width size for built-in double vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getNativeCharVectorWidth

public int getNativeCharVectorWidth()
Native vector width size for built-in char vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getNativeShortVectorWidth

public int getNativeShortVectorWidth()
Native vector width size for built-in short vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getNativeIntVectorWidth

public int getNativeIntVectorWidth()
Native vector width size for built-in int vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getNativeLongVectorWidth

public int getNativeLongVectorWidth()
Native vector width size for built-in long vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getNativeHalfVectorWidth

public int getNativeHalfVectorWidth()
Native vector width size for built-in half vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getNativeFloatVectorWidth

public int getNativeFloatVectorWidth()
Native vector width size for built-in float vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getNativeDoubleVectorWidth

public int getNativeDoubleVectorWidth()
Native vector width size for built-in double vectors. The vector width is defined as the number of scalar elements that can be stored in the vector.


getMaxComputeUnits

public int getMaxComputeUnits()
Returns the number of parallel compute cores on the OpenCL device. The minimum value is 1.


getMaxWorkGroupSize

public int getMaxWorkGroupSize()
Returns the maximum number of work-items in a work-group executing a kernel using the data parallel execution model. The minimum value is 1.


getMaxClockFrequency

public int getMaxClockFrequency()
Returns the maximum configured clock frequency of the device in MHz.


getMaxWorkItemDimensions

public int getMaxWorkItemDimensions()
Returns the maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model. The minimum value is 3.


getMaxWorkItemSizes

public int[] getMaxWorkItemSizes()
Returns the maximum number of work-items that can be specified in each dimension of the work-group. The minimum value is (1, 1, 1).


getMaxParameterSize

public long getMaxParameterSize()
Returns the max size in bytes of the arguments that can be passed to a kernel.
The minimum OpenCL 1.0 value is 256.
The minimum OpenCL 1.1 value is 1024.


getMaxMemAllocSize

public long getMaxMemAllocSize()
Returns the maximal allocatable memory on this device.


getGlobalMemSize

public long getGlobalMemSize()
Returns the global memory size in bytes.


getLocalMemSize

public long getLocalMemSize()
Returns the local memory size in bytes.
The minimum OpenCL 1.0 value is 16 KB.
The minimum OpenCL 1.1 value is 32 KB.


isMemoryUnified

public boolean isMemoryUnified()
Returns true if the device and the host have a unified memory subsystem.


getMaxConstantBufferSize

public long getMaxConstantBufferSize()
Returns the max size in bytes of a constant buffer allocation. The minimum value is 64 KB.


getGlobalMemCachelineSize

public long getGlobalMemCachelineSize()
Returns the size of global memory cache line in bytes.


getGlobalMemCacheSize

public long getGlobalMemCacheSize()
Returns the size of global memory cache in bytes.


getMaxConstantArgs

public long getMaxConstantArgs()
Returns the max number of arguments declared with the constant qualifier in a kernel. The minimum value is 8.


isImageSupportAvailable

public boolean isImageSupportAvailable()
Returns true if images are supported by the OpenCL device and false otherwise.


getMaxReadImageArgs

public int getMaxReadImageArgs()
Returns the max number of simultaneous image objects that can be read by a kernel. The minimum value is 128 if image support is available.


getMaxWriteImageArgs

public int getMaxWriteImageArgs()
Returns the max number of simultaneous image objects that can be written by a kernel. The minimum value is 8 if image support is available.


getMaxImage2dWidth

public int getMaxImage2dWidth()
Returns the max width of 2D image in pixels. The minimum value is 8192 if image support is available.


getMaxImage2dHeight

public int getMaxImage2dHeight()
Returns the max height of 2D image in pixels. The minimum value is 8192 if image support is available.


getMaxImage3dWidth

public int getMaxImage3dWidth()
Returns the max width of 3D image in pixels. The minimum value is 2048 if image support is available.


getMaxImage3dHeight

public int getMaxImage3dHeight()
Returns the max height of 3D image in pixels. The minimum value is 2048 if image support is available.


getMaxImage3dDepth

public int getMaxImage3dDepth()
Returns the max depth of 3D image in pixels. The minimum value is 2048 if image support is available.


getMaxSamplers

public int getMaxSamplers()
Returns the maximum number of samplers that can be used in a kernel. The minimum value is 16 if image support is available.


getProfilingTimerResolution

public long getProfilingTimerResolution()
Returns the resolution of device timer. This is measured in nanoseconds.


getExecutionCapabilities

public EnumSet<CLDevice.Capabilities> getExecutionCapabilities()
Returns the execution capabilities as EnumSet.


getHalfFPConfig

public EnumSet<CLDevice.FPConfig> getHalfFPConfig()
Returns the optional half precision floating-point capability of the device. The required minimum half precision floating-point capabilities as implemented by this extension are CLDevice.FPConfig.ROUND_TO_ZERO, CLDevice.FPConfig.ROUND_TO_INF and CLDevice.FPConfig.INF_NAN.

Returns:
An EnumSet containing the extensions, never null.

getSingleFPConfig

public EnumSet<CLDevice.FPConfig> getSingleFPConfig()
Returns the single precision floating-point capability of the device. The mandated minimum floating-point capabilities are CLDevice.FPConfig.ROUND_TO_NEAREST and CLDevice.FPConfig.INF_NAN.

Returns:
An EnumSet containing the extensions, never null.

getDoubleFPConfig

public EnumSet<CLDevice.FPConfig> getDoubleFPConfig()
Returns the optional double precision floating-point capability of the device. The mandated minimum double precision floating-point capabilities are CLDevice.FPConfig.FMA, CLDevice.FPConfig.ROUND_TO_NEAREST, CLDevice.FPConfig.ROUND_TO_ZERO, CLDevice.FPConfig.ROUND_TO_INF, CLDevice.FPConfig.INF_NAN, and CLDevice.FPConfig.DENORM.

Returns:
An EnumSet containing the extensions, never null.

getLocalMemType

public CLDevice.LocalMemType getLocalMemType()
Returns the local memory type.


getGlobalMemCacheType

public CLDevice.GlobalMemCacheType getGlobalMemCacheType()
Returns the type of global memory cache supported.


getQueueProperties

public EnumSet<CLCommandQueue.Mode> getQueueProperties()
Returns the command-queue properties supported by the device.


isAvailable

public boolean isAvailable()
Returns true if this device is available.


isCompilerAvailable

public boolean isCompilerAvailable()
Returns false if the implementation does not have a compiler available to compile the program source. Is true if the compiler is available. This can be false for the OpenCL ES profile only.


isLittleEndian

public boolean isLittleEndian()
Returns true if the OpenCL device is a little endian device and false otherwise.


isErrorCorrectionSupported

public boolean isErrorCorrectionSupported()
Returns true if the device implements error correction for the memories, caches, registers etc. in the device. Is false if the device does not implement error correction.


isHalfFPAvailable

public boolean isHalfFPAvailable()
Returns isExtensionAvailable(java.lang.String)("cl_khr_fp16").

See Also:
getExtensions()

isDoubleFPAvailable

public boolean isDoubleFPAvailable()
Returns isExtensionAvailable(java.lang.String)("cl_khr_fp64").

See Also:
getExtensions()

isGLMemorySharingSupported

public boolean isGLMemorySharingSupported()
Returns isExtensionAvailable(java.lang.String)("cl_khr_gl_sharing") || isExtensionAvailable(java.lang.String)("cl_apple_gl_sharing").

See Also:
getExtensions()

isExtensionAvailable

public boolean isExtensionAvailable(String extension)
Returns true if the extension is supported on this device.

See Also:
getExtensions()

getExtensions

public Set<String> getExtensions()
Returns all device extension names as unmodifiable Set.


getProperties

public Map<String,String> getProperties()
Returns a Map of device properties with the enum names as keys.

See Also:
CLUtil.obtainDeviceProperties(com.jogamp.opencl.CLDevice)

toString

public String toString()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

close

@Deprecated
public final void close()
Deprecated. This method is not intended to be called from client code.

Implementation detail. TODO remove as soon we have extension methods.

Specified by:
close in interface AutoCloseable
See Also:
AutoCloseable

getContext

public CLContext getContext()
Returns the context for this OpenCL object.


getID

public long getID()
Returns the OpenCL object handle