-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resources: update gapbs to use new 24.04 images #46
base: stable
Are you sure you want to change the base?
Changes from 7 commits
31a06cf
06e16b9
fb586ff
a8142b6
e98ff3e
b013e31
78525cb
3a77227
4429b9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
disk-image-ubuntu-24-04/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,71 +6,112 @@ tags: | |
permalink: resources/gapbs | ||
shortdoc: > | ||
This resource implementes the [GAP benchmark suite](http://gap.cs.berkeley.edu/benchmark.html). | ||
author: ["Marjan Fariborz"] | ||
author: ["Harshil Patel"] | ||
license: BSD-3-Clause | ||
--- | ||
|
||
This document provides instructions to create a GAP Benchmark Suite (GAPBS) disk image, which, along with an example script, may be used to run GAPBS within gem5 simulations. The example script uses a pre-built disk-image. | ||
|
||
A pre-built disk image, for X86, can be found, gzipped, here: <http://dist.gem5.org/dist/v22-1/images/x86/ubuntu-18-04/gapbs.img.gz>. | ||
A pre-built disk image, for X86, can be found, gzipped, here: <add link> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add link There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If everything looks good then I will upload the disks and add the links. |
||
|
||
## Building the Disk Image | ||
## What's on the disk? | ||
|
||
Assuming that you are in the `src/gapbs/` directory, first create `m5` (which is needed to create the disk image): | ||
- username: gem5 | ||
- password: 12345 | ||
|
||
```sh | ||
git clone https://gem5.googlesource.com/public/gem5 | ||
cd gem5/util/m5 | ||
scons build/x86/out/m5 | ||
``` | ||
- The `gem5-bridge`(m5) utility is installed in `/usr/local/bin/gem5-bridge`. | ||
- `libm5` is installed in `/usr/local/lib/`. | ||
- The headers for `libm5` are installed in `/usr/local/include/gem5-bridge`. | ||
Harshil2107 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- `gapbs` benchmark sutie with ROI annotations | ||
Harshil2107 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Thus, you should be able to build packages on the disk and easily link to the gem5-bridge library. | ||
|
||
The disk has network disabled by default to improve boot time in gem5. | ||
|
||
If you want to enable networking, you need to modify the disk image and move the file `/etc/netplan/00-installer-config.yaml.bak` to `/etc/netplan/00-installer-config.yaml`. | ||
|
||
To create the disk image you need to add the packer binary in the disk-image directory: | ||
## Building the Disk Image | ||
Harshil2107 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Assuming that you are in the `src/gapbs/` directory, run | ||
|
||
```sh | ||
cd disk-image/ | ||
./build.sh # the script downloading packer binary and building the disk image | ||
``` | ||
|
||
After this process succeeds, the disk image can be found on the `src/gapbs/disk-image/gapbs-image/gapbs`. | ||
After this process succeeds, the disk image can be found on the `src/gapbs/disk-image-ubuntu-24-04`. | ||
|
||
GAPBS disk image can support both real and synthetic graph inputs. The current pre-built disk image contains only one graph input which includes the New York city road map (with 733K nodes) it can be found: <http://users.diag.uniroma1.it/challenge9/download.shtml>. | ||
This gapbs image uses the prebuilt ubuntu 24.04 image as a base image. The gapbs image also throws the same exit events as the base image. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Elaborate more on exit events in the base disk image and/or add link to base image documentation. I think you should also say "Look at the Boot Sequences section for information on what exit events will take place", then tell users where they can find configuration scripts with that exit event setup. Since the PR to update the config scripts is still pending, maybe you could point users to the "usage" tab of one of the gem5 resources with the fleshed out exit event handler setup (such as this one: https://resources.gem5.org/resources/x86-ubuntu-24.04-img/usage?database=gem5-resources&version=2.0.0). Or even just put it in a code block somewhere in this document. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with more explanations about two things:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
To use other graphs simply copy the graph in the gapbs/ directory and add them to gapbs/gapbs.json. | ||
Each benchmark also has its regions of intrests annotated and they throw a `gem5-bridge workbegin` and `gem5-bridge workend` exit event. | ||
Harshil2107 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Simulating GAPBS using an example script | ||
## Init Process and Exit Events | ||
|
||
An example script with a pre-configured system is available in the following directory within the gem5 repository: | ||
This section outlines the disk image's boot process variations and the impact of specific boot parameters on its behavior. | ||
By default, the disk image boots with systemd in a non-interactive mode. | ||
Users can adjust this behavior through kernel arguments at boot time, influencing the init system and session interactivity. | ||
|
||
``` | ||
gem5/configs/example/gem5_library/x86-gapbs-benchmarks.py | ||
``` | ||
### Boot Parameters | ||
|
||
The example script specifies a system with the following parameters: | ||
The disk image supports two main kernel arguments to adjust the boot process: | ||
|
||
* A `SimpleSwitchableProcessor` (`KVM` for startup and `TIMING` for ROI execution). There are 2 CPU cores, each clocked at 3 GHz. | ||
* 2 Level `MESI_Two_Level` cache with 32 kB L1I and L1D size, and, 256 kB L2 size. The L1 cache(s) has associativity of 8, and, the L2 cache has associativity 16. There are 2 L2 cache banks. | ||
* The system has 3 GB `SingleChannelDDR4_2400` memory. | ||
* The script uses `x86-linux-kernel-4.19.83` and `x86-gapbs`, the disk image created from following the instructions in this `README.md`. | ||
- `no_systemd=true`: Disables systemd as the init system, allowing the system to boot without systemd's management. | ||
- `interactive=true`: Enables interactive mode, presenting a shell prompt to the user for interactive session management. | ||
|
||
The example script must be run with the `X86` binary. To build: | ||
Combining these parameters yields four possible boot configurations: | ||
|
||
```sh | ||
git clone https://gem5.googlesource.com/public/gem5 | ||
cd gem5 | ||
scons build/X86/gem5.opt -j<proc> | ||
``` | ||
Once compiled, you may use the example config file to run the GAPBS benchmark programs using the following command: | ||
1. **Default (Systemd, Non-Interactive)**: The system uses systemd for initialization and runs non-interactively. | ||
2. **Systemd and Interactive**: Systemd initializes the system, and the boot process enters an interactive mode, providing a user shell. | ||
3. **Without Systemd and Non-Interactive**: The system boots without systemd and proceeds non-interactively, executing predefined scripts. | ||
4. **Without Systemd and Interactive**: Boots without systemd and provides a shell for interactive use. | ||
|
||
```sh | ||
# In the gem5 directory | ||
build/X86/gem5.opt \ | ||
configs/example/gem5_library/x86-gapbs-benchmarks.py \ | ||
--benchmark <benchmark_program> \ | ||
--synthetic <synthetic> \ | ||
--size <size_or_graph_name> | ||
``` | ||
### Note on Print Statements and Exit Events | ||
|
||
- The bold points in the sequence descriptions are `printf` statements in the code, indicating key moments in the boot process. | ||
- The `**` symbols mark gem5 exit events, essential for simulation purposes, dictating system shutdown or reboot actions based on the configured scenario. | ||
|
||
### Boot Sequences | ||
|
||
#### Default Boot Sequence (Systemd, Non-Interactive) | ||
|
||
- Kernel output | ||
- **Kernel Booted print message** ** | ||
- Running systemd print message | ||
- Systemd output | ||
- autologin | ||
- **Running after_boot script** ** | ||
- Print indicating **non-interactive** mode | ||
- **Reading run script file** | ||
- Script output | ||
- Exit ** | ||
|
||
#### With Systemd and Interactive | ||
|
||
- Kernel output | ||
- **Kernel Booted print message** ** | ||
- Running systemd print message | ||
- Systemd output | ||
- autologin | ||
- **Running after_boot script** ** | ||
- Shell | ||
|
||
#### Without Systemd and Non-Interactive | ||
|
||
- Kernel output | ||
- **Kernel Booted print message** ** | ||
- autologin | ||
- **Running after_boot script** ** | ||
- Print indicating **non-interactive** mode | ||
- **Reading run script file** | ||
- Script output | ||
- Exit ** | ||
|
||
#### Without Systemd and Interactive | ||
|
||
- Kernel output | ||
- **Kernel Booted print message** ** | ||
- autologin | ||
- **Running after_boot script** ** | ||
- Shell | ||
|
||
Description of the three arguments, provided in the above command are: | ||
* **--benchmark**, which refers to one of 5 benchmark programs, provided in the GAP Benchmark Suite. These include `cc`, `bc`, `tc`, `pr` and `bfs`. For more information on the workloads can be found at <http://gap.cs.berkeley.edu/benchmark.html>. | ||
* **--synthetic** refers whether to use a synthetic or a real graph. It accepts a boolean value. | ||
* **--size**, which refers to either the size of a synthetic graph from 1 to 16 nodes, or, a real graph. The real graph included in the pre-built disk-image is `USA-road-d.NY.gr`. Note that `--synthetic True` and `--size USA-road-d.NY.gr` cannot be combined, and, vice versa for real graphs. | ||
This detailed overview provides a foundational understanding of how different boot configurations affect the system's initialization and mode of operation. | ||
By selecting the appropriate parameters, users can customize the boot process for diverse environments, ranging from automated setups to hands-on interactive sessions. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could be good to add an overview of the benchmarks available on the built disk, or point toward the GAPBS documentation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will add a section with all the benchmark workloads, when we upload the disk to the cloud and I can push the JSONs to MongoDB. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
packer { | ||
required_plugins { | ||
qemu = { | ||
source = "github.com/hashicorp/qemu" | ||
version = "~> 1" | ||
} | ||
} | ||
} | ||
|
||
variable "image_name" { | ||
type = string | ||
default = "arm-ubuntu" | ||
} | ||
|
||
variable "ssh_password" { | ||
type = string | ||
default = "12345" | ||
} | ||
|
||
variable "ssh_username" { | ||
type = string | ||
default = "gem5" | ||
} | ||
|
||
source "qemu" "initialize" { | ||
boot_command = ["<wait120>", | ||
"gem5<enter><wait>", | ||
"12345<enter><wait>", | ||
"sudo mv /etc/netplan/50-cloud-init.yaml.bak /etc/netplan/50-cloud-init.yaml<enter><wait>", | ||
"12345<enter><wait>", | ||
"sudo netplan apply<enter><wait>", | ||
"<wait>" | ||
] | ||
cpus = "4" | ||
disk_size = "4600" | ||
format = "raw" | ||
headless = "true" | ||
disk_image = "true" | ||
iso_checksum = "sha256:eb94422a3908c6c5183c03666b278b6e8bcfbde04da3d7c3bb5374bc82e0ef48" | ||
iso_urls = ["./arm-ubuntu-24.04-20240823"] | ||
memory = "8192" | ||
output_directory = "arm-disk-image-24-04" | ||
qemu_binary = "/usr/bin/qemu-system-aarch64" | ||
qemuargs = [ ["-boot", "order=dc"], | ||
["-bios", "./files/flash0.img"], | ||
["-cpu", "host"], | ||
["-enable-kvm"], | ||
["-machine", "virt"], | ||
["-machine", "gic-version=3"], | ||
["-device","virtio-gpu-pci"], | ||
["-device", "qemu-xhci"], | ||
["-device","usb-kbd"], | ||
|
||
] | ||
shutdown_command = "echo '${var.ssh_password}'|sudo -S shutdown -P now" | ||
ssh_password = "${var.ssh_password}" | ||
ssh_username = "${var.ssh_username}" | ||
ssh_wait_timeout = "60m" | ||
vm_name = "${var.image_name}" | ||
ssh_handshake_attempts = "1000" | ||
} | ||
|
||
build { | ||
sources = ["source.qemu.initialize"] | ||
|
||
provisioner "file" { | ||
destination = "/home/gem5/" | ||
source = "gapbs-with-roi-annotations/gapbs" | ||
} | ||
provisioner "shell" { | ||
execute_command = "echo '${var.ssh_password}' | {{ .Vars }} sudo -E -S bash '{{ .Path }}'" | ||
scripts = ["scripts/post-installation.sh"] | ||
expect_disconnect = true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
PACKER_VERSION="1.10.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add copyright (?) |
||
|
||
if [ ! -f ./packer ]; then | ||
wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_arm64.zip; | ||
unzip packer_${PACKER_VERSION}_linux_arm64.zip; | ||
rm packer_${PACKER_VERSION}_linux_arm64.zip; | ||
fi | ||
|
||
Harshil2107 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# make the flash0.sh file | ||
mkdir files | ||
cd ./files | ||
|
||
dd if=/dev/zero of=flash0.img bs=1M count=64 | ||
dd if=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd of=flash0.img conv=notrunc | ||
cd .. | ||
|
||
wget https://storage.googleapis.com/dist.gem5.org/dist/develop/images/arm/ubuntu-24-04/arm-ubuntu-24.04-20240823.gz | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line has a problem when the .gz file already exists. Can you do one of the following?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also applies to similar wget commands below. |
||
gunzip arm-ubuntu-24.04-20240823.gz | ||
|
||
./packer init arm-ubuntu-24-04-gapbs.pkr.hcl | ||
./packer build arm-ubuntu-24-04-gapbs.pkr.hcl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
PACKER_VERSION="1.7.8" | ||
#!/bin/bash | ||
|
||
# Copyright (c) 2024 The Regents of the University of California. | ||
# SPDX-License-Identifier: BSD 3-Clause | ||
|
||
PACKER_VERSION="1.10.0" | ||
|
||
if [ ! -f ./packer ]; then | ||
wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip; | ||
unzip packer_${PACKER_VERSION}_linux_amd64.zip; | ||
rm packer_${PACKER_VERSION}_linux_amd64.zip; | ||
fi | ||
|
||
Harshil2107 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
./packer validate gapbs/gapbs.json | ||
./packer build gapbs/gapbs.json | ||
./packer init riscv-ubuntu-24-04-gapbs.pkr.hcl | ||
./packer build riscv-ubuntu-24-04-gapbs.pkr.hcl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) 2024 The Regents of the University of California. | ||
# SPDX-License-Identifier: BSD 3-Clause | ||
|
||
PACKER_VERSION="1.10.0" | ||
|
||
if [ ! -f ./packer ]; then | ||
wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip; | ||
unzip packer_${PACKER_VERSION}_linux_amd64.zip; | ||
rm packer_${PACKER_VERSION}_linux_amd64.zip; | ||
fi | ||
|
||
# wget https://storage.googleapis.com/dist.gem5.org/dist/develop/images/x86/ubuntu-24-04/x86-ubuntu-24-04.gz | ||
Harshil2107 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# gunzip x86-ubuntu-24-04.gz | ||
Harshil2107 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
./packer init x86-ubuntu-24-04-gapbs.pkr.hcl | ||
./packer build x86-ubuntu-24-04-gapbs.pkr.hcl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add link