Skip to content

Compiling CPU2000 2006 2017

Changwei Zou edited this page Mar 12, 2023 · 11 revisions

1 Use Gold-Plugin

1.1 CPU2000

  1. Put cpu2000-flto.cfg file into folder $CPU2000_HOME/config

  2. Analyze CPU2000 to generate bc files

cd $CPU2000_HOME
. ./shrc
rm -rf benchspec/CINT2000/*/exe/
rm -rf benchspec/CFP2000/*/exe/
runspec  --action=run --config=cpu2000-flto --tune=base --size=test --iterations=1 --noreportable all
  1. Collect bc files
cd $CPU2000_HOME
mkdir llvm-4.0.0.opt.bcs
find . -name *.opt.bc -exec cp {} llvm-4.0.0.opt.bcs/ \;
  1. Rename *.bc ==> *.orig
for f in *.opt.bc; do
mv "$f" "$(basename "$f" .opt.bc).orig"
done
  1. Print out command line to run a specific exe for a benchmark
cd benchspec/CINT2000/252.eon/run/00000001/
specinvoke -n

1.2 CPU2006

  1. Put cpu2006-flto.cfg file into folder $CPU2006_HOME/config

  2. Analyze CPU2006 to generate bc files

cd $CPU2000_HOME
. ./shrc
rm -rf benchspec/CPU2006/*/exe/
runspec  --action=run --config=cpu2006-flto --tune=base --size=test --iterations=1 --noreportable all

2 Use WLLVM

2.1 CPU2017

  1. Install WLLVM and make sure it works as expected

  2. Put cpu2017-wllvm.cfg file into folder $CPU2017_HOME/config

  3. Generate bc files for the 28 C/C++ programs (excluding the other 15 Fortran programs) in CPU2017.

There are 43 benchmarks in CPU2017.

cd $CPU2017_HOME
. ./shrc
runcpu --action=clean --config=cpu2017-wllvm all
rm -rf benchspec/CPU/*/exe/
rm -rf benchspec/CPU/*/build/
rm -rf benchspec/CPU/*/run/
runcpu --action=build --tune=base --config=cpu2017-wllvm 500 502 505 508 510 511 519 520 523 525 526 531 538 541 544 557 600 602 605 619 620 623 625 631 638 641 644 657
  1. Copy the generated executable files to a directory you specify.
cd /path/to/the/directory
mkdir -p exe
mkdir -p bc
mkdir -p ll
find $CPU2017_HOME/benchspec/CPU -name "*.mytest-*" -exec cp {} /path/to/the/directory/exe \;
  1. Reuse the following shell script to generate bc files .

Make sure your WLLVM is still working in your current shell terminal.

#!/bin/bash

exes=`ls ./exe`
for e in ${exes}
do 	
	echo "extract-bc ./exe/${e} -o ./bc/${e}.bc 2>/dev/null"
	extract-bc ./exe/${e} -o ./bc/${e}.bc 2>/dev/null
	llvm-dis ./bc/${e}.bc -o ./ll/${e}.ll
done