ParallelME Runtime Environment
|
#include <Task.hpp>
Classes | |
struct | Score |
Public Types | |
typedef std::function< void(Device &, KernelHash &)> | KernelFunction |
Public Member Functions | |
Task (const Task &)=delete | |
Task & | operator= (const Task &)=delete |
Task (Program::Vector &programs, Score score=Score()) | |
Task * | addKernel (const std::string &name) |
void | setConfigFunction (KernelFunction configFunction) |
void | setFinishFunction (KernelFunction finishFunction) |
const Score & | score () |
Kernel & | kernel (const std::string &name) |
void | callConfigFunction (Device &device) |
Calls the configFunction currently set or does nothing if it wasn't set. | |
void | callFinishFunction (Device &device) |
Calls the finishFunction currently set or does nothing if it wasn't set. | |
const ProgramObjectMap & | programObjects () |
Returns the map of program objects. | |
const KernelVector & | kernels () |
Returns the kernels in the order of execution. | |
bool | hasDeviceType (DeviceType type) |
bool | hasDeviceID (DeviceID id) |
Represents a single task to be executed by the target device. Can be composed of multiple kernels.
typedef std::function<void (Device &, KernelHash &)> Task::KernelFunction |
Callback function called before the task is executed to configure the task or after the task is executed to get the buffers back.
Task::Task | ( | Program::Vector & | programs, |
Score | score = Score() |
||
) |
Creates a task. A task is composed of multiple kernels that are dependent of each other. Different tasks can be executed concurrently.
programs | Vector of the programs available for the task execution. This makes all the target devices that the programs supports available for execution for the task. The order in which they are specified in the vector also defines which programs have preference for execution. For example, if you create a task with an OpenCL program specified first and then a RenderScript program, OpenCL will be used for both CPU and GPU devices if available, and RenderScript will be used as a CPU device only if OpenCL CPU wasn't found. However, if you create a task with a RenderScript program specified first and then a RenderScript program, RenderScript will be used as the CPU device and OpenCL as the GPU device. |
score | How good the task is to execute at each device type. By default the task is good to execute on all device types. |
Task* Task::addKernel | ( | const std::string & | name | ) |
Adds a kernel to the task. The kernels are executed in the order they were added.
|
inline |
Returns if the Task has the given device ID.
bool Task::hasDeviceType | ( | DeviceType | type | ) |
Returns if the Task already has a ProgramObject with the given device type.
|
inline |
Returns the kernel with the given name or throws an exception. This should only be used temporarily, and not stored.
|
inline |
Returns the score of the task/
|
inline |
This function prepares the Task to be executed by a worker. It is called after the scheduler decides where the task will run on, so that buffers can be created and set to the Kernels with only one copy for each device.
|
inline |
This function gets the data back from the Task after it is executed by a worker.