From e23d565fd2747b3eb8a8afa20b4178bf22e463b0 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 16 Nov 2022 17:39:09 +0100 Subject: [PATCH] Create `bench` target for calculating the average of 9 runs --- OpenMP/linear-algebra/kernels/atax/.bench.sh | 14 ++++++++++++++ OpenMP/linear-algebra/kernels/atax/Makefile | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 OpenMP/linear-algebra/kernels/atax/.bench.sh diff --git a/OpenMP/linear-algebra/kernels/atax/.bench.sh b/OpenMP/linear-algebra/kernels/atax/.bench.sh new file mode 100755 index 0000000..b79e6c0 --- /dev/null +++ b/OpenMP/linear-algebra/kernels/atax/.bench.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +runs=9 +totalt=0.0 + +for i in $(seq $runs) +do + exet=$(./atax_acc) + totalt=$(awk "BEGIN{print $totalt+$exet}") + echo " Run #$i: $exet seconds" +done + +avgt=$(awk "BEGIN{print $totalt/$runs}") +echo "Average: $avgt seconds" diff --git a/OpenMP/linear-algebra/kernels/atax/Makefile b/OpenMP/linear-algebra/kernels/atax/Makefile index b0afc30..96c7b77 100644 --- a/OpenMP/linear-algebra/kernels/atax/Makefile +++ b/OpenMP/linear-algebra/kernels/atax/Makefile @@ -21,4 +21,4 @@ MAKEFLAGS+= --silent bench: make clean all - ./atax_acc + ./.bench.sh