aboutsummaryrefslogtreecommitdiff
path: root/benchmark/benchmark.sh
blob: 6de280c231821b8a2cc17ee3f6310d9b82350e6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

re="${RUN:-$@}"

CC="cc -std=c99 -pedantic -Wall -Wextra \
    -Wno-unused-parameter -Wno-unused-function -O3 -D$CUBETYPE \
    -D_POSIX_C_SOURCE=199309L"

[ "$CUBETYPE" = "CUBE_AVX2" ] && CC="$CC -mavx2"

BIN="benchmark/run"
RES="benchmark/results"
CUBEOBJ="cube.o"
d="$(date +'%Y-%m-%d-%H-%M-%S')"

mkdir -p "$RES"

for t in benchmark/*; do
	if [ -n "$re" ] && [ -z "$(echo "$t" | grep "$re")" ]; then
		continue
	fi
	if [ ! -d "$t" ] || [ "$t" = "benchmark/results" ]; then continue; fi
	$CC -o $BIN $t/*.c $CUBEOBJ || exit 1;
	$BIN | tee "$RES/results-$d.txt" "$RES/results-last.txt"
done

rm -rf $BIN $CUBEOBJ

Generated with cgit - Back to sebastiano.tronto.net