org.jocl.cloth
Class CLU

java.lang.Object
  extended by org.jocl.cloth.CLU

 class CLU
extends java.lang.Object

OpenCL utility class


Field Summary
(package private) static boolean PROFILING
          Whether profiling should be enabled for the command queue created by this class
 
Constructor Summary
CLU(int platformIndex, int deviceIndex, long[] clContextProperties)
          Creates a new CLU which will initialize the context with the given properties for the specified platform, and a command queue for the specified device.
 
Method Summary
(package private)  org.jocl.cl_kernel createKernel(java.lang.String fileName, java.lang.String kernelName)
          Creates an OpenCL kernel with the given name from the file with the given name
(package private)  org.jocl.cl_mem createMem(float[] array)
          Create a memory object that contains the data from the given array
(package private)  org.jocl.cl_mem createMem(int[] array)
          Create a memory object that contains the data from the given array
(package private)  org.jocl.cl_command_queue getCommandQueue()
          Returns the command queue
(package private)  org.jocl.cl_context getContext()
          Returns the OpenCL context
(package private) static void setKernelArgs(org.jocl.cl_kernel kernel, java.lang.Object... args)
          Utility method to set the specified kernel arguments
(package private)  void shutdown()
          Shut down this CLU.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROFILING

static final boolean PROFILING
Whether profiling should be enabled for the command queue created by this class

See Also:
Constant Field Values
Constructor Detail

CLU

CLU(int platformIndex,
    int deviceIndex,
    long[] clContextProperties)
Creates a new CLU which will initialize the context with the given properties for the specified platform, and a command queue for the specified device. The properties may be null.

Parameters:
platformIndex - The index of the platform to use.
deviceIndex - The index of the device to use
clContextProperties - The context properties: An array containing property IDs and their values, as required for clCreateContext. This array may be null
Method Detail

getContext

org.jocl.cl_context getContext()
Returns the OpenCL context

Returns:
The OpenCL context

getCommandQueue

org.jocl.cl_command_queue getCommandQueue()
Returns the command queue

Returns:
The command queue

createKernel

org.jocl.cl_kernel createKernel(java.lang.String fileName,
                                java.lang.String kernelName)
Creates an OpenCL kernel with the given name from the file with the given name

Parameters:
fileName - The file name
kernelName - The kernel name
Returns:
The kernel

createMem

org.jocl.cl_mem createMem(float[] array)
Create a memory object that contains the data from the given array

Parameters:
array - The array
Returns:
The memory object

createMem

org.jocl.cl_mem createMem(int[] array)
Create a memory object that contains the data from the given array

Parameters:
array - The array
Returns:
The memory object

shutdown

void shutdown()
Shut down this CLU. That is, release the resources that have been created by this class, except for the kernels and memory objects: The responsibility to release the kernels and memory objects is left to the caller of the respective creation methods.


setKernelArgs

static void setKernelArgs(org.jocl.cl_kernel kernel,
                          java.lang.Object... args)
Utility method to set the specified kernel arguments

Parameters:
kernel - The kernel
args - The arguments
Throws:
java.lang.IllegalArgumentException - If the argument types are not primitive types and cl_mem