Package net.glowstone.util
Class OpenCompute
java.lang.Object
net.glowstone.util.OpenCompute
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.jogamp.opencl.CLContext
static com.jogamp.opencl.CLDevice
static int
getGlobalSize
(int size) Calculates the number of work groups.static int
getGlobalSize
(int size, int localWorkSize) Calculates the number of work groups.static com.jogamp.opencl.CLKernel
static com.jogamp.opencl.CLKernel
Returns aCLKernel
that is part of the givenCLProgram
.static int
Calculates the number of local work units per work group.static int
getLocalSize
(int max) Calculates the number of local work units per work group, applying a specified maximum.static com.jogamp.opencl.CLPlatform
static com.jogamp.opencl.CLProgram
getProgram
(String name) Returns an OpenCL program, loading it synchronously if it's not in cache.static com.jogamp.opencl.CLCommandQueue
getQueue()
static void
initContext
(com.jogamp.opencl.CLPlatform platform) Initializes theCLContext
,CLDevice
andCLCommandQueue
for the givenCLPlatform
.static void
release()
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 aCLKernel
that is part of the givenCLProgram
.- Parameters:
program
- theCLProgram
that contains the kernelname
- the name of the kernelthreaded
- if true, always create a newCLKernel
instance- Returns:
- the
CLKernel
-
initContext
public static void initContext(com.jogamp.opencl.CLPlatform platform) Initializes theCLContext
,CLDevice
andCLCommandQueue
for the givenCLPlatform
.- Parameters:
platform
- theCLPlatform
to 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
,CLKernel
andCLContext
instances. -
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()
-