changeset f5e86115a07a in /z/repo/m5 details: http://repo.m5sim.org/m5?cmd=changeset;node=f5e86115a07a description: sim: fold checkpoint restore code into instantiate() The separate restoreCheckpoint() call is gone; just pass the checkpoint dir as an optional arg to instantiate(). This change is a precursor to some more extensive reworking of the startup code.
diffstat: configs/common/Simulation.py | 12 +++--------- src/python/m5/simulate.py | 14 ++++++-------- 2 files changed, 9 insertions(+), 17 deletions(-) diffs (75 lines): diff -r 89b6893554f5 -r f5e86115a07a configs/common/Simulation.py --- a/configs/common/Simulation.py Tue Aug 17 05:17:06 2010 -0700 +++ b/configs/common/Simulation.py Tue Aug 17 05:17:06 2010 -0700 @@ -190,8 +190,7 @@ for i in xrange(np): testsys.cpu[i].max_insts_any_thread = offset - m5.instantiate() - + checkpoint_dir = None if options.checkpoint_restore != None: from os.path import isdir, exists from os import listdir @@ -212,10 +211,6 @@ "cpt.%s.%s" % (options.bench, inst)) if not exists(checkpoint_dir): fatal("Unable to find checkpoint directory %s", checkpoint_dir) - - print "Restoring checkpoint ..." - m5.restoreCheckpoint(checkpoint_dir) - print "Done." else: dirs = listdir(cptdir) expr = re.compile('cpt\.([0-9]*)') @@ -234,10 +229,9 @@ ## Adjust max tick based on our starting tick maxtick = maxtick - int(cpts[cpt_num - 1]) + checkpoint_dir = joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1]) - ## Restore the checkpoint - m5.restoreCheckpoint(joinpath(cptdir, - "cpt.%s" % cpts[cpt_num - 1])) + m5.instantiate(checkpoint_dir) if options.standard_switch or cpu_class: if options.standard_switch: diff -r 89b6893554f5 -r f5e86115a07a src/python/m5/simulate.py --- a/src/python/m5/simulate.py Tue Aug 17 05:17:06 2010 -0700 +++ b/src/python/m5/simulate.py Tue Aug 17 05:17:06 2010 -0700 @@ -46,7 +46,7 @@ # The final hook to generate .ini files. Called from the user script # once the config is built. -def instantiate(): +def instantiate(ckpt_dir=None): root = objects.Root.getInstance() if not root: @@ -86,6 +86,11 @@ # We're done registering statistics. Enable the stats package now. stats.enable() + # Restore checkpoint (if any) + if ckpt_dir: + internal.core.unserializeAll(ckpt_dir) + need_resume.append(root) + # Reset to put the stats in a consistent state. stats.reset() @@ -160,13 +165,6 @@ internal.core.serializeAll(dir) resume(root) -def restoreCheckpoint(dir): - root = objects.Root.getInstance() - print "Restoring from checkpoint" - internal.core.unserializeAll(dir) - need_resume.append(root) - stats.reset() - def changeToAtomic(system): if not isinstance(system, (objects.Root, objects.System)): raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \ _______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev