This document aims to provide instructions to create a gem5-compatible disk image containing the SPEC 2017 benchmark suite. It also demonstrates how to simulate the SPEC CPU2017 benchmarks using an example configuration script.
Creating a disk-image for SPEC 2017 requires the benchmark suite ISO file. More info about SPEC 2017 can be found at https://www.spec.org/cpu2017/.
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/ | |___ build.sh # the script downloading packer binary and building the 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) | |___ vmlinux-4.19.83 # Linux kernel, link to download provided below | |___ README.md
First, to build
m5 (required for interactions between gem5 and the system under simuations):
git clone https://gem5.googlesource.com/public/gem5 cd gem5 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 ./build.sh # the script downloading packer binary and building the disk image
An example script with a pre-configured system is available in the following directory within the gem5 repository:
The example script specifies a system with the following parameters:
KVMfor startup and
TIMINGfor ROI execution). There are 2 CPU cores, each clocked at 3 GHz.
MESI_Two_Levelcache 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.
x86-linux-kernel-4.19.83and the disk image created from following the instructions in this
CustomResourceclass to use the
The example script must be run with the
X86_MESI_Two_Level binary. To build:
git clone https://gem5.googlesource.com/public/gem5 cd gem5 scons build/X86/gem5.opt -j<proc>
Once compiled, you may use the example configuration file to run the SPEC CPU2017 benchmark programs using the following command:
# In the gem5 directory build/X86/gem5.opt \ configs/example/gem5_library/x86-spec-cpu2017-benchmarks.py \ --image <path_to_built_spec-2017_disk_image> \ --partition <root_partition_to_mount> \ --benchmark <benchmark_program> \ --size <workload_size>
Description of the four arguments, provided in the above command are:
--partition "". Otherwise, pass an integer specifying the partition number. Set
--partition 1if the above instructions to build the disk-image are followed.
The output directory, where the simulation statistics will be redirected to, will have a new folder named
speclogs_<Day><Month><Date><Hour><Minute><Second>. The time is of execution is appended to avoid conflicts while coping the files. The output files, generated on the disk-image in the folder
speclogs will be copied to this aforementioned directory.
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