Example #1
0
 def test_HAL03(self):
     """Do inference asynchronously(callback+wait)"""
     test_case = "HAL_03"
     case_path = os.path.join(HAL_TEST_CODE, test_case)
     case_name = "AsyncCallbackWaitV2"
     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()
Example #2
0
 def test_HAL16_tinyyolov1(self):
     """Do inference SyncTestFromMemoryV2"""
     test_case = "HAL_16"
     case_path = os.path.join(HAL_TEST_CODE, test_case)
     case_name = "SyncTestFromMemoryV2"
     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,
                                             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()
Example #3
0
 def test_HAL01(self):
     """Multiple client mix sync/async test with MyraidX Device"""
     test_case = "HAL_01"
     case_path = os.path.join(HAL_TEST_CODE, test_case + "-L")
     image_path = os.path.join(IMAGE_DIR, "pic{}google0".format(os.sep))
     graph_path = os.path.join(GRAPH_DIR, "google{}".format(os.sep))
     runtime = str(RUN_TIME)
     log_path, server = self.__run_server(test_case, is_cmake=True)
     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(8) and check.graph_num(2) \
             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()
Example #4
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()
Example #5
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()
Example #6
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()