Module openj9.cuda
Package com.ibm.cuda

Class CudaKernel

java.lang.Object
com.ibm.cuda.CudaKernel

public class CudaKernel extends Object
The CudaKernel class represents a kernel function in a loaded CudaModule.
  • Constructor Details

    • CudaKernel

      public CudaKernel(CudaModule module, CudaFunction function)
      Creates a new kernel object in the given module whose entry point is the specified function.
      Parameters:
      module - the module containing the kernel code
      function - the entry point of the kernel
    • CudaKernel

      public CudaKernel(CudaModule module, String functionName) throws CudaException
      Creates a new kernel object in the given module whose entry point is the function with the specified name.
      Parameters:
      module - the module containing the kernel code
      functionName - the name of the entry point of the kernel
      Throws:
      CudaException - if a CUDA exception occurs
  • Method Details

    • getAttribute

      public final int getAttribute(int attribute) throws CudaException
      Returns the value of the specified @{code attribute} for the function associated with this kernel.
      Parameters:
      attribute - the attribute to be queried (see CudaFunction.ATTRIBUTE_XXX)
      Returns:
      the attribute value
      Throws:
      CudaException - if a CUDA exception occurs
    • launch

      public final void launch(CudaGrid grid, Object... parameters) throws CudaException
      Launches this kernel. The launch configuration is given by grid and the actual parameter values are specified by parameters.

      Each parameter value must be one of the following:

      • a boxed primitive value
      • a CudaBuffer object
      • null
      Parameters:
      grid - the launch configuration
      parameters - the actual parameter values
      Throws:
      CudaException - if a CUDA exception occurs
      IllegalArgumentException - if parameters contains any unsupported types
    • launch

      public final void launch(CudaGrid grid, CudaKernel.Parameters parameters) throws CudaException
      Launches this kernel. The launch configuration is given by grid and the actual parameter values are specified by parameters.
      Parameters:
      grid - the launch configuration
      parameters - the actual parameter values
      Throws:
      CudaException - if a CUDA exception occurs
      IllegalArgumentException - if parameters does not contain the correct number of values
    • setCacheConfig

      public final void setCacheConfig(CudaDevice.CacheConfig config) throws CudaException
      Configures the cache for the function associated with this kernel.
      Parameters:
      config - the desired cache configuration
      Throws:
      CudaException - if a CUDA exception occurs
    • setSharedMemConfig

      public final void setSharedMemConfig(CudaDevice.SharedMemConfig config) throws CudaException
      Configures the shared memory of the function associated with this kernel.
      Parameters:
      config - the desired shared memory configuration
      Throws:
      CudaException - if a CUDA exception occurs