java.lang.Object
uk.ac.manchester.tornado.api.TaskGraph
- All Implemented Interfaces:
TaskGraphInterface
Tornado Task Graph API.
Task-based parallel API to express methods to be accelerated on any OpenCL, PTX and/or SPIR-V compatible device.
- Since:
- v0.15
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTask(TaskPackage taskPackage) It adds a task by using aTaskPackage.consumeFromDevice(Object... objects) consumeFromDevice(String uniqueTaskGraphName, Object... objects) Tag a set of objects to be used directly from the device.Collection<?> protected StringObtains the task-schedule name that was assigned.booleanpersistOnDevice(Object... objects) Tags a set of objects to persist on the device without transferring them back to the host after execution.prebuiltTask(String id, String entryPoint, String filename, AccessorParameters accessorParameters) prebuiltTask(String id, String entryPoint, String filename, AccessorParameters accessorParameters, int[] atomics) Add a pre-built OpenCL task into a task-schedule with atomics region.snapshot()Function that closes a task-graph definition and creates an immutable task-graph ready for execution.task(String id, TornadoFunctions.Task code) Adds task with no parameter.<T1> TaskGraphtask(String id, TornadoFunctions.Task1<T1> code, T1 arg) Adds task with one parameter.<T1,T2, T3, T4, T5, T6, T7, T8, T9, T10>
TaskGraphtask(String id, TornadoFunctions.Task10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10) Adds task with 10 parameters.<T1,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
TaskGraphtask(String id, TornadoFunctions.Task11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11) It creates a task with 11 parameters.<T1,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>
TaskGraphtask(String id, TornadoFunctions.Task12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12) It creates a task with 12 parameters.<T1,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>
TaskGraphtask(String id, TornadoFunctions.Task13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13) It creates a task with 13 parameters.<T1,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>
TaskGraphtask(String id, TornadoFunctions.Task14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14) It creates a task with 14 parameters.<T1,T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>
TaskGraphtask(String id, TornadoFunctions.Task15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15) It creates a task with 15 parameters.<T1,T2> TaskGraph task(String id, TornadoFunctions.Task2<T1, T2> code, T1 arg1, T2 arg2) Adds task with two parameters.<T1,T2, T3>
TaskGraphtask(String id, TornadoFunctions.Task3<T1, T2, T3> code, T1 arg1, T2 arg2, T3 arg3) Add task with three parameters.<T1,T2, T3, T4>
TaskGraphtask(String id, TornadoFunctions.Task4<T1, T2, T3, T4> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4) Adds task with four parameters.<T1,T2, T3, T4, T5>
TaskGraphtask(String id, TornadoFunctions.Task5<T1, T2, T3, T4, T5> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) Adds task with five parameters.<T1,T2, T3, T4, T5, T6>
TaskGraphtask(String id, TornadoFunctions.Task6<T1, T2, T3, T4, T5, T6> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) Adds task with six parameters.<T1,T2, T3, T4, T5, T6, T7>
TaskGraphtask(String id, TornadoFunctions.Task7<T1, T2, T3, T4, T5, T6, T7> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) Adds task with seven parameters.<T1,T2, T3, T4, T5, T6, T7, T8>
TaskGraphtask(String id, TornadoFunctions.Task8<T1, T2, T3, T4, T5, T6, T7, T8> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) Adds task with eight parameters.<T1,T2, T3, T4, T5, T6, T7, T8, T9>
TaskGraphtask(String id, TornadoFunctions.Task9<T1, T2, T3, T4, T5, T6, T7, T8, T9> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) Adds task with nine parameters.transferToDevice(int mode, Object... objects) Tag a set of objects (Java objects) to be transferred to the device.transferToHost(int mode, Object... objects) Tag a set of objects (Java objects) to be transferred from the device to the host after the execution completes.
-
Field Details
-
taskGraphImpl
-
taskNames
-
-
Constructor Details
-
TaskGraph
-
-
Method Details
-
addTask
It adds a task by using aTaskPackage.- Specified by:
addTaskin interfaceTaskGraphInterface- Parameters:
taskPackage-TaskPackage- Returns:
-
}
invalid @link
{@link @TaskGraph
-
task
Adds task with no parameter.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with one argument- Returns:
TaskGraph
-
task
Adds task with one parameter.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with one argumentarg- Argument to the method- Returns:
TaskGraph
-
task
Adds task with two parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with two argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3> (String id, TornadoFunctions.Task3<T1, T2, T3> code, T1 arg1, T2 arg2, T3 arg3) Add task with three parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with three argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4> (String id, TornadoFunctions.Task4<T1, T2, T3, T4> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4) Adds task with four parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with four argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5> (String id, TornadoFunctions.Task5<T1, T2, T3, T4, T5> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) Adds task with five parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with five argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6> (String id, TornadoFunctions.Task6<T1, T2, T3, T4, T5, T6> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) Adds task with six parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with six argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6, T7> (String id, TornadoFunctions.Task7<T1, T2, T3, T4, T5, T6, T7> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) Adds task with seven parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with seven argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the methodarg7- Argument 7 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6, T7, T8> (String id, TornadoFunctions.Task8<T1, T2, T3, T4, T5, T6, T7, T8> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) Adds task with eight parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with eight argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the methodarg7- Argument 7 to the methodarg8- Argument 8 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6, T7, T8, T9> (String id, TornadoFunctions.Task9<T1, T2, T3, T4, T5, T6, T7, T8, T9> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) Adds task with nine parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with nine argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the methodarg7- Argument 7 to the methodarg8- Argument 8 to the methodarg9- Argument 9 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6, T7, T8, T9, T10> (String id, TornadoFunctions.Task10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10) Adds task with 10 parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with 10 argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the methodarg7- Argument 7 to the methodarg8- Argument 8 to the methodarg9- Argument 9 to the methodarg10- Argument 10 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6, T7, T8, T9, T10, T11> (String id, TornadoFunctions.Task11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11) It creates a task with 11 parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with 10 argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the methodarg7- Argument 7 to the methodarg8- Argument 8 to the methodarg9- Argument 9 to the methodarg10- Argument 10 to the methodarg11- Argument 11 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6, T7, T8, T9, T10, T11, T12> (String id, TornadoFunctions.Task12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12) It creates a task with 12 parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with 10 argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the methodarg7- Argument 7 to the methodarg8- Argument 8 to the methodarg9- Argument 9 to the methodarg10- Argument 10 to the methodarg11- Argument 11 to the methodarg12- Argument 12 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> (String id, TornadoFunctions.Task13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13) It creates a task with 13 parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with 10 argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the methodarg7- Argument 7 to the methodarg8- Argument 8 to the methodarg9- Argument 9 to the methodarg10- Argument 10 to the methodarg11- Argument 11 to the methodarg12- Argument 12 to the methodarg13- Argument 13 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> (String id, TornadoFunctions.Task14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14) It creates a task with 14 parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with 10 argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the methodarg7- Argument 7 to the methodarg8- Argument 8 to the methodarg9- Argument 9 to the methodarg10- Argument 10 to the methodarg11- Argument 11 to the methodarg12- Argument 12 to the methodarg13- Argument 13 to the methodarg14- Argument 14 to the method- Returns:
TaskGraph
-
task
public <T1,T2, TaskGraph taskT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> (String id, TornadoFunctions.Task15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> code, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15) It creates a task with 15 parameters.- Specified by:
taskin interfaceTaskGraphInterface- Parameters:
id- Task-idcode- Reference to an existing Java method with 15 argumentsarg1- Argument 1 to the methodarg2- Argument 2 to the methodarg3- Argument 3 to the methodarg4- Argument 4 to the methodarg5- Argument 5 to the methodarg6- Argument 6 to the methodarg7- Argument 7 to the methodarg8- Argument 8 to the methodarg9- Argument 9 to the methodarg10- Argument 10 to the methodarg11- Argument 11 to the methodarg12- Argument 12 to the methodarg13- Argument 13 to the methodarg14- Argument 14 to the methodarg15- Argument 15 to the method- Returns:
TaskGraph
-
prebuiltTask
public TaskGraph prebuiltTask(String id, String entryPoint, String filename, AccessorParameters accessorParameters) - Specified by:
prebuiltTaskin interfaceTaskGraphInterface- Parameters:
id- String that represents the task-id.entryPoint- Name of the kernel to be launched on the target device.filename- String that represents the path to the native source (e.g., the OpenCL C kernel).accessorParameters-AccessorParameterswith the type of accessor for each of the input parameters to the low-level kernel.- Returns:
TaskGraph
-
prebuiltTask
public TaskGraph prebuiltTask(String id, String entryPoint, String filename, AccessorParameters accessorParameters, int[] atomics) Add a pre-built OpenCL task into a task-schedule with atomics region.- Specified by:
prebuiltTaskin interfaceTaskGraphInterface- Parameters:
id- Task-identryPoint- Kernel's name of the entry pointfilename- Input OpenCL C KernelaccessorParameters-AccessorParameterswith the type of accessor for each of the input parameters to the low-level kernel.atomics- Atomics region.- Returns:
TaskGraph
-
getTaskGraphName
Obtains the task-schedule name that was assigned.- Specified by:
getTaskGraphNamein interfaceTaskGraphInterface- Returns:
String
-
transferToDevice
Tag a set of objects (Java objects) to be transferred to the device. There are three modes:DataTransferMode.FIRST_EXECUTION: it transfers data only the first execution of the task-graph (READ ONLY)DataTransferMode.EVERY_EXECUTION: it transfers data for every execution of the task-graph (READ/WRITE)- Specified by:
transferToDevicein interfaceTaskGraphInterface- Parameters:
mode- A mode fromDataTransferModeobjects- List of Java objects (usually arrays) to be transferred to the device.- Returns:
TaskGraph
-
consumeFromDevice
Tag a set of objects to be used directly from the device. It requires objects to be tagged as persisted objects from a previous taskgraph. This method ensures that the specified objects are consumed from the device and are not copied from the host.- Specified by:
consumeFromDevicein interfaceTaskGraphInterface- Parameters:
uniqueTaskGraphName- A unique identifier for the task graph.objects- List of Java objects (usually arrays) to be consumed from the device.- Returns:
TaskGraph
-
consumeFromDevice
- Specified by:
consumeFromDevicein interfaceTaskGraphInterface
-
transferToHost
Tag a set of objects (Java objects) to be transferred from the device to the host after the execution completes. There are two modes:DataTransferMode.EVERY_EXECUTION: transfers data for every execution of the task-graph (WRITE only)DataTransferMode.UNDER_DEMAND: it transfers data only under demand. Data are not transferred unless the execution-plan, anTornadoExecutionPlanobject, invokes the `transferToHost` function. This is used for optimization of data transfers.- Specified by:
transferToHostin interfaceTaskGraphInterface- Parameters:
mode- A mode fromDataTransferModeobjects- List of Java objects (usually arrays) to be transferred to the device.- Returns:
TaskGraph
-
persistOnDevice
Tags a set of objects to persist on the device without transferring them back to the host after execution.This method marks the objects as available on the device for future taskGraph executions without redundant data transfers. Data is not transferred to the host unless explicitly requested via the execution plan.
- Specified by:
persistOnDevicein interfaceTaskGraphInterface- Parameters:
objects- List of Java objects (usually arrays) to persist on the device.- Returns:
TaskGraph
-
snapshot
Function that closes a task-graph definition and creates an immutable task-graph ready for execution.- Specified by:
snapshotin interfaceTaskGraphInterface- Returns:
ImmutableTaskGraph
-
getArgumentsLookup
-
getProfileLog
-
getOutputs
-
isGridRegistered
public boolean isGridRegistered()
-