Difference between revisions of "Running gem5"

From gem5
Jump to: navigation, search
Line 1: Line 1:
M5 uses configuration files to specify simulated system configurations and simulation options. Running M5 is as simple as giving the name of a configuration 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 configuration file documentation page ([[Configuration Files Explained]]) has details on config file format and interpretation. The easiest way to get started is to use an existing configuration file. A variety of config files are provided in the m5/configs directory. Another good source of example config files is the regression test suite in the m5-test directory. Each regression test is executed by specifying the 'run.py' file in the test directory as the configuration, e.g., '../m5/build/ALPHA_SE/m5.opt test1/run.py'. Unlike the files in m5/config, the config files in m5-test are tested regularly and are guaranteed to work.
+
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.
  
Configuration parameters can also be specified directly on the command line as "--<variable>=<value>" (see Configuration Files Explained). From the simulator's perspective, setting parameters in this fashion is indistinguishable from specifying them in a configuration file. A few parameters typically specified on the command line instead of in a config file are:
+
Simluation options can be specified directly on the command line as "--<option>=<value>". From the simulator's perspective, setting options in this fashion is indistinguishable from specifying them in a script file. A few options typically specified on the command line instead of in a script file are:
  
 +
* --traceflags="SomeFlagString" - turn on event tracing for the specified classes of simulation events
 +
* --tracestart=<start_cycle> - cycle at which the traces indicated by the trace.flags param are to begin dumping
  
* --root.trace.flags="SomeFlagString" - turn on event tracing for the specified classes of simulation events
+
Running m5 with the "-h" flag prints a help message, including basic command-line parameters. Here is what it looks like:
* --root.trace.start=<start_cycle> - cycle at which the traces indicated by the trace.flags param are to begin dumping
+
 
* --Serialize.cycle=<start_cycle> - dump a checkpoint at this cycle
+
<pre>
* --Serialize.period=<period> - repeat interval for dumping checkpoints
+
% build/ALPHA_SE/m5.debug -h
* --Serialize.count=<number> - number of checkpoints to dump
+
Usage:
 +
m5.debug [-p <path>] [-i ] [-h] <config file>
  
Some configuration parameters require instantiating an actual Python object. To do this on the command line, you can inform m5 that you want a direct python string interpreted using the -P parameter. Here are a few examples:
+
-p, --path <path>  prepends <path> to PYTHONPATH instead of using
 +
                    built-in zip archive.  Useful when developing/debugging
 +
                    changes to built-in Python libraries, as the new Python
 +
                    can be tested without building a new m5 binary.
  
 +
-i, --interactive  forces entry into interactive mode after the supplied
 +
                    script is executed (just like the -i option to  the
 +
                    Python interpreter).
  
* -P"root.max=Terminate(cycle=1000)" - terminate the simulation at 1000 cycles
+
-h                 Prints this help
* -P"root.progress=Progress(cycle=100)" - dump a message every 100 cycles (to know that m5 is not hanging)
 
Running m5 with the "-h" flag prints a help message, including basic command-line parameters. Here is what it looks like:
 
  
<pre>
+
<configfile>       config file name (ends in .py)
Usage:
+
</pre>
m5.debug [-d <dir>] [-E <var>[=<val>]] [-I <dir>] [-P <python>]
 
        [--<var>=<val>] <config file>
 
  
  -d            set the output directory to <dir>
+
Additionally, running m5 with a config file and the "-h" flag prints out all options that are available. Here is a sample:
  -E            set the environment variable <var> to <val> (or 'True')
 
  -I            add the directory <dir> to python's path
 
  -P            execute <python> directly in the configuration
 
  --var=val    set the python variable <var> to '<val>'
 
  <configfile> config file name (ends in .py)
 
  
m5.debug -X
+
<pre>
  -X            extract embedded files
+
% build/ALPHA_SE/m5.debug configs/test/test.py -h
 +
usage: test.py [options]
  
m5.debug -h
+
options:
  -h            print short help
+
  --traceflags=TRACEFLAGS
 +
  --tracestart=TRACESTART
 +
  --tracefile=TRACEFILE
 +
  --pcsymbol=True | False
 +
                        Use PC symbols in trace output
 +
  --printcycle=True | False
 +
                        Print cycle numbers in trace output
 +
...
 
</pre>
 
</pre>

Revision as of 00:04, 17 June 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. A variety of script files are provided in the src/configs directory.

Simluation options can be specified directly on the command line as "--<option>=<value>". From the simulator's perspective, setting options in this fashion is indistinguishable from specifying them in a script file. A few options typically specified on the command line instead of in a script file are:

  • --traceflags="SomeFlagString" - turn on event tracing for the specified classes of simulation events
  • --tracestart=<start_cycle> - cycle 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. Here is what it looks like:

% build/ALPHA_SE/m5.debug -h
Usage:
m5.debug [-p <path>] [-i ] [-h] <config file>

 -p, --path <path>  prepends <path> to PYTHONPATH instead of using
                    built-in zip archive.  Useful when developing/debugging
                    changes to built-in Python libraries, as the new Python
                    can be tested without building a new m5 binary.

 -i, --interactive  forces entry into interactive mode after the supplied
                    script is executed (just like the -i option to  the
                    Python interpreter).

 -h                 Prints this help

 <configfile>       config file name (ends in .py)

Additionally, running m5 with a config file and the "-h" flag prints out all options that are available. Here is a sample:

% build/ALPHA_SE/m5.debug configs/test/test.py -h
usage: test.py [options]

options:
  --traceflags=TRACEFLAGS
  --tracestart=TRACESTART
  --tracefile=TRACEFILE
  --pcsymbol=True | False
                        Use PC symbols in trace output
  --printcycle=True | False
                        Print cycle numbers in trace output
...