Top Description Fields Constructors Methods
com.jogamp.opencl

public Class CLKernel

extends CLObjectResource
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
com.jogamp.opencl.util.CLUtil, com.jogamp.common.nio.Buffers, .PointerBuffer, com.jogamp.opencl.llb.CLKernelBinding, java.nio.Buffer, .ByteBuffer

High level abstraction for an OpenCL Kernel. A kernel is a function declared in a program. A kernel is identified by the kernel qualifier applied to any function in a program. A kernel object encapsulates the specific kernel function declared in a program and the argument values to be used when executing this kernel function. CLKernel is not threadsafe.
Author
Michael Bien, et al.
See Also
CLProgram#createCLKernel(java.lang.String), CLProgram#createCLKernels()

Field Summary

Modifier and TypeField and Description
private int
private final CLKernelBinding
private final ByteBuffer
private boolean
public final String
public final int
private final CLProgram

Constructor Summary

AccessConstructor and Description
pack-priv
CLKernel(final CLProgram program, final long id)

pack-priv
CLKernel(final CLProgram program, final String name, final long id)

Method Summary

Modifier and TypeMethod and Description
public CLKernel
clone()

Overrides java.lang.Object.clone.

Returns a new instance of this kernel with uninitialized arguments.
public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public long[]
getCompileWorkGroupSize(final CLDevice device)

Returns the work-group size specified by the __attribute__((reqd_work_group_size(X, Y, Z))) qualifier in kernel sources.

public long
getLocalMemorySize(final CLDevice device)

Returns the amount of local memory in bytes being used by a kernel.

public CLProgram
private long
getWorkGroupInfo(final CLDevice device, final int flag)

public long
getWorkGroupSize(final CLDevice device)

Returns the work group size for this kernel on the given device.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public boolean
public int
position()

Returns the argument index used in the relative putArt(...) methods.

public CLKernel
putArg(final CLMemory<?> value)

public CLKernel
putArg(final short value)

public CLKernel
putArg(final int value)

public CLKernel
putArg(final long value)

public CLKernel
putArg(final float value)

public CLKernel
putArg(final double value)

public CLKernel
putArgs(final CLMemory<?>... values)

public CLKernel
putNullArg(final int size)

public void
release()

Overrides com.jogamp.opencl.CLObjectResource.release.

Implements com.jogamp.opencl.CLResource.release.

Releases all resources of this kernel from its context.
public CLKernel
rewind()

Resets the argument index to 0.

public CLKernel
setArg(final int argumentIndex, final CLMemory<?> value)

public CLKernel
setArg(final int argumentIndex, final short value)

public CLKernel
setArg(final int argumentIndex, final int value)

public CLKernel
setArg(final int argumentIndex, final long value)

public CLKernel
setArg(final int argumentIndex, final float value)

public CLKernel
setArg(final int argumentIndex, final double value)

public CLKernel
setArgs(final CLMemory<?>... values)

public CLKernel
setArgs(final Object... values)

private void
setArgs(final int startIndex, final CLMemory<?>... values)

private void
setArgument(final int argumentIndex, final int size, final Buffer value)

public CLKernel
setForce32BitArgs(final boolean force)

Forces double and long arguments to be passed as float and int to the OpenCL kernel.

public CLKernel
setNullArg(final int argumentIndex, final int size)

public String
toString()

Overrides com.jogamp.opencl.CLObject.toString.

Returns a string representation of the object.
private Buffer
wrap(final float value)

private Buffer
wrap(final double value)

private Buffer
wrap(final short value)

private Buffer
wrap(final int value)

private Buffer
wrap(final long value)

Inherited from com.jogamp.opencl.CLObjectResource:
closeisReleased

Field Detail

argIndexback to summary
private int argIndex
bindingback to summary
private final CLKernelBinding binding
bufferback to summary
private final ByteBuffer buffer
force32BitArgsback to summary
private boolean force32BitArgs
nameback to summary
public final String name
numArgsback to summary
public final int numArgs
programback to summary
private final CLProgram program

Constructor Detail

CLKernelback to summary
pack-priv CLKernel(final CLProgram program, final long id)
CLKernelback to summary
pack-priv CLKernel(final CLProgram program, final String name, final long id)

Method Detail

cloneback to summary
public CLKernel clone()

Overrides java.lang.Object.clone.

Returns a new instance of this kernel with uninitialized arguments.

Returns:CLKernel

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

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.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getCompileWorkGroupSizeback to summary
public long[] getCompileWorkGroupSize(final CLDevice device)

Returns the work-group size specified by the __attribute__((reqd_work_group_size(X, Y, Z))) qualifier in kernel sources. If the work-group size is not specified using the above attribute qualifier new long[]{(0, 0, 0)} is returned. The returned array has always three elements.

getLocalMemorySizeback to summary
public long getLocalMemorySize(final CLDevice device)

Returns the amount of local memory in bytes being used by a kernel. This includes local memory that may be needed by an implementation to execute the kernel, variables declared inside the kernel with the __local address qualifier and local memory to be allocated for arguments to the kernel declared as pointers with the __local address qualifier and whose size is specified with clSetKernelArg. If the local memory size, for any pointer argument to the kernel declared with the __local address qualifier, is not specified, its size is assumed to be 0.

getProgramback to summary
public CLProgram getProgram()
getWorkGroupInfoback to summary
private long getWorkGroupInfo(final CLDevice device, final int flag)
getWorkGroupSizeback to summary
public long getWorkGroupSize(final CLDevice device)

Returns the work group size for this kernel on the given device. This provides a mechanism for the application to query the work-group size that can be used to execute a kernel on a specific device given by device. The OpenCL implementation uses the resource requirements of the kernel (register usage etc.) to determine what this work-group size should be.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isForce32BitArgsEnabledback to summary
public boolean isForce32BitArgsEnabled()
See Also
setForce32BitArgs(boolean)
positionback to summary
public int position()

Returns the argument index used in the relative putArt(...) methods.

putArgback to summary
public CLKernel putArg(final CLMemory<?> value)
putArgback to summary
public CLKernel putArg(final short value)
putArgback to summary
public CLKernel putArg(final int value)
putArgback to summary
public CLKernel putArg(final long value)
putArgback to summary
public CLKernel putArg(final float value)
putArgback to summary
public CLKernel putArg(final double value)
putArgsback to summary
public CLKernel putArgs(final CLMemory<?>... values)
putNullArgback to summary
public CLKernel putNullArg(final int size)
releaseback to summary
public void release()

Overrides com.jogamp.opencl.CLObjectResource.release.

Implements com.jogamp.opencl.CLResource.release.

Releases all resources of this kernel from its context.

Annotations
@Override
rewindback to summary
public CLKernel rewind()

Resets the argument index to 0.

setArgback to summary
public CLKernel setArg(final int argumentIndex, final CLMemory<?> value)
setArgback to summary
public CLKernel setArg(final int argumentIndex, final short value)
setArgback to summary
public CLKernel setArg(final int argumentIndex, final int value)
setArgback to summary
public CLKernel setArg(final int argumentIndex, final long value)
setArgback to summary
public CLKernel setArg(final int argumentIndex, final float value)
setArgback to summary
public CLKernel setArg(final int argumentIndex, final double value)
setArgsback to summary
public CLKernel setArgs(final CLMemory<?>... values)
setArgsback to summary
public CLKernel setArgs(final Object... values)
setArgsback to summary
private void setArgs(final int startIndex, final CLMemory<?>... values)
setArgumentback to summary
private void setArgument(final int argumentIndex, final int size, final Buffer value)
setForce32BitArgsback to summary
public CLKernel setForce32BitArgs(final boolean force)

Forces double and long arguments to be passed as float and int to the OpenCL kernel. This can be used in applications which want to mix kernels with different floating point precision.

setNullArgback to summary
public CLKernel setNullArg(final int argumentIndex, final int size)
toStringback to summary
public String toString()

Overrides com.jogamp.opencl.CLObject.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
wrapback to summary
private Buffer wrap(final float value)
wrapback to summary
private Buffer wrap(final double value)
wrapback to summary
private Buffer wrap(final short value)
wrapback to summary
private Buffer wrap(final int value)
wrapback to summary
private Buffer wrap(final long value)