1. 程式人生 > >mxnet 源碼閱讀 8

mxnet 源碼閱讀 8

engine cat shutdown handle notify nbsp down opera ice

mxnet/include/mxnet/engine.h

在名字空間 mxnet engine 中定義了抽象類Engine,用以規範接口,其接口有

NotifyShutdown

NewVariable

DeleteVariable

NewOperator

DeleteOperator

Push

PushAsync

PushSync

WaitForVar

WaitForAll

DeduplicateVarHandle

mxnet/src/engine/engine_impl.h

定義了多態實現的

Engine *CreateNaiveEngine

Engine *CreateThreadedEnginePolled

Engine *CreateThreadedEnginePerDevice

mxnet/src/engine/engine.cc

根據環境變量決定Engine *CreateEngine的選擇情況。有三種形式

CreateNaiveEngine,CreateThreadedEnginePooled,CreateThreadEnginePerDevice。

mxnet 源碼閱讀 8