[neurun] Replace EnvVar with ConfigManager (#4045)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Fri, 14 Dec 2018 07:09:43 +0000 (16:09 +0900)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 14 Dec 2018 07:09:43 +0000 (16:09 +0900)
Replace EnvVar with ConfigManager. Some default values are revised to
work in the same way as before.

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

index b3cd5a7..9d1b46c 100644 (file)
@@ -22,7 +22,7 @@
 #include <typeindex>
 
 #include "logging.h"
-#include "misc/EnvVar.h"
+#include "util/config/ConfigManager.h"
 #include "backend/BackendManager.h"
 #include "backend/interface/IStageGenerator.h"
 
@@ -38,8 +38,8 @@ public:
   {
     _backend_manager = std::make_shared<backend::BackendManager>(operands);
 
-    const auto &backend_all_str =
-        ::nnfw::misc::EnvVar{std::string("OP_BACKEND_ALLOPS")}.asString("none");
+    const auto backend_all_str =
+        config::ConfigManager::instance().get<std::string>("OP_BACKEND_ALLOPS");
     if (backend_all_str.compare("none") != 0)
     {
       VERBOSE(BackendResolver) << "Use backend for all ops: " << backend_all_str << std::endl;
@@ -58,7 +58,7 @@ public:
   if (IsNnApi)                                                                                    \
   {                                                                                               \
     const auto &backend_str =                                                                     \
-        ::nnfw::misc::EnvVar{std::string("OP_BACKEND_") + #NnApiName}.asString("acl_cl");         \
+        config::ConfigManager::instance().get<std::string>("OP_BACKEND_" #NnApiName);             \
     auto backend = _backend_manager->get(backend_str);                                            \
     VERBOSE(BackendResolver) << "backend for " << #NnApiName << ": " << backend_str << std::endl; \
     _gen_map[typeid(graph::operation::InternalName)] = backend;                                   \
index 0688766..cf5a048 100644 (file)
@@ -26,7 +26,7 @@
 #include "dumper/dot/DotDumper.h"
 #include "linear/Linear.h"
 
-#include "misc/EnvVar.h"
+#include "util/config/ConfigManager.h"
 
 namespace neurun
 {
@@ -50,7 +50,7 @@ void Compiler::compile(void)
 
   // dump graph to .dot
   // TODO : These can be moved to another place.
-  const auto &dotdump_env = ::nnfw::misc::EnvVar{"GRAPH_DOT_DUMP"}.asInt(0);
+  const auto dotdump_env = config::ConfigManager::instance().get<int>("GRAPH_DOT_DUMP");
   if (dotdump_env)
   {
     neurun::dumper::dot::DotDumper dot_dumper(graph);
index d1a46af..95cee51 100644 (file)
 
 //     Name                    | Type         | Default
 CONFIG(GRAPH_DOT_DUMP          , int          , "0")
-CONFIG(BACKENDS                , std::string  , "cpu")
-CONFIG(OP_BACKEND_ALLOPS       , std::string  , "cpu")
+CONFIG(BACKENDS                , std::string  , "cpu;acl_cl")
+CONFIG(OP_BACKEND_ALLOPS       , std::string  , "none")
 
 
 // Auto-generate all operations
 
 #define OP(InternalName, IsNnApi, NnApiName) \
-    CONFIG(OP_BACKEND_ ## NnApiName, std::string, std::string{"cpu"})
+    CONFIG(OP_BACKEND_ ## NnApiName, std::string, "acl_cl")
 #include "graph/operation/Op.lst"
 #undef OP