Package net.glowstone.util
Class OpenCompute
java.lang.Object
net.glowstone.util.OpenCompute
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.jogamp.opencl.CLContextstatic com.jogamp.opencl.CLDevicestatic intgetGlobalSize(int size) Calculates the number of work groups.static intgetGlobalSize(int size, int localWorkSize) Calculates the number of work groups.static com.jogamp.opencl.CLKernelstatic com.jogamp.opencl.CLKernelReturns aCLKernelthat is part of the givenCLProgram.static intCalculates the number of local work units per work group.static intgetLocalSize(int max) Calculates the number of local work units per work group, applying a specified maximum.static com.jogamp.opencl.CLPlatformstatic com.jogamp.opencl.CLProgramgetProgram(String name) Returns an OpenCL program, loading it synchronously if it's not in cache.static com.jogamp.opencl.CLCommandQueuegetQueue()static voidinitContext(com.jogamp.opencl.CLPlatform platform) Initializes theCLContext,CLDeviceandCLCommandQueuefor the givenCLPlatform.static voidrelease()Static de-initializer.
-
Constructor Details
-
OpenCompute
public OpenCompute()
-
-
Method Details
-
getProgram
Returns an OpenCL program, loading it synchronously if it's not in cache.- Parameters:
name- the program filename- Returns:
- the OpenCL program, or null if there isn't a valid program with that name
-
getKernel
public static com.jogamp.opencl.CLKernel getKernel(com.jogamp.opencl.CLProgram program, String name) -
getKernel
public static com.jogamp.opencl.CLKernel getKernel(com.jogamp.opencl.CLProgram program, String name, boolean threaded) Returns aCLKernelthat is part of the givenCLProgram.- Parameters:
program- theCLProgramthat contains the kernelname- the name of the kernelthreaded- if true, always create a newCLKernelinstance- Returns:
- the
CLKernel
-
initContext
public static void initContext(com.jogamp.opencl.CLPlatform platform) Initializes theCLContext,CLDeviceandCLCommandQueuefor the givenCLPlatform.- Parameters:
platform- theCLPlatformto use
-
getGlobalSize
public static int getGlobalSize(int size) Calculates the number of work groups.- Parameters:
size- the total number of local work units- Returns:
- the number of work groups
-
getGlobalSize
public static int getGlobalSize(int size, int localWorkSize) Calculates the number of work groups.- Parameters:
size- the total number of local work unitslocalWorkSize- the number of local work units per work group- Returns:
- the number of work groups
-
getLocalSize
public static int getLocalSize()Calculates the number of local work units per work group.- Returns:
- the size of the work groups
-
getLocalSize
public static int getLocalSize(int max) Calculates the number of local work units per work group, applying a specified maximum.- Parameters:
max- the maximum size allowed- Returns:
- the size of the work groups
-
release
public static void release()Static de-initializer. Clears all references toCLProgram,CLKernelandCLContextinstances. -
getPlatform
public static com.jogamp.opencl.CLPlatform getPlatform() -
getContext
public static com.jogamp.opencl.CLContext getContext() -
getDevice
public static com.jogamp.opencl.CLDevice getDevice() -
getQueue
public static com.jogamp.opencl.CLCommandQueue getQueue()
-