Skip to content

Instantly share code, notes, and snippets.

@WOnder93
Last active March 29, 2018 12:37
Show Gist options
  • Save WOnder93/b5fcf9c989b4a1715684d5c82367cdbe to your computer and use it in GitHub Desktop.
Save WOnder93/b5fcf9c989b4a1715684d5c82367cdbe to your computer and use it in GitHub Desktop.
Stockfish - scripts for automated bench comparison
#!/bin/bash
if [ $# -eq 0 ]; then
echo "usage: [SYZYGY_PATH='...'] [BENCH_ARGS='...'] $0 COMMIT..."
echo
echo " Prints bench for each COMMIT. Output is stored in 'bench-COMMIT.log'."
echo
echo " Command-line arguments:"
echo " COMMIT... list of commits to check"
echo
echo " Environment variables:"
echo " SYZYGY_PATH path to syzygy (enables syzygy bench)"
echo " BENCH_ARGS arguments to bench"
echo
echo " Example:"
echo " SYZYGY_PATH=/data/syzygy BENCH_ARGS='128 1 22' $0 master my_patch"
echo
echo " TIP: Put 2>/dev/null after the command to hide status output."
fi
for commit in "$@"; do
git checkout "$commit" 1>&2 || exit 1
make clean 1>&2 || { git checkout -; exit 1; }
make build ARCH=x86-64-modern 1>&2 || { git checkout -; exit 1; }
git checkout - 1>&2 || exit 1
./get_bench.sh "bench-$commit.log" "$BENCH_ARGS" || exit 1
done
#!/bin/bash
outfile="${1:-/dev/null}"; shift
args="$1"; shift
(
echo "setoption name SyzygyPath value $SYZYGY_PATH"
echo "bench $args"
) | \
./stockfish 2>&1 | tee "$outfile" | \
grep 'Nodes searched' | grep -E -o '[0-9]+' || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment