예제 #1
0
 def test_HAL04(self):
     """Mix Sync/Async clients random connect/disconnect test"""
     test_case = "HAL_04"
     case_path = os.path.join(HAL_TEST_CODE, test_case)
     image_path = os.path.join(IMAGE_DIR, "pic{}google0".format(os.sep))
     graph_path = os.path.join(GRAPH_DIR,
                               "google{}google1.blob".format(os.sep))
     log_path, server = self.__run_server(test_case)
     if server.is_ready():
         for thread_index in range(1, 17):
             runtime = str(random.randint(50, 60))
             Client(log_path=log_path, thread_index=thread_index).inference(
                 case_path=case_path,
                 image_path=image_path,
                 graph_path=graph_path,
                 runtime=runtime)
     while Client.is_running():
         time.sleep(5)
     check = CheckResult(log_path, thread_num=16)
     result = check.server_is_running() and check.error_tasks() and check.client_num(256) and check.graph_num() \
              and check.device_num(DEVICE_NUM) and check.load_graph_time()
     check.write_result()
     self.assertTrue(
         result,
         msg="Please see '{}{}hal_result.csv' for detail.".format(
             log_path, os.sep))
     server.stop_run()
예제 #2
0
 def test_HAL09(self):
     """Check the loading time for cached graph."""
     test_case = "HAL_09"
     case_path = os.path.join(HAL_TEST_CODE, test_case)
     image_path = os.path.join(IMAGE_DIR, "pic{}google0".format(os.sep))
     runtime = "60"
     log_path, server = self.__run_server(test_case)
     if server.is_ready():
         for thread_index in range(1, 9):
             if thread_index > 4:
                 index = thread_index - 4
             else:
                 index = thread_index
             graph_path = os.path.join(
                 GRAPH_DIR,
                 "google{}google{}.blob".format(os.sep, str(index)))
             Client(log_path=log_path, thread_index=thread_index).inference(
                 case_path=case_path,
                 image_path=image_path,
                 graph_path=graph_path,
                 runtime=runtime)
             time.sleep(5)
     while Client.is_running():
         time.sleep(5)
     check = CheckResult(log_path, thread_num=8)
     result = check.server_is_running() and check.error_tasks() and check.client_num(8) and check.graph_num(4) \
              and check.device_num(DEVICE_NUM) and check.load_graph_time() and check.all_device_running(DEVICE_NUM)
     check.write_result()
     self.assertTrue(
         result,
         msg="Please see '{}{}hal_result.csv' for detail.".format(
             log_path, os.sep))
     server.stop_run()
예제 #3
0
 def test_HAL10(self):
     """Check the performance for cached graph"""
     test_case = "HAL_10"
     config = ModifyDict({"graph_snapshot_mode": 1}).sub()
     case_path = os.path.join(HAL_TEST_CODE, test_case)
     image_path = os.path.join(IMAGE_DIR, "pic{}google0".format(os.sep))
     graph_path = os.path.join(GRAPH_DIR, "google{}".format(os.sep))
     log_path, server = self.__run_server(test_case, config)
     if server.is_ready():
         Client(log_path=log_path).inference(case_path=case_path,
                                             image_path=image_path,
                                             graph_path=graph_path)
     while Client.is_running():
         time.sleep(5)
     check = CheckResult(log_path)
     result = check.server_is_running() and check.error_tasks() and check.client_num(1) \
              and check.graph_num(102) and check.all_device_running(DEVICE_NUM) and check.load_graph_time()
     check.write_result()
     self.assertTrue(result, msg="Please see '{}{}hal_result.csv' for detail.".format(log_path, os.sep))
     server.stop_run()