0% found this document useful (0 votes)
123 views7 pages

Home - MD Cheat Sheet: Get Arm Research Starter Kit

This document provides instructions for using the Arm Research Starter Kit (RSK) to run benchmarks and simulations using the gem5 simulator in both System Call Emulation (SE) and Full System (FS) modes. It describes how to clone repositories, build gem5, run simple examples, obtain benchmark suites like LLVM and PARSEC, and compile/run the benchmarks in gem5. The goal is to simulate Arm systems and compare benchmark performance in SE and FS modes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views7 pages

Home - MD Cheat Sheet: Get Arm Research Starter Kit

This document provides instructions for using the Arm Research Starter Kit (RSK) to run benchmarks and simulations using the gem5 simulator in both System Call Emulation (SE) and Full System (FS) modes. It describes how to clone repositories, build gem5, run simple examples, obtain benchmark suites like LLVM and PARSEC, and compile/run the benchmarks in gem5. The goal is to simulate Arm systems and compare benchmark performance in SE and FS modes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

6/8/2019 Documentation

TABLE OF
CONTENTS


Home.md
Home.md

Cheat Sheet
This Cheat Sheet contains all commands and code examples used in the Arm Research Starter Kit
(RSK) on System Modeling using gem5

1. Get Started
Follow these instructions to download all the required materials, build a gem5 binary and run simple
examples in both System Call Emulation (SE) and Full System (FS) modes.

Get Arm Research Starter Kit


Clone Repositories
Get and run the clone.sh script to clone both gem5 and arm-gem5-rsk repositories

$ wget https://raw.githubusercontent.com/arm-university/arm-gem5-rsk/master/clo
$ bash clone.sh

Build gem5
Build gem5 binaries for Arm

$ cd gem5
$ scons build/ARM/gem5.opt -j4 # parallel build

Simulate Arm in gem5


SE Simulation
Run simple SE:

$ ./build/ARM/gem5.opt configs/example/arm/starter_se.py --cpu="minor" "tests/t

Run multicore SE:

file:///Users/reyad/Downloads/documentation.html#Home 1/7
6/8/2019 Documentation
Note: each core runs its own program

$ ./build/ARM/gem5.opt configs/example/arm/starter_se.py --cpu="minor" --nu

FS Simulation
Get Arm full system disk image and set $M5_PATH :

$ wget http://www.gem5.org/dist/current/arm/aarch-system-20170616.tar.xz
$ tar xvfJ aarch-system-20170616.tar.xz

Note: set the /path_to_aarch-system-20170616_dir/

$ echo "export M5_PATH=/path_to_aarch-system-20170616_dir/" >> ~/.bashrc


$ source ~/.bashrc

Run simple FS:

$ ./build/ARM/gem5.opt configs/example/arm/starter_fs.py --cpu="minor"

Run with disk image:

$ ./build/ARM/gem5.opt configs/example/arm/starter_fs.py --cpu="minor" --num-co

Create a checkpoint after boot:

$ telnet localhost 3456


$ m5 checkpoint

Restore from a checkpoint:

Note: Arm starter_fs.py allows to specify checkpoints with --


restore=m5out/cpt.TICKNUMBER/

$ ./build/ARM/gem5.opt configs/example/arm/starter_fs.py --restore=m5out/cp

2. SE Benchmarks
We use the Stanford SingleSource workloads from the LLVM test-suite for benchmarking in the SE
mode.

Get and Compile LLVM test-suite


Download the Stanford SingleSource LLVM test-suite:

$ svn export https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_390/fina

Install the Arm cross compiler toolchain:


file:///Users/reyad/Downloads/documentation.html#Home 2/7
6/8/2019 Documentation

$ sudo apt-get install gcc-arm-linux-gnueabihf

Replace se-benchmarks/Makefile with the code below and then make :

Note: replace whitespaces with tabs in your Makefile

SRCS = $(wildcard *.c)


PROGS = $(patsubst %.c,%,$(SRCS))
all: $(PROGS)
%: %.c
arm-linux-gnueabihf-gcc --static $< -o $@
clean:
rm -f $(PROGS)

Run LLVM test-suite


Run LLVM test-suite on HPI:

Note: set <benchmark> and /path_to_benchmark/

$ ./build/ARM/gem5.opt -d se_results/<benchmark> configs/example/arm/starte

Read results of SE runs


To compare the benchmarks, we first need to create a simple configuration file and specify a list of
benchmarks to be compared, comparison parameters and an output file. Then, we just pass this
configuration file to the read_results.sh bash script.

Step1: create a .ini under the se_results directory (where the results of SE runs are
stored), e.g. exe_time.ini looks like this:

[Benchmarks]
Bubblesort
IntMM
Oscar

[Parameters]
sim_seconds

[Output]
res_exe_time.txt

Step2: run the read_results.sh bash script from the se_results directory and pass the
sample exe_time.ini file as a parameter:

$ cd se_results # where the results of SE runs are stored


$ bash ../../arm-gem5-rsk/read_results.sh exe_time.ini
$ cat res_exe_time.txt

3. FS Benchmarks
file:///Users/reyad/Downloads/documentation.html#Home 3/7
6/8/2019 Documentation

We use The PARSEC Benchmark Suite for benchmarking in the FS mode.

Get and Compile PARSEC


Download PARSEC 3.0:

$ wget http://parsec.cs.princeton.edu/download/3.0/parsec-3.0.tar.gz
$ tar -xvzf parsec-3.0.tar.gz

We describe two ways to compile PARSEC benchmarks for Arm:

Cross-compiling on an x86 machine

Compiling on QEMU

The common steps apply to both approaches.

Common Steps
Step1: from the parsec-3.0 directory, apply static-patch.diff :

$ patch -p1 < ../arm-gem5-rsk/parsec_patches/static-patch.diff

Step2: replace config.guess and config.sub :

Note: set path to /parsec_dir/ and /absolute_path_to_tmp/

$ mkdir tmp; cd tmp # make a tmp dir outside the parsec dir
$ wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=
$ wget -O config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=bl
$ cd /parsec_dir/ # cd to the parsec dir
$ find . -name "config.guess" -type f -print -execdir cp {} config.guess_ol
$ find . -name "config.guess" -type f -print -execdir cp /absolute_path_to_
$ find . -name "config.sub" -type f -print -execdir cp {} config.sub_old \;
$ find . -name "config.sub" -type f -print -execdir cp /absolute_path_to_tm

Cross-Compile PARSEC on x86


Get the aarch64-linux-gnu toolchain:

$ wget https://releases.linaro.org/components/toolchain/binaries/latest-5/aarch
$ tar xvfJ gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz

From the parsec-3.0 directory, apply xcompile-patch.diff :

Note: before applying the patch, change the CC_HOME and the BINUTIL_HOME in the
xcompile-patch.diff to point to the downloaded <gcc-linaro directory> and
<gcc-linaro directory>/aarch64-linux-gnu directories

$ patch -p1 < ../arm-gem5-rsk/parsec_patches/xcompile-patch.diff

file:///Users/reyad/Downloads/documentation.html#Home 4/7
6/8/2019 Documentation
Cross-compile PARSEC:

Note: set <pkgname>

$ export PARSECPLAT="aarch64-linux" # set the platform


$ source ./env.sh
$ parsecmgmt -a build -c gcc-hooks -p <pkgname>

Compile PARSEC on QEMU


From the parsec-3.0 directory, apply qemu-patch.diff :

$ patch -p1 < ../arm-gem5-rsk/parsec_patches/qemu-patch.diff

Resolve dependencies

$ sudo apt-get install libglib2.0 libpixman-1-dev libfdt-dev libcap-dev libattr

Clone and make QEMU:

$ git clone git://git.qemu.org/qemu.git qemu


$ cd qemu
$ ./configure --target-list=aarch64-softmmu
$ make

Get the Arm AArch64 kernel and disk image for QEMU:

$ wget http://releases.linaro.org/archive/15.06/openembedded/aarch64/Image
$ wget http://releases.linaro.org/archive/15.06/openembedded/aarch64/vexpress64
$ gzip -dc vexpress64-openembedded_lamp-armv8-gcc-4.9_20150620-722.img.gz > vex

Start QEMU:

Note: set path to /shared_directory/

$ ./qemu/aarch64-softmmu/qemu-system-aarch64 -m 1024 -cpu cortex-a53 -nogra

Mount /shared_directory/ on QEMU:

$ mount -t 9p -o trans=virtio r /mnt

Compile PARSEC on QEMU:

Note: set <pkgname>

$ cd /mnt # cd to the mounted PARSEC directory


$ source ./env.sh
$ parsecmgmt -a build -c gcc-hooks -p <pkgname>
$ poweroff # quit QEMU

file:///Users/reyad/Downloads/documentation.html#Home 5/7
6/8/2019 Documentation

Run PARSEC
To run PARSEC benchmarks on Arm, we need to enlarge the disk image and copy the directory of
compiled benchmarks parsec-3.0 to it. Then, we need to generate benchmark runscripts and pass
them via the --script option to the simulation script starter_fs.py .

Copy PARSEC to Disk Image


Expand the disk image:

$ cp linaro-minimal-aarch64.img expanded-linaro-minimal-aarch64.img
$ dd if=/dev/zero bs=1G count=20 >> ./expanded-linaro-minimal-aarch64.img # add
$ sudo parted expanded-linaro-minimal-aarch64.img resizepart 1 100% # grow part

Mount the expanded disk image, resize it, and copy PARSEC to it:

Note: set /path_to_compiled_parsec-3.0_dir/

$ mkdir disk_mnt
$ name=$(sudo fdisk -l expanded-linaro-minimal-aarch64.img | tail -1 | awk
$ start_sector=$(sudo fdisk -l expanded-linaro-minimal-aarch64.img | grep $
$ units=$(sudo fdisk -l expanded-linaro-minimal-aarch64.img | grep ^Units |
$ sudo mount -o loop,offset=$(($start_sector*$units)) expanded-linaro-minim
$ df # find /dev/loopX for disk_mnt
$ sudo resize2fs /dev/loopX # resize filesystem
$ df # check that the Available space for disk_mnt is increased
$ sudo cp -r /path_to_compiled_parsec-3.0_dir/ disk_mnt/home/root # copy th
$ ls disk_mnt/home/root # check the parsec-3.0 contents
$ sudo umount disk_mnt

Run PARSEC on HPI


We only show how to run PARSEC on the HPI model. Reading results from stats.txt files can be
done by using the read_results.sh script, as shown for the SE mode.

Generate benchmark runscripts

$ cd arm-gem5-rsk/parsec_rcs
$ bash gen_rcs.sh -i simsmall -p <pkgname> -i <simsmall/simmedium/simlarge> -n

Run starter_fs using the expanded image and benchmark runscript

Note: set both <benchmark> instances

` bash $ ./build/ARM/gem5.opt -d fs_results/ configs/example/arm/starter_fs.py --cpu="hpi" --


num-cores=1 --disk-image=$M5_PATH/disks/expanded-linaro-minimal-aarch64.img --
script=../arm-gem5-rsk/parsec_rcs/.rcS

Example: canneal on 2 cores

file:///Users/reyad/Downloads/documentation.html#Home 6/7
6/8/2019 Documentation

$ ./build/ARM/gem5.opt -d fs_results/canneal_simsmall_2 configs/example/arm/starter_fs.py --


cpu="hpi" --num-cores=2 --disk-image=$M5_PATH/disks/expanded-linaro-minimal-aarch64.img --
script=../arm-gem5-rsk/parsec_rcs/canneal_simsmall_2.rcS `

file:///Users/reyad/Downloads/documentation.html#Home 7/7

You might also like