Skip to content

Commit

Permalink
Automated running many benchmarks and parsing the results
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwilkins18 committed Aug 3, 2022
1 parent 6d7e81a commit c94a64c
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
LANG="C"
BENCH="CG"
CLASS="S"
PROCS=1
GRAIN=1

setup:
./scripts/setup.sh
Expand All @@ -13,3 +15,9 @@ bench:

all_benches:
./scripts/make_all.sh

run_bench:
./scripts/run_single.sh $(LANG) $(BENCH) $(CLASS) $(PROCS) $(GRAIN)

run_all:
./scripts/run_all.sh
10 changes: 10 additions & 0 deletions scripts/parse_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# This script parses all benchmark results
# $1=file to parse

file=$1

awk -F: '{total_time[$1]+=$6; ++count[$1]} END{for (key in total_time) if(key != "") print key","total_time[key]/count[key]}' $file | sort -t, -k1,1 -k2,2 -k3,3n -k4,4n

#END
47 changes: 47 additions & 0 deletions scripts/run_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# This script runs all benchmarks from both the MPL and C Implementations of NAS multiple times


root_dir=$(pwd)
langs=("C" "MPL")
benchs=("CG" "EP" "FT" "IS" "MG")
classes=("S" "W" "A" "B" "C")
procs=(1 4 16 64 128)
grains=(1 4 16 64)

for x in {1..5}
do
for lang in ${langs[@]}
do
for bench in ${benchs[@]}
do
for class in ${classes[@]}
do
if [[ "$bench" == "FT" ]] && [[ "$class" == "C" ]] ; then
continue
fi

for proc in ${procs[@]}
do
if [[ "$lang" == "MPL" ]] ; then
for grain in ${grains[@]}
do
./scripts/run_single.sh $lang $bench $class $proc $grain
cd $root_dir
done

elif [[ "$lang" == "C" ]] ; then
./scripts/run_single.sh $lang $bench $class $proc 1
cd $root_dir

else
echo "Error: Invalid Implementation Language"
fi
done
done
done
done
done

#END
29 changes: 29 additions & 0 deletions scripts/run_single.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# This script run a single benchmark from either MPL or C Implementations of NAS
# $1 = MPL or C
# $2 = Benchmark name
# $3 = Class size
# $4 = Processes
# $5 = Grain Size (MPL Only)

lang=$1
bench=$2
class=$3
procs=$4
grain=$5

if [[ "$lang" == "MPL" ]] ; then
cd $(pwd)/NPB/MPL-NPB/$bench
make run CLASS=$class PROCS=$procs GRAIN=$grain

elif [[ "$lang" == "C" ]] ; then
cd $(pwd)/NPB/NPB-C-3.0/bin
export OMP_NUM_THREADS=$procs
./${bench,,}.$class | awk -v bench=$bench -v class=$class -v procs=$procs -v grain=$grain\
'{if($3 == "seconds"){print bench","class","procs","grain":"bench":"class":"procs":"grain":"$5}}'
else
echo "Error: Invalid Implementation Language"
fi

#END

0 comments on commit c94a64c

Please sign in to comment.