|
JOCL v2.6.0-rc-20250722
JOCL, OpenCL® API Binding for Java (public API).
|
CLContext is responsible for managing objects such as command-queues, memory, program and kernel objects and for executing kernels on one or more devices specified in the context. More...
Classes | |
| class | ErrorDispatcher |
Public Member Functions | |
| CLProgram | createProgram (final String src) |
| Creates a program from the given sources, the returned program is not build yet. More... | |
| CLProgram | createProgram (final InputStream source) throws IOException |
| Creates a program and reads the source from stream, the returned program is not build yet. More... | |
| CLProgram | createProgram (final Map< CLDevice, byte[]> binaries) |
| Creates a program from the given binaries, the program is not build yet. More... | |
| final CLBuffer< ShortBuffer > | createShortBuffer (final int size, final Mem... flags) |
| Creates a CLBuffer with the specified flags and element count. More... | |
| final CLBuffer< IntBuffer > | createIntBuffer (final int size, final Mem... flags) |
| Creates a CLBuffer with the specified flags and element count. More... | |
| final CLBuffer< LongBuffer > | createLongBuffer (final int size, final Mem... flags) |
| Creates a CLBuffer with the specified flags and element count. More... | |
| final CLBuffer< FloatBuffer > | createFloatBuffer (final int size, final Mem... flags) |
| Creates a CLBuffer with the specified flags and element count. More... | |
| final CLBuffer< DoubleBuffer > | createDoubleBuffer (final int size, final Mem... flags) |
| Creates a CLBuffer with the specified flags and element count. More... | |
| final CLBuffer< ByteBuffer > | createByteBuffer (final int size, final Mem... flags) |
| Creates a CLBuffer with the specified flags and buffer size in bytes. More... | |
| final CLBuffer< ByteBuffer > | createByteBuffer (final int size, final int flags) |
| Creates a CLBuffer with the specified flags and buffer size in bytes. More... | |
| final CLBuffer<?> | createBuffer (final int size, final Mem... flags) |
| Creates a CLBuffer with the specified flags. More... | |
| final CLBuffer<?> | createBuffer (final int size, final int flags) |
| Creates a CLBuffer with the specified flags. More... | |
| final< B extends Buffer > CLBuffer< B > | createBuffer (final B directBuffer, final Mem... flags) |
| Creates a CLBuffer with the specified flags. More... | |
| final< B extends Buffer > CLBuffer< B > | createBuffer (final B directBuffer, final int flags) |
| Creates a CLBuffer with the specified flags. More... | |
| final CLImage2d<?> | createImage2d (final int width, final int height, final CLImageFormat format, final Mem... flags) |
| Creates a CLImage2d with the specified format, dimension and flags. More... | |
| final CLImage2d<?> | createImage2d (final int width, final int height, final int rowPitch, final CLImageFormat format, final Mem... flags) |
| Creates a CLImage2d with the specified format, dimension and flags. More... | |
| final< B extends Buffer > CLImage2d< B > | createImage2d (final B directBuffer, final int width, final int height, final CLImageFormat format, final Mem... flags) |
| Creates a CLImage2d with the specified format, dimension and flags. More... | |
| final< B extends Buffer > CLImage2d< B > | createImage2d (final B directBuffer, final int width, final int height, final int rowPitch, final CLImageFormat format, final Mem... flags) |
| Creates a CLImage2d with the specified format, dimension and flags. More... | |
| final CLImage3d<?> | createImage3d (final int width, final int height, final int depth, final CLImageFormat format, final Mem... flags) |
| Creates a CLImage3d with the specified format, dimension and flags. More... | |
| final CLImage3d<?> | createImage3d (final int width, final int height, final int depth, final int rowPitch, final int slicePitch, final CLImageFormat format, final Mem... flags) |
| Creates a CLImage3d with the specified format, dimension and flags. More... | |
| final< B extends Buffer > CLImage3d< B > | createImage3d (final B directBuffer, final int width, final int height, final int depth, final CLImageFormat format, final Mem... flags) |
| Creates a CLImage3d with the specified format, dimension and flags. More... | |
| final< B extends Buffer > CLImage3d< B > | createImage3d (final B directBuffer, final int width, final int height, final int depth, final int rowPitch, final int slicePitch, final CLImageFormat format, final Mem... flags) |
| Creates a CLImage3d with the specified format, dimension and flags. More... | |
| CLSampler | createSampler (final AddressingMode addrMode, final FilteringMode filtMode, final boolean normalizedCoords) |
| void | addCLErrorHandler (final CLErrorHandler handler) |
| void | removeCLErrorHandler (final CLErrorHandler handler) |
| synchronized void | release () |
| Releases this context and all resources. More... | |
| CLImageFormat[] | getSupportedImage2dFormats (final Mem... flags) |
| Returns all supported 2d image formats with the (optional) memory allocation flags. More... | |
| CLImageFormat[] | getSupportedImage3dFormats (final Mem... flags) |
| Returns all supported 3d image formats with the (optional) memory allocation flags. More... | |
| CLPlatform | getPlatform () |
| Returns the CLPlatform this context is running on. More... | |
| CLContext | getContext () |
| Returns the context for this OpenCL object. More... | |
| List< CLProgram > | getPrograms () |
| Returns a read only shapshot of all programs associated with this context. More... | |
| List< CLMemory<? extends Buffer > > | getMemoryObjects () |
| Returns a read only shapshot of all allocated memory objects associated with this context. More... | |
| List< CLSampler > | getSamplers () |
| Returns a read only shapshot of all samplers associated with this context. More... | |
| CLDevice | getMaxFlopsDevice () |
| Returns the device with maximal FLOPS from this context. More... | |
| CLDevice | getMaxFlopsDevice (final CLDevice.Type type) |
| Returns the device with maximal FLOPS of the specified device type from this context. More... | |
| long | getMaxMemBaseAddrAlign () |
Returns the maximum CLDevice#getMemBaseAddrAlign() of all devices. More... | |
| CLDevice[] | getDevices () |
| Returns all devices associated with this CLContext. More... | |
| CL | getCL () |
| Return the low level OpenCL interface. More... | |
| String | toString () |
| boolean | equals (final Object obj) |
| int | hashCode () |
Static Public Member Functions | |
| static CLContext | create () |
| Creates a context on all available devices (CL_DEVICE_TYPE_ALL). More... | |
| static CLContext | create (final Type... deviceTypes) |
| Creates a context on the specified device types. More... | |
| static CLContext | create (final CLPlatform platform) |
| Creates a context on the specified platform on all available devices (CL_DEVICE_TYPE_ALL). More... | |
| static CLContext | create (CLPlatform platform, final Type... deviceTypes) |
| Creates a context on the specified platform and with the specified device types. More... | |
| static CLContext | create (final CLDevice... devices) |
| Creates a context on the specified devices. More... | |
Protected Member Functions | |
| CLContext (final CLPlatform platform, final long contextID, final ErrorDispatcher dispatcher) | |
| void | overrideContext (final CLDevice device) |
Static Protected Member Functions | |
| static long | createContextFromType (final CLPlatform platform, final CLErrorHandler handler, final PointerBuffer properties, final long deviceType) |
| static long | createContext (final CLPlatform platform, final CLErrorHandler handler, final PointerBuffer properties, final CLDevice... devices) |
| static long | toDeviceBitmap (final Type[] deviceTypes) |
| static ErrorDispatcher | createErrorHandler () |
Protected Attributes | |
| CLDevice[] | devices |
| final Set< CLProgram > | programs |
| final Set< CLSampler > | samplers |
| final Set< CLMemory<? extends Buffer > > | memoryObjects |
| final Map< CLDevice, List< CLCommandQueue > > | queuesMap |
| final CLPlatform | platform |
CLContext is responsible for managing objects such as command-queues, memory, program and kernel objects and for executing kernels on one or more devices specified in the context.
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.
Definition at line 79 of file CLContext.java.
|
protected |
| void com.jogamp.opencl.CLContext.addCLErrorHandler | ( | final CLErrorHandler | handler | ) |
Definition at line 474 of file CLContext.java.
|
static |
Creates a context on all available devices (CL_DEVICE_TYPE_ALL).
The platform to be used is implementation dependent.
Definition at line 139 of file CLContext.java.
|
static |
Creates a context on the specified platform and with the specified device types.
Definition at line 162 of file CLContext.java.
|
static |
Creates a context on the specified devices.
Definition at line 178 of file CLContext.java.
|
static |
Creates a context on the specified platform on all available devices (CL_DEVICE_TYPE_ALL).
Definition at line 154 of file CLContext.java.
|
static |
Creates a context on the specified device types.
The platform to be used is implementation dependent.
Definition at line 147 of file CLContext.java.
| final< B extends Buffer > CLBuffer< B > com.jogamp.opencl.CLContext.createBuffer | ( | final B | directBuffer, |
| final int | flags | ||
| ) |
Creates a CLBuffer with the specified flags.
Definition at line 364 of file CLContext.java.
| final< B extends Buffer > CLBuffer< B > com.jogamp.opencl.CLContext.createBuffer | ( | final B | directBuffer, |
| final Mem... | flags | ||
| ) |
Creates a CLBuffer with the specified flags.
No flags creates a MEM.READ_WRITE buffer.
Definition at line 357 of file CLContext.java.
| final CLBuffer<?> com.jogamp.opencl.CLContext.createBuffer | ( | final int | size, |
| final int | flags | ||
| ) |
Creates a CLBuffer with the specified flags.
Definition at line 348 of file CLContext.java.
| final CLBuffer<?> com.jogamp.opencl.CLContext.createBuffer | ( | final int | size, |
| final Mem... | flags | ||
| ) |
Creates a CLBuffer with the specified flags.
No flags creates a MEM.READ_WRITE buffer.
Definition at line 341 of file CLContext.java.
| final CLBuffer< ByteBuffer > com.jogamp.opencl.CLContext.createByteBuffer | ( | final int | size, |
| final int | flags | ||
| ) |
Creates a CLBuffer with the specified flags and buffer size in bytes.
Definition at line 334 of file CLContext.java.
| final CLBuffer< ByteBuffer > com.jogamp.opencl.CLContext.createByteBuffer | ( | final int | size, |
| final Mem... | flags | ||
| ) |
Creates a CLBuffer with the specified flags and buffer size in bytes.
No flags creates a MEM.READ_WRITE buffer.
Definition at line 327 of file CLContext.java.
|
staticprotected |
Definition at line 209 of file CLContext.java.
|
staticprotected |
Definition at line 199 of file CLContext.java.
| final CLBuffer< DoubleBuffer > com.jogamp.opencl.CLContext.createDoubleBuffer | ( | final int | size, |
| final Mem... | flags | ||
| ) |
Creates a CLBuffer with the specified flags and element count.
No flags creates a MEM.READ_WRITE buffer.
Definition at line 320 of file CLContext.java.
|
staticprotected |
| final CLBuffer< FloatBuffer > com.jogamp.opencl.CLContext.createFloatBuffer | ( | final int | size, |
| final Mem... | flags | ||
| ) |
Creates a CLBuffer with the specified flags and element count.
No flags creates a MEM.READ_WRITE buffer.
Definition at line 313 of file CLContext.java.
| final< B extends Buffer > CLImage2d< B > com.jogamp.opencl.CLContext.createImage2d | ( | final B | directBuffer, |
| final int | width, | ||
| final int | height, | ||
| final CLImageFormat | format, | ||
| final Mem... | flags | ||
| ) |
Creates a CLImage2d with the specified format, dimension and flags.
Definition at line 387 of file CLContext.java.
| final< B extends Buffer > CLImage2d< B > com.jogamp.opencl.CLContext.createImage2d | ( | final B | directBuffer, |
| final int | width, | ||
| final int | height, | ||
| final int | rowPitch, | ||
| final CLImageFormat | format, | ||
| final Mem... | flags | ||
| ) |
Creates a CLImage2d with the specified format, dimension and flags.
Definition at line 394 of file CLContext.java.
| final CLImage2d<?> com.jogamp.opencl.CLContext.createImage2d | ( | final int | width, |
| final int | height, | ||
| final CLImageFormat | format, | ||
| final Mem... | flags | ||
| ) |
Creates a CLImage2d with the specified format, dimension and flags.
Definition at line 373 of file CLContext.java.
| final CLImage2d<?> com.jogamp.opencl.CLContext.createImage2d | ( | final int | width, |
| final int | height, | ||
| final int | rowPitch, | ||
| final CLImageFormat | format, | ||
| final Mem... | flags | ||
| ) |
Creates a CLImage2d with the specified format, dimension and flags.
Definition at line 380 of file CLContext.java.
| final< B extends Buffer > CLImage3d< B > com.jogamp.opencl.CLContext.createImage3d | ( | final B | directBuffer, |
| final int | width, | ||
| final int | height, | ||
| final int | depth, | ||
| final CLImageFormat | format, | ||
| final Mem... | flags | ||
| ) |
Creates a CLImage3d with the specified format, dimension and flags.
Definition at line 417 of file CLContext.java.
| final< B extends Buffer > CLImage3d< B > com.jogamp.opencl.CLContext.createImage3d | ( | final B | directBuffer, |
| final int | width, | ||
| final int | height, | ||
| final int | depth, | ||
| final int | rowPitch, | ||
| final int | slicePitch, | ||
| final CLImageFormat | format, | ||
| final Mem... | flags | ||
| ) |
Creates a CLImage3d with the specified format, dimension and flags.
Definition at line 424 of file CLContext.java.
| final CLImage3d<?> com.jogamp.opencl.CLContext.createImage3d | ( | final int | width, |
| final int | height, | ||
| final int | depth, | ||
| final CLImageFormat | format, | ||
| final Mem... | flags | ||
| ) |
Creates a CLImage3d with the specified format, dimension and flags.
Definition at line 403 of file CLContext.java.
| final CLImage3d<?> com.jogamp.opencl.CLContext.createImage3d | ( | final int | width, |
| final int | height, | ||
| final int | depth, | ||
| final int | rowPitch, | ||
| final int | slicePitch, | ||
| final CLImageFormat | format, | ||
| final Mem... | flags | ||
| ) |
Creates a CLImage3d with the specified format, dimension and flags.
Definition at line 410 of file CLContext.java.
| final CLBuffer< IntBuffer > com.jogamp.opencl.CLContext.createIntBuffer | ( | final int | size, |
| final Mem... | flags | ||
| ) |
Creates a CLBuffer with the specified flags and element count.
No flags creates a MEM.READ_WRITE buffer.
Definition at line 299 of file CLContext.java.
| final CLBuffer< LongBuffer > com.jogamp.opencl.CLContext.createLongBuffer | ( | final int | size, |
| final Mem... | flags | ||
| ) |
Creates a CLBuffer with the specified flags and element count.
No flags creates a MEM.READ_WRITE buffer.
Definition at line 306 of file CLContext.java.
| CLProgram com.jogamp.opencl.CLContext.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.
| IOException | when a IOException occurred while reading or closing the stream. |
Definition at line 254 of file CLContext.java.
Creates a program from the given binaries, the program is not build yet.
Creating a program will fail if:
Definition at line 282 of file CLContext.java.
| CLProgram com.jogamp.opencl.CLContext.createProgram | ( | final String | src | ) |
Creates a program from the given sources, the returned program is not build yet.
Definition at line 243 of file CLContext.java.
| CLSampler com.jogamp.opencl.CLContext.createSampler | ( | final AddressingMode | addrMode, |
| final FilteringMode | filtMode, | ||
| final boolean | normalizedCoords | ||
| ) |
Definition at line 446 of file CLContext.java.
| final CLBuffer< ShortBuffer > com.jogamp.opencl.CLContext.createShortBuffer | ( | final int | size, |
| final Mem... | flags | ||
| ) |
Creates a CLBuffer with the specified flags and element count.
No flags creates a MEM.READ_WRITE buffer.
Definition at line 292 of file CLContext.java.
| boolean com.jogamp.opencl.CLContext.equals | ( | final Object | obj | ) |
Definition at line 683 of file CLContext.java.
| CL com.jogamp.opencl.CLContext.getCL | ( | ) |
Return the low level OpenCL interface.
Reimplemented in com.jogamp.opencl.gl.CLGLContext.
Definition at line 646 of file CLContext.java.
| CLContext com.jogamp.opencl.CLContext.getContext | ( | ) |
Returns the context for this OpenCL object.
Reimplemented from com.jogamp.opencl.CLObject.
Reimplemented in com.jogamp.opencl.gl.CLGLContext.
Definition at line 574 of file CLContext.java.
| CLDevice[] com.jogamp.opencl.CLContext.getDevices | ( | ) |
Returns all devices associated with this CLContext.
Definition at line 638 of file CLContext.java.
| CLDevice com.jogamp.opencl.CLContext.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.
Definition at line 611 of file CLContext.java.
| CLDevice com.jogamp.opencl.CLContext.getMaxFlopsDevice | ( | final CLDevice.Type | type | ) |
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.
Definition at line 620 of file CLContext.java.
| long com.jogamp.opencl.CLContext.getMaxMemBaseAddrAlign | ( | ) |
Returns the maximum CLDevice#getMemBaseAddrAlign() of all devices.
Definition at line 627 of file CLContext.java.
| List< CLMemory<? extends Buffer > > com.jogamp.opencl.CLContext.getMemoryObjects | ( | ) |
Returns a read only shapshot of all allocated memory objects associated with this context.
Definition at line 590 of file CLContext.java.
| CLPlatform com.jogamp.opencl.CLContext.getPlatform | ( | ) |
Returns the CLPlatform this context is running on.
Reimplemented from com.jogamp.opencl.CLObject.
Definition at line 569 of file CLContext.java.
| List< CLProgram > com.jogamp.opencl.CLContext.getPrograms | ( | ) |
Returns a read only shapshot of all programs associated with this context.
Definition at line 581 of file CLContext.java.
| List< CLSampler > com.jogamp.opencl.CLContext.getSamplers | ( | ) |
Returns a read only shapshot of all samplers associated with this context.
Definition at line 599 of file CLContext.java.
| CLImageFormat[] com.jogamp.opencl.CLContext.getSupportedImage2dFormats | ( | final Mem... | flags | ) |
Returns all supported 2d image formats with the (optional) memory allocation flags.
Definition at line 554 of file CLContext.java.
| CLImageFormat[] com.jogamp.opencl.CLContext.getSupportedImage3dFormats | ( | final Mem... | flags | ) |
Returns all supported 3d image formats with the (optional) memory allocation flags.
Definition at line 561 of file CLContext.java.
| int com.jogamp.opencl.CLContext.hashCode | ( | ) |
|
protected |
| synchronized void com.jogamp.opencl.CLContext.release | ( | ) |
Releases this context and all resources.
Implements com.jogamp.opencl.CLResource.
Definition at line 493 of file CLContext.java.
| void com.jogamp.opencl.CLContext.removeCLErrorHandler | ( | final CLErrorHandler | handler | ) |
Definition at line 478 of file CLContext.java.
|
staticprotected |
| String com.jogamp.opencl.CLContext.toString | ( | ) |
Reimplemented from com.jogamp.opencl.CLObject.
Definition at line 674 of file CLContext.java.
|
protected |
Definition at line 81 of file CLContext.java.
|
protected |
Definition at line 85 of file CLContext.java.
|
protected |
Definition at line 89 of file CLContext.java.
|
protected |
Definition at line 83 of file CLContext.java.
|
protected |
Definition at line 87 of file CLContext.java.
|
protected |
Definition at line 84 of file CLContext.java.