diff options
author | Lisa Hsu <hsul@eecs.umich.edu> | 2006-10-09 00:12:16 -0400 |
---|---|---|
committer | Lisa Hsu <hsul@eecs.umich.edu> | 2006-10-09 00:12:16 -0400 |
commit | 67a114fc29662d262a3d7ae867f6ee4c25c0ce8f (patch) | |
tree | 05d163d8eee78ca1272b4258c3f13b4d7072bf19 /configs | |
parent | 67c20dd9ddb5ce2f7f8a80246841684f69320019 (diff) | |
download | gem5-67a114fc29662d262a3d7ae867f6ee4c25c0ce8f.tar.xz |
add in checkpoint restoration option, you can restore a checkpoint by giving a directory, and then giving a checkpoint number, the earliest checkpoint is 1, the latest is N. the default checkpoint directory is the cwd.
so you can restore by a command line like this:
m5.opt fs.py --checkpoint_dir="/my/ckpt/dir" -c 3
configs/example/fs.py:
add in checkpoint restoration option, you can restore a checkpoint by giving a directory, and then giving a checkpoint number, the earliest checkpoint is 1, the latest is N.
--HG--
extra : convert_revision : bf9c8d3265a3875cdfb6a878005baa7ae29af90d
Diffstat (limited to 'configs')
-rw-r--r-- | configs/example/fs.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/configs/example/fs.py b/configs/example/fs.py index 6db26a02a..0dadcbe1b 100644 --- a/configs/example/fs.py +++ b/configs/example/fs.py @@ -55,6 +55,8 @@ parser.add_option("--etherdump", action="store", type="string", dest="etherdump" "ethernet traffic") parser.add_option("--checkpoint_dir", action="store", type="string", help="Place all checkpoints in this absolute directory") +parser.add_option("-c", "--checkpoint", action="store", type="int", + help="restore from checkpoint <N>") (options, args) = parser.parse_args() @@ -115,6 +117,31 @@ else: m5.instantiate(root) +if options.checkpoint: + from os.path import isdir + from os import listdir, getcwd + import re + if options.checkpoint_dir: + cptdir = options.checkpoint_dir + else: + cptdir = getcwd() + + if not isdir(cptdir): + m5.panic("checkpoint dir %s does not exist!" % cptdir) + + dirs = listdir(cptdir) + expr = re.compile('cpt.([0-9]*)') + cpts = [] + for dir in dirs: + match = expr.match(dir) + if match: + cpts.append(match.group(1)) + + if options.checkpoint > len(cpts): + m5.panic('Checkpoint %d not found' % options.checkpoint) + + m5.restoreCheckpoint(root, "/".join([cptdir, "cpt.%s" % cpts[options.checkpoint - 1]])) + if options.maxtick: maxtick = options.maxtick elif options.maxtime: |