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 <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44449
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Hoa Nguyen
2021-04-13 01:30:32 -07:00
parent 03a62e61d0
commit 3530b8659e

View File

@@ -55,12 +55,12 @@
#
# Examples:
#
# util/checkpoint-tester.py -i 400000 -- build/<ISA>/m5.opt \
# configs/example/se.py -c tests/test-progs/hello/bin/<isa>/tru64/hello \
# util/checkpoint-tester.py -i 400000 -- build/<ISA>/gem5.opt \
# configs/example/se.py -c tests/test-progs/hello/bin/<isa>/linux/hello \
# --output=progout --errout=progerr
#
# util/checkpoint-tester.py -i 200000000000 -- build/<ISA>/m5.opt \
# configs/example/fs.py --script tests/halt.sh
# util/checkpoint-tester.py -i 200000000000 -- build/<ISA>/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]