ParallelME Runtime Environment
Classes | Public Types | Public Member Functions | List of all members
Task Class Reference

#include <Task.hpp>

Classes

struct  Score
 

Public Types

typedef std::function< void(Device &, KernelHash &)> KernelFunction
 

Public Member Functions

 Task (const Task &)=delete
 
Taskoperator= (const Task &)=delete
 
 Task (Program::Vector &programs, Score score=Score())
 
TaskaddKernel (const std::string &name)
 
void setConfigFunction (KernelFunction configFunction)
 
void setFinishFunction (KernelFunction finishFunction)
 
const Scorescore ()
 
Kernelkernel (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)
 

Detailed Description

Represents a single task to be executed by the target device. Can be composed of multiple kernels.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

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.

Parameters
programsVector 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.
scoreHow good the task is to execute at each device type. By default the task is good to execute on all device types.

Member Function Documentation

Task* Task::addKernel ( const std::string &  name)

Adds a kernel to the task. The kernels are executed in the order they were added.

bool Task::hasDeviceID ( DeviceID  id)
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.

Kernel& Task::kernel ( const std::string &  name)
inline

Returns the kernel with the given name or throws an exception. This should only be used temporarily, and not stored.

const Score& Task::score ( )
inline

Returns the score of the task/

void Task::setConfigFunction ( KernelFunction  configFunction)
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.

void Task::setFinishFunction ( KernelFunction  finishFunction)
inline

This function gets the data back from the Task after it is executed by a worker.


The documentation for this class was generated from the following file: