From 3530b8659e756fec5a8c994206be43c934e06802 Mon Sep 17 00:00:00 2001 From: Hoa Nguyen Date: Tue, 13 Apr 2021 01:30:32 -0700 Subject: [PATCH] util: Fix checkpoint-tester.py checkpoint parameter checkpoint-tester script tests gem5's checkpoints by using gem5 to produce a series of checkpoints, each with a specified interval. After that, for all K > 1, each of K-th produced checkpoint is used by gem5 to produce the {K+1}-th checkpoint. The newly produced checkpoint will be compared against the {K+1}-th checkpoint that was previously produced. Previously, in the tester script, the inputs to `--take-checkpoints X,Y` was `(interval, interval)`. The intention was to restore the N-th checkpoint and to run the simulation for `interval` ticks. According to the current configs/common/Options.py file, `--take-checkpoints X,Y` means `X` is the starting tick of the simulation, while `Y` is the number of ticks to be simulated after tick `X`. Therefore, `X` should be the starting tick of the N-th checkpont, and this change addresses this problem. Change-Id: I1fd7c91c9454f42a4fb98aa878fb5e4ac7d238f3 Signed-off-by: Hoa Nguyen Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44449 Reviewed-by: Jason Lowe-Power Reviewed-by: Daniel Carvalho Maintainer: Jason Lowe-Power Tested-by: kokoro --- util/checkpoint-tester.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/util/checkpoint-tester.py b/util/checkpoint-tester.py index 2600644da9..58174693c6 100755 --- a/util/checkpoint-tester.py +++ b/util/checkpoint-tester.py @@ -55,12 +55,12 @@ # # Examples: # -# util/checkpoint-tester.py -i 400000 -- build//m5.opt \ -# configs/example/se.py -c tests/test-progs/hello/bin//tru64/hello \ +# util/checkpoint-tester.py -i 400000 -- build//gem5.opt \ +# configs/example/se.py -c tests/test-progs/hello/bin//linux/hello \ # --output=progout --errout=progerr # -# util/checkpoint-tester.py -i 200000000000 -- build//m5.opt \ -# configs/example/fs.py --script tests/halt.sh +# util/checkpoint-tester.py -i 200000000000 -- build//gem5.opt \ +# configs/example/fs.py --script configs/boot/halt.sh # @@ -94,12 +94,12 @@ m5_binary = args.cmdline[0] args = args.cmdline[1:] -initial_args = ['--take-checkpoints', '%d,%d' % (interval, interval)] +checkpoint_args = ['--take-checkpoints', '%d,%d' % (interval, interval)] cptdir = os.path.join(top_dir, 'm5out') print('===> Running initial simulation.') -subprocess.call([m5_binary] + ['-red', cptdir] + args + initial_args) +subprocess.call([m5_binary] + ['-red', cptdir] + args + checkpoint_args) dirs = os.listdir(cptdir) expr = re.compile('cpt\.([0-9]*)') @@ -117,8 +117,9 @@ cpts.sort() # less than tha number of checkpoints. for i in range(1, len(cpts)): print('===> Running test %d of %d.' % (i, len(cpts)-1)) + checkpoint_args = ['--take-checkpoints', '%d,%d' % (cpts[i], interval)] mydir = os.path.join(top_dir, 'test.%d' % i) - subprocess.call([m5_binary] + ['-red', mydir] + args + initial_args + + subprocess.call([m5_binary] + ['-red', mydir] + args + checkpoint_args + ['--max-checkpoints' , '1', '--checkpoint-dir', cptdir, '--checkpoint-restore', str(i)]) cpt_name = 'cpt.%d' % cpts[i]