Enum Kernel.EXECUTION_MODE
- java.lang.Object
-
- java.lang.Enum<Kernel.EXECUTION_MODE>
-
- com.aparapi.Kernel.EXECUTION_MODE
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<Kernel.EXECUTION_MODE>
- Enclosing class:
- Kernel
@Deprecated public static enum Kernel.EXECUTION_MODE extends java.lang.Enum<Kernel.EXECUTION_MODE>
Deprecated.It is no longer recommended thatEXECUTION_MODEs are used, as a more sophisticatedDevicepreference mechanism is in place, seeKernelManager. ThoughKernel.setExecutionMode(EXECUTION_MODE)is still honored, the default EXECUTION_MODE is nowAUTO, 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 value Execution 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.executionModecan be set to one ofJTP,GPU,ACC,CPU,SEQwhen an application is launched.java -classpath ....;codegen.jar -Dcom.codegen.executionMode=GPU MyApplicationGenerally 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.
- Version:
- Alpha, 21/09/2010
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ACCDeprecated.The value representing execution on an accelerator device (Xeon Phi) via OpenCL.AUTODeprecated.CPUDeprecated.The value representing execution on a CPU device via OpenCL.GPUDeprecated.The value representing execution on a GPU device via OpenCL.JTPDeprecated.The value representing execution on a Java Thread Pool.NONEDeprecated.A dummy value to indicate an unknown state.SEQDeprecated.The value representing execution sequentially in a single loop.
-
Constructor Summary
Constructors Modifier Constructor Description privateEXECUTION_MODE()Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) static booleananyOpenCL(java.util.LinkedHashSet<Kernel.EXECUTION_MODE> _executionModes)Deprecated.(package private) static java.util.LinkedHashSet<Kernel.EXECUTION_MODE>getDefaultExecutionModes()Deprecated.(package private) static java.util.LinkedHashSet<Kernel.EXECUTION_MODE>getExecutionModeFromString(java.lang.String executionMode)Deprecated.(package private) static Kernel.EXECUTION_MODEgetFallbackExecutionMode()Deprecated.booleanisOpenCL()Deprecated.static Kernel.EXECUTION_MODEvalueOf(java.lang.String name)Deprecated.Returns the enum constant of this type with the specified name.static Kernel.EXECUTION_MODE[]values()Deprecated.Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
AUTO
public static final Kernel.EXECUTION_MODE AUTO
Deprecated.
-
NONE
public static final Kernel.EXECUTION_MODE NONE
Deprecated.A dummy value to indicate an unknown state.
-
GPU
public static final Kernel.EXECUTION_MODE GPU
Deprecated.The value representing execution on a GPU device via OpenCL.
-
CPU
public static final Kernel.EXECUTION_MODE CPU
Deprecated.The value representing execution on a CPU device via OpenCL.Note not all OpenCL implementations support OpenCL compute on the CPU.
-
JTP
public static final Kernel.EXECUTION_MODE JTP
Deprecated.The value representing execution on a Java Thread Pool.By default one Java thread is started for each available core and each core will execute
globalSize/coreswork items. This creates a total ofglobalSize%coresthreads to complete the work. Choose suitable values forglobalSizeto minimize the number of threads that are spawned.
-
SEQ
public static final Kernel.EXECUTION_MODE SEQ
Deprecated.The value representing execution sequentially in a single loop.This is meant to be used for debugging a kernel.
-
ACC
public static final Kernel.EXECUTION_MODE ACC
Deprecated.The value representing execution on an accelerator device (Xeon Phi) via OpenCL.
-
-
Method Detail
-
values
public static Kernel.EXECUTION_MODE[] values()
Deprecated.Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Kernel.EXECUTION_MODE c : Kernel.EXECUTION_MODE.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Kernel.EXECUTION_MODE valueOf(java.lang.String name)
Deprecated.Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getDefaultExecutionModes
@Deprecated static java.util.LinkedHashSet<Kernel.EXECUTION_MODE> getDefaultExecutionModes()
Deprecated.
-
getExecutionModeFromString
static java.util.LinkedHashSet<Kernel.EXECUTION_MODE> getExecutionModeFromString(java.lang.String executionMode)
Deprecated.
-
getFallbackExecutionMode
static Kernel.EXECUTION_MODE getFallbackExecutionMode()
Deprecated.
-
anyOpenCL
static boolean anyOpenCL(java.util.LinkedHashSet<Kernel.EXECUTION_MODE> _executionModes)
Deprecated.
-
isOpenCL
public boolean isOpenCL()
Deprecated.
-
-