This document aims to provide instructions to create a gem5-compatible disk image containing the SPEC 2017 benchmark suite and also to provide necessary configuration files.
Creating a disk-image for SPEC 2017 requires the benchmark suite ISO file. More info about SPEC 2017 can be found here.
In this tutorial, we assume that the file cpu2017-1.1.0.iso
contains the SPEC benchmark suite, and we provide the scripts that are made specifically for SPEC 2017 version 1.1.0. Throughout the this document, the root folder is src/spec-2017/
. All commands should be run from the assumed root folder.
The layout of the folder after the scripts are run is as follows,
spec-2017/ |___ gem5/ # gem5 folder | |___ disk-image/ | |___ shared/ | |___ spec-2017/ | |___ spec-2017-image/ | | |___ spec-2017 # the disk image will be generated here | |___ spec-2017.json # the Packer script | |___ cpu2017-1.1.0.iso # SPEC 2017 ISO (add here) | |___ configs | |___ system/ | |___ run_spec.py # gem5 run script | |___ vmlinux-4.19.83 # Linux kernel, link to download provided below | |___ README.md
First, to build m5
(required for interactions between gem5 and the guest):
git clone https://gem5.googlesource.com/public/gem5 cd gem5 git checkout origin/develop cd util/m5 scons build/x86/out/m5
We use Packer, an open-source automated disk image creation tool, to build the disk image. In the root folder,
cd disk-image wget https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip # download the packer binary unzip packer_1.6.0_linux_amd64.zip ./packer validate spec-2017/spec-2017.json # validate the Packer script ./packer build spec-2017/spec-2017.json
The path to the disk image is spec-2017/spec-2017-image/spec-2017
. Please refer to this tutorial for more information about the scripts used in this document.
The following link contains the compiled Linux kernel that was tested by running gem5-20 with SPEC 2017,
gem5 scripts which configure the system and run the simulation are available in configs/
. The main script run_spec.py
expects following arguments:
usage: run_spec.py [-h] [-l] [-z] kernel disk cpu benchmark size
-h
: show this help message and exit.
-l
, --no-copy-logs
: optional, to not copy SPEC run logs to the host system, logs are copied by default, and are available in the result folder.
-z
, --allow-listeners
: optional, to turn on GDB listening ports, the ports are off by default.
kernel
: required, a positional argument specifying the path to the Linux kernel.
disk
: required, a positional argument specifying the path to the disk image containing SPEC 2017 benchmark suite.
cpu
: required, a positional argument specifying the name of either a detailed CPU model or KVM CPU model.
The available CPU models are,
cpu | Corresponding CPU model in gem5 |
---|---|
kvm | |
o3 | DerivO3CPU |
atomic | AtomicSimpleCPU |
timing | TimingSimpleCPU |
benchmark
: required, a positional argument specifying the name of the SPEC 2017 workload to run.
size
: required, a positional argument specifying the input data size, must be one of {test, train, ref}.
Assume the compiled Linux kernel is available in the assumed root folder, the following is an example of running a SPEC 2017 workload in full system mode, gem5/build/X86/gem5.opt --outdir [path to the gem5 output directory] configs/run_spec.py -z vmlinux-4.19.83 disk-image/spec-2017/spec-2017-image/spec-2017 atomic 403.gcc test
Status of these benchmarks runs with respect to gem5-20, linux kernel version 4.19.83 and gcc version 7.5.0 can be found here