Simulation.py (5378:7c058e69f257) | Simulation.py (5822:05ffa2c3c800) |
---|---|
1# Copyright (c) 2006-2008 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 64 unchanged lines hidden (view full) --- 73 if options.checkpoint_dir: 74 cptdir = options.checkpoint_dir 75 elif m5.options.outdir: 76 cptdir = m5.options.outdir 77 else: 78 cptdir = getcwd() 79 80 if options.fast_forward and options.checkpoint_restore != None: | 1# Copyright (c) 2006-2008 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 64 unchanged lines hidden (view full) --- 73 if options.checkpoint_dir: 74 cptdir = options.checkpoint_dir 75 elif m5.options.outdir: 76 cptdir = m5.options.outdir 77 else: 78 cptdir = getcwd() 79 80 if options.fast_forward and options.checkpoint_restore != None: |
81 m5.panic("Error: Can't specify both --fast-forward and --checkpoint-restore") | 81 m5.fatal("Error: Can't specify both --fast-forward and --checkpoint-restore") |
82 83 if options.standard_switch and not options.caches: | 82 83 if options.standard_switch and not options.caches: |
84 m5.panic("Error: Must specify --caches when using --standard-switch") | 84 m5.fatal("Error: Must specify --caches when using --standard-switch") |
85 86 np = options.num_cpus 87 max_checkpoints = options.max_checkpoints 88 switch_cpus = None 89 90 if cpu_class: 91 switch_cpus = [cpu_class(defer_registration=True, cpu_id=(np+i)) 92 for i in xrange(np)] --- 31 unchanged lines hidden (view full) --- 124 if options.checkpoint_restore != None: 125 testsys.cpu[i].max_insts_any_thread = 1 126 # Fast forward to specified location if we are not restoring 127 elif options.fast_forward: 128 testsys.cpu[i].max_insts_any_thread = int(options.fast_forward) 129 # Fast forward to a simpoint (warning: time consuming) 130 elif options.simpoint: 131 if testsys.cpu[i].workload[0].simpoint == 0: | 85 86 np = options.num_cpus 87 max_checkpoints = options.max_checkpoints 88 switch_cpus = None 89 90 if cpu_class: 91 switch_cpus = [cpu_class(defer_registration=True, cpu_id=(np+i)) 92 for i in xrange(np)] --- 31 unchanged lines hidden (view full) --- 124 if options.checkpoint_restore != None: 125 testsys.cpu[i].max_insts_any_thread = 1 126 # Fast forward to specified location if we are not restoring 127 elif options.fast_forward: 128 testsys.cpu[i].max_insts_any_thread = int(options.fast_forward) 129 # Fast forward to a simpoint (warning: time consuming) 130 elif options.simpoint: 131 if testsys.cpu[i].workload[0].simpoint == 0: |
132 m5.panic('simpoint not found') | 132 m5.fatal('simpoint not found') |
133 testsys.cpu[i].max_insts_any_thread = \ 134 testsys.cpu[i].workload[0].simpoint 135 # No distance specified, just switch 136 else: 137 testsys.cpu[i].max_insts_any_thread = 1 138 139 # warmup period 140 if options.warmup_insts: --- 17 unchanged lines hidden (view full) --- 158 # set the checkpoint in the cpu before m5.instantiate is called 159 if options.take_checkpoints != None and \ 160 (options.simpoint or options.at_instruction): 161 offset = int(options.take_checkpoints) 162 # Set an instruction break point 163 if options.simpoint: 164 for i in xrange(np): 165 if testsys.cpu[i].workload[0].simpoint == 0: | 133 testsys.cpu[i].max_insts_any_thread = \ 134 testsys.cpu[i].workload[0].simpoint 135 # No distance specified, just switch 136 else: 137 testsys.cpu[i].max_insts_any_thread = 1 138 139 # warmup period 140 if options.warmup_insts: --- 17 unchanged lines hidden (view full) --- 158 # set the checkpoint in the cpu before m5.instantiate is called 159 if options.take_checkpoints != None and \ 160 (options.simpoint or options.at_instruction): 161 offset = int(options.take_checkpoints) 162 # Set an instruction break point 163 if options.simpoint: 164 for i in xrange(np): 165 if testsys.cpu[i].workload[0].simpoint == 0: |
166 m5.panic('no simpoint for testsys.cpu[%d].workload[0]' % i) | 166 m5.fatal('no simpoint for testsys.cpu[%d].workload[0]', i) |
167 checkpoint_inst = int(testsys.cpu[i].workload[0].simpoint) + offset 168 testsys.cpu[i].max_insts_any_thread = checkpoint_inst 169 # used for output below 170 options.take_checkpoints = checkpoint_inst 171 else: 172 options.take_checkpoints = offset 173 # Set all test cpus with the right number of instructions 174 # for the upcoming simulation 175 for i in xrange(np): 176 testsys.cpu[i].max_insts_any_thread = offset 177 178 m5.instantiate(root) 179 180 if options.checkpoint_restore != None: 181 from os.path import isdir, exists 182 from os import listdir 183 import re 184 185 if not isdir(cptdir): | 167 checkpoint_inst = int(testsys.cpu[i].workload[0].simpoint) + offset 168 testsys.cpu[i].max_insts_any_thread = checkpoint_inst 169 # used for output below 170 options.take_checkpoints = checkpoint_inst 171 else: 172 options.take_checkpoints = offset 173 # Set all test cpus with the right number of instructions 174 # for the upcoming simulation 175 for i in xrange(np): 176 testsys.cpu[i].max_insts_any_thread = offset 177 178 m5.instantiate(root) 179 180 if options.checkpoint_restore != None: 181 from os.path import isdir, exists 182 from os import listdir 183 import re 184 185 if not isdir(cptdir): |
186 m5.panic("checkpoint dir %s does not exist!" % cptdir) | 186 m5.fatal("checkpoint dir %s does not exist!", cptdir) |
187 188 if options.at_instruction: 189 checkpoint_dir = joinpath(cptdir, "cpt.%s.%s" % \ 190 (options.bench, options.checkpoint_restore)) 191 if not exists(checkpoint_dir): | 187 188 if options.at_instruction: 189 checkpoint_dir = joinpath(cptdir, "cpt.%s.%s" % \ 190 (options.bench, options.checkpoint_restore)) 191 if not exists(checkpoint_dir): |
192 m5.panic("Unable to find checkpoint directory %s" % \ | 192 m5.fatal("Unable to find checkpoint directory %s", |
193 checkpoint_dir) 194 195 print "Restoring checkpoint ..." 196 m5.restoreCheckpoint(root, checkpoint_dir) 197 print "Done." 198 elif options.simpoint: 199 # assume workload 0 has the simpoint 200 if testsys.cpu[0].workload[0].simpoint == 0: | 193 checkpoint_dir) 194 195 print "Restoring checkpoint ..." 196 m5.restoreCheckpoint(root, checkpoint_dir) 197 print "Done." 198 elif options.simpoint: 199 # assume workload 0 has the simpoint 200 if testsys.cpu[0].workload[0].simpoint == 0: |
201 m5.panic('Unable to find simpoint') | 201 m5.fatal('Unable to find simpoint') |
202 203 options.checkpoint_restore += \ 204 int(testsys.cpu[0].workload[0].simpoint) 205 206 checkpoint_dir = joinpath(cptdir, "cpt.%s.%d" % \ 207 (options.bench, options.checkpoint_restore)) 208 if not exists(checkpoint_dir): | 202 203 options.checkpoint_restore += \ 204 int(testsys.cpu[0].workload[0].simpoint) 205 206 checkpoint_dir = joinpath(cptdir, "cpt.%s.%d" % \ 207 (options.bench, options.checkpoint_restore)) 208 if not exists(checkpoint_dir): |
209 m5.panic("Unable to find checkpoint directory %s.%s" % \ 210 (options.bench, options.checkpoint_restore)) | 209 m5.fatal("Unable to find checkpoint directory %s.%s", 210 options.bench, options.checkpoint_restore) |
211 212 print "Restoring checkpoint ..." 213 m5.restoreCheckpoint(root,checkpoint_dir) 214 print "Done." 215 else: 216 dirs = listdir(cptdir) 217 expr = re.compile('cpt\.([0-9]*)') 218 cpts = [] 219 for dir in dirs: 220 match = expr.match(dir) 221 if match: 222 cpts.append(match.group(1)) 223 224 cpts.sort(lambda a,b: cmp(long(a), long(b))) 225 226 cpt_num = options.checkpoint_restore 227 228 if cpt_num > len(cpts): | 211 212 print "Restoring checkpoint ..." 213 m5.restoreCheckpoint(root,checkpoint_dir) 214 print "Done." 215 else: 216 dirs = listdir(cptdir) 217 expr = re.compile('cpt\.([0-9]*)') 218 cpts = [] 219 for dir in dirs: 220 match = expr.match(dir) 221 if match: 222 cpts.append(match.group(1)) 223 224 cpts.sort(lambda a,b: cmp(long(a), long(b))) 225 226 cpt_num = options.checkpoint_restore 227 228 if cpt_num > len(cpts): |
229 m5.panic('Checkpoint %d not found' % cpt_num) | 229 m5.fatal('Checkpoint %d not found', cpt_num) |
230 231 ## Adjust max tick based on our starting tick 232 maxtick = maxtick - int(cpts[cpt_num - 1]) 233 234 ## Restore the checkpoint 235 m5.restoreCheckpoint(root, 236 joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1])) 237 --- 125 unchanged lines hidden --- | 230 231 ## Adjust max tick based on our starting tick 232 maxtick = maxtick - int(cpts[cpt_num - 1]) 233 234 ## Restore the checkpoint 235 m5.restoreCheckpoint(root, 236 joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1])) 237 --- 125 unchanged lines hidden --- |