mirror of https://github.com/llvm/torch-mlir
Add -s flag to run e2e tests sequentially
A user might want to avoid the extra layer of multiprocessing libary for debugging purpose. In such cases, the -s flag can be used to force sequential execution.pull/850/head snapshot-20220512.446
parent
f15d257aac
commit
ec0e9e0bc7
|
@ -56,6 +56,10 @@ torch-mlir).
|
||||||
See `build_tools/torchscript_e2e_heavydep_tests/generate_serialized_tests.sh`
|
See `build_tools/torchscript_e2e_heavydep_tests/generate_serialized_tests.sh`
|
||||||
for more information on building these artifacts.
|
for more information on building these artifacts.
|
||||||
''')
|
''')
|
||||||
|
parser.add_argument('-s', '--sequential',
|
||||||
|
default=False,
|
||||||
|
action='store_true',
|
||||||
|
help='run e2e tests sequentially rather than in parallel')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -98,7 +102,7 @@ def main():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Run the tests.
|
# Run the tests.
|
||||||
results = run_tests(tests, config)
|
results = run_tests(tests, config, args.sequential)
|
||||||
|
|
||||||
# Report the test results.
|
# Report the test results.
|
||||||
failed = report_results(results, xfail_set, args.verbose)
|
failed = report_results(results, xfail_set, args.verbose)
|
||||||
|
|
|
@ -330,8 +330,10 @@ def run_workers_in_parallel(task_queue: mp.Queue, worker):
|
||||||
p.join()
|
p.join()
|
||||||
|
|
||||||
|
|
||||||
def run_tests(tests: List[Test], config: TestConfig) -> List[TestResult]:
|
def run_tests(tests: List[Test], config: TestConfig, sequential = False) -> List[TestResult]:
|
||||||
"""Invoke the given `Test`'s with the provided `TestConfig`."""
|
"""Invoke the given `Test`'s with the provided `TestConfig`."""
|
||||||
|
if sequential:
|
||||||
|
return [compile_and_run_test(test, config) for test in tests]
|
||||||
|
|
||||||
# To run e2e tests in parallel:
|
# To run e2e tests in parallel:
|
||||||
# The tests are put into a synchronized queue. Multiple worker processes are
|
# The tests are put into a synchronized queue. Multiple worker processes are
|
||||||
|
|
Loading…
Reference in New Issue