Simulation.py (7530:89b6893554f5) Simulation.py (7531:f5e86115a07a)
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

--- 176 unchanged lines hidden (view full) ---

185 options.take_checkpoints = checkpoint_inst
186 else:
187 options.take_checkpoints = offset
188 # Set all test cpus with the right number of instructions
189 # for the upcoming simulation
190 for i in xrange(np):
191 testsys.cpu[i].max_insts_any_thread = offset
192
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

--- 176 unchanged lines hidden (view full) ---

185 options.take_checkpoints = checkpoint_inst
186 else:
187 options.take_checkpoints = offset
188 # Set all test cpus with the right number of instructions
189 # for the upcoming simulation
190 for i in xrange(np):
191 testsys.cpu[i].max_insts_any_thread = offset
192
193 m5.instantiate()
194
193 checkpoint_dir = None
195 if options.checkpoint_restore != None:
196 from os.path import isdir, exists
197 from os import listdir
198 import re
199
200 if not isdir(cptdir):
201 fatal("checkpoint dir %s does not exist!", cptdir)
202

--- 4 unchanged lines hidden (view full) ---

207 if testsys.cpu[0].workload[0].simpoint == 0:
208 fatal('Unable to find simpoint')
209 inst += int(testsys.cpu[0].workload[0].simpoint)
210
211 checkpoint_dir = joinpath(cptdir,
212 "cpt.%s.%s" % (options.bench, inst))
213 if not exists(checkpoint_dir):
214 fatal("Unable to find checkpoint directory %s", checkpoint_dir)
194 if options.checkpoint_restore != None:
195 from os.path import isdir, exists
196 from os import listdir
197 import re
198
199 if not isdir(cptdir):
200 fatal("checkpoint dir %s does not exist!", cptdir)
201

--- 4 unchanged lines hidden (view full) ---

206 if testsys.cpu[0].workload[0].simpoint == 0:
207 fatal('Unable to find simpoint')
208 inst += int(testsys.cpu[0].workload[0].simpoint)
209
210 checkpoint_dir = joinpath(cptdir,
211 "cpt.%s.%s" % (options.bench, inst))
212 if not exists(checkpoint_dir):
213 fatal("Unable to find checkpoint directory %s", checkpoint_dir)
215
216 print "Restoring checkpoint ..."
217 m5.restoreCheckpoint(checkpoint_dir)
218 print "Done."
219 else:
220 dirs = listdir(cptdir)
221 expr = re.compile('cpt\.([0-9]*)')
222 cpts = []
223 for dir in dirs:
224 match = expr.match(dir)
225 if match:
226 cpts.append(match.group(1))
227
228 cpts.sort(lambda a,b: cmp(long(a), long(b)))
229
230 cpt_num = options.checkpoint_restore
231
232 if cpt_num > len(cpts):
233 fatal('Checkpoint %d not found', cpt_num)
234
235 ## Adjust max tick based on our starting tick
236 maxtick = maxtick - int(cpts[cpt_num - 1])
214 else:
215 dirs = listdir(cptdir)
216 expr = re.compile('cpt\.([0-9]*)')
217 cpts = []
218 for dir in dirs:
219 match = expr.match(dir)
220 if match:
221 cpts.append(match.group(1))
222
223 cpts.sort(lambda a,b: cmp(long(a), long(b)))
224
225 cpt_num = options.checkpoint_restore
226
227 if cpt_num > len(cpts):
228 fatal('Checkpoint %d not found', cpt_num)
229
230 ## Adjust max tick based on our starting tick
231 maxtick = maxtick - int(cpts[cpt_num - 1])
232 checkpoint_dir = joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1])
237
233
238 ## Restore the checkpoint
239 m5.restoreCheckpoint(joinpath(cptdir,
240 "cpt.%s" % cpts[cpt_num - 1]))
234 m5.instantiate(checkpoint_dir)
241
242 if options.standard_switch or cpu_class:
243 if options.standard_switch:
244 print "Switch at instruction count:%s" % \
245 str(testsys.cpu[0].max_insts_any_thread)
246 exit_event = m5.simulate()
247 elif cpu_class and options.fast_forward:
248 print "Switch at instruction count:%s" % \

--- 131 unchanged lines hidden ---
235
236 if options.standard_switch or cpu_class:
237 if options.standard_switch:
238 print "Switch at instruction count:%s" % \
239 str(testsys.cpu[0].max_insts_any_thread)
240 exit_event = m5.simulate()
241 elif cpu_class and options.fast_forward:
242 print "Switch at instruction count:%s" % \

--- 131 unchanged lines hidden ---