[nnpkg-run] set default backend using OP_BACKEND_ALLOPS environment var. (#8003)
author이상규/On-Device Lab(SR)/Principal Engineer/삼성전자 <sg5.lee@samsung.com>
Thu, 10 Oct 2019 04:32:39 +0000 (13:32 +0900)
committer이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Thu, 10 Oct 2019 04:32:39 +0000 (13:32 +0900)
`nnpackage-run` (in short, `nnpkg-run`) uses `nnfw_session` from nnfw APIs.
It uses GeneralConfigSource. It means we need to set configuration using nnfw APIs.
Thus, it reads from environment var and set default backends.

Signed-off-by: Sanggyu Lee <sg5.lee@samsung.com>
tests/tools/nnpackage_run/src/nnpackage_run.cc

index 97edebf..3e849cd 100644 (file)
@@ -70,6 +70,9 @@ int main(const int argc, char **argv)
 
   nnfw_session *session = nullptr;
   NNPR_ENSURE_STATUS(nnfw_create_session(&session));
+  char *default_backend = std::getenv("OP_BACKEND_ALLOPS");
+  if (default_backend)
+    NNPR_ENSURE_STATUS(nnfw_set_default_backend(session, default_backend));
   NNPR_ENSURE_STATUS(nnfw_load_model_from_file(session, nnpackage_path.c_str()));
 
   uint32_t num_inputs;