diff options
Diffstat (limited to '')
| -rwxr-xr-x | tools/run_tool.sh (renamed from benchmark/benchmark.sh) | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/benchmark/benchmark.sh b/tools/run_tool.sh index 6de280c..21b6ce9 100755 --- a/benchmark/benchmark.sh +++ b/tools/run_tool.sh | |||
| @@ -1,6 +1,9 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | re="${RUN:-$@}" | 3 | if [ -z "$TOOL" ]; then |
| 4 | echo "No tool selected (TOOL variable must be set)" | ||
| 5 | exit 1 | ||
| 6 | fi | ||
| 4 | 7 | ||
| 5 | CC="cc -std=c99 -pedantic -Wall -Wextra \ | 8 | CC="cc -std=c99 -pedantic -Wall -Wextra \ |
| 6 | -Wno-unused-parameter -Wno-unused-function -O3 -D$CUBETYPE \ | 9 | -Wno-unused-parameter -Wno-unused-function -O3 -D$CUBETYPE \ |
| @@ -8,20 +11,17 @@ CC="cc -std=c99 -pedantic -Wall -Wextra \ | |||
| 8 | 11 | ||
| 9 | [ "$CUBETYPE" = "CUBE_AVX2" ] && CC="$CC -mavx2" | 12 | [ "$CUBETYPE" = "CUBE_AVX2" ] && CC="$CC -mavx2" |
| 10 | 13 | ||
| 11 | BIN="benchmark/run" | 14 | BIN="tools/run" |
| 12 | RES="benchmark/results" | ||
| 13 | CUBEOBJ="cube.o" | 15 | CUBEOBJ="cube.o" |
| 14 | d="$(date +'%Y-%m-%d-%H-%M-%S')" | 16 | d="$(date +'%Y-%m-%d-%H-%M-%S')" |
| 15 | 17 | ||
| 16 | mkdir -p "$RES" | 18 | for t in tools/*; do |
| 17 | 19 | if [ ! -d "$t" ] || [ -z "$(echo "$t" | grep "$TOOL")" ]; then | |
| 18 | for t in benchmark/*; do | ||
| 19 | if [ -n "$re" ] && [ -z "$(echo "$t" | grep "$re")" ]; then | ||
| 20 | continue | 20 | continue |
| 21 | fi | 21 | fi |
| 22 | if [ ! -d "$t" ] || [ "$t" = "benchmark/results" ]; then continue; fi | ||
| 23 | $CC -o $BIN $t/*.c $CUBEOBJ || exit 1; | 22 | $CC -o $BIN $t/*.c $CUBEOBJ || exit 1; |
| 24 | $BIN | tee "$RES/results-$d.txt" "$RES/results-last.txt" | 23 | $BIN |
| 24 | break | ||
| 25 | done | 25 | done |
| 26 | 26 | ||
| 27 | rm -rf $BIN $CUBEOBJ | 27 | rm -rf $BIN $CUBEOBJ |
