Ciro Santilli has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/12985 )

Change subject: config: add --param to fs.py, se.py and fs_bigLITTLE.py
......................................................................

config: add --param to fs.py, se.py and fs_bigLITTLE.py

The option allows to set SimObject params from the CLI.

The existing config scripts have a large number of options that simply set
a single SimObject parameter, and many still are not exposed.

This commit allows users to pass arbitrary parameters from the command
line to prevent the need for this kind of trivial option.

Change-Id: Ic4bd36948aca4998d2eaf6369c85d3668efa3944
Reviewed-on: https://gem5-review.googlesource.com/c/12985
Reviewed-by: Andreas Sandberg <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
---
M configs/common/Options.py
M configs/common/Simulation.py
M configs/example/arm/fs_bigLITTLE.py
3 files changed, 18 insertions(+), 0 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  Andreas Sandberg: Looks good to me, approved



diff --git a/configs/common/Options.py b/configs/common/Options.py
index aed8881..c36dc38 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -125,6 +125,14 @@
     parser.add_option("--maxtime", type="float", default=None,
help="Run to the specified absolute simulated time in "
                       "seconds")
+    parser.add_option("-P", "--param", action="append", default=[],
+        help="Set a SimObject parameter relative to the root node. "
+             "An extended Python multi range slicing syntax can be used "
+             "for arrays. For example: "
+             "'system.cpu[0,1,3:8:2].max_insts_all_threads = 42' "
+             "sets max_insts_all_threads for cpus 0, 1, 3, 5 and 7 "
+             "Direct parameters of the root object are not accessible, "
+             "only parameters of its children.")

 # Add common options that assume a non-NULL ISA.
 def addCommonOptions(parser):
diff --git a/configs/common/Simulation.py b/configs/common/Simulation.py
index f306a03..23a7783 100644
--- a/configs/common/Simulation.py
+++ b/configs/common/Simulation.py
@@ -597,6 +597,7 @@
     checkpoint_dir = None
     if options.checkpoint_restore:
cpt_starttick, checkpoint_dir = findCptDir(options, cptdir, testsys)
+    root.apply_config(options.param)
     m5.instantiate(checkpoint_dir)

     # Initialization is complete.  If we're not in control of simulation
diff --git a/configs/example/arm/fs_bigLITTLE.py b/configs/example/arm/fs_bigLITTLE.py
index 7d66c03..8cf89e3 100644
--- a/configs/example/arm/fs_bigLITTLE.py
+++ b/configs/example/arm/fs_bigLITTLE.py
@@ -182,6 +182,14 @@
     parser.add_argument("--sim-quantum", type=str, default="1ms",
help="Simulation quantum for parallel simulation. " \
                         "Default: %(default)s")
+    parser.add_argument("-P", "--param", action="append", default=[],
+        help="Set a SimObject parameter relative to the root node. "
+             "An extended Python multi range slicing syntax can be used "
+             "for arrays. For example: "
+             "'system.cpu[0,1,3:8:2].max_insts_all_threads = 42' "
+             "sets max_insts_all_threads for cpus 0, 1, 3, 5 and 7 "
+             "Direct parameters of the root object are not accessible, "
+             "only parameters of its children.")
     return parser

 def build(options):
@@ -330,6 +338,7 @@
     addOptions(parser)
     options = parser.parse_args()
     root = build(options)
+    root.apply_config(options.param)
     instantiate(options)
     run()


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12985
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ic4bd36948aca4998d2eaf6369c85d3668efa3944
Gerrit-Change-Number: 12985
Gerrit-PatchSet: 8
Gerrit-Owner: Ciro Santilli <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Anthony Gutierrez <[email protected]>
Gerrit-Reviewer: Ciro Santilli <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-CC: Daniel Carvalho <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to