mirror of https://github.com/openXC7/prjxray.git
utils: parallelize all roi parts generation
Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
This commit is contained in:
parent
f63752fe3e
commit
6c4188a520
|
|
@ -9,13 +9,26 @@
|
|||
#
|
||||
# SPDX-License-Identifier: ISC
|
||||
import argparse
|
||||
import yaml
|
||||
import subprocess
|
||||
import multiprocessing as mp
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import yaml
|
||||
|
||||
from prjxray import util
|
||||
|
||||
|
||||
def worker(arglist):
|
||||
part, cwd = arglist
|
||||
cmd = "make roi_only"
|
||||
|
||||
env = os.environ.copy()
|
||||
env['XRAY_PART'] = part
|
||||
|
||||
print("running subprocess")
|
||||
subprocess.run(cmd.split(' '), check=True, env=env, cwd=cwd)
|
||||
|
||||
|
||||
def main():
|
||||
"""Rois all parts for a family by calling "make roi_only" over all parts
|
||||
with the same device as XRAY_PART.
|
||||
|
|
@ -36,12 +49,17 @@ def main():
|
|||
if device['fabric'] == information['device']:
|
||||
valid_devices.append(name)
|
||||
|
||||
tasks = []
|
||||
|
||||
for part, data in util.get_parts(db_root).items():
|
||||
if data['device'] in valid_devices:
|
||||
command = "make roi_only"
|
||||
env['XRAY_PART'] = part
|
||||
cwd = os.getenv('XRAY_FUZZERS_DIR')
|
||||
subprocess.run(command.split(' '), check=True, env=env, cwd=cwd)
|
||||
|
||||
tasks.append((part, cwd))
|
||||
|
||||
with mp.Pool() as pool:
|
||||
for _ in pool.imap_unordered(worker, tasks):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Reference in New Issue