()
| 194 | |
| 195 | |
| 196 | def main(): |
| 197 | pool = ThreadPoolExecutor(max_workers=GPU_NUM) |
| 198 | |
| 199 | test_lines = [] |
| 200 | for test_ans_file in test_ans_file_list: |
| 201 | print(test_ans_file) |
| 202 | with open(test_ans_file, "r") as f: |
| 203 | lines = f.readlines() |
| 204 | test_lines += lines |
| 205 | |
| 206 | batch_num = len(test_lines)//GPU_NUM + int(len(test_lines)%GPU_NUM>0) |
| 207 | |
| 208 | obj_list = [] |
| 209 | for idx in range(GPU_NUM): |
| 210 | batch_test_lines = test_lines[idx*batch_num:(idx+1)*batch_num] |
| 211 | obj = pool.submit(test_process, batch_test_lines, gpu_index=idx) |
| 212 | obj_list.append(obj) |
| 213 | |
| 214 | for future in as_completed(obj_list): |
| 215 | # 暂时留在这里,但是其实没有返回数据 |
| 216 | data = future.result() |
| 217 | |
| 218 | print_result() |
| 219 | |
| 220 | if __name__ == "__main__": |
| 221 | main() |
no test coverage detected