6 #ifndef MXNET_ENGINE_H_
7 #define MXNET_ENGINE_H_
41 (*callback_)(engine_, param_);
46 friend class ::mxnet::Engine;
48 void (*callback_)(
Engine *,
void *);
79 typedef std::function<void(RunContext)>
SyncFn;
81 typedef std::function<void(RunContext, CallbackOnComplete)>
AsyncFn;
93 virtual void NotifyShutdown() = 0;
112 std::vector<VarHandle>
const& const_vars,
113 std::vector<VarHandle>
const& mutable_vars,
122 virtual void DeleteOperator(
OprHandle op) = 0;
143 std::vector<VarHandle>
const& const_vars,
144 std::vector<VarHandle>
const& mutable_vars,
146 int priority = 0) = 0;
158 virtual void DeleteVariable(
SyncFn delete_fn,
166 virtual void WaitForVar(
VarHandle var) = 0;
170 virtual void WaitForAll() = 0;
185 static std::shared_ptr<Engine> _GetSharedRef();
197 template<
typename SyncFn>
199 std::vector<VarHandle>
const& const_vars,
200 std::vector<VarHandle>
const& mutable_vars,
206 }, exec_ctx, const_vars, mutable_vars, prop, priority);
216 void (*callback)(
Engine *,
void *),
void *param) {
218 ret.callback_ = callback;
224 #endif // DMLC_USE_CXX11
226 #endif // MXNET_ENGINE_H_
FnProperty
Function property, used to hint what action is pushed to engine.
Definition: engine.h:58
std::function< void(RunContext)> SyncFn
Synchronous operation to pass to engine.
Definition: engine.h:79
std::function< void(RunContext, CallbackOnComplete)> AsyncFn
Asynchronous operation to pass to engine.
Definition: engine.h:81
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)
Push an synchronous operation to the engine.
Definition: engine.h:198
Asynchronous function call.
CallbackOnComplete CreateCallback(void(*callback)(Engine *, void *), void *param)
factory function to create OnComplete callback.
Definition: engine.h:215
void operator()() const
involve the callback
Definition: engine.h:40
execution time context. The information needed in runtime for actual execution.
Definition: base.h:181
virtual ~Engine() noexcept(false)
virtual destructor
Definition: engine.h:172
#define MXNET_API
define compatible keywords in g++ Used to support g++-4.6 and g++4.7
Definition: base.h:62
Copy operation from GPU to other devices.
engine::OprHandle OprHandle
Operator pointer.
Definition: engine.h:85
engine::VarHandle VarHandle
Variable pointer.
Definition: engine.h:83
Var * VarHandle
Variable pointer type, usually hold by user used to specify dependencies.
Definition: engine.h:27
Prioritized sync operation on CPU.
engine::CallbackOnComplete CallbackOnComplete
callback on complete
Definition: engine.h:77
Dependency engine that schedules operations.
Definition: engine.h:74
OnComplete Callback to the engine, called by AsyncFn when action completes.
Definition: engine.h:36
configuation of mxnet as well as basic data structure.
Context information about the execution enviroment.
Definition: base.h:90
Copy operation from CPU to other devices.
Opr * OprHandle
Operator pointer type, usually hold by user.
Definition: engine.h:31