Class KernelReference

java.lang.Object
civitas.celestis.gpu.KernelReference

public final class KernelReference extends Object
A reference object to a GPU kernel. This object is handed out to external classes by the GPU interface in order to provide an object-oriented interface for handling GPU kernel operations.
  • Method Details

    • setInput

      @Nonnull public KernelReference setInput(int i, double value)
      Sets the ith parameter as an input.
      Parameters:
      i - The index of the parameter to set
      value - The value to use as input
      Returns:
      A reference to itself (this)
    • setInput

      @Nonnull public KernelReference setInput(int i, @Nonnull double[] value)
      Sets the ith parameter as an input.
      Parameters:
      i - The index of the parameter to set
      value - The value to use as input
      Returns:
      A reference to itself (this)
    • setOutput

      @Nonnull public KernelReference setOutput(int i, @Nonnull double[] out)
      Sets the ith parameter as an output.
      Parameters:
      i - The index of the parameter to set
      out - The array to use as output
      Returns:
      A reference to itself (this)
    • execute

      @Nonnull public KernelReference execute(long workSize)
      Executes this kernel. The work size is the number of elements the input and output arrays contain.
      Parameters:
      workSize - The work size of this kernel (the input and output arrays' length)
      Returns:
      A reference to itself (this)
    • readOutput

      @Nonnull public KernelReference readOutput(int i, @Nonnull double[] out)
      Reads the output of this kernel to an array of doubles.
      Parameters:
      i - The index of the argument to read
      out - The output array
      Returns:
      A reference to itself (this)
    • dispose

      public void dispose()
      Disposes this reference. The reference to the kernel will be lost.