ParallelME Runtime Environment
|
#include <Runtime.hpp>
Public Member Functions | |
Runtime (JavaVM *jvm=nullptr, jobject androidContext=nullptr, std::shared_ptr< Scheduler > &&sched=std::make_shared< SchedulerFCFS >()) | |
Runtime (const Runtime &)=delete | |
Runtime & | operator= (const Runtime &)=delete |
void | submitTask (std::unique_ptr< Task > task) |
void | finish () |
DeviceVector & | devices () |
The Runtime class is responsible for managing all the contexts used by ParallelME's runtime to execute a given kernel. It encapsulates the OpenCL structures and the RenderScript context, for example, and is needed when creating a CLProgram or a RSProgram. When creating the runtime, a pointer to the JavaVM and the android context can be passed to the constructor, along with changing the scheduler policy to one different to the default (FCFS). To make the runtime run in an Android device, at least the JavaVM pointer must be given, and to support RenderScript a pointer to the android context (the "this" in the main activity) is also required.
|
inline |
Constructs the runtime.
sched | the scheduler to be used by the runtime, defaulting to First Come First Served. |
jvm | A pointer to the JavaVM. If this is specified, the worker threads of the runtime will be linked to the JavaVM. |
androidContext | The Android Context class of the application. This normally is the "this" member of the main activity. If this is not specified, programming platforms that depend on this context (such as RenderScript) will not be used as potential devices. This context also depends on specifying a valid JavaVM on the first parameter. |
|
inline |
Returns the available devices from all platforms.
void Runtime::finish | ( | ) |
Waits for all tasks to finish before returning.
void Runtime::submitTask | ( | std::unique_ptr< Task > | task | ) |
Submits a task for execution. The runtime claims ownership to this class, which will be deleted by it after the execution.