Options.py (9736:20ae86ebd4c2) Options.py (9789:233420718e61)
1# Copyright (c) 2013 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license
9# terms below provided that you ensure that this notice is replicated
10# unmodified and in its entirety in all distributions of the software,
11# modified or unmodified, in source code or in binary form.
12#
13# Copyright (c) 2006-2008 The Regents of The University of Michigan
14# All rights reserved.
15#
16# Redistribution and use in source and binary forms, with or without
17# modification, are permitted provided that the following conditions are
18# met: redistributions of source code must retain the above copyright
19# notice, this list of conditions and the following disclaimer;
20# redistributions in binary form must reproduce the above copyright
21# notice, this list of conditions and the following disclaimer in the
22# documentation and/or other materials provided with the distribution;
23# neither the name of the copyright holders nor the names of its
24# contributors may be used to endorse or promote products derived from
25# this software without specific prior written permission.
26#
27# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38#
39# Authors: Lisa Hsu
40
41import m5
42from m5.defines import buildEnv
43from m5.objects import *
44from Benchmarks import *
45
46import CpuConfig
47import MemConfig
48
49def _listCpuTypes(option, opt, value, parser):
50 CpuConfig.print_cpu_list()
51 sys.exit(0)
52
53def _listMemTypes(option, opt, value, parser):
54 MemConfig.print_mem_list()
55 sys.exit(0)
56
57def addCommonOptions(parser):
58 # system options
59 parser.add_option("--list-cpu-types",
60 action="callback", callback=_listCpuTypes,
61 help="List available CPU types")
62 parser.add_option("--cpu-type", type="choice", default="atomic",
63 choices=CpuConfig.cpu_names(),
64 help = "type of cpu to run with")
65 parser.add_option("--list-mem-types",
66 action="callback", callback=_listMemTypes,
67 help="List available memory types")
68 parser.add_option("--mem-type", type="choice", default="simple_mem",
69 choices=MemConfig.mem_names(),
70 help = "type of memory to use")
71 parser.add_option("--checker", action="store_true");
72 parser.add_option("-n", "--num-cpus", type="int", default=1)
73 parser.add_option("--caches", action="store_true")
74 parser.add_option("--l2cache", action="store_true")
75 parser.add_option("--fastmem", action="store_true")
76 parser.add_option("--simpoint-profile", action="store_true",
77 help="Enable basic block profiling for SimPoints")
78 parser.add_option("--simpoint-interval", type="int", default=10000000,
79 help="SimPoint interval in num of instructions")
80 parser.add_option("--clock", action="store", type="string", default='2GHz')
1# Copyright (c) 2013 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license
9# terms below provided that you ensure that this notice is replicated
10# unmodified and in its entirety in all distributions of the software,
11# modified or unmodified, in source code or in binary form.
12#
13# Copyright (c) 2006-2008 The Regents of The University of Michigan
14# All rights reserved.
15#
16# Redistribution and use in source and binary forms, with or without
17# modification, are permitted provided that the following conditions are
18# met: redistributions of source code must retain the above copyright
19# notice, this list of conditions and the following disclaimer;
20# redistributions in binary form must reproduce the above copyright
21# notice, this list of conditions and the following disclaimer in the
22# documentation and/or other materials provided with the distribution;
23# neither the name of the copyright holders nor the names of its
24# contributors may be used to endorse or promote products derived from
25# this software without specific prior written permission.
26#
27# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38#
39# Authors: Lisa Hsu
40
41import m5
42from m5.defines import buildEnv
43from m5.objects import *
44from Benchmarks import *
45
46import CpuConfig
47import MemConfig
48
49def _listCpuTypes(option, opt, value, parser):
50 CpuConfig.print_cpu_list()
51 sys.exit(0)
52
53def _listMemTypes(option, opt, value, parser):
54 MemConfig.print_mem_list()
55 sys.exit(0)
56
57def addCommonOptions(parser):
58 # system options
59 parser.add_option("--list-cpu-types",
60 action="callback", callback=_listCpuTypes,
61 help="List available CPU types")
62 parser.add_option("--cpu-type", type="choice", default="atomic",
63 choices=CpuConfig.cpu_names(),
64 help = "type of cpu to run with")
65 parser.add_option("--list-mem-types",
66 action="callback", callback=_listMemTypes,
67 help="List available memory types")
68 parser.add_option("--mem-type", type="choice", default="simple_mem",
69 choices=MemConfig.mem_names(),
70 help = "type of memory to use")
71 parser.add_option("--checker", action="store_true");
72 parser.add_option("-n", "--num-cpus", type="int", default=1)
73 parser.add_option("--caches", action="store_true")
74 parser.add_option("--l2cache", action="store_true")
75 parser.add_option("--fastmem", action="store_true")
76 parser.add_option("--simpoint-profile", action="store_true",
77 help="Enable basic block profiling for SimPoints")
78 parser.add_option("--simpoint-interval", type="int", default=10000000,
79 help="SimPoint interval in num of instructions")
80 parser.add_option("--clock", action="store", type="string", default='2GHz')
81 parser.add_option("--cpu-clock", action="store", type="string",
82 default='2GHz',
83 help="Clock for blocks running at CPU speed")
81 parser.add_option("--num-dirs", type="int", default=1)
82 parser.add_option("--num-l2caches", type="int", default=1)
83 parser.add_option("--num-l3caches", type="int", default=1)
84 parser.add_option("--l1d_size", type="string", default="64kB")
85 parser.add_option("--l1i_size", type="string", default="32kB")
86 parser.add_option("--l2_size", type="string", default="2MB")
87 parser.add_option("--l3_size", type="string", default="16MB")
88 parser.add_option("--l1d_assoc", type="int", default=2)
89 parser.add_option("--l1i_assoc", type="int", default=2)
90 parser.add_option("--l2_assoc", type="int", default=8)
91 parser.add_option("--l3_assoc", type="int", default=16)
92 parser.add_option("--cacheline_size", type="int", default=64)
93 parser.add_option("--ruby", action="store_true")
94 parser.add_option("--smt", action="store_true", default=False,
95 help = """
96 Only used if multiple programs are specified. If true,
97 then the number of threads per cpu is same as the
98 number of programs.""")
99
100 # Run duration options
101 parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick,
102 metavar="T", help="Stop after T ticks")
103 parser.add_option("--maxtime", type="float")
104 parser.add_option("-I", "--maxinsts", action="store", type="int",
105 default=None, help="""Total number of instructions to
106 simulate (default: run forever)""")
107 parser.add_option("--work-item-id", action="store", type="int",
108 help="the specific work id for exit & checkpointing")
109 parser.add_option("--work-begin-cpu-id-exit", action="store", type="int",
110 help="exit when work starts on the specified cpu")
111 parser.add_option("--work-end-exit-count", action="store", type="int",
112 help="exit at specified work end count")
113 parser.add_option("--work-begin-exit-count", action="store", type="int",
114 help="exit at specified work begin count")
115 parser.add_option("--init-param", action="store", type="int", default=0,
116 help="""Parameter available in simulation with m5
117 initparam""")
118
119 # Checkpointing options
120 ###Note that performing checkpointing via python script files will override
121 ###checkpoint instructions built into binaries.
122 parser.add_option("--take-checkpoints", action="store", type="string",
123 help="<M,N> take checkpoints at tick M and every N ticks thereafter")
124 parser.add_option("--max-checkpoints", action="store", type="int",
125 help="the maximum number of checkpoints to drop", default=5)
126 parser.add_option("--checkpoint-dir", action="store", type="string",
127 help="Place all checkpoints in this absolute directory")
128 parser.add_option("-r", "--checkpoint-restore", action="store", type="int",
129 help="restore from checkpoint <N>")
130 parser.add_option("--checkpoint-at-end", action="store_true",
131 help="take a checkpoint at end of run")
132 parser.add_option("--work-begin-checkpoint-count", action="store", type="int",
133 help="checkpoint at specified work begin count")
134 parser.add_option("--work-end-checkpoint-count", action="store", type="int",
135 help="checkpoint at specified work end count")
136 parser.add_option("--work-cpus-checkpoint-count", action="store", type="int",
137 help="checkpoint and exit when active cpu count is reached")
138 parser.add_option("--restore-with-cpu", action="store", type="choice",
139 default="atomic", choices=CpuConfig.cpu_names(),
140 help = "cpu type for restoring from a checkpoint")
141
142
143 # CPU Switching - default switch model goes from a checkpoint
144 # to a timing simple CPU with caches to warm up, then to detailed CPU for
145 # data measurement
146 parser.add_option("--repeat-switch", action="store", type="int",
147 default=None,
148 help="switch back and forth between CPUs with period <N>")
149 parser.add_option("-s", "--standard-switch", action="store", type="int",
150 default=None,
151 help="switch from timing to Detailed CPU after warmup period of <N>")
152 parser.add_option("-p", "--prog-interval", type="str",
153 help="CPU Progress Interval")
154
155 # Fastforwarding and simpoint related materials
156 parser.add_option("-W", "--warmup-insts", action="store", type="int",
157 default=None,
158 help="Warmup period in total instructions (requires --standard-switch)")
159 parser.add_option("--bench", action="store", type="string", default=None,
160 help="base names for --take-checkpoint and --checkpoint-restore")
161 parser.add_option("-F", "--fast-forward", action="store", type="string",
162 default=None,
163 help="Number of instructions to fast forward before switching")
164 parser.add_option("-S", "--simpoint", action="store_true", default=False,
165 help="""Use workload simpoints as an instruction offset for
166 --checkpoint-restore or --take-checkpoint.""")
167 parser.add_option("--at-instruction", action="store_true", default=False,
168 help="""Treat value of --checkpoint-restore or --take-checkpoint as a
169 number of instructions.""")
170
171def addSEOptions(parser):
172 # Benchmark options
173 parser.add_option("-c", "--cmd", default="",
174 help="The binary to run in syscall emulation mode.")
175 parser.add_option("-o", "--options", default="",
176 help="""The options to pass to the binary, use " "
177 around the entire string""")
178 parser.add_option("-i", "--input", default="",
179 help="Read stdin from a file.")
180 parser.add_option("--output", default="",
181 help="Redirect stdout to a file.")
182 parser.add_option("--errout", default="",
183 help="Redirect stderr to a file.")
184
185def addFSOptions(parser):
186 # Simulation options
187 parser.add_option("--timesync", action="store_true",
188 help="Prevent simulated time from getting ahead of real time")
189
190 # System options
191 parser.add_option("--kernel", action="store", type="string")
192 parser.add_option("--script", action="store", type="string")
193 parser.add_option("--frame-capture", action="store_true",
194 help="Stores changed frame buffers from the VNC server to compressed "\
195 "files in the gem5 output directory")
196
197 if buildEnv['TARGET_ISA'] == "arm":
198 parser.add_option("--bare-metal", action="store_true",
199 help="Provide the raw system without the linux specific bits")
200 parser.add_option("--machine-type", action="store", type="choice",
201 choices=ArmMachineType.map.keys(), default="RealView_PBX")
202 parser.add_option("--dtb-filename", action="store", type="string",
203 help="Specifies device tree blob file to use with device-tree-"\
204 "enabled kernels")
205 # Benchmark options
206 parser.add_option("--dual", action="store_true",
207 help="Simulate two systems attached with an ethernet link")
208 parser.add_option("-b", "--benchmark", action="store", type="string",
209 dest="benchmark",
210 help="Specify the benchmark to run. Available benchmarks: %s"\
211 % DefinedBenchmarks)
212
213 # Metafile options
214 parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
215 help="Specify the filename to dump a pcap capture of the" \
216 "ethernet traffic")
217
218 # Disk Image Options
219 parser.add_option("--disk-image", action="store", type="string", default=None,
220 help="Path to the disk image to use.")
221
222 # Memory Size Options
223 parser.add_option("--mem-size", action="store", type="string", default=None,
224 help="Specify the physical memory size (single memory)")
84 parser.add_option("--num-dirs", type="int", default=1)
85 parser.add_option("--num-l2caches", type="int", default=1)
86 parser.add_option("--num-l3caches", type="int", default=1)
87 parser.add_option("--l1d_size", type="string", default="64kB")
88 parser.add_option("--l1i_size", type="string", default="32kB")
89 parser.add_option("--l2_size", type="string", default="2MB")
90 parser.add_option("--l3_size", type="string", default="16MB")
91 parser.add_option("--l1d_assoc", type="int", default=2)
92 parser.add_option("--l1i_assoc", type="int", default=2)
93 parser.add_option("--l2_assoc", type="int", default=8)
94 parser.add_option("--l3_assoc", type="int", default=16)
95 parser.add_option("--cacheline_size", type="int", default=64)
96 parser.add_option("--ruby", action="store_true")
97 parser.add_option("--smt", action="store_true", default=False,
98 help = """
99 Only used if multiple programs are specified. If true,
100 then the number of threads per cpu is same as the
101 number of programs.""")
102
103 # Run duration options
104 parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick,
105 metavar="T", help="Stop after T ticks")
106 parser.add_option("--maxtime", type="float")
107 parser.add_option("-I", "--maxinsts", action="store", type="int",
108 default=None, help="""Total number of instructions to
109 simulate (default: run forever)""")
110 parser.add_option("--work-item-id", action="store", type="int",
111 help="the specific work id for exit & checkpointing")
112 parser.add_option("--work-begin-cpu-id-exit", action="store", type="int",
113 help="exit when work starts on the specified cpu")
114 parser.add_option("--work-end-exit-count", action="store", type="int",
115 help="exit at specified work end count")
116 parser.add_option("--work-begin-exit-count", action="store", type="int",
117 help="exit at specified work begin count")
118 parser.add_option("--init-param", action="store", type="int", default=0,
119 help="""Parameter available in simulation with m5
120 initparam""")
121
122 # Checkpointing options
123 ###Note that performing checkpointing via python script files will override
124 ###checkpoint instructions built into binaries.
125 parser.add_option("--take-checkpoints", action="store", type="string",
126 help="<M,N> take checkpoints at tick M and every N ticks thereafter")
127 parser.add_option("--max-checkpoints", action="store", type="int",
128 help="the maximum number of checkpoints to drop", default=5)
129 parser.add_option("--checkpoint-dir", action="store", type="string",
130 help="Place all checkpoints in this absolute directory")
131 parser.add_option("-r", "--checkpoint-restore", action="store", type="int",
132 help="restore from checkpoint <N>")
133 parser.add_option("--checkpoint-at-end", action="store_true",
134 help="take a checkpoint at end of run")
135 parser.add_option("--work-begin-checkpoint-count", action="store", type="int",
136 help="checkpoint at specified work begin count")
137 parser.add_option("--work-end-checkpoint-count", action="store", type="int",
138 help="checkpoint at specified work end count")
139 parser.add_option("--work-cpus-checkpoint-count", action="store", type="int",
140 help="checkpoint and exit when active cpu count is reached")
141 parser.add_option("--restore-with-cpu", action="store", type="choice",
142 default="atomic", choices=CpuConfig.cpu_names(),
143 help = "cpu type for restoring from a checkpoint")
144
145
146 # CPU Switching - default switch model goes from a checkpoint
147 # to a timing simple CPU with caches to warm up, then to detailed CPU for
148 # data measurement
149 parser.add_option("--repeat-switch", action="store", type="int",
150 default=None,
151 help="switch back and forth between CPUs with period <N>")
152 parser.add_option("-s", "--standard-switch", action="store", type="int",
153 default=None,
154 help="switch from timing to Detailed CPU after warmup period of <N>")
155 parser.add_option("-p", "--prog-interval", type="str",
156 help="CPU Progress Interval")
157
158 # Fastforwarding and simpoint related materials
159 parser.add_option("-W", "--warmup-insts", action="store", type="int",
160 default=None,
161 help="Warmup period in total instructions (requires --standard-switch)")
162 parser.add_option("--bench", action="store", type="string", default=None,
163 help="base names for --take-checkpoint and --checkpoint-restore")
164 parser.add_option("-F", "--fast-forward", action="store", type="string",
165 default=None,
166 help="Number of instructions to fast forward before switching")
167 parser.add_option("-S", "--simpoint", action="store_true", default=False,
168 help="""Use workload simpoints as an instruction offset for
169 --checkpoint-restore or --take-checkpoint.""")
170 parser.add_option("--at-instruction", action="store_true", default=False,
171 help="""Treat value of --checkpoint-restore or --take-checkpoint as a
172 number of instructions.""")
173
174def addSEOptions(parser):
175 # Benchmark options
176 parser.add_option("-c", "--cmd", default="",
177 help="The binary to run in syscall emulation mode.")
178 parser.add_option("-o", "--options", default="",
179 help="""The options to pass to the binary, use " "
180 around the entire string""")
181 parser.add_option("-i", "--input", default="",
182 help="Read stdin from a file.")
183 parser.add_option("--output", default="",
184 help="Redirect stdout to a file.")
185 parser.add_option("--errout", default="",
186 help="Redirect stderr to a file.")
187
188def addFSOptions(parser):
189 # Simulation options
190 parser.add_option("--timesync", action="store_true",
191 help="Prevent simulated time from getting ahead of real time")
192
193 # System options
194 parser.add_option("--kernel", action="store", type="string")
195 parser.add_option("--script", action="store", type="string")
196 parser.add_option("--frame-capture", action="store_true",
197 help="Stores changed frame buffers from the VNC server to compressed "\
198 "files in the gem5 output directory")
199
200 if buildEnv['TARGET_ISA'] == "arm":
201 parser.add_option("--bare-metal", action="store_true",
202 help="Provide the raw system without the linux specific bits")
203 parser.add_option("--machine-type", action="store", type="choice",
204 choices=ArmMachineType.map.keys(), default="RealView_PBX")
205 parser.add_option("--dtb-filename", action="store", type="string",
206 help="Specifies device tree blob file to use with device-tree-"\
207 "enabled kernels")
208 # Benchmark options
209 parser.add_option("--dual", action="store_true",
210 help="Simulate two systems attached with an ethernet link")
211 parser.add_option("-b", "--benchmark", action="store", type="string",
212 dest="benchmark",
213 help="Specify the benchmark to run. Available benchmarks: %s"\
214 % DefinedBenchmarks)
215
216 # Metafile options
217 parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
218 help="Specify the filename to dump a pcap capture of the" \
219 "ethernet traffic")
220
221 # Disk Image Options
222 parser.add_option("--disk-image", action="store", type="string", default=None,
223 help="Path to the disk image to use.")
224
225 # Memory Size Options
226 parser.add_option("--mem-size", action="store", type="string", default=None,
227 help="Specify the physical memory size (single memory)")