Difference between revisions of "Running gem5"

From gem5
Jump to: navigation, search
(Clean up)
Line 1: Line 1:
 
M5 uses script files to specify simulated system configurations and simulation options. Running M5 is as simple as giving the name of a script file (ending in '.py') as a command-line argument.
 
M5 uses script files to specify simulated system configurations and simulation options. Running M5 is as simple as giving the name of a script file (ending in '.py') as a command-line argument.
  
The script file documentation page ([[Configuration Files Explained]]) has details on script file format and interpretation. The easiest way to get started is to use an existing script file. A variety of script files are provided in the src/configs directory.
+
The script file documentation page ([[Configuration Files Explained]]) has details on script file format and interpretation. The easiest way to get started is to use an existing script file. Several examples are provided in the src/configs directory.
  
There are several options that are global to M5, such as output options and debug print options.  These options must be specified prior to the script file.  Thus a typical m5 command line looks like:
+
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 optionsThe usage is:
  
 
<pre>
 
<pre>
Line 9: Line 9:
 
</pre>
 
</pre>
  
A few typical m5 options are:
+
The build/ALPHA_SE/m5.debug part is the m5 executabe, 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:
 
 
* --trace-flags="SomeFlagString" - turn on event tracing for the specified classes of simulation events
 
* --trace-start=<start_time> - time at which the traces indicated by the trace.flags param are to begin dumping
 
 
 
Running m5 with the "-h" flag prints a help message, including basic command-line parameters and the global m5 options. Here is what it looks like:
 
  
 
<pre>
 
<pre>
Line 41: Line 36:
 
                         script
 
                         script
 
--quiet, -q            Reduce verbosity
 
--quiet, -q            Reduce verbosity
 +
--verbose, -v          Increase verbosity
 
...
 
...
 
</pre>
 
</pre>
  
Simluation options that are script-specific can be specified directly on the command line as "--<option>=<value>", with these options being listed after the script file. From the simulator's perspective, setting options in this fashion is indistinguishable from specifying them in a script file.
+
The script section of the command line begins with a path to your script file. M5 runs the script in almost exactly the same way python itself would run your script directly (e.g. "python myscript.py [ myscript options ]".  The key difference being that m5 executable provides the m5 package and some debugging hooks. This means that you can pass your script options on the command line just like a normal script would. More details can be found in the [[Configuration Files Explained#Options|Options]] section.
 
 
Running m5 with a config file and the "-h" flag prints out all options that are available for that script. Here is a sample:
 
 
 
<pre>
 
% build/ALPHA_SE/m5.debug configs/test/test.py -h
 
usage: test.py [options]
 
 
 
options:
 
  -h, --help            show this help message and exit
 
  -d, --detailed
 
  -t, --timing
 
  -m MAXTICK, --maxtick=MAXTICK
 
...
 
</pre>
 

Revision as of 20:26, 19 August 2006

M5 uses script files to specify simulated system configurations and simulation options. Running M5 is as simple as giving the name of a script file (ending in '.py') as a command-line argument.

The script file documentation page (Configuration Files Explained) has details on script file format and interpretation. The easiest way to get started is to use an existing script file. Several examples are provided in the src/configs directory.

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:

% build/ALPHA_SE/m5.debug [m5 options] script.py [script options]

The build/ALPHA_SE/m5.debug part is the m5 executabe, 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. M5 runs the script in almost exactly the same way python itself would run your script directly (e.g. "python myscript.py [ myscript options ]". The key difference being that m5 executable provides the m5 package and some debugging hooks. This means that you can pass your script options on the command line just like a normal script would. More details can be found in the Options section.