Class OpenCompute

java.lang.Object
net.glowstone.util.OpenCompute

public class OpenCompute extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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
    getKernel(com.jogamp.opencl.CLProgram program, String name)
     
    static com.jogamp.opencl.CLKernel
    getKernel(com.jogamp.opencl.CLProgram program, String name, boolean threaded)
    Returns a CLKernel that is part of the given CLProgram.
    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
    Returns an OpenCL program, loading it synchronously if it's not in cache.
    static com.jogamp.opencl.CLCommandQueue
     
    static void
    initContext(com.jogamp.opencl.CLPlatform platform)
    Initializes the CLContext, CLDevice and CLCommandQueue for the given CLPlatform.
    static void
    Static de-initializer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OpenCompute

      public OpenCompute()
  • Method Details

    • getProgram

      public static com.jogamp.opencl.CLProgram getProgram(String name)
      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 a CLKernel that is part of the given CLProgram.
      Parameters:
      program - the CLProgram that contains the kernel
      name - the name of the kernel
      threaded - if true, always create a new CLKernel instance
      Returns:
      the CLKernel
    • initContext

      public static void initContext(com.jogamp.opencl.CLPlatform platform)
      Initializes the CLContext, CLDevice and CLCommandQueue for the given CLPlatform.
      Parameters:
      platform - the CLPlatform 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 units
      localWorkSize - 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 to CLProgram, CLKernel and CLContext 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()