Class CL

java.lang.Object
org.lwjgl.opencl.CL

public final class CL extends Object
This class loads the OpenCL library (usually via the ICD loader) into the JVM process.

The CLCapabilities instance returned by getICD() contains function pointers for all functionality present in the ICD. This may include multiple platforms with very different capabilities. It should only be used if direct access to the ICD function pointers is required, for customization purposes.

Platform capabilities can be created with createPlatformCapabilities(long). Calling this method is expensive, so CLCapabilities instances should be cached in user code.

Device capabilities can be created with createDeviceCapabilities(long, org.lwjgl.opencl.CLCapabilities). Calling this method is expensive, so CLCapabilities instances should be cached in user code.

  • Method Details

    • create

      public static void create()
      Loads the OpenCL native library, using the default library name.
    • create

      public static void create(String libName)
      Loads the OpenCL native library, using the specified library name.
      Parameters:
      libName - the native library name
    • create

      public static void create(FunctionProviderLocal functionProvider)
      Initializes OpenCL with the specified FunctionProviderLocal. This method can be used to implement custom OpenCL library loading.
      Parameters:
      functionProvider - the provider of OpenCL function addresses
    • destroy

      public static void destroy()
      Unloads the OpenCL native library.
    • getFunctionProvider

      public static FunctionProviderLocal getFunctionProvider()
      Returns the FunctionProviderLocal for the OpenCL native library.
    • getICD

      public static CLCapabilities getICD()
      Returns the CLCapabilities of the ICD.
    • createPlatformCapabilities

      public static CLCapabilities createPlatformCapabilities(long cl_platform_id)
      Creates a CLCapabilities instance for the specified OpenCL platform.

      This method call is relatively expensive. The result should be cached and reused.

      Parameters:
      cl_platform_id - the platform to query
      Returns:
      the instance
    • createDeviceCapabilities

      public static CLCapabilities createDeviceCapabilities(long cl_device_id, CLCapabilities platformCapabilities)
      Creates a CLCapabilities instance for the specified OpenCL device.

      This method call is relatively expensive. The result should be cached and reused.

      Parameters:
      cl_device_id - the device to query
      Returns:
      the instance