From 5cf3d188c600ea32137ec9eca3caf7df04c4de96 Mon Sep 17 00:00:00 2001 From: Jarred Allen Date: Mon, 1 Feb 2021 15:40:27 -0500 Subject: [PATCH] Parallelize regression-wally.p --- wally-pipelined/regression/regression-wally.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/wally-pipelined/regression/regression-wally.py b/wally-pipelined/regression/regression-wally.py index dc23232dc..d8f2489e6 100755 --- a/wally-pipelined/regression/regression-wally.py +++ b/wally-pipelined/regression/regression-wally.py @@ -11,11 +11,12 @@ # edit this line to add more configurations confignames = ["rv32ic", "rv64ic"] -import os +import multiprocessing, os fail = 0 -for config in confignames: +def test_config(config, print_res=True): + """Run the given config, and return 0 if it suceeds and 1 if it fails""" logname = "wally_"+config+".log" cmd = "vsim -c >" + logname +" < /dev/null" grepval = os.system(cmd) if (grepval): - fail = fail + 1 - print(logname+": failures detected") + if print_res:print(logname+": failures detected") + return 1 else: - print(logname+": Success") + if print_res:print(logname+": Success") + return 0 + +pool = multiprocessing.Pool(min(len(confignames), 12)) +fail = sum(pool.map(test_config, confignames)) if (fail): print ("Regression failed with " +str(fail)+ " failed configurations") + exit(1) else: print ("SUCCESS! All tests ran without failures") + exit(0)