gem5-users@gem5.org

The gem5 Users mailing list

View all threads

Periodically generating checkpoints based on instructions executed

KS
Kshitij Sudan
Tue, Feb 12, 2013 12:21 AM

Hi,

I'm trying to stop the gem5 simulation periodically based on number of
instructions executed and create checkpoints.
I've put together this functionality based on examples in the
Simulate.py script and my changes look like this:

     .
     .
     exit_event = m5.simulate()
     exit_cause = exit_event.getCause()
     print "first exit cause = %s" % exit_cause

    while exit_cause == "a thread reached the max instruction count" :
         print "Creating checkpoint at inst:%d" % (checkpoint_inst)
         m5.checkpoint(joinpath(cptdir, "cpt.%s.%d" % 

(options.bench, checkpoint_inst)))
print "Checkpoint written."

         # Set all cpus with number of instructions to simulate 

before checkpointing
checkpoint_inst += period
for i in xrange(options.num_cpus):
testsys.cpu[i].max_insts = checkpoint_inst
print "set checkpoint_inst to %d for CPU %d" %
(testsys.cpu[i].max_insts_any_thread, i)

         # simulate
         print "Starting simulation again ...."
         exit_event = m5.simulate()
         exit_cause = exit_event.getCause()
     .
     .

These changes however fail to generate the checkpoints periodically.
Only one checkpoint is generated with this code.

I've cloned the repository recently (about a monthago) and I'm
simulating an ARM VExpress_EMM machine in FS mode. My command line to
launchgem5 is below. It is supposed to generate the first checkpoint
checkpoint after 1000 instructions from start, and then periodically
after every 1000 instructions:

./build/ARM/gem5.fast -d m5out_inst configs/example/fs.py
--kernel=/gem5/FSimages/vmlinux-3.3-arm-vexpress-emm-pcie
--machine-type=VExpress_EMM --num-cpus=1 --mem-size=2047MB
--disk-image=/gem5/FSimages/disks/arm-ubuntu-natty-headless.img
--checkpoint-dir=./inst_chkpts --at-instruction
--take-checkpoints=1000,1000 -b test_benchmark

This issueis very similar to one discussed in this gem5-users thread
previously >>
http://comments.gmane.org/gmane.comp.emulators.m5.users/8662

I've also experimented with m5.stats.dump() followed by m5.stats.reset()
as suggested in the thread, however it doesn't seem to be working. I've
also tried changing the CPU model from AtomicSimple to Timing and
Detailed to no avail.

Any suggestions?

Thanks,
-Kshitij

Hi, I'm trying to stop the gem5 simulation periodically based on number of instructions executed and create checkpoints. I've put together this functionality based on examples in the Simulate.py script and my changes look like this: . . exit_event = m5.simulate() exit_cause = exit_event.getCause() print "first exit cause = %s" % exit_cause while exit_cause == "a thread reached the max instruction count" : print "Creating checkpoint at inst:%d" % (checkpoint_inst) m5.checkpoint(joinpath(cptdir, "cpt.%s.%d" % (options.bench, checkpoint_inst))) print "Checkpoint written." # Set all cpus with number of instructions to simulate before checkpointing checkpoint_inst += period for i in xrange(options.num_cpus): testsys.cpu[i].max_insts = checkpoint_inst print "set checkpoint_inst to %d for CPU %d" % (testsys.cpu[i].max_insts_any_thread, i) # simulate print "Starting simulation again ...." exit_event = m5.simulate() exit_cause = exit_event.getCause() . . These changes however fail to generate the checkpoints periodically. Only one checkpoint is generated with this code. I've cloned the repository recently (about a monthago) and I'm simulating an ARM VExpress_EMM machine in FS mode. My command line to launchgem5 is below. It is supposed to generate the first checkpoint checkpoint after 1000 instructions from start, and then periodically after every 1000 instructions: ./build/ARM/gem5.fast -d m5out_inst configs/example/fs.py --kernel=/gem5/FSimages/vmlinux-3.3-arm-vexpress-emm-pcie --machine-type=VExpress_EMM --num-cpus=1 --mem-size=2047MB --disk-image=/gem5/FSimages/disks/arm-ubuntu-natty-headless.img --checkpoint-dir=./inst_chkpts --at-instruction --take-checkpoints=1000,1000 -b test_benchmark This issueis very similar to one discussed in this gem5-users thread previously >> http://comments.gmane.org/gmane.comp.emulators.m5.users/8662 I've also experimented with m5.stats.dump() followed by m5.stats.reset() as suggested in the thread, however it doesn't seem to be working. I've also tried changing the CPU model from AtomicSimple to Timing and Detailed to no avail. Any suggestions? Thanks, -Kshitij
GY
Gabriel Yessin
Tue, Feb 12, 2013 1:22 AM

I don't know if this helps but I'm currently able to get this working with
my own configurations (not VExpress_EMM). Just pulled from the repo a few
days ago, maybe try cloning the newest version.

gem5 compiled Feb  5 2013 00:53:58
gem5 started Feb 11 2013 20:18:54
gem5 executing on pyramid3.local
command line: ./build/ARM/gem5.fast -v --dump-config=config.ini
--outdir=m5out configs/example/fs.py --take-checkpoints=10,10 -b bbench-gb
--kernel=/home/gyessin/m5/system/binaries/vmlinux.smp.mouse.arm
--frame-capture --checkpoint-dir=checkpoint
--disk-image=/home/gyessin/m5/system/disks/ARMv7a-Gingerbread-Android.SMP.mouse.nolock.img

Global frequency set at 1000000000000 ticks per second
info: kernel located at:
/home/gyessin/bbench1site/dist_google/m5/system/binaries/vmlinux.smp.mouse.arm
warn: Sockets disabled, not accepting vnc client connections
warn: Sockets disabled, not accepting terminal connections
warn: Sockets disabled, not accepting gdb connections
info: Using bootloader at address 0x80000000
info: Entering event queue @ 0.  Starting simulation...
Writing checkpoint
info: Entering event queue @ 10.  Starting simulation...
Writing checkpoint
info: Entering event queue @ 20.  Starting simulation...
Writing checkpoint

On Mon, Feb 11, 2013 at 7:21 PM, Kshitij Sudan <k.sudan(a)samsung.com> wrote:

Hi,

I'm trying to stop the gem5 simulation periodically based on number of
instructions executed and create checkpoints.
I've put together this functionality based on examples in the Simulate.py
script and my changes look like this:

     .
     .
     exit_event = m5.simulate()
     exit_cause = exit_event.getCause()
     print "first exit cause = %s" % exit_cause

    while exit_cause == "a thread reached the max instruction count" :
         print "Creating checkpoint at inst:%d" % (checkpoint_inst)
         m5.checkpoint(joinpath(cptdir, "cpt.%s.%d" % (options.bench,

checkpoint_inst)))
print "Checkpoint written."

         # Set all cpus with number of instructions to simulate before

checkpointing
checkpoint_inst += period
for i in xrange(options.num_cpus):
testsys.cpu[i].max_insts = checkpoint_inst
print "set checkpoint_inst to %d for CPU %d" %
(testsys.cpu[i].max_insts_any_thread, i)

         # simulate
         print "Starting simulation again ...."
         exit_event = m5.simulate()
         exit_cause = exit_event.getCause()
     .
     .

These changes however fail to generate the checkpoints periodically. Only
one checkpoint is generated with this code.

I've cloned the repository recently (about a month ago) and I'm simulating
an ARM VExpress_EMM machine in FS mode. My command line to launch gem5 is
below. It is supposed to generate the first checkpoint checkpoint after
1000 instructions from start, and then periodically after every 1000 inst
ructions:

./build/ARM/gem5.fast -d m5out_inst configs/example/fs.py
--kernel=/gem5/FSimages/vmlinux-3.3-arm-vexpress-emm-pcie
--machine-type=VExpress_EMM --num-cpus=1 --mem-size=2047MB
--disk-image=/gem5/FSimages/disks/arm-ubuntu-natty-headless.img
--checkpoint-dir=./inst_chkpts --at-instruction --take-checkpoints=1000,1000
-b test_benchmark

This issue is very similar to one discussed in this gem5-users thread
previously >>
http://comments.gmane.org/gmane.comp.emulators.m5.users/8662

I've also experimented with m5.stats.dump() followed by m5.stats.reset()
as suggested in the thread, however it doesn't seem to be working. I've
also tried changing the CPU model from AtomicSimple to Timing and Detailed
to no avail.

Any suggestions?

Thanks,
-Kshitij


gem5-users mailing list
gem5-users(a)gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

--
Gabriel Yessin
B.S. Biomedical Engineering, May 2011
M.S. Computer Engineering, May 2013
The George Washington University
774.238.0101

I don't know if this helps but I'm currently able to get this working with my own configurations (not VExpress_EMM). Just pulled from the repo a few days ago, maybe try cloning the newest version. gem5 compiled Feb 5 2013 00:53:58 gem5 started Feb 11 2013 20:18:54 gem5 executing on pyramid3.local command line: ./build/ARM/gem5.fast -v --dump-config=config.ini --outdir=m5out configs/example/fs.py --take-checkpoints=10,10 -b bbench-gb --kernel=/home/gyessin/m5/system/binaries/vmlinux.smp.mouse.arm --frame-capture --checkpoint-dir=checkpoint --disk-image=/home/gyessin/m5/system/disks/ARMv7a-Gingerbread-Android.SMP.mouse.nolock.img Global frequency set at 1000000000000 ticks per second info: kernel located at: /home/gyessin/bbench1site/dist_google/m5/system/binaries/vmlinux.smp.mouse.arm warn: Sockets disabled, not accepting vnc client connections warn: Sockets disabled, not accepting terminal connections warn: Sockets disabled, not accepting gdb connections info: Using bootloader at address 0x80000000 info: Entering event queue @ 0. Starting simulation... Writing checkpoint info: Entering event queue @ 10. Starting simulation... Writing checkpoint info: Entering event queue @ 20. Starting simulation... Writing checkpoint On Mon, Feb 11, 2013 at 7:21 PM, Kshitij Sudan <k.sudan(a)samsung.com> wrote: > Hi, > > I'm trying to stop the gem5 simulation periodically based on number of > instructions executed and create checkpoints. > I've put together this functionality based on examples in the Simulate.py > script and my changes look like this: > > . > . > exit_event = m5.simulate() > exit_cause = exit_event.getCause() > print "first exit cause = %s" % exit_cause > > while exit_cause == "a thread reached the max instruction count" : > print "Creating checkpoint at inst:%d" % (checkpoint_inst) > m5.checkpoint(joinpath(cptdir, "cpt.%s.%d" % (options.bench, > checkpoint_inst))) > print "Checkpoint written." > > # Set all cpus with number of instructions to simulate before > checkpointing > checkpoint_inst += period > for i in xrange(options.num_cpus): > testsys.cpu[i].max_insts = checkpoint_inst > print "set checkpoint_inst to %d for CPU %d" % > (testsys.cpu[i].max_insts_any_thread, i) > > # simulate > print "Starting simulation again ...." > exit_event = m5.simulate() > exit_cause = exit_event.getCause() > . > . > > > These changes however fail to generate the checkpoints periodically. Only > one checkpoint is generated with this code. > > I've cloned the repository recently (about a month ago) and I'm simulating > an ARM VExpress_EMM machine in FS mode. My command line to launch gem5 is > below. It is supposed to generate the first checkpoint checkpoint after > 1000 instructions from start, and then periodically after every 1000 inst > ructions: > > ./build/ARM/gem5.fast -d m5out_inst configs/example/fs.py > --kernel=/gem5/FSimages/vmlinux-3.3-arm-vexpress-emm-pcie > --machine-type=VExpress_EMM --num-cpus=1 --mem-size=2047MB > --disk-image=/gem5/FSimages/disks/arm-ubuntu-natty-headless.img > --checkpoint-dir=./inst_chkpts --at-instruction --take-checkpoints=1000,1000 > -b test_benchmark > > This issue is very similar to one discussed in this gem5-users thread > previously >> > http://comments.gmane.org/gmane.comp.emulators.m5.users/8662 > > I've also experimented with m5.stats.dump() followed by m5.stats.reset() > as suggested in the thread, however it doesn't seem to be working. I've > also tried changing the CPU model from AtomicSimple to Timing and Detailed > to no avail. > > Any suggestions? > > Thanks, > -Kshitij > > _______________________________________________ > gem5-users mailing list > gem5-users(a)gem5.org > http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users > -- Gabriel Yessin B.S. Biomedical Engineering, May 2011 M.S. Computer Engineering, May 2013 The George Washington University 774.238.0101
CC
Chao Chen
Tue, Feb 12, 2013 2:31 AM

Hi,

I think your code "testsys.cpu[i].max_insts = checkpoint_inst" only changes
the configuration file.
Since you have instantiate the C objects with configuration file, any
changes to the configuration file would not affect the generated C objects.
I would suggest define your own setMax() functions in the following files

./python/m5/SimObject.py
./sim/sim_object.cc
./sim/sim_object.hh
./cpu/simple/base.hh

And use "testsys.cpu[i]._ccObject.setMax(max_inst) in Simulation.py
It would then change the parameters in the C objects directly.

Hope it will help you.

Chao

Hi, I think your code "testsys.cpu[i].max_insts = checkpoint_inst" only changes the configuration file. Since you have instantiate the C objects with configuration file, any changes to the configuration file would not affect the generated C objects. I would suggest define your own setMax() functions in the following files ./python/m5/SimObject.py ./sim/sim_object.cc ./sim/sim_object.hh ./cpu/simple/base.hh And use "testsys.cpu[i]._ccObject.setMax(max_inst) in Simulation.py It would then change the parameters in the C objects directly. Hope it will help you. Chao