Difference between revisions of "Running gem5"

From gem5
Jump to: navigation, search
(Update links)
Line 37: Line 37:
  
 
The script section of the command line begins with a path to your script file and includes any options that you'd like to pass to that script. Since M5 runs the script in a way similar to python itself (i.e. it's similar to running "python myscript.py [ options ]"), you can pass your script options on the command line to make your script flexible.  The script file documentation page ([[Simulation Scripts Explained]]) has details on how to write scripts for M5, and the [[Simulation Scripts Explained#Options|Options]] section of that page gives a bit of detail on how your scripts can have their own options.
 
The script section of the command line begins with a path to your script file and includes any options that you'd like to pass to that script. Since M5 runs the script in a way similar to python itself (i.e. it's similar to running "python myscript.py [ options ]"), you can pass your script options on the command line to make your script flexible.  The script file documentation page ([[Simulation Scripts Explained]]) has details on how to write scripts for M5, and the [[Simulation Scripts Explained#Options|Options]] section of that page gives a bit of detail on how your scripts can have their own options.
 +
 +
 +
== Restoring from a checkpoint ==
 +
First of all, you need to create a checkpoint.
 +
After booting the M5 simulator, execute a command (in the shell):
 +
<pre>
 +
m5 checkpoint
 +
</pre>
 +
which will create a new directory with the checkpoint, named 'cpt.TICKNUMBER'
 +
 +
With the new simulator (2.0 beta2), the restoring from a checkpoint can usually be easily done from the command line, e.g.:
 +
<pre>
 +
build/ALPHA_FS/m5.debug configs/example/fs.py -r N
 +
OR
 +
build/ALPHA_FS/m5.debug configs/example/fs.py ----checkpoint_restore=N
 +
</pre>
 +
The number N is integer that represents checkpoint number, when they are order lexically (i.e. by the ticknumber) - oldest tick has number 1, next checkpoint has number 2, etc.

Revision as of 06:36, 6 February 2007

The m5 command line has two parts: (1) the simulator section which includes the simulator executable and its options, and (2) the script section, which includes the script file and its options. The usage is:

% m5 [m5 options] <script.py> [script options]

The m5 executable is any of the version you may have built (See Compiling M5) such as ALPHA_SE/m5.debug, and the [m5 options] part are all of the options that the simulator itself understands. Running m5 with the "-h" flag prints a help messag that includes all of the supported simulator options. Here's a snippet:

% build/ALPHA_SE/m5.debug -h
Usage
=====
  m5.debug [m5 options] script.py [script options]

 Copyright (c) 2001-2006 The Regents of The University of Michigan All Rights
Reserved

options
=======
--version               show program's version number and exit
--help, -h              show this help message and exit
--authors, -A           Show author information
--copyright, -C         Show full copyright information
--readme, -R            Show the readme
--release-notes, -N     Show the release notes
--outdir=DIR, -d DIR    Set the output directory to DIR [Default: .]
--interactive, -i       Invoke the interactive interpreter after running the
                        script
--pdb                   Invoke the python debugger before running the script
--path=PATH[:PATH], -p PATH[:PATH]
                        Prepend PATH to the system path when invoking the
                        script
--quiet, -q             Reduce verbosity
--verbose, -v           Increase verbosity
...

The script section of the command line begins with a path to your script file and includes any options that you'd like to pass to that script. Since M5 runs the script in a way similar to python itself (i.e. it's similar to running "python myscript.py [ options ]"), you can pass your script options on the command line to make your script flexible. The script file documentation page (Simulation Scripts Explained) has details on how to write scripts for M5, and the Options section of that page gives a bit of detail on how your scripts can have their own options.


Restoring from a checkpoint

First of all, you need to create a checkpoint. After booting the M5 simulator, execute a command (in the shell):

m5 checkpoint

which will create a new directory with the checkpoint, named 'cpt.TICKNUMBER'

With the new simulator (2.0 beta2), the restoring from a checkpoint can usually be easily done from the command line, e.g.:

build/ALPHA_FS/m5.debug configs/example/fs.py -r N
OR
build/ALPHA_FS/m5.debug configs/example/fs.py ----checkpoint_restore=N

The number N is integer that represents checkpoint number, when they are order lexically (i.e. by the ticknumber) - oldest tick has number 1, next checkpoint has number 2, etc.