Simulation.py (9151:a4faa7dde56c) | Simulation.py (9156:38dd0780322a) |
---|---|
1# Copyright (c) 2006-2008 The Regents of The University of Michigan 2# Copyright (c) 2010 Advanced Micro Devices, Inc. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 139 unchanged lines hidden (view full) --- 148 if cpt_num > len(cpts): 149 fatal('Checkpoint %d not found', cpt_num) 150 151 maxtick = maxtick - int(cpts[cpt_num - 1]) 152 checkpoint_dir = joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1]) 153 154 return maxtick, checkpoint_dir 155 | 1# Copyright (c) 2006-2008 The Regents of The University of Michigan 2# Copyright (c) 2010 Advanced Micro Devices, Inc. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 139 unchanged lines hidden (view full) --- 148 if cpt_num > len(cpts): 149 fatal('Checkpoint %d not found', cpt_num) 150 151 maxtick = maxtick - int(cpts[cpt_num - 1]) 152 checkpoint_dir = joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1]) 153 154 return maxtick, checkpoint_dir 155 |
156def scriptCheckpoints(options): | 156def scriptCheckpoints(options, cptdir): |
157 if options.at_instruction or options.simpoint: 158 checkpoint_inst = int(options.take_checkpoints) 159 160 # maintain correct offset if we restored from some instruction 161 if options.checkpoint_restore != None: 162 checkpoint_inst += options.checkpoint_restore 163 164 print "Creating checkpoint at inst:%d" % (checkpoint_inst) --- 10 unchanged lines hidden (view full) --- 175 m5.checkpoint(joinpath(cptdir, "cpt.%s.%d" % \ 176 (options.bench, checkpoint_inst))) 177 print "Checkpoint written." 178 179 else: 180 when, period = options.take_checkpoints.split(",", 1) 181 when = int(when) 182 period = int(period) | 157 if options.at_instruction or options.simpoint: 158 checkpoint_inst = int(options.take_checkpoints) 159 160 # maintain correct offset if we restored from some instruction 161 if options.checkpoint_restore != None: 162 checkpoint_inst += options.checkpoint_restore 163 164 print "Creating checkpoint at inst:%d" % (checkpoint_inst) --- 10 unchanged lines hidden (view full) --- 175 m5.checkpoint(joinpath(cptdir, "cpt.%s.%d" % \ 176 (options.bench, checkpoint_inst))) 177 print "Checkpoint written." 178 179 else: 180 when, period = options.take_checkpoints.split(",", 1) 181 when = int(when) 182 period = int(period) |
183 num_checkpoints = 0 |
|
183 184 exit_event = m5.simulate(when) 185 exit_cause = exit_event.getCause() 186 while exit_cause == "checkpoint": 187 exit_event = m5.simulate(when - m5.curTick()) 188 exit_cause = exit_event.getCause() 189 190 if exit_cause == "simulate() limit reached": 191 m5.checkpoint(joinpath(cptdir, "cpt.%d")) 192 num_checkpoints += 1 193 194 sim_ticks = when | 184 185 exit_event = m5.simulate(when) 186 exit_cause = exit_event.getCause() 187 while exit_cause == "checkpoint": 188 exit_event = m5.simulate(when - m5.curTick()) 189 exit_cause = exit_event.getCause() 190 191 if exit_cause == "simulate() limit reached": 192 m5.checkpoint(joinpath(cptdir, "cpt.%d")) 193 num_checkpoints += 1 194 195 sim_ticks = when |
195 num_checkpoints = 0 | |
196 max_checkpoints = options.max_checkpoints 197 198 while num_checkpoints < max_checkpoints and \ 199 exit_cause == "simulate() limit reached": 200 if (sim_ticks + period) > maxtick: 201 exit_event = m5.simulate(maxtick - sim_ticks) 202 exit_cause = exit_event.getCause() 203 break --- 279 unchanged lines hidden (view full) --- 483 else: 484 cptdir = getcwd() 485 486 if options.take_checkpoints != None : 487 # Checkpoints being taken via the command line at <when> and at 488 # subsequent periods of <period>. Checkpoint instructions 489 # received from the benchmark running are ignored and skipped in 490 # favor of command line checkpoint instructions. | 196 max_checkpoints = options.max_checkpoints 197 198 while num_checkpoints < max_checkpoints and \ 199 exit_cause == "simulate() limit reached": 200 if (sim_ticks + period) > maxtick: 201 exit_event = m5.simulate(maxtick - sim_ticks) 202 exit_cause = exit_event.getCause() 203 break --- 279 unchanged lines hidden (view full) --- 483 else: 484 cptdir = getcwd() 485 486 if options.take_checkpoints != None : 487 # Checkpoints being taken via the command line at <when> and at 488 # subsequent periods of <period>. Checkpoint instructions 489 # received from the benchmark running are ignored and skipped in 490 # favor of command line checkpoint instructions. |
491 exit_cause = scriptCheckpoints(options) | 491 exit_cause = scriptCheckpoints(options, cptdir) |
492 else: 493 if options.fast_forward: 494 m5.stats.reset() 495 print "**** REAL SIMULATION ****" 496 497 # If checkpoints are being taken, then the checkpoint instruction 498 # will occur in the benchmark code it self. 499 if options.repeat_switch and maxtick > options.repeat_switch: 500 exit_cause = repeatSwitch(testsys, repeat_switch_cpu_list, 501 maxtick, options.repeat_switch) 502 else: 503 exit_cause = benchCheckpoints(options, maxtick, cptdir) 504 505 print 'Exiting @ tick %i because %s' % (m5.curTick(), exit_cause) 506 if options.checkpoint_at_end: 507 m5.checkpoint(joinpath(cptdir, "cpt.%d")) | 492 else: 493 if options.fast_forward: 494 m5.stats.reset() 495 print "**** REAL SIMULATION ****" 496 497 # If checkpoints are being taken, then the checkpoint instruction 498 # will occur in the benchmark code it self. 499 if options.repeat_switch and maxtick > options.repeat_switch: 500 exit_cause = repeatSwitch(testsys, repeat_switch_cpu_list, 501 maxtick, options.repeat_switch) 502 else: 503 exit_cause = benchCheckpoints(options, maxtick, cptdir) 504 505 print 'Exiting @ tick %i because %s' % (m5.curTick(), exit_cause) 506 if options.checkpoint_at_end: 507 m5.checkpoint(joinpath(cptdir, "cpt.%d")) |