Deprecated API

Contents

  • Deprecated Enums
    Enum
    Description
    It is no longer recommended that EXECUTION_MODEs are used, as a more sophisticated Device preference mechanism is in place, see KernelManager. Though Kernel.setExecutionMode(EXECUTION_MODE) is still honored, the default EXECUTION_MODE is now Kernel.EXECUTION_MODE.AUTO, which indicates that the KernelManager will determine execution behaviours.

    The execution mode ENUM enumerates the possible modes of executing a kernel. One can request a mode of execution using the values below, and query a kernel after it first executes to determine how it executed.

    Aparapi supports 5 execution modes. Default is GPU.

      Enum valueExecution
      GPUExecute using OpenCL on first available GPU device
      ACCExecute using OpenCL on first available Accelerator device
      CPUExecute using OpenCL on first available CPU device
      JTPExecute using a Java Thread Pool (one thread spawned per available core)
      SEQExecute using a single loop. This is useful for debugging but will be less performant than the other modes

    To request that a kernel is executed in a specific mode, call Kernel.setExecutionMode(EXECUTION_MODE) before the kernel first executes.

         int[] values = new int[1024];
         // fill values array
         SquareKernel kernel = new SquareKernel(values);
         kernel.setExecutionMode(Kernel.EXECUTION_MODE.JTP);
         kernel.execute(values.length);
     

    Alternatively, the property com.codegen.executionMode can be set to one of JTP,GPU,ACC,CPU,SEQ when an application is launched.

        java -classpath ....;codegen.jar -Dcom.codegen.executionMode=GPU MyApplication
     

    Generally setting the execution mode is not recommended (it is best to let Aparapi decide automatically) but the option provides a way to compare a kernel's performance under multiple execution modes.