You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gem5: track build and run variants separately with -M and -N
Otherwise, checking out branches is too insane, as it does not
update the worktrees, even though the gem5/gem5 module was updated.
gem5: expose build types, document debug builds.
simultaneous runs: store stdout and stderr on a file to allow running
all from a single terminal on the background cleanly.
Since this is such a common setup, we provide helper for it at: link:rootfs_overlay/gem5.sh[rootfs_overlay/gem5.sh].
6201
+
6202
+
Other loophole possibilities include:
6192
6203
6193
6204
* <<9p>>
6194
-
* create multiple disk images, and mount the benchmark one
6205
+
* link:https://stackoverflow.com/questions/50862906/how-to-attach-multiple-disk-images-in-a-simulation-with-gem5-fs-py/51037661#51037661[create multiple disk images], and mount the benchmark from on one of them
6195
6206
* `expect` as mentioned at: https://stackoverflow.com/questions/7013137/automating-telnet-session-using-bash-scripts
6196
6207
+
6197
6208
....
@@ -6798,28 +6809,69 @@ Analogous to the <<linux-kernel-build-variants>> but with the `-M` option instea
6798
6809
....
6799
6810
./build -g
6800
6811
git -C gem5/gem5 checkout some-branch
6801
-
./build -M some-branch -g
6812
+
./build -g -M some-branch
6802
6813
git -C gem5/gem5 checkout -
6803
6814
./run -g
6815
+
git -C gem5/gem5 checkout some-branch
6804
6816
./run -M some-branch -g
6805
6817
....
6806
6818
6807
-
Since we control the gem5 build however, unlike Linux which uses Buildroot, we make it awesomer, and use `git worktree` instead of a mere `rsync` for the copy.
6819
+
Don't forget however that gem5 has Python scripts in its source code tree, and that those must match the source code of a given build.
6808
6820
6809
-
It works like this:
6821
+
Therefore, you can't forget to checkout to the sources to that of the corresponding build before running, unless you explicitly tell gem5 to use a non-default source tree with `-N`.
6810
6822
6811
-
* when you don't pass the `-M` option, which is the same as the `-M default` variant, we use the source code from under the `gem5/gem5` submodule for the build
6812
-
* otherwise, if you pass `-M some-branch`, we generate a git worktree checkout under `data/gem5/some-branch`, with branch name `wt/some-branch`.
6813
-
+
6814
-
The initial revision for that worktree is whatever `gem5/gem5` is currently points to.
6815
-
+
6816
-
However, if the worktree already exists, we leave it untouched.
6817
-
+
6818
-
Therefore, you can safely go to that directory and edit the source there without fear that it will get deleted.
6823
+
This becomes inevitable when you want to launch <<gem5-simultaneous-runs-with-build-variants>>.
6824
+
6825
+
===== gem5 simultaneous runs with build variants
6826
+
6827
+
In order to checkout multiple gem5 builds and run them simultaneously, you also need to use the `-N`:
The `-N <woktree-id>` determines the location of the gem5 tree to be used for both:
6839
+
6840
+
* the input C files of the build at build time
6841
+
* the Python scripts to be used at runtime
6842
+
6843
+
The difference between `-M` and `-N` is that `-M` specifies the gem5 build output directory, while `-N` specifies the source input directory.
6844
+
6845
+
When `-N` is not given, source tree under `gem5/gem5` is used.
6846
+
6847
+
If `-N <worktree-id>` is given, the directory used is `data/gem5/<worktree-id>`, and:
6848
+
6849
+
* if that directory does not exist, create a `git worktree` at a branch `wt/<worktree-id>` on current commit of `gem5/gem5` there.
6819
6850
+
6820
-
The `wt/` branch name prefix stands for `WorkTree`, and is done to allow us to checkout to a test `some-branch` branch under `gem5/gem5` and still use `-M some-branch`, without aconflict for the worktree branch.
6851
+
The `wt/` branch name prefix stands for `WorkTree`, and is done to allow us to checkout to a test `some-branch` branch under `gem5/gem5` and still use `-N some-branch`, without conflict for the worktree branch, which can only be checked out once.
6852
+
* otherwise, leave that worktree untouched, without updating it
6853
+
6854
+
`-N` is only required if you have multiple gem5 checkouts, e.g. it would not be required for multiple builds of the same tree, e.g. a <<gem5-debug-build>> and a non-debug one.
6855
+
6856
+
===== gem5 debug build
6857
+
6858
+
Built and run `gem5.debug`, which has optimizations turned off unlike the default `gem5.opt`:
6859
+
6860
+
....
6861
+
./build -aA -g -M debug -t debug
6862
+
./run -aA -g -M debug -t debug
6863
+
....
6864
+
6865
+
`-M` is optional just to prevent it from overwriting the `opt` build.
6866
+
6867
+
A Linux kernel boot was about 14 times slower than opt at 71e927e63bda6507d5a528f22c78d65099bdf36f between the commands:
0 commit comments