[neurun] Introduce Config `EXECUTOR` (#4616)
author이한종/On-Device Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Thu, 7 Mar 2019 01:17:23 +0000 (10:17 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Thu, 7 Mar 2019 01:17:23 +0000 (10:17 +0900)
Introduce environment variable `EXECUTOR` to specify which executor to
use.

Now we can run with Dataflow Executor with these variables.

```bash
export CPU_MEMORY_PLANNER=Bump
export EXECUTOR=Dataflow
```

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/src/compiler/Compiler.cc
runtimes/neurun/src/util/config/Config.lst

index 6b49159..f469d93 100644 (file)
@@ -28,6 +28,7 @@
 #include "exec/Executor.h"
 #include "exec/DataflowExecutor.h"
 #include "exec/interp/Interpreter.h"
+#include "util/config/ConfigManager.h"
 
 namespace neurun
 {
@@ -67,7 +68,9 @@ void Compiler::compile(void)
 
   dot_dumper.dumpIfNeeded("after_lower");
 
-  const bool use_dataflow_executor = false; // TODO Read value from ConfigManager
+  const std::string executor_str =
+      config::ConfigManager::instance().get<std::string>(config::EXECUTOR);
+  const bool use_dataflow_executor = (executor_str == "Dataflow");
 
   // Compile for DataflowExecutor
   if (use_dataflow_executor)
index ca22f6c..ce995c5 100644 (file)
@@ -25,6 +25,7 @@ CONFIG(OP_BACKEND_ALLOPS       , std::string  , "none")
 CONFIG(DISABLE_COMPILE         , bool         , "0")
 CONFIG(NEURUN_LOG_ENABLE       , bool         , "0")
 CONFIG(CPU_MEMORY_PLANNER      , std::string  , "FirstFit")
+CONFIG(EXECUTOR                , std::string  , "Linear")
 
 
 // Auto-generate all operations