mxnet
|
Dependency engine that schedules operations. More...
#include <engine.h>
Public Types | |
typedef engine::CallbackOnComplete | CallbackOnComplete |
callback on complete More... | |
typedef std::function< void(RunContext)> | SyncFn |
Synchronous operation to pass to engine. More... | |
typedef std::function< void(RunContext, CallbackOnComplete)> | AsyncFn |
Asynchronous operation to pass to engine. More... | |
typedef engine::VarHandle | VarHandle |
Variable pointer. More... | |
typedef engine::OprHandle | OprHandle |
Operator pointer. More... | |
Public Member Functions | |
virtual void | NotifyShutdown ()=0 |
Notify the engine about a shutdown, This can help engine to print less messages into display. More... | |
virtual void | Stop () |
Stop all workers in the engine. More... | |
virtual void | Start () |
Restart all workers in the engine. More... | |
virtual VarHandle | NewVariable ()=0 |
Allocate a new variable, the variable can then be used to schedule the operation concurrently via dependency patterns. More... | |
virtual OprHandle | NewOperator (AsyncFn fn, std::vector< VarHandle > const &const_vars, std::vector< VarHandle > const &mutable_vars, FnProperty prop=FnProperty::kNormal, const char *opr_name=nullptr, bool wait=false)=0 |
Create a new operator. The returned operator could be saved externally so that it could be resued for scheduling. More... | |
virtual void | DeleteOperator (OprHandle op)=0 |
Delete the given operator. More... | |
virtual void | Push (OprHandle op, Context exec_ctx, int priority=0, bool profiling=false)=0 |
Push an operator to the engine. More... | |
virtual void | PushAsync (AsyncFn exec_fun, Context exec_ctx, std::vector< VarHandle > const &const_vars, std::vector< VarHandle > const &mutable_vars, FnProperty prop=FnProperty::kNormal, int priority=0, const char *opr_name=nullptr, bool wait=false)=0 |
Push an asynchronous operation to the engine. More... | |
virtual void | DeleteVariable (SyncFn delete_fn, Context exec_ctx, VarHandle var)=0 |
Schedule the deletion of a variable. More... | |
virtual void | WaitForVar (VarHandle var)=0 |
Wait for a variable. More... | |
virtual void | WaitForAll ()=0 |
Wait until all the activity of engine finishes. More... | |
virtual | ~Engine () noexcept(false) |
virtual destructor More... | |
virtual void | PushSync (SyncFn exec_fn, Context exec_ctx, std::vector< VarHandle > const &const_vars, std::vector< VarHandle > const &mutable_vars, FnProperty prop=FnProperty::kNormal, int priority=0, const char *opr_name=nullptr) |
Push an synchronous operation to the engine. More... | |
CallbackOnComplete | CreateCallback (void(*callback)(Engine *, void *), void *param) |
factory function to create OnComplete callback. More... | |
void | DeduplicateVarHandle (std::vector< engine::VarHandle > *read_vars, std::vector< engine::VarHandle > *write_vars) |
virtual int | bulk_size () const |
query current limit for bulk size More... | |
virtual int | set_bulk_size (int) |
set maximum limit for bulk size More... | |
Static Public Member Functions | |
static Engine * | Get () |
static std::shared_ptr< Engine > | _GetSharedRef () |
Get shared pointer reference to engine singleton. Most user should not call this function. This function is called by another singleton X who requires engine to be destructed after X. More... | |
Dependency engine that schedules operations.
typedef std::function<void(RunContext, CallbackOnComplete)> mxnet::Engine::AsyncFn |
Asynchronous operation to pass to engine.
callback on complete
Operator pointer.
typedef std::function<void(RunContext)> mxnet::Engine::SyncFn |
Synchronous operation to pass to engine.
Variable pointer.
|
inlinevirtualnoexcept |
virtual destructor
|
static |
Get shared pointer reference to engine singleton. Most user should not call this function. This function is called by another singleton X who requires engine to be destructed after X.
|
inlinevirtual |
query current limit for bulk size
|
inline |
factory function to create OnComplete callback.
callback | th static callback function. |
param | the paramter passed to callback. |
|
inline |
|
pure virtual |
Delete the given operator.
op | The operator to delete. |
The delete will not happen immediately, but will wait until all the operations using this operator are completed.
|
pure virtual |
Schedule the deletion of a variable.
The delete will not happen immediately, but will wait until all the operations depending on var are completed.
delete_fn | A function that will be called after the variable is deleted. |
exec_ctx | Execution context. |
var | The variable to be deleted. |
|
pure virtual |
Create a new operator. The returned operator could be saved externally so that it could be resued for scheduling.
fn | The execution function. |
const_vars | The variables that current operation will use but not mutate. |
mutable_vars | The variables that current operation will mutate. |
prop | Property of the function. |
opr_name | The operator name. |
wait | Whether this is a WaitForVar operation |
|
pure virtual |
Allocate a new variable, the variable can then be used to schedule the operation concurrently via dependency patterns.
|
pure virtual |
Notify the engine about a shutdown, This can help engine to print less messages into display.
User do not have to call this function.
|
pure virtual |
Push an operator to the engine.
op | The operator to push. |
exec_ctx | Execution context. |
priority | Priority of the action, as hint to the engine. |
profiling | The variable indicate whether to profile this operator. |
|
pure virtual |
Push an asynchronous operation to the engine.
exec_fun | Execution function, this function takes a parameter on_complete that must be called when the execution completes. |
exec_ctx | Execution context. |
const_vars | The variables that current operation will use but not mutate. |
mutable_vars | The variables that current operation will mutate. |
prop | Property of the function. |
priority | Priority of the action, as hint to the engine. |
opr_name | The operator name. |
wait | Whether this is a WaitForVar operation |
|
inlinevirtual |
Push an synchronous operation to the engine.
exec_fn | Execution function that executes the operation. |
exec_ctx | Execution context. |
const_vars | The variables that current operation will use but not mutate. |
mutable_vars | The variables that current operation will mutate. |
prop | Property of the function. |
priority | Priority of the action, as hint to the engine. |
opr_name | The operator name. |
SyncFn | the synchronous function to be pushed. |
|
inlinevirtual |
set maximum limit for bulk size
|
inlinevirtual |
Restart all workers in the engine.
|
inlinevirtual |
Stop all workers in the engine.
|
pure virtual |
Wait until all the activity of engine finishes.
|
pure virtual |
Wait for a variable.
var | The variable we should wait for. This function returns when the variable is ready. |