Skip to content

Instantly share code, notes, and snippets.

@cyfdecyf
Last active December 29, 2015 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyfdecyf/7611623 to your computer and use it in GitHub Desktop.
Save cyfdecyf/7611623 to your computer and use it in GitHub Desktop.
Script to run and collect ROI (region of interest) time for the PARSEC benchmark.
#!/bin/bash
# Extract parsec benchmark run command.
APPS="blackscholes bodytrack canneal swaptions fluidanimate"
# Number of threads to run.
NTHR="2 4"
# Output file
OUTPUT=cmd
# Specify input data set.
INPUT=simlarge
# Build before running.
BUILD=false
source env.sh
# build <bench>
build() {
echo "building $i"
parsecmgmt -a build -c gcc-hooks -p $1
}
# runbench <bench> <nthr>
run() {
parsecmgmt -a run -c gcc-hooks -i $INPUT -p $1 -n $2
}
# bench <app>
extract() {
echo "==============Running $1=============="
$BUILD && build $1
for thr in $NTHR; do
echo "run $1 with $thr threads"
# extract cmd
run $1 $thr | awk '/\[PARSEC\] Running/ { st=index($0, $4); print substr($0, st, length($0)-st-1) }' >> $OUTPUT
done
}
for a in $APPS; do
extract $a
done
#!/bin/bash
# 1. Put this script in PARSEC 3 benchmark root directory.
# 2. Customize by modifying the following variables.
# 3. Run it.
APPS="blackscholes bodytrack swaptions fluidanimate freqmine"
# Number of threads to run.
NTHR="1 2 4"
# Run each benchmark for how many times.
NTIMES="5"
OUTDIR=data
# Specify input data set.
INPUT=simlarge
# Build before running.
BUILD=true
source env.sh
# build <bench>
build() {
echo "building $i"
parsecmgmt -a build -c gcc-hooks -p $1
}
# runbench <bench> <nthr>
run() {
parsecmgmt -a run -c gcc-hooks -i $INPUT -p $1 -n $2
}
# bench <app>
bench() {
mkdir -p $OUTDIR
echo "==============Benchmarking $1=============="
pushd $OUTDIR
$BUILD && build $1
for thr in $NTHR; do
echo $thr > $1.$thr # print number of threads
for ((i=1; i<=$NTIMES;i++)); do
echo "run $1 with $thr threads"
# print ROI time
run $1 $thr | awk '/\[HOOKS\] Total time spent in ROI:/ { print substr($7, 0, length($7)-1) }' >> $1.$thr
done
done
paste $1.* > $1
rm -f $1.*
popd
}
for a in $APPS; do
bench $a
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment