-
Notifications
You must be signed in to change notification settings - Fork 384
Add Performance Tests #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: DiskANN Nightly Performance Metrics | ||
| on: | ||
| schedule: | ||
| - cron: "41 14 * * *" # 14:41 UTC, 7:41 PDT, 8:41 PST, 08:11 IST | ||
| jobs: | ||
| perf-test: | ||
| name: Run Perf Test from main | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 1 | ||
| - name: Build Perf Container | ||
| run: | | ||
| docker build --build-arg GIT_COMMIT_ISH="$GITHUB_SHA" -t perf -f scripts/perf/Dockerfile scripts | ||
| - name: Performance Tests | ||
| run: | | ||
| mkdir metrics | ||
| docker run -v ./metrics:/app/logs perf &> ./metrics/combined_stdouterr.log | ||
| - name: Upload Metrics Logs | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: metrics | ||
| path: | | ||
| ./metrics/** | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #Copyright(c) Microsoft Corporation.All rights reserved. | ||
| #Licensed under the MIT license. | ||
|
|
||
| FROM ubuntu:jammy | ||
harsha-simhadri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Can be provided at build to point to a specific commit-ish, by default builds from HEAD | ||
| ARG GIT_COMMIT_ISH=HEAD | ||
|
|
||
| RUN apt update | ||
| RUN apt install -y software-properties-common | ||
| RUN add-apt-repository -y ppa:git-core/ppa | ||
| RUN apt update | ||
| RUN DEBIAN_FRONTEND=noninteractive apt install -y git time | ||
|
|
||
| COPY dev/install-dev-deps-ubuntu.bash /app/fallback/install-dev-deps-ubuntu.bash | ||
| WORKDIR /app | ||
| RUN git clone https://github.com/microsoft/DiskANN.git | ||
| WORKDIR /app/DiskANN | ||
| RUN git checkout $GIT_COMMIT_ISH | ||
|
|
||
| # we would prefer to use the deps requested at the same commit. if the script doesn't exist we'll use the current one. | ||
| RUN bash scripts/dev/install-dev-deps-ubuntu.bash || bash /app/fallback/install-dev-deps-ubuntu.bash | ||
harsha-simhadri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| RUN mkdir build | ||
| RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DUNIT_TEST=True | ||
| RUN cmake --build build -- -j | ||
|
|
||
| RUN mkdir /app/logs | ||
| COPY perf/perf_test.sh /app/DiskANN/perf_test.sh | ||
|
|
||
| ENTRYPOINT bash perf_test.sh | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #Performance Tests | ||
|
|
||
| The bash scripts in this folder are responsible for running a suite of performance | ||
| tests. | ||
|
|
||
| The timing and recall metrics reported by these tests when run periodically can then | ||
| be used to identify performance improvements or regressions as | ||
| development continues. | ||
|
|
||
| ## Usage | ||
|
|
||
| `docker build` must be run with the context directory set to `scripts`, but the Dockerfile set to `scripts/perf/Dockerfile` as in: | ||
| ```bash | ||
| docker build [--build-arg GIT_COMMIT_ISH=<rev>] -f scripts/perf/Dockerfile scripts | ||
| ``` | ||
|
|
||
| We prefer to install the dependencies from the commit-ish that we're building against, but as the deps were not stored | ||
| in a known file in all commits, we will fall back to the one currently in HEAD if one is not found already. | ||
|
|
||
| The `--build-arg GIT_COMMIT_ISH=<rev>` is optional, with a default value of HEAD if not otherwise specified. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/bash | ||
|
|
||
| function json_time { | ||
| command="$@" | ||
| echo "Executing $command" | ||
| /usr/bin/time --quiet -o /app/logs/time.log -a --format '{"command":"%C", "wallclock": %e, "user": %U, "sys": %S}' $command | ||
| ret=$? | ||
| if [ $ret -ne 0 ]; then | ||
| echo "{\"command\": \""$command"\", \"status_code\": $ret}" >> /app/logs/time.log | ||
| fi | ||
| } | ||
|
|
||
| mkdir data | ||
| rm /app/logs/time.log | ||
| touch /app/logs/time.log | ||
| chmod 666 /app/logs/time.log | ||
|
|
||
| if [ -d "build/apps" ]; then | ||
| export BASE_PATH="build/apps" | ||
| else | ||
| export BASE_PATH="build/tests" | ||
| fi | ||
|
|
||
| json_time $BASE_PATH/utils/rand_data_gen --data_type float --output_file data/rand_float_768D_1M_norm1.0.bin -D 768 -N 1000000 --norm 1.0 | ||
| json_time $BASE_PATH/utils/rand_data_gen --data_type float --output_file data/rand_float_768D_10K_norm1.0.bin -D 768 -N 10000 --norm 1.0 | ||
|
|
||
| json_time $BASE_PATH/utils/compute_groundtruth --data_type float --dist_fn l2 --base_file data/rand_float_768D_1M_norm1.0.bin --query_file data/rand_float_768D_10K_norm1.0.bin --gt_file data/l2_rand_float_768D_1M_norm1.0_768D_10K_norm1.0_gt100 --K 100 | ||
| json_time $BASE_PATH/utils/compute_groundtruth --data_type float --dist_fn mips --base_file data/rand_float_768D_1M_norm1.0.bin --query_file data/rand_float_768D_10K_norm1.0.bin --gt_file data/mips_rand_float_768D_1M_norm1.0_768D_10K_norm1.0_gt100 --K 100 | ||
| json_time $BASE_PATH/utils/compute_groundtruth --data_type float --dist_fn cosine --base_file data/rand_float_768D_1M_norm1.0.bin --query_file data/rand_float_768D_10K_norm1.0.bin --gt_file data/cosine_rand_float_768D_1M_norm1.0_768D_10K_norm1.0_gt100 --K 100 | ||
|
|
||
| json_time $BASE_PATH/build_memory_index --data_type float --dist_fn l2 --data_path data/rand_float_768D_1M_norm1.0.bin --index_path_prefix data/index_l2_rand_float_768D_1M_norm1.0 | ||
| json_time $BASE_PATH/search_memory_index --data_type float --dist_fn l2 --index_path_prefix data/index_l2_rand_float_768D_1M_norm1.0 --query_file data/rand_float_768D_10K_norm1.0.bin --recall_at 10 --result_path temp --gt_file data/l2_rand_float_768D_1M_norm1.0_768D_10K_norm1.0_gt100 -L 100 32 | ||
| json_time $BASE_PATH/search_memory_index --data_type float --dist_fn fast_l2 --index_path_prefix data/index_l2_rand_float_768D_1M_norm1.0 --query_file data/rand_float_768D_10K_norm1.0.bin --recall_at 10 --result_path temp --gt_file data/l2_rand_float_768D_1M_norm1.0_768D_10K_norm1.0_gt100 -L 100 32 | ||
|
|
||
| json_time $BASE_PATH/build_memory_index --data_type float --dist_fn mips --data_path data/rand_float_768D_1M_norm1.0.bin --index_path_prefix data/index_mips_rand_float_768D_1M_norm1.0 | ||
| json_time $BASE_PATH/search_memory_index --data_type float --dist_fn mips --index_path_prefix data/index_l2_rand_float_768D_1M_norm1.0 --query_file data/rand_float_768D_10K_norm1.0.bin --recall_at 10 --result_path temp --gt_file data/mips_rand_float_768D_1M_norm1.0_768D_10K_norm1.0_gt100 -L 100 32 | ||
|
|
||
| json_time $BASE_PATH/build_memory_index --data_type float --dist_fn cosine --data_path data/rand_float_768D_1M_norm1.0.bin --index_path_prefix data/index_cosine_rand_float_768D_1M_norm1.0 | ||
| json_time $BASE_PATH/search_memory_index --data_type float --dist_fn cosine --index_path_prefix data/index_l2_rand_float_768D_1M_norm1.0 --query_file data/rand_float_768D_10K_norm1.0.bin --recall_at 10 --result_path temp --gt_file data/cosine_rand_float_768D_1M_norm1.0_768D_10K_norm1.0_gt100 -L 100 32 | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.