|
@@ -3,9 +3,14 @@
|
|
|
# Save path the current path that will be used to store the results.
|
|
|
BASE_PATH=$(pwd)
|
|
|
|
|
|
+# Variable to store the name of the benchmark
|
|
|
+BENCH_NAME=$1
|
|
|
|
|
|
# Local variable to store if cpu or gpu directed benchmark
|
|
|
-TYPE=$3
|
|
|
+TYPE=$2
|
|
|
+
|
|
|
+# A bit of debug info to the user
|
|
|
+echo "We are executing the benchmark $BENCH_NAME for $TYPE"
|
|
|
|
|
|
# Check if we need to create the directories to store the results
|
|
|
if [ ! -d "results" ]; then
|
|
@@ -18,27 +23,24 @@ fi
|
|
|
|
|
|
|
|
|
# Start power measurement
|
|
|
-./SmartPower results/$TYPE/power-usage.csv & export PID_POWER=$!
|
|
|
-echo $PID_POWER
|
|
|
+./SmartPower results/$TYPE/power-usage.csv >/dev/null & export PID_POWER=$!
|
|
|
|
|
|
|
|
|
-# Enter in the directory passed as first parameter, then execute run and save the results in the file passed as second parameter
|
|
|
-cd $1
|
|
|
-BENCH_NAME=$1
|
|
|
+# Enter in the directory of the benchmarks
|
|
|
+cd $BENCH_NAME
|
|
|
|
|
|
-# Start and time the actual benchmark
|
|
|
+# Start and time the actual benchmark and save the result in a local variable
|
|
|
BENCH_TIME=`(/usr/bin/time -f "%e" ./run-$TYPE) 2>&1 > /dev/zero | tail -1`
|
|
|
|
|
|
# Stop power measurement
|
|
|
kill -SIGUSR1 $PID_POWER
|
|
|
|
|
|
-# Wait until the Smartpower utility has received the kill signal and force a sync on the disk to avoid reading the previous result
|
|
|
-
|
|
|
-sleep 5 && sync
|
|
|
+# Wait until the Smartpower utility has received the kill signal and force a sync on the disk to avoid reading the previous result from the result file
|
|
|
|
|
|
+sleep 10 && sync
|
|
|
|
|
|
-# Save execution time in the log
|
|
|
-echo "$BENCH_NAME, $BENCH_TIME" >> $BASE_PATH/results/$TYPE/$2
|
|
|
+# A bit of debug info to the user
|
|
|
+echo "Saving the results and preparing for the next benchmark"
|
|
|
|
|
|
# Prepare a log that contains all the info relative to a benchmark
|
|
|
# To retrieve the power measurement we take the third column of the last row from the file where the measurement utility has saved the results
|
|
@@ -50,7 +52,7 @@ echo "$BENCH_NAME, $BENCH_TIME, $BENCH_CONSUMPTION" >> $BASE_PATH/results/$TYPE/
|
|
|
sleep 3
|
|
|
|
|
|
# Add an additional SIGKILL to avoid zombie processes in case of a faulty measurement, we ignore the standard output/error and we always succeed, otherwise make will complain
|
|
|
-kill -SIGKILL $PID_POWER 2>&1 > /dev/null || true
|
|
|
+kill -SIGKILL $PID_POWER >/dev/null 2>&1 > /dev/null || true
|
|
|
|
|
|
# Sleep in order to give time to the power measurement script to reset and to dissipate the heat accumuled in the previous benchmark.
|
|
|
sleep 3
|