Skip to content

Commit

Permalink
updates to master comparison script
Browse files Browse the repository at this point in the history
  • Loading branch information
ledwards2225 committed Jun 6, 2023
1 parent 2592445 commit 0000ce9
Showing 1 changed file with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,47 +1,51 @@
#!/bin/bash

# This script is used to compare the honk benchmarks between baseline (master) and
# This script is used to compare the honk benchmarks between baseline (default: master) and
# the branch from which the script is run. Simply check out the branch of interest, ensure
# it is up to date with local master, and run the script.

echo -e '\nComparing Honk benchmarks between master and current branch:'
# Specify the benchmark suite and the "baseline" branch against which to compare
BENCH_TARGET="ultra_honk_bench"
BASELINE_BRANCH="master"

echo -e "\nComparing $BENCH_TARGET between $BASELINE_BRANCH and current branch:"
# Set some directories
BASE_DIR="$HOME/barretenberg/cpp"
BUILD_DIR="$BASE_DIR/build-bench"
BUILD_DIR="$BASE_DIR/build-bench" # matches build dir specified in bench preset
BENCH_RESULTS_DIR="$BASE_DIR/tmp_bench_results"
BENCH_TOOLS_DIR="$BUILD_DIR/_deps/benchmark-src/tools"

# Install requirements (numpy + scipy) for comparison script if necessary.
# Note: By default, installation will occur in $HOME/.local/bin.
pip3 install -r $BUILD_DIR/_deps/benchmark-src/requirements.txt

# Create temporary directory for honk_bench results (json)
# Create temporary directory for benchmark results (json)
cd $BASE_DIR
mkdir $BENCH_RESULTS_DIR

# Checkout master, run benchmarks, save results in json format
echo -e '\nConfiguring and building benchmarks in master branch..'
# Checkout baseline branch, run benchmarks, save results in json format
echo -e "\nConfiguring and building $BENCH_TARGET in $BASELINE_BRANCH branch..\n"
git checkout master > /dev/null
rm -rf $BUILD_DIR
cmake --preset bench > /dev/null && cmake --build --preset bench --target honk_bench > /dev/null
cmake --preset bench > /dev/null && cmake --build --preset bench --target $BENCH_TARGET
cd build-bench
MASTER_HONK_BENCH_RESULTS="$BENCH_RESULTS_DIR/honk_bench_results_master.json"
echo -e '\nRunning honk_bench in master..'
bin/honk_bench --benchmark_format=json > $MASTER_HONK_BENCH_RESULTS
BASELINE_RESULTS="$BENCH_RESULTS_DIR/results_baseline.json"
echo -e "\nRunning $BENCH_TARGET in master.."
bin/$BENCH_TARGET --benchmark_format=json > $BASELINE_RESULTS

# Checkout working branch (-), run benchmarks, save results in json format
echo -e '\nConfiguring and building benchmarks in current feature branch..'
echo -e "\nConfiguring and building $BENCH_TARGET in current feature branch..\n"
git checkout -
rm -rf $BUILD_DIR
cmake --preset bench > /dev/null && cmake --build --preset bench --target honk_bench
cmake --preset bench > /dev/null && cmake --build --preset bench --target $BENCH_TARGET
cd build-bench
BRANCH_HONK_BENCH_RESULTS="$BENCH_RESULTS_DIR/honk_bench_results_branch.json"
echo -e '\nRunning honk_bench in feature branch..'
bin/ultra_honk_bench --benchmark_format=json > $BRANCH_HONK_BENCH_RESULTS
BRANCH_RESULTS="$BENCH_RESULTS_DIR/results_branch.json"
echo -e "\nRunning $BENCH_TARGET in feature branch.."
bin/$BENCH_TARGET --benchmark_format=json > $BRANCH_RESULTS

# Call compare.py on the results (json) to get high level statistics.
# See docs at https://github.com/google/benchmark/blob/main/docs/tools.md for more details.
$BENCH_TOOLS_DIR/compare.py benchmarks $MASTER_HONK_BENCH_RESULTS $BRANCH_HONK_BENCH_RESULTS
$BENCH_TOOLS_DIR/compare.py benchmarks $BASELINE_RESULTS $BRANCH_RESULTS

# Delete the temporary results directory and its contents
rm -r $BENCH_RESULTS_DIR
rm -r $BENCH_RESULTS_DIR

0 comments on commit 0000ce9

Please sign in to comment.