19
19
import re
20
20
import shutil
21
21
import subprocess
22
- import functools
23
22
import multiprocessing
24
23
import json
25
24
@@ -294,14 +293,6 @@ def make_spec(obj_file: str):
294
293
return [make_spec (path ) for path in paths ]
295
294
296
295
297
- def extract_artifacts (obj : TrainingIRExtractor , llvm_objcopy_path : str ,
298
- cmd_filter : str , thinlto_build : str ,
299
- cmd_section_name : str ,
300
- bitcode_section_name ) -> Optional [str ]:
301
- return obj .extract (llvm_objcopy_path , cmd_filter , thinlto_build ,
302
- cmd_section_name , bitcode_section_name )
303
-
304
-
305
296
def run_extraction (objs : List [TrainingIRExtractor ], num_workers : int ,
306
297
llvm_objcopy_path : str , cmd_filter : str , thinlto_build : str ,
307
298
cmd_section_name : str , bitcode_section_name : str ):
@@ -323,15 +314,13 @@ def run_extraction(objs: List[TrainingIRExtractor], num_workers: int,
323
314
bitcode_section_name: The name of the bitcode section created by the
324
315
bitcode embedding.
325
316
"""
326
- extract_artifacts_function = functools .partial (
327
- extract_artifacts ,
328
- llvm_objcopy_path = llvm_objcopy_path ,
329
- cmd_filter = cmd_filter ,
330
- thinlto_build = thinlto_build ,
331
- cmd_section_name = cmd_section_name ,
332
- bitcode_section_name = bitcode_section_name )
317
+
318
+ def extract_artifacts (obj : TrainingIRExtractor ) -> Optional [str ]:
319
+ return obj .extract (llvm_objcopy_path , cmd_filter , thinlto_build ,
320
+ cmd_section_name , bitcode_section_name )
321
+
333
322
with multiprocessing .Pool (num_workers ) as pool :
334
- relative_output_paths = pool .map (extract_artifacts_function , objs )
323
+ relative_output_paths = pool .map (extract_artifacts , objs )
335
324
pool .close ()
336
325
pool .join ()
337
326
return relative_output_paths
0 commit comments