Skip to content

Commit

Permalink
ci: test splitting apart benchmark and reducing time (VowpalWabbit#3802)
Browse files Browse the repository at this point in the history
* ci: test splitting apart benchmark

* add needs

* updates

* update permissions

* permissions

* add ls

* update paths

* ls

* chmod

* check chmod

* remove ls

* manually set min time in code

* tweak times

* tweak timings

* formatting
  • Loading branch information
jackgerrits authored Mar 16, 2022
1 parent b0f7300 commit e2446a0
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 41 deletions.
91 changes: 64 additions & 27 deletions .github/workflows/run_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'releases/**'

jobs:
benchmark:
build-benchmark-master:
container:
image: vowpalwabbit/ubuntu1804-build:latest
runs-on: ubuntu-latest
Expand All @@ -19,46 +19,83 @@ jobs:
- name: Install google benchmarks
shell: bash
run: ./.scripts/linux/install-benchmarks.sh
- name: Build ${{ github.base_ref }}
shell: bash
run: ./.scripts/linux/build-with-benchmarks.sh
- name: Benchmark ${{ github.base_ref }}
shell: bash
run: ./.scripts/linux/run-benchmarks.sh master-benchmarks.json
- name: Upload ${{ github.base_ref }} benchmark results
uses: actions/upload-artifact@v2
with:
name: master-benchmarks
path: master-benchmarks.json
- name: Upload benchmark compare
uses: actions/upload-artifact@v2
with:
name: benchmark-compare
path: benchmark/tools/
- name: Install benchmark compare requirements
- name: Build ${{ github.base_ref }}
shell: bash
run: |
python3 -m pip install -r benchmark/tools/requirements.txt
# The above requirements file is missing the pandas dependency.
python3 -m pip install pandas
- run: rm -rf benchmark build vowpalwabbit/parser/flatbuffer/generated/ # generated or downloaded files
run: ./.scripts/linux/build-with-benchmarks.sh
- name: Upload benchmark binary
uses: actions/upload-artifact@v2
with:
name: master-benchmark-bin
path: build/test/benchmarks/vw-benchmarks.out
build-benchmark-branch:
container:
image: vowpalwabbit/ubuntu1804-build:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: 'recursive'
- name: Download ${{ github.base_ref }} benchmark results
uses: actions/download-artifact@v2
- name: Install google benchmarks
shell: bash
run: ./.scripts/linux/install-benchmarks.sh
- name: Build branch
shell: bash
run: ./.scripts/linux/build-with-benchmarks.sh
- name: Upload benchmark binary
uses: actions/upload-artifact@v2
with:
name: master-benchmarks
name: branch-benchmark-bin
path: build/test/benchmarks/vw-benchmarks.out
run-benchmarks:
container:
image: vowpalwabbit/ubuntu1804-build:latest
runs-on: ubuntu-latest
needs: [build-benchmark-master, build-benchmark-branch]
steps:
- name: Download benchmark compare
uses: actions/download-artifact@v2
with:
name: benchmark-compare
- name: Build branch
shell: bash
run: ./.scripts/linux/build-with-benchmarks.sh
- name: Benchmark branch
path: tools/
- name: Download master bin
uses: actions/download-artifact@v2
with:
name: master-benchmark-bin
path: master-benchmark-bin/
- name: Download branch bin
uses: actions/download-artifact@v2
with:
name: branch-benchmark-bin
path: branch-benchmark-bin/
- name: Update permissions
run: |
chmod +x ./master-benchmark-bin/vw-benchmarks.out
chmod +x ./branch-benchmark-bin/vw-benchmarks.out
- name: Run master benchmark
run: >
./master-benchmark-bin/vw-benchmarks.out
--benchmark_min_time=3
--benchmark_format=console
--benchmark_out_format=json
--benchmark_out=master-benchmarks.json
- name: Run branch benchmark
run: >
./branch-benchmark-bin/vw-benchmarks.out
--benchmark_min_time=3
--benchmark_format=console
--benchmark_out_format=json
--benchmark_out=branch-benchmarks.json
- name: Install benchmark compare requirements
shell: bash
run: ./.scripts/linux/run-benchmarks.sh branch-benchmarks.json
run: |
python3 -m pip install -r tools/requirements.txt
# The above requirements file is missing the pandas dependency.
python3 -m pip install pandas
- name: Compare benchmarks
shell: bash
run: ./.scripts/linux/compare-benchmarks.sh master-benchmarks.json branch-benchmarks.json
run: python3 tools/compare.py benchmarks master-benchmarks.json branch-benchmarks.json
2 changes: 1 addition & 1 deletion .scripts/linux/install-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ cd benchmark
git checkout v1.6.1

# Generate build system files with cmake.
cmake -S . -B build -G Ninja -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DCMAKE_BUILD_TYPE=Release
cmake -S . -B build -G Ninja -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_ENABLE_TESTING=Off -DCMAKE_BUILD_TYPE=Release
# Install globally
sudo cmake --build "build" --config Release --target install
32 changes: 21 additions & 11 deletions test/benchmarks/standalone/benchmark_text_input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,30 +247,40 @@ BENCHMARK_CAPTURE(benchmark_ccb_adf_learn, many_features_no_predic,
"a b c d e f g h i j k l m n o p q r s t u v w x y z", " --no_predict");

BENCHMARK_CAPTURE(benchmark_cb_adf_learn, few_features, 2);
BENCHMARK_CAPTURE(benchmark_cb_adf_learn, many_features, 120);
BENCHMARK_CAPTURE(benchmark_cb_adf_learn, many_features, 120)->MinTime(15.0);

#ifdef PRIVACY_ACTIVATION
BENCHMARK_CAPTURE(benchmark_cb_adf_learn_privacy_preserving, few_features, 2);
BENCHMARK_CAPTURE(benchmark_cb_adf_learn_privacy_preserving, many_features, 120);
#endif

BENCHMARK_CAPTURE(benchmark_multi, cb_adf_no_namespaces, gen_cb_examples(100, 7, 3, 6, 1, 4, 14, 2, false),
"--cb_explore_adf --quiet");
"--cb_explore_adf --quiet")
->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_multi, cb_adf_diff_char_no_interactions, gen_cb_examples(100, 7, 3, 6, 3, 4, 14, 2, false),
"--cb_explore_adf --quiet");
"--cb_explore_adf --quiet")
->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_multi, cb_adf_diff_char_interactions, gen_cb_examples(100, 7, 3, 6, 3, 4, 14, 2, false),
"--cb_explore_adf --quiet -q ::");
"--cb_explore_adf --quiet -q ::")
->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_multi, cb_adf_same_char_no_interactions, gen_cb_examples(100, 7, 3, 6, 3, 4, 14, 2, true),
"--cb_explore_adf --quiet");
"--cb_explore_adf --quiet")
->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_multi, cb_adf_same_char_interactions, gen_cb_examples(100, 7, 3, 6, 3, 4, 14, 2, true),
"--cb_explore_adf --quiet -q ::");
"--cb_explore_adf --quiet -q ::")
->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_multi, ccb_adf_no_namespaces, gen_ccb_examples(50, 7, 3, 6, 1, 4, 14, 2, false, 3),
"--ccb_explore_adf --quiet");
"--ccb_explore_adf --quiet")
->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_multi, ccb_adf_diff_char_no_interactions,
gen_ccb_examples(50, 7, 3, 6, 3, 4, 14, 2, false, 3), "--ccb_explore_adf --quiet");
gen_ccb_examples(50, 7, 3, 6, 3, 4, 14, 2, false, 3), "--ccb_explore_adf --quiet")
->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_multi, ccb_adf_diff_char_interactions, gen_ccb_examples(50, 7, 3, 6, 3, 4, 14, 2, false, 3),
"--ccb_explore_adf --quiet -q ::");
"--ccb_explore_adf --quiet -q ::")
->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_multi, ccb_adf_same_char_no_interactions,
gen_ccb_examples(50, 7, 3, 6, 3, 4, 14, 2, true, 3), "--ccb_explore_adf --quiet");
gen_ccb_examples(50, 7, 3, 6, 3, 4, 14, 2, true, 3), "--ccb_explore_adf --quiet")
->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_multi, ccb_adf_same_char_interactions, gen_ccb_examples(50, 7, 3, 6, 3, 4, 14, 2, true, 3),
"--ccb_explore_adf --quiet -q ::");
"--ccb_explore_adf --quiet -q ::")
->MinTime(15.0);
4 changes: 2 additions & 2 deletions test/benchmarks/standalone/rcv1_benchmarks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5332,5 +5332,5 @@ static void benchmark_rcv1_dataset(benchmark::State& state, std::string command_
VW::finish(*vw);
}

BENCHMARK_CAPTURE(benchmark_rcv1_dataset, simple, "--quiet");
BENCHMARK_CAPTURE(benchmark_rcv1_dataset, quadratic, "--quiet -q ::");
BENCHMARK_CAPTURE(benchmark_rcv1_dataset, simple, "--quiet")->MinTime(15.0);
BENCHMARK_CAPTURE(benchmark_rcv1_dataset, quadratic, "--quiet -q ::")->MinTime(15.0);

0 comments on commit e2446a0

Please sign in to comment.