-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New configuration script for component models
Simple configuration script that leverages the gem5 component models. - Upgrade to gem5 v24 - New gem5init which works also for arm Signed-off-by: David Schall <[email protected]>
- Loading branch information
Showing
12 changed files
with
411 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,68 @@ | ||
#!/bin/bash - | ||
|
||
function gem5_run() { | ||
# ==== | ||
# gem5 init service | ||
# ==== | ||
# | ||
# Try to read in a run script from the host system. | ||
# For gem5 use the special magic instruction `m5 readfile` | ||
# | ||
/sbin/m5 readfile > /tmp/script | ||
chmod 755 /tmp/script | ||
if [ -s /tmp/script ] | ||
then | ||
# If there is a script, execute the script and then exit the simulation | ||
su root -c '/tmp/script' # gives script full privileges as root user in multi-user mode | ||
sync | ||
sleep 10 | ||
/sbin/m5 exit | ||
else | ||
echo "No script found" | ||
fi | ||
echo "Gem5 init done" | ||
} | ||
|
||
|
||
function qemu_run() { | ||
# ==== | ||
# Qemu run service | ||
# ==== | ||
# | ||
# Try to read in a run script from the host system. | ||
# For qemu we will try to get the file from an | ||
# HTTP server running on the host port 3003. | ||
# | ||
# | ||
|
||
curl "http://10.0.2.2:3003/run.sh" -f -o /tmp/script | ||
chmod 755 /tmp/script | ||
|
||
if [ 0 -eq $? ]; | ||
then | ||
echo "Run script found... run it." | ||
if [ $(uname -i) == "aarch64" ]; | ||
then | ||
echo "On Arm machine" | ||
M5_ADDR="--addr=0x10010000" | ||
else | ||
echo "On x86 machine" | ||
M5_ADDR=0xffff0000 | ||
M5_ADDR="" | ||
fi | ||
|
||
# If there is a script, execute the script and then shutdown the machine | ||
su root -c '/tmp/script' # gives script full privileges as root user in multi-user mode | ||
sync | ||
sleep 10 | ||
else | ||
echo "No script found" | ||
fi | ||
} | ||
|
||
###################################################### | ||
# Qemu run service | ||
# ==== | ||
# | ||
# Try to read in a run script from the host system. | ||
# For qemu we will try to get the file from an | ||
# HTTP server running on the host port 3003. | ||
# | ||
# | ||
printf "Try QEMU read \n" | ||
|
||
## | ||
## Check if we are in gem5 or qemu | ||
## | ||
CPU=`cat /proc/cpuinfo | grep vendor_id | head -n 1 | cut -d ' ' -f2-` | ||
echo "Got CPU type: $CPU" | ||
curl "http://10.0.2.2:3003/run.sh" -f -o /tmp/script | ||
|
||
if [ "$CPU" == "M5 Simulator" ]; | ||
if [ 0 -eq $? ]; | ||
then | ||
echo "In gem5. Try loading script" | ||
gem5_run | ||
else | ||
echo "Not in gem5. Try to load script from http server" | ||
qemu_run | ||
echo "Found file server in qemu." | ||
echo "Run script found... run it." | ||
chmod 755 /tmp/script | ||
|
||
# If there is a script, execute the script and then shutdown the machine | ||
/tmp/script || true | ||
echo "Done running script, exiting." | ||
rm -f /tmp/script | ||
|
||
exit 0 | ||
fi | ||
exit 0 | ||
|
||
|
||
|
||
|
||
###################################################### | ||
# gem5 init service | ||
# ==== | ||
printf "Starting gem5 init... trying to read run script file via readfile.\n" | ||
# | ||
# Try to read in a run script from the host system. | ||
# For gem5 use the special magic instruction `m5 readfile` | ||
# | ||
|
||
if m5 $M5_ADDR readfile > /tmp/script; then | ||
|
||
echo "Run script found... run it." | ||
chmod 755 /tmp/script | ||
/tmp/script || true | ||
echo "Done running script, exiting." | ||
rm -f /tmp/script | ||
/sbin/m5 $M5_ADDR exit | ||
fi | ||
|
||
|
||
rm -f /tmp/script | ||
|
||
echo "All done, exiting." | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
layout: default | ||
title: Simple Simulation with gem5 Component Library | ||
parent: Simulation | ||
nav_order: 1 | ||
--- | ||
|
||
# Simulation Methodology | ||
{: .no_toc } | ||
|
||
<details open markdown="block"> | ||
<summary> | ||
Table of contents | ||
</summary> | ||
{: .text-delta } | ||
1. TOC | ||
{:toc} | ||
</details> | ||
|
||
<!-- ## Table of contents | ||
{: .no_toc .text-delta } | ||
1. TOC | ||
{:toc} --> | ||
|
||
|
||
--- | ||
|
||
Gem5 offers a wide range of prebuild configurations, aka. standard library, for cpus, boards, caches, etc. To simplify the configuration process we provide a configuration script that is mostly constructed out the component models provided by gem5. This script is called `vswarm_simple.py` and will be copied into your working directory. | ||
|
||
After installing the functions on the disk you can perform the *setup* step with the following command: | ||
|
||
```bash | ||
<gem5_root>/build/<ALL/X86>/gem5.opt vswarm_simple.py --kernel kernel --disk disk.img --mode setup --atomic-warming=50 --num-invocations=20 | ||
``` | ||
|
||
This will boot the kernel, function, invoke the function for 50 times and then create a checkpoint. The simulation will exit or can be killed otherwise | ||
|
||
Once the checkpoint is created the simulation can be performed with: | ||
|
||
```bash | ||
<gem5_root>/build/<ALL/X86>/gem5.opt vswarm_simple.py --kernel kernel --disk disk.img --mode evaluation --atomic-warming=50 --num-invocations=20 | ||
``` | ||
|
||
The script was tested with ATOMIC,TIMING and O3 core which can be configured commenting the corresponding lines in the script | ||
``` | ||
eval_core = CPUTypes.<TIMING/ATOMIC/O3> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.