[CONF] Remove test_mode configuration
authorDongju Chae <dongju.chae@samsung.com>
Fri, 22 Nov 2019 10:13:21 +0000 (19:13 +0900)
committer임근식/On-Device Lab(SR)/Principal Engineer/삼성전자 <geunsik.lim@samsung.com>
Mon, 25 Nov 2019 01:42:56 +0000 (10:42 +0900)
This commit removes test_mode configuration cuz it's no longer used.
Now, NPU Engine runs with either NPU Emulation (Ubuntu 16.04) or real
NPU device (FastModel)

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
meson.build
meson_options.txt
npu-engine.ini.in
src/core/ne-conf.c
src/core/ne-conf.h

index dcb8839..715898e 100644 (file)
@@ -73,11 +73,6 @@ ne_install_conf.set('INCLUDE_INSTALL_DIR', ne_includedir)
 ne_install_conf.set('RESV_MEM_SIZE', get_option('resv_mem_size'))
 ne_install_conf.set('WORKING_DIR', get_option('working_dir'))
 ne_install_conf.set('LOG_DIR', get_option('log_dir'))
-if get_option('enable_npu_emul')
-  ne_install_conf.set('TEST_MODE', true)
-else
-  ne_install_conf.set('TEST_MODE', get_option('enable_test_mode'))
-endif
 
 # Install .ini
 configure_file(input: 'npu-engine.ini.in', output: 'npu-engine.ini',
index c23c9f6..4acfb5b 100644 (file)
@@ -2,5 +2,4 @@ option('comm_opt', type : 'string', value : 'ip')
 option('resv_mem_size', type : 'string', value : '0')
 option('working_dir', type : 'string', value : '/tmp/')
 option('log_dir', type : 'string', value : '/tmp/')
-option('enable_test_mode', type : 'boolean', value : true)
 option('enable_npu_emul', type : 'boolean', value : false)
index 90661f8..6c3f981 100644 (file)
@@ -2,4 +2,3 @@
 resv_mem_size=@RESV_MEM_SIZE@
 working_dir=@WORKING_DIR@
 log_dir=@LOG_DIR@
-test_mode=@TEST_MODE@
index c248960..6ee69ca 100644 (file)
 #define INI_PATH                "/etc/npu-engine.ini"
 
 #define DEFAULT_RESV_MEM_SIZE   0   /* default mode is the CMA allocation */
-#define DEFAULT_TEST_MODE       1   /* test mode is enabled in default for unit tests */
 #define DEFAULT_WORKING_DIR     "/tmp/"
 #define DEFAULT_LOG_DIR         "/tmp/"
 
 #define ENV_RESV_MEM_SIZE       "NE_RESV_MEM_SIZE"
 #define ENV_WORKING_DIR         "NE_WORKING_DIR"
 #define ENV_LOG_DIR             "NE_LOG_DIR"
-#define ENV_TEST_MODE           "NE_TEST_MODE"
 
 static conf_t config;
 const conf_t *conf = &config;
@@ -42,13 +40,12 @@ const conf_t *conf = &config;
  * @param[in] resv_mem_size config string for reserved mem size
  * @param[in] working_dir config string for working dir
  * @param[in] log_dir config string for log dir
- * @param[in] test_mode config string for test mode
  * @param[out] c The configuration object to be updated.
  * @note if a config param is NULL, it is not set. so use default one.
  */
 static void
 load_conf_each (const char *resv_mem_size, const char *working_dir,
-                const char *log_dir, const int test_mode, conf_t *c)
+                const char *log_dir, conf_t *c)
 {
   if (resv_mem_size) {
     uint64_t val;
@@ -83,9 +80,6 @@ load_conf_each (const char *resv_mem_size, const char *working_dir,
     strncpy (c->log_dir, log_dir, strlen(log_dir));
     c->log_dir[strlen(log_dir)] = '\x00';
   }
-
-  if (test_mode != -1)
-    c->test_mode = test_mode;
 }
 
 /**
@@ -98,9 +92,8 @@ static void load_conf_ini(dictionary *ini, conf_t *c)
   const char *resv_mem_size = iniparser_getstring(ini, "main:resv_mem_size", NULL);
   const char *working_dir = iniparser_getstring(ini, "main:working_dir", NULL);
   const char *log_dir = iniparser_getstring(ini, "main:log_dir", NULL);
-  int test_mode = iniparser_getboolean(ini, "main:test_mode", -1);
 
-  load_conf_each (resv_mem_size, working_dir, log_dir, test_mode, c);
+  load_conf_each (resv_mem_size, working_dir, log_dir, c);
 }
 
 /**
@@ -112,17 +105,8 @@ static void load_conf_envvar(conf_t *c)
   const char *resv_mem_size = getenv (ENV_RESV_MEM_SIZE);
   const char *working_dir = getenv (ENV_WORKING_DIR);
   const char *log_dir = getenv (ENV_LOG_DIR);
-  const char *test_mode_str = getenv (ENV_TEST_MODE);
-  int test_mode = -1;
-
-  /* the below is iniparser's getboolean condition */
-  if (test_mode_str) {
-    test_mode = (test_mode_str[0] == '1'
-        || test_mode_str[0] == 't' || test_mode_str[0] == 'T'
-        || test_mode_str[0] == 'y' || test_mode_str[0] == 'Y');
-  }
 
-  load_conf_each (resv_mem_size, working_dir, log_dir, test_mode, c);
+  load_conf_each (resv_mem_size, working_dir, log_dir, c);
 }
 
 /**
@@ -138,8 +122,6 @@ static void load_conf_default(void)
 
   config.reserved_mem_size = DEFAULT_RESV_MEM_SIZE;
 
-  config.test_mode = DEFAULT_TEST_MODE;
-
   strncpy (config.working_dir, DEFAULT_WORKING_DIR, strlen(DEFAULT_WORKING_DIR));
   config.working_dir[strlen(DEFAULT_WORKING_DIR)] = '\x00';
 
@@ -181,13 +163,3 @@ int load_conf(const char *inipath)
 
   return 0;
 }
-
-/**
- * @brief Check if the current running mose is 'test'
- * @return 1 if in the 'test' mode, otherwise 0
- * @note The behavior of calling before loading default configuration is undefined.
- */
-int is_test_mode(void)
-{
-  return config.test_mode;
-}
index 3240a32..7d04cd3 100644 (file)
@@ -34,7 +34,6 @@ typedef struct {
     COMM_SOCIP,
     COMM_PCIE,
   } communication_method; /**< Determined at build-time. Not configurable at runtime. The activated N1x plugin. */
-  int test_mode;  /**< NE_TEST_MODE, [main] test_mode, indicates whether NE runs in test mode */
   char working_dir[MAX_DIR_LEN]; /**< NE_WORKING_DIR, [main] working_dir, the path where the daemon is executed */
   char log_dir[MAX_DIR_LEN]; /**< NE_LOG_DIR, [main] log_dir, the path where log files are created */
 } conf_t;
@@ -50,11 +49,4 @@ extern const conf_t *conf; /** Users cannot modify this. */
  */
 int load_conf(const char *inipath);
 
-/**
- * @brief Check if the current running mose is 'test'
- * @return 1 if in the 'test' mode, otherwise 0
- * @note The behavior of calling before loading default configuration is undefined.
- */
-int is_test_mode(void);
-
 #endif /* NE_CONF_H__ */