Must be released if no longer used to free native resources. release() will
also free all associated CLResource like programs, samplers, command queues and memory
objects.
For a code example see CLPlatform.
concurrency:
CLContext is threadsafe.
| Modifier and Type | Class and Description |
|---|---|
| protected static class |
| Modifier and Type | Field and Description |
|---|---|
| protected CLDevice[] | |
| private final CLContext. | |
| protected final Set | |
| protected final CLPlatform | |
| protected final Set | |
| protected final Map | |
| protected final Set |
| Access | Constructor and Description |
|---|---|
| protected | CLContext(final CLPlatform platform, final long contextID, final CLContext.
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public static CLContext | |
| public static CLContext | |
| public static CLContext | create(final CLPlatform platform)
Creates a context on the specified platform on all available devices (CL_DEVICE_TYPE_ALL). |
| public static CLContext | create(CLPlatform platform, final CLDevice.
Creates a context on the specified platform and with the specified device types. |
| public static CLContext | |
| public final CLBuffer | createBuffer(final int size, final CLMemory.
Creates a CLBuffer with the specified flags. |
| public final CLBuffer | |
| public final <B extends Buffer> CLBuffer | createBuffer(final B directBuffer, final CLMemory.
Creates a CLBuffer with the specified flags. |
| public final <B extends Buffer> CLBuffer | |
| public final CLBuffer | createByteBuffer(final int size, final CLMemory.
Creates a CLBuffer with the specified flags and buffer size in bytes. |
| public final CLBuffer | createByteBuffer(final int size, final int flags)
Creates a CLBuffer with the specified flags and buffer size in bytes. |
| pack-priv CLCommandQueue | |
| protected static long | createContext(final CLPlatform platform, final CLErrorHandler handler, final PointerBuffer properties, final CLDevice... devices)
|
| protected static long | createContextFromType(final CLPlatform platform, final CLErrorHandler handler, final PointerBuffer properties, final long deviceType)
|
| public final CLBuffer | createDoubleBuffer(final int size, final CLMemory.
Creates a CLBuffer with the specified flags and element count. |
| protected static CLContext. | |
| public final CLBuffer | createFloatBuffer(final int size, final CLMemory.
Creates a CLBuffer with the specified flags and element count. |
| public final CLImage2d | createImage2d(final int width, final int height, final CLImageFormat format, final CLMemory.
Creates a CLImage2d with the specified format, dimension and flags. |
| public final CLImage2d | createImage2d(final int width, final int height, final int rowPitch, final CLImageFormat format, final CLMemory.
Creates a CLImage2d with the specified format, dimension and flags. |
| public final <B extends Buffer> CLImage2d | createImage2d(final B directBuffer, final int width, final int height, final CLImageFormat format, final CLMemory.
Creates a CLImage2d with the specified format, dimension and flags. |
| public final <B extends Buffer> CLImage2d | createImage2d(final B directBuffer, final int width, final int height, final int rowPitch, final CLImageFormat format, final CLMemory.
Creates a CLImage2d with the specified format, dimension and flags. |
| public final CLImage3d | createImage3d(final int width, final int height, final int depth, final CLImageFormat format, final CLMemory.
Creates a CLImage3d with the specified format, dimension and flags. |
| public final CLImage3d | createImage3d(final int width, final int height, final int depth, final int rowPitch, final int slicePitch, final CLImageFormat format, final CLMemory.
Creates a CLImage3d with the specified format, dimension and flags. |
| public final <B extends Buffer> CLImage3d | createImage3d(final B directBuffer, final int width, final int height, final int depth, final CLImageFormat format, final CLMemory.
Creates a CLImage3d with the specified format, dimension and flags. |
| public final <B extends Buffer> CLImage3d | createImage3d(final B directBuffer, final int width, final int height, final int depth, final int rowPitch, final int slicePitch, final CLImageFormat format, final CLMemory.
Creates a CLImage3d with the specified format, dimension and flags. |
| public final CLBuffer | createIntBuffer(final int size, final CLMemory.
Creates a CLBuffer with the specified flags and element count. |
| public final CLBuffer | createLongBuffer(final int size, final CLMemory.
Creates a CLBuffer with the specified flags and element count. |
| public CLProgram | createProgram(final String src)
Creates a program from the given sources, the returned program is not build yet. |
| public CLProgram | createProgram(final InputStream source)
Creates a program and reads the source from stream, the returned program is not build yet. |
| public CLProgram | createProgram(final Map<CLDevice, byte[]> binaries)
Creates a program from the given binaries, the program is not build yet. |
| public CLSampler | createSampler(final CLSampler.
|
| public final CLBuffer | createShortBuffer(final int size, final CLMemory.
Creates a CLBuffer with the specified flags and element count. |
| public boolean | equals(final Object
the reference object with which to compare. obj)Overrides java. |
| public CL | |
| public CLContext | getContext()
Overrides com. |
| pack-priv CLDevice | |
| public CLDevice[] | |
| public CLDevice | |
| public CLDevice | getMaxFlopsDevice(final CLDevice.
Returns the device with maximal FLOPS of the specified device type from this context. |
| public long | |
| public List | getMemoryObjects()
Returns a read only shapshot of all allocated memory objects associated with this context. |
| public CLPlatform | getPlatform()
Overrides com. |
| public List | |
| public List | |
| public CLImageFormat[] | getSupportedImage2dFormats(final CLMemory.
Returns all supported 2d image formats with the (optional) memory allocation flags. |
| public CLImageFormat[] | getSupportedImage3dFormats(final CLMemory.
Returns all supported 3d image formats with the (optional) memory allocation flags. |
| private CLImageFormat[] | |
| public int | |
| private synchronized void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| protected void | |
| private void | |
| public synchronized void | release()
Overrides com. Implements com. |
| public void | |
| private static PointerBuffer | |
| protected static long | |
| public String | toString()
Overrides com. |
| devices | back to summary |
|---|---|
| protected CLDevice[] devices | |
| errorHandler | back to summary |
|---|---|
| private final CLContext. | |
| memoryObjects | back to summary |
|---|---|
| protected final Set<CLMemory<? extends Buffer>> memoryObjects | |
| platform | back to summary |
|---|---|
| protected final CLPlatform platform | |
| programs | back to summary |
|---|---|
| protected final Set<CLProgram> programs | |
| queuesMap | back to summary |
|---|---|
| protected final Map<CLDevice, List<CLCommandQueue>> queuesMap | |
| samplers | back to summary |
|---|---|
| protected final Set<CLSampler> samplers | |
| CLContext | back to summary |
|---|---|
| protected CLContext(final CLPlatform platform, final long contextID, final CLContext. | |
| addCLErrorHandler | back to summary |
|---|---|
| public void addCLErrorHandler(final CLErrorHandler handler) | |
| create | back to summary |
|---|---|
| public static CLContext create() Creates a context on all available devices (CL_DEVICE_TYPE_ALL). The platform to be used is implementation dependent. | |
| create | back to summary |
|---|---|
| public static CLContext create(final CLDevice. Creates a context on the specified device types. The platform to be used is implementation dependent. | |
| create | back to summary |
|---|---|
| public static CLContext create(final CLPlatform platform) Creates a context on the specified platform on all available devices (CL_DEVICE_TYPE_ALL). | |
| create | back to summary |
|---|---|
| public static CLContext create(CLPlatform platform, final CLDevice. Creates a context on the specified platform and with the specified device types. | |
| create | back to summary |
|---|---|
| public static CLContext create(final CLDevice... devices) Creates a context on the specified devices. | |
| createBuffer | back to summary |
|---|---|
| public final CLBuffer Creates a CLBuffer with the specified flags. No flags creates a MEM.READ_WRITE buffer. | |
| createBuffer | back to summary |
|---|---|
| public final CLBuffer Creates a CLBuffer with the specified flags. | |
| createBuffer | back to summary |
|---|---|
| public final <B extends Buffer> CLBuffer Creates a CLBuffer with the specified flags. No flags creates a MEM.READ_WRITE buffer. | |
| createBuffer | back to summary |
|---|---|
| public final <B extends Buffer> CLBuffer Creates a CLBuffer with the specified flags. | |
| createByteBuffer | back to summary |
|---|---|
| public final CLBuffer Creates a CLBuffer with the specified flags and buffer size in bytes. No flags creates a MEM.READ_WRITE buffer. | |
| createByteBuffer | back to summary |
|---|---|
| public final CLBuffer Creates a CLBuffer with the specified flags and buffer size in bytes. | |
| createCommandQueue | back to summary |
|---|---|
| pack-priv CLCommandQueue createCommandQueue(final CLDevice device, final long properties) | |
| createContext | back to summary |
|---|---|
| protected static long createContext(final CLPlatform platform, final CLErrorHandler handler, final PointerBuffer properties, final CLDevice... devices) | |
| createContextFromType | back to summary |
|---|---|
| protected static long createContextFromType(final CLPlatform platform, final CLErrorHandler handler, final PointerBuffer properties, final long deviceType) | |
| createDoubleBuffer | back to summary |
|---|---|
| public final CLBuffer Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. | |
| createErrorHandler | back to summary |
|---|---|
| protected static CLContext. | |
| createFloatBuffer | back to summary |
|---|---|
| public final CLBuffer Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. | |
| createImage2d | back to summary |
|---|---|
| public final CLImage2d Creates a CLImage2d with the specified format, dimension and flags. | |
| createImage2d | back to summary |
|---|---|
| public final CLImage2d Creates a CLImage2d with the specified format, dimension and flags. | |
| createImage2d | back to summary |
|---|---|
| public final <B extends Buffer> CLImage2d Creates a CLImage2d with the specified format, dimension and flags. | |
| createImage2d | back to summary |
|---|---|
| public final <B extends Buffer> CLImage2d Creates a CLImage2d with the specified format, dimension and flags. | |
| createImage3d | back to summary |
|---|---|
| public final CLImage3d Creates a CLImage3d with the specified format, dimension and flags. | |
| createImage3d | back to summary |
|---|---|
| public final CLImage3d Creates a CLImage3d with the specified format, dimension and flags. | |
| createImage3d | back to summary |
|---|---|
| public final <B extends Buffer> CLImage3d Creates a CLImage3d with the specified format, dimension and flags. | |
| createImage3d | back to summary |
|---|---|
| public final <B extends Buffer> CLImage3d Creates a CLImage3d with the specified format, dimension and flags. | |
| createIntBuffer | back to summary |
|---|---|
| public final CLBuffer Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. | |
| createLongBuffer | back to summary |
|---|---|
| public final CLBuffer Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. | |
| createProgram | back to summary |
|---|---|
| public CLProgram createProgram(final String src) Creates a program from the given sources, the returned program is not build yet. | |
| createProgram | back to summary |
|---|---|
| public CLProgram createProgram(final InputStream source) throws IOException Creates a program and reads the source from stream, the returned program is not build yet. The InputStream is automatically closed after the sources have been read.
| |
| createProgram | back to summary |
|---|---|
| public CLProgram createProgram(final Map<CLDevice, byte[]> binaries) Creates a program from the given binaries, the program is not build yet.
| |
| createSampler | back to summary |
|---|---|
| public CLSampler createSampler(final CLSampler. | |
| createShortBuffer | back to summary |
|---|---|
| public final CLBuffer Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer. | |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getCL | back to summary |
|---|---|
| public CL getCL() Return the low level OpenCL interface. | |
| getContext | back to summary |
|---|---|
| public CLContext getContext() Overrides com. Doc from com. Returns the context for this OpenCL object.
| |
| getDevice | back to summary |
|---|---|
| pack-priv CLDevice getDevice(final long dID) | |
| getDevices | back to summary |
|---|---|
| public CLDevice[] getDevices() Returns all devices associated with this CLContext. | |
| getMaxFlopsDevice | back to summary |
|---|---|
| public CLDevice getMaxFlopsDevice() Returns the device with maximal FLOPS from this context. The device speed is estimated by calculating the product of MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY. | |
| getMaxFlopsDevice | back to summary |
|---|---|
| public CLDevice getMaxFlopsDevice(final CLDevice. Returns the device with maximal FLOPS of the specified device type from this context. The device speed is estimated by calculating the product of MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY. | |
| getMaxMemBaseAddrAlign | back to summary |
|---|---|
| public long getMaxMemBaseAddrAlign() Returns the maximum | |
| getMemoryObjects | back to summary |
|---|---|
| public List Returns a read only shapshot of all allocated memory objects associated with this context. | |
| getPlatform | back to summary |
|---|---|
| public CLPlatform getPlatform() Overrides com. Returns the CLPlatform this context is running on.
| |
| getPrograms | back to summary |
|---|---|
| public List Returns a read only shapshot of all programs associated with this context. | |
| getSamplers | back to summary |
|---|---|
| public List Returns a read only shapshot of all samplers associated with this context. | |
| getSupportedImage2dFormats | back to summary |
|---|---|
| public CLImageFormat[] getSupportedImage2dFormats(final CLMemory. Returns all supported 2d image formats with the (optional) memory allocation flags. | |
| getSupportedImage3dFormats | back to summary |
|---|---|
| public CLImageFormat[] getSupportedImage3dFormats(final CLMemory. Returns all supported 3d image formats with the (optional) memory allocation flags. | |
| getSupportedImageFormats | back to summary |
|---|---|
| private CLImageFormat[] getSupportedImageFormats(final int flags, final int type) | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| initDevices | back to summary |
|---|---|
| private synchronized void initDevices(final CLContextBinding cl) | |
| onCommandQueueReleased | back to summary |
|---|---|
| pack-priv void onCommandQueueReleased(final CLDevice device, final CLCommandQueue queue) | |
| onMemoryReleased | back to summary |
|---|---|
| pack-priv void onMemoryReleased(final CLMemory<?> buffer) | |
| onProgramReleased | back to summary |
|---|---|
| pack-priv void onProgramReleased(final CLProgram program) | |
| onSamplerReleased | back to summary |
|---|---|
| pack-priv void onSamplerReleased(final CLSampler sampler) | |
| overrideContext | back to summary |
|---|---|
| protected void overrideContext(final CLDevice device) | |
| release | back to summary |
|---|---|
| private void release(final Collection<? extends CLResource> resources) | |
| release | back to summary |
|---|---|
| public synchronized void release() Overrides com. Implements com. Releases this context and all resources.
| |
| removeCLErrorHandler | back to summary |
|---|---|
| public void removeCLErrorHandler(final CLErrorHandler handler) | |
| setupContextProperties | back to summary |
|---|---|
| private static PointerBuffer setupContextProperties(final CLPlatform platform) | |
| toDeviceBitmap | back to summary |
|---|---|
| protected static long toDeviceBitmap(final CLDevice. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides com. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| private CLErrorHandler[] |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private synchronized void | |
| public synchronized void | onError(final String errinfo, final ByteBuffer private_info, final long cb)
Implements com. |
| private synchronized void |
| clientHandlers | back to summary |
|---|---|
| private CLErrorHandler[] clientHandlers | |
| ErrorDispatcher | back to summary |
|---|---|
| protected ErrorDispatcher() | |
| addHandler | back to summary |
|---|---|
| private synchronized void addHandler(final CLErrorHandler handler) | |
| onError | back to summary |
|---|---|
| public synchronized void onError(final String errinfo, final ByteBuffer private_info, final long cb) Implements com.
| |
| removeHandler | back to summary |
|---|---|
| private synchronized void removeHandler(final CLErrorHandler handler) | |