Hello,

>1. reset the stats and checkpoint, both after 10M instructions

You don't need to reset the stats before taking a checkpoint. There is the
option --at-instruction that let you interpret some command line options in
committed instructions rather than gem5 ticks. If it is convenient to you,
you can also insert a 'm5 exit' in your script and --checkpoint-at-end in
the command line (the checkpoint is restorable like this).

>2. restore the checkpoint with detailed CPU type and run for 1B
instructions then stop

It's probably the option '-I MAXINSTS' that you're looking for.
Regards,

--
Fernando A. Endo, Post-doc

INRIA Rennes-Bretagne Atlantique
France


2017-02-06 3:35 GMT+01:00 Alsuwaiyan, Ali Saleh <[email protected]>:

> Jason,
>
>
> I tried running "sample.py" but got an error:
>
>
> command line: build/X86/gem5.opt configs/example/sample.py 100 1
>
>
> Traceback (most recent call last):
>
>   File "<string>", line 1, in <module>
>
>   File "/home/asa78/simulators/nvmain-gem5/gem5/src/python/m5/main.py",
> line 388, in main
>
>     exec filecode in scope
>
>   File "configs/example/sample.py", line 51, in <module>
>
>     from system import MySystem
>
>   File "configs/example/system/__init__.py", line 30, in <module>
>
>     from system import MySystem
>
>   File "configs/example/system/system.py", line 34, in <module>
>
>     from caches import *
>
>   File "configs/example/system/caches.py", line 47, in <module>
>
>     class PrefetchCache(Cache):
>
> TypeError: Error when calling the metaclass bases
>
>     module.__init__() takes at most 2 arguments (3 given)
>
>
> I also get a similar error when running "runkvm.py":
>
> command line: build/X86/gem5.opt configs/example/runkvm.py
>
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "/home/asa78/simulators/nvmain-gem5/gem5/src/python/m5/main.py",
> line 388, in main
>     exec filecode in scope
>   File "configs/example/runkvm.py", line 51, in <module>
>     from system import MySystem
>   File "configs/example/system/__init__.py", line 30, in <module>
>     from system import MySystem
>   File "configs/example/system/system.py", line 34, in <module>
>     from caches import *
>   File "configs/example/system/caches.py", line 47, in <module>
>     class PrefetchCache(Cache):
> TypeError: Error when calling the metaclass bases
>     module.__init__() takes at most 2 arguments (3 given)
>
> I also appreciate if you can help me answer the following questions:
>
>    1. Is "sample.py" compatible with non-kvm gem5 images? If not, then
>    would you please let me know how I can change it to be so. I have to admit
>    that I have no experience with kvm at all.
>    2. Can "sample.py" process the same set of arguments as the standard
>    fs.py? I need to simulate 4 CPUs, 2-levels of cache, ... etc. Can I pass
>    these arguments to "sample.py" the same way I do with fs.py?
>
> Thank you,
>
> Ali.
>
> ------------------------------
> *From:* gem5-users <[email protected]> on behalf of Jason
> Lowe-Power <[email protected]>
> *Sent:* Saturday, February 4, 2017 4:20 PM
> *To:* gem5 users mailing list
> *Subject:* Re: [gem5-users] Number of instructions Vs number of ticks +
> resetstats + checkpointing
>
> Hi Ali,
>
> Since you're doing something that isn't fully supported by the fs.py
> script, I would suggest making your own config file. The fs.py script, and
> the other supporting scripts in common/, are not very flexible, and when
> you want to do something that is a little outside of the norm it becomes
> very hard to make changes to those scripts.
>
> To answer your question about the number of instructions, the CPU objects
> have a function exposed to python which returns the number of instructions
> the CPU has executed. Therefore, you can use this to figure out the number
> of instructions from Python. Also, each CPU can cause the simulation to
> exit after it has executed some number of instructions. In fact, I have
> some scripts that do exactly this on my github page (
> https://github.com/powerjg/gem5/tree/devel/simplefs/configs/myconfigs
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpowerjg%2Fgem5%2Ftree%2Fdevel%2Fsimplefs%2Fconfigs%2Fmyconfigs&data=01%7C01%7Casa78%40pitt.edu%7Cc4cd0dc13636431acc9808d44d43b84f%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1&sdata=g5gvXG3nLiVPYnJy5pLMSXMiM%2FXE%2F1iBzWPGdAMFITM%3D&reserved=0>).
> My scripts fast-forward with KVM instead of restoring from a checkpoint,
> but the skeletons for the code are similar either way.
>
> Let me know if you have more questions.
>
> Jason
>
> On Thu, Feb 2, 2017 at 5:41 AM Alsuwaiyan, Ali Saleh <[email protected]>
> wrote:
>
> Hi everyone,
>
>
> I'm relatively new to gem5 and came across a problem where I need to
> perform the following:
>
> 1. reset the stats and checkpoint, both after 10M instructions
>
> 2. restore the checkpoint with detailed CPU type and run for 1B
> instructions then stop
>
>
> The problem is that both resetstats and checkpoint commands take the
> number of ticks as input, while what I need is the number of instructions.
>
>
> I know that this question has been asked previously (e.g.,
> https://www.mail-archive.com/[email protected]/msg00489.html
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mail-archive.com%2Fgem5-users%40gem5.org%2Fmsg00489.html&data=01%7C01%7Casa78%40pitt.edu%7Cc4cd0dc13636431acc9808d44d43b84f%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1&sdata=M76CjAO2TYRkS8Uvdj%2F9yzQzE9%2FHNj%2BELNsR0XxjcPE%3D&reserved=0>
> , a 2011 thread), however, no accurate answer has been provided.
>
>
> Currently, I'm using ticks instead of instructions in step 1 above;
> however, the number of instructions is different from one workload to
> another, when keeping the number of ticks constant. Here is my command line
> for step 1:
>
>
> build/X86/gem5.opt configs/example/fs.py --caches
> --disk-image=linux-x86-large.img --kernel=x86_64-vmlinux-3.2.24.smp
> --l1d_size=128kB --l1i_size=128kB --l2cache --l2_size=8MB --l2_assoc=8
> --cacheline_size=64 -n 4 --script=configs/boot/myworkloads/wd1.rcS -r 1
> --rel-max-tick=250000000000
>
>
> Here, checkpoint 1 is taken by the standard boot script
> "hack_back_ckpt.rcS", which hands over control to wd1.rcS script after
> restoring. Also, the rel-max-tick is set to stop the execution after the
> checkpoint is created. The content of wd1.rcS is as follows:
>
>
> #!/bin/sh
>
>
> echo "delayed checkpoint..."
>
> /sbin/m5 checkpoint   200000000
>
> echo "delayed resetstat..."
>
> /sbin/m5 resetstats   200000000
>
>
> cd /myapps/spec/benchspec/CPU2006/437.leslie3d/data/ref/input
>
>
> echo "Starting leslie3d..."
>
> taskset 0x1 
> /myapps/spec/benchspec/CPU2006/437.leslie3d/exe/leslie3d_base.gcc43-64bit
> < leslie3d.in
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fleslie3d.in&data=01%7C01%7Casa78%40pitt.edu%7Cc4cd0dc13636431acc9808d44d43b84f%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1&sdata=xPWh14k%2BOK7TfIdzXnc6Qyt%2BnC0YOkvdKdQxg5UqGBs%3D&reserved=0>
> > leslie3d.ref.out 2> leslie3d.ref.err &
>
>
> echo "Starting leslie3d..."
>
> taskset 0x2 
> /myapps/spec/benchspec/CPU2006/437.leslie3d/exe/leslie3d_base.gcc43-64bit
> < leslie3d.in
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fleslie3d.in&data=01%7C01%7Casa78%40pitt.edu%7Cc4cd0dc13636431acc9808d44d43b84f%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1&sdata=xPWh14k%2BOK7TfIdzXnc6Qyt%2BnC0YOkvdKdQxg5UqGBs%3D&reserved=0>
> > leslie3d.ref.out2 2> leslie3d.ref.err2 &
>
>
>
> cd /myapps/spec/benchspec/CPU2006/429.mcf/data/ref/input
>
> echo "Starting mcf..."
>
> taskset 0x4 /myapps/spec/benchspec/CPU2006/429.mcf/exe/mcf_base.gcc43-64bit
> inp.in
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Finp.in&data=01%7C01%7Casa78%40pitt.edu%7Cc4cd0dc13636431acc9808d44d43b84f%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1&sdata=NSrfIWOztC0EsoUanW6K6xdkqqIsDCc4nR8TiM7XAZA%3D&reserved=0>
> > mcf.ref.out 2> mcf.ref.err &
>
>
> echo "Starting mcf..."
>
> taskset 0x8 /myapps/spec/benchspec/CPU2006/429.mcf/exe/mcf_base.gcc43-64bit
> inp.in
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Finp.in&data=01%7C01%7Casa78%40pitt.edu%7Cc4cd0dc13636431acc9808d44d43b84f%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1&sdata=NSrfIWOztC0EsoUanW6K6xdkqqIsDCc4nR8TiM7XAZA%3D&reserved=0>
> > mcf.ref.out2 2> mcf.ref.err2 &
>
>
> echo "Waiting ..."
>
> wait
>
> echo "finished!"
>
>
> /sbin/m5 exit
>
>
> When the script exists and the second checkpoint is created, I simply
> carry on to step #2 using the command below:
>
>
> build/X86/gem5.opt configs/example/fs.py --caches
> --disk-image=linux-x86-large.img --kernel=x86_64-vmlinux-3.2.24.smp
> --l1d_size=128kB --l1i_size=128kB --l2cache --l2_size=8MB --l2_assoc=8
> --cacheline_size=64 -n 4 -r 2 --cpu-type=detailed -I 1000000000
>
>
> I know that the "-I" option counts the instructions from the beginning,
> but at least it uses instructions as a unit, not ticks.
>
>
> I'm very sure someone has done something regarding this, i.e., resetstats
> and checkpoint at "instruction#"  instead of at "tick#". I have seen this
> done by many papers in the literature.
>
>
> Your feedback is highly appreciated.
>
>
> BTW, my gem5 revision number is 10791.
>
>
> Thank you,
>
> Ali.
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fm5sim.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fgem5-users&data=01%7C01%7Casa78%40pitt.edu%7Cc4cd0dc13636431acc9808d44d43b84f%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1&sdata=l4rz1nqbBhD8hOMn8iKjxqv%2Bp3PA4uJT0G%2F9zilR5qs%3D&reserved=0>
>
>
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to