Exemplo n.º 1
0
 def test_HAL13(self):
     """Do inference asynchronously(wait)"""
     test_case = "HAL_13"
     case_path = os.path.join(HAL_TEST_CODE, test_case)
     case_name = "AsyncWaitTestV2"
     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))
     runtime = str(RUN_TIME)
     log_path, server = self.__run_server(test_case)
     if server.is_ready():
         Client(log_path=log_path).inference(case_path=case_path,
                                             case_name=case_name,
                                             image_path=image_path,
                                             graph_path=graph_path,
                                             runtime=runtime)
     time.sleep(RUN_TIME + 5)
     check = CheckResult(log_path)
     result = check.server_is_running() and check.error_tasks() and check.client_num() 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()
Exemplo n.º 2
0
 def test_HAL07(self):
     """Check task ID information"""
     test_case = "HAL_07"
     config = ModifyDict({"task_snapshot_mode": "base"}).add()
     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))
     runtime = str(RUN_TIME)
     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,
                                             runtime=runtime)
     time.sleep(RUN_TIME + 5)
     check = CheckResult(log_path)
     result = check.server_is_running() and check.keywords("TaskId=") and check.error_tasks() \
              and check.client_num() and check.graph_num() 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()
Exemplo n.º 3
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()
Exemplo n.º 4
0
 def test_HAL11_tinyyolov1(self):
     """Do inference asynchronously"""
     test_case = "HAL_11"
     case_path = os.path.join(HAL_TEST_CODE, test_case)
     image_path = os.path.join(IMAGE_DIR, "448x448")
     graph_path = os.path.join(GRAPH_DIR, "yolo_graph.blob")
     runtime = str(RUN_TIME)
     log_path, server = self.__run_server(test_case)
     if server.is_ready():
         Client(log_path=log_path).inference(case_path=case_path,
                                             image_path=image_path,
                                             graph_path=graph_path,
                                             runtime=runtime)
     time.sleep(RUN_TIME + 5)
     check = CheckResult(log_path)
     result = check.server_is_running() and check.error_tasks() and check.client_num() and check.graph_num() \
              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()
Exemplo n.º 5
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()
Exemplo n.º 6
0
 def test_HAL08(self):
     """Check Squeeze mode"""
     test_case = "HAL_08"
     case_path = os.path.join(HAL_TEST_CODE, test_case)
     runtime = "300"
     log_path, server = self.__run_server(test_case)
     if server.is_ready():
         for thread_index in range(1, 9):
             image_path = os.path.join(IMAGE_DIR, "pic{}google{}".format(os.sep, str(thread_index)))
             graph_path = os.path.join(GRAPH_DIR, "google{}google{}.blob".format(os.sep, str(thread_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(20)
     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(8) \
              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()