Last active
December 11, 2015 07:18
-
-
Save aprell/4564843 to your computer and use it in GitHub Desktop.
Throw-away script for runtime experiments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 program" | |
exit 0 | |
fi | |
# Task granularity | |
taskgran="small" | |
nruns=10 | |
out=runtimes_$1_${taskgran}_$(git branch | grep "^*" | cut -d" " -f2).csv | |
tmp=runtimes_$1_${taskgran}_$(git branch | grep "^*" | cut -d" " -f2)_01.tmp | |
echo "Writing $out" | |
echo "Number of workers,Average execution time,Standard deviation" > $out | |
for i in 1 $(seq 2 2 10); do | |
export NUM_THREADS=$i | |
echo $NUM_THREADS | |
if [ $i -lt 10 ]; then | |
tmp=runtimes_$1_${taskgran}_$(git branch | grep "^*" | cut -d" " -f2)_0$i.tmp | |
else | |
tmp=runtimes_$1_${taskgran}_$(git branch | grep "^*" | cut -d" " -f2)_$i.tmp | |
fi | |
echo -n $i, >> $out | |
echo -n "" > $tmp | |
# Repeat every experiment nruns times | |
for j in $(seq 1 $nruns); do | |
./$1 | grep "Elapsed" | tr -d " " | cut -d: -f2 | tr -d -C [0-9.\\n] >> $tmp | |
done | |
# Calculate average of runs | |
cat $tmp | average | tail -1 | tr -d '\n' >> $out | |
echo -n "," >> $out | |
# Calculate standard deviation of runs (to two decimal places) | |
cat $tmp | stddev | tail -1 >> $out | |
done | |
#rm runtimes_*.tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment