-
Notifications
You must be signed in to change notification settings - Fork 53
resources: update gapbs to use new 24.04 images #46
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
base: stable
Are you sure you want to change the base?
Changes from all commits
31a06cf
06e16b9
fb586ff
a8142b6
e98ff3e
b013e31
78525cb
3a77227
4429b9d
36c74a7
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,113 @@ 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 | ||
|
||
Assuming that you are in the `src/gapbs/` directory, first create `m5` (which is needed to create the disk image): | ||
Assuming that you are in the `src/gapbs/` directory, run | ||
|
||
```sh | ||
git clone https://gem5.googlesource.com/public/gem5 | ||
cd gem5/util/m5 | ||
scons build/x86/out/m5 | ||
./build.sh # the script downloading packer binary and building the disk image | ||
``` | ||
|
||
To create the disk image you need to add the packer binary in the disk-image directory: | ||
After this process succeeds, the disk image can be found on the `src/gapbs/disk-image-ubuntu-24-04`. | ||
|
||
```sh | ||
cd disk-image/ | ||
./build.sh # the script downloading packer binary and building the disk image | ||
``` | ||
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. For more details on the exit events, check out the [Boot Sequences](#boot-sequences) section. | ||
|
||
After this process succeeds, the disk image can be found on the `src/gapbs/disk-image/gapbs-image/gapbs`. | ||
Each benchmark also has its regions of interest annotated and they throw a `gem5-bridge workbegin` and `gem5-bridge workend` exit event. | ||
|
||
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>. | ||
## What's on the disk? | ||
|
||
To use other graphs simply copy the graph in the gapbs/ directory and add them to gapbs/gapbs.json. | ||
- username: gem5 | ||
- password: 12345 | ||
|
||
## Simulating GAPBS using an example script | ||
- 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`. For more information on m5, read the following [documentation](https://www.gem5.org/documentation/general_docs/m5ops/). | ||
- `gapbs` benchmark suite with ROI annotations. The built binaries are in the path `/home/gem5/gapbs/`. | ||
- Two real graphs: `soc-LiveJournal1` and `facebook_combined` | ||
|
||
An example script with a pre-configured system is available in the following directory within the gem5 repository: | ||
Thus, you should be able to build packages on the disk and easily link to the gem5-bridge library. | ||
|
||
``` | ||
gem5/configs/example/gem5_library/x86-gapbs-benchmarks.py | ||
``` | ||
The disk has network disabled by default to improve boot time in gem5. | ||
|
||
The example script specifies a system with the following parameters: | ||
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`. | ||
|
||
* 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`. | ||
## Init Process and Exit Events | ||
|
||
The example script must be run with the `X86` binary. To build: | ||
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. | ||
|
||
```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: | ||
### Boot Parameters | ||
|
||
```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> | ||
``` | ||
The disk image supports two main kernel arguments to adjust the boot process: | ||
|
||
- `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. | ||
|
||
Combining these parameters yields four possible boot configurations: | ||
|
||
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. | ||
|
||
### 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,23 @@ | ||
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 .. | ||
|
||
if [ ! -f arm-ubuntu-24.04-20240823 ]; then | ||
wget https://storage.googleapis.com/dist.gem5.org/dist/develop/images/arm/ubuntu-24-04/arm-ubuntu-24.04-20240823.gz | ||
gunzip arm-ubuntu-24.04-20240823.gz | ||
fi | ||
|
||
./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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/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
|
||
if [ ! -f riscv-ubuntu-24-04 ]; then | ||
wget https://storage.googleapis.com/dist.gem5.org/dist/develop/images/riscv/ubuntu-24-04/riscv-ubuntu-24-04.gz; | ||
gunzip riscv-ubuntu-24-04.gz; | ||
fi | ||
|
||
./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,21 @@ | ||
#!/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 | ||
|
||
if [ ! -f ./x86-ubuntu-24-04 ]; then | ||
wget https://storage.googleapis.com/dist.gem5.org/dist/develop/images/x86/ubuntu-24-04/x86-ubuntu-24-04.gz | ||
gunzip x86-ubuntu-24-04.gz | ||
fi | ||
|
||
|
||
./packer init x86-ubuntu-24-04-gapbs.pkr.hcl | ||
./packer build x86-ubuntu-24-04-gapbs.pkr.hcl |
This file was deleted.
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