-
Notifications
You must be signed in to change notification settings - Fork 210
[FEA] Add missing pytests for cuvs-bench algorithms #1460
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
Open
tarang-jain
wants to merge
50
commits into
NVIDIA:main
Choose a base branch
from
tarang-jain:cuvs-bench-pytests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 41 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
bd2289b
null check
tarang-jain d8d9256
all tests
tarang-jain fa932cc
syntax error
tarang-jain b9acca7
add cuvs_ivf_pq pytest
tarang-jain 119b0ba
format
tarang-jain 37462e4
correct order in header
tarang-jain 4ae79f0
format and docs
tarang-jain dedd71e
Merge branch 'main' of https://github.com/rapidsai/cuvs into cagra-be…
tarang-jain 0c93b2a
correct header and params
tarang-jain 47f879b
sparams to get increasing pareto
tarang-jain 1f9d8e8
Merge branch 'main' into cagra-bench-params
tarang-jain 9c8f72c
update pytests
tarang-jain 4ea7705
merge ivf_pq tests
tarang-jain 3a8909d
add new algos to current set of tests
tarang-jain 0e49c6b
correct headers
tarang-jain ff64f48
Merge branch 'main' into cuvs-bench-pytests
tarang-jain 3830f4a
Merge branch 'main' into cuvs-bench-pytests
tarang-jain 3deffbe
Merge branch 'main' into cuvs-bench-pytests
cjnolet b5fbb40
Merge branch 'main' of https://github.com/rapidsai/cuvs into cuvs-ben…
tarang-jain 42d4c0f
style
tarang-jain 513cb7e
fix data_export and tests
tarang-jain ba47877
Merge branch 'main' into cuvs-bench-pytests
tarang-jain bf5442c
Merge branch 'release/26.04' into cuvs-bench-pytests
tarang-jain 0c7cd2e
cmake change
tarang-jain f89d672
check arm cpu
tarang-jain bb74dc8
Merge branch 'release/26.04' into cuvs-bench-pytests
tarang-jain 6ed5e06
undo cmake changes and conda env
tarang-jain a9e58a7
Merge branch 'cuvs-bench-pytests' of https://github.com/tarang-jain/c…
tarang-jain 350db1b
style check
tarang-jain 47586de
add vamana to the list
tarang-jain eb7e615
Merge branch 'release/26.04' into cuvs-bench-pytests
tarang-jain e9f0da7
single thread build
tarang-jain ed35be1
Merge branch 'cuvs-bench-pytests' of https://github.com/tarang-jain/c…
tarang-jain 6f8d289
fix single thread config
tarang-jain 268ab86
sync stream after vamana build
tarang-jain 46ef644
do not skip state
tarang-jain f2c41da
fix style
tarang-jain 284984a
add sync stream in dataset serialization
tarang-jain 5edb4e5
rm sync stream in vamana wrapper
tarang-jain aa022a2
one more fix to serialize-dataset
tarang-jain 23019c8
style
tarang-jain 7ebf54f
lower value for L_load
tarang-jain 690c72c
Merge branch 'main' into cuvs-bench-pytests
aamijar 5b7f3bf
Merge branch 'main' into cuvs-bench-pytests
aamijar cda3731
Merge branch 'main' into cuvs-bench-pytests
tarang-jain f7191ae
Merge branch 'main' of https://github.com/rapidsai/cuvs into cuvs-ben…
tarang-jain f231647
debug statements
tarang-jain fb443c1
Merge branch 'cuvs-bench-pytests' of github.com:tarang-jain/cuvs into…
tarang-jain e239ea1
more debug prints
tarang-jain a17986e
more debug prints
tarang-jain 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
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 |
|---|---|---|
|
|
@@ -3,3 +3,6 @@ groups: | |
| base: | ||
| build: | ||
| search: | ||
| test: | ||
| build: | ||
| search: | ||
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
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
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 |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| # | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION. | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
|
|
||
| import platform | ||
| from pathlib import Path | ||
|
|
||
| import pandas as pd | ||
|
|
@@ -11,6 +12,11 @@ | |
| from cuvs_bench.get_dataset.__main__ import main | ||
|
|
||
|
|
||
| def is_arm_cpu(): | ||
| """Check if running on ARM Linux architecture.""" | ||
| return platform.machine() in ("aarch64", "arm64") | ||
|
Comment on lines
+15
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broaden ARM architecture detection to avoid false negatives. The helper currently misses common ARM variants like Proposed fix def is_arm_cpu():
"""Check if running on ARM Linux architecture."""
- return platform.machine() in ("aarch64", "arm64")
+ machine = platform.machine().lower()
+ return machine in ("aarch64", "arm64") or machine.startswith("arm")🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def temp_datasets_dir(tmp_path_factory): | ||
| return tmp_path_factory.mktemp("datasets") | ||
|
|
@@ -51,7 +57,8 @@ def test_run_command_creates_results(temp_datasets_dir: Path): | |
|
|
||
| python -m cuvs_bench.run --dataset test-data --dataset-path datasets/ \ | ||
| --algorithms faiss_gpu_ivf_flat,faiss_gpu_ivf_sq,cuvs_ivf_flat,\ | ||
| cuvs_cagra,ggnn,cuvs_cagra_hnswlib,cuvs_ivf_pq \ | ||
| cuvs_cagra,ggnn,cuvs_cagra_hnswlib,cuvs_ivf_pq,cuvs_vamana,\ | ||
| diskann_memory \ | ||
| --batch-size 100 -k 10 --groups test -m latency --force | ||
|
|
||
| It then verifies that the set of expected result files | ||
|
|
@@ -63,14 +70,19 @@ def test_run_command_creates_results(temp_datasets_dir: Path): | |
|
|
||
| from cuvs_bench.run.__main__ import main as run_main | ||
|
|
||
| skip_diskann = is_arm_cpu() | ||
| algorithms = "faiss_gpu_ivf_flat,faiss_gpu_ivf_sq,cuvs_ivf_flat,cuvs_cagra,ggnn,cuvs_cagra_hnswlib,cuvs_ivf_pq" | ||
| if not skip_diskann: | ||
| algorithms += ",cuvs_vamana,diskann_memory" | ||
|
|
||
| runner = CliRunner() | ||
| run_args = [ | ||
| "--dataset", | ||
| "test-data", | ||
| "--dataset-path", | ||
| dataset_path_arg, | ||
| "--algorithms", | ||
| "faiss_gpu_ivf_flat,faiss_gpu_ivf_sq,cuvs_ivf_flat,cuvs_cagra,ggnn,cuvs_cagra_hnswlib,cuvs_ivf_pq", # noqa: E501 | ||
| algorithms, | ||
| "--batch-size", | ||
| "100", | ||
| "-k", | ||
|
|
@@ -105,6 +117,8 @@ def test_run_command_creates_results(temp_datasets_dir: Path): | |
| ] | ||
|
|
||
| # --- Verify that the expected result files exist and are not empty --- | ||
| skip_diskann = is_arm_cpu() | ||
|
|
||
| expected_files = { | ||
| # Build files: | ||
| "test-data/result/build/cuvs_ivf_flat,test.csv": { | ||
|
|
@@ -423,6 +437,143 @@ def test_run_command_creates_results(temp_datasets_dir: Path): | |
| }, | ||
| } | ||
|
|
||
| if not skip_diskann: | ||
| expected_files.update( | ||
| { | ||
| "test-data/result/build/cuvs_vamana,test.csv": { | ||
| "header": common_build_header | ||
| + [ | ||
| "GPU", | ||
| "alpha", | ||
| "graph_degree", | ||
| "visited_size", | ||
| ], | ||
| "rows": 1, | ||
| }, | ||
| "test-data/result/search/cuvs_vamana,test,k10,bs100,raw.csv": { | ||
| "header": common_search_header | ||
| + [ | ||
| "GPU", | ||
| "L_search", | ||
| "end_to_end", | ||
| "k", | ||
| "n_queries", | ||
| "total_queries", | ||
| "build time", | ||
| "build threads", | ||
| "build cpu_time", | ||
| "build GPU", | ||
| "alpha", | ||
| "graph_degree", | ||
| "visited_size", | ||
| ], | ||
| "rows": 1, | ||
| }, | ||
| "test-data/result/search/cuvs_vamana,test,k10,bs100,latency.csv": { | ||
| "header": common_search_header | ||
| + [ | ||
| "GPU", | ||
| "L_search", | ||
| "end_to_end", | ||
| "k", | ||
| "n_queries", | ||
| "total_queries", | ||
| "build time", | ||
| "build threads", | ||
| "build cpu_time", | ||
| "build GPU", | ||
| "alpha", | ||
| "graph_degree", | ||
| "visited_size", | ||
| ], | ||
| "rows": 1, | ||
| }, | ||
| "test-data/result/search/cuvs_vamana,test,k10,bs100,throughput.csv": { | ||
| "header": common_search_header | ||
| + [ | ||
| "GPU", | ||
| "L_search", | ||
| "end_to_end", | ||
| "k", | ||
| "n_queries", | ||
| "total_queries", | ||
| "build time", | ||
| "build threads", | ||
| "build cpu_time", | ||
| "build GPU", | ||
| "alpha", | ||
| "graph_degree", | ||
| "visited_size", | ||
| ], | ||
| "rows": 1, | ||
| }, | ||
| "test-data/result/build/diskann_memory,test.csv": { | ||
| "header": common_build_header | ||
| + [ | ||
| "L_build", | ||
| "R", | ||
| "alpha", | ||
| "num_threads", | ||
| ], | ||
| "rows": 1, | ||
| }, | ||
| "test-data/result/search/diskann_memory,test,k10,bs100,raw.csv": { | ||
| "header": common_search_header | ||
| + [ | ||
| "L_search", | ||
| "end_to_end", | ||
| "k", | ||
| "n_queries", | ||
| "total_queries", | ||
| "build time", | ||
| "build threads", | ||
| "build cpu_time", | ||
| "L_build", | ||
| "R", | ||
| "alpha", | ||
| "build_num_threads", | ||
| ], | ||
| "rows": 1, | ||
| }, | ||
| "test-data/result/search/diskann_memory,test,k10,bs100,latency.csv": { | ||
| "header": common_search_header | ||
| + [ | ||
| "L_search", | ||
| "end_to_end", | ||
| "k", | ||
| "n_queries", | ||
| "total_queries", | ||
| "build time", | ||
| "build threads", | ||
| "build cpu_time", | ||
| "L_build", | ||
| "R", | ||
| "alpha", | ||
| "build_num_threads", | ||
| ], | ||
| "rows": 1, | ||
| }, | ||
| "test-data/result/search/diskann_memory,test,k10,bs100,throughput.csv": { | ||
| "header": common_search_header | ||
| + [ | ||
| "L_search", | ||
| "end_to_end", | ||
| "k", | ||
| "n_queries", | ||
| "total_queries", | ||
| "build time", | ||
| "build threads", | ||
| "build cpu_time", | ||
| "L_build", | ||
| "R", | ||
| "alpha", | ||
| "build_num_threads", | ||
| ], | ||
| "rows": 1, | ||
| }, | ||
| } | ||
| ) | ||
|
|
||
| for rel_path, expectations in expected_files.items(): | ||
| file_path = temp_datasets_dir / rel_path | ||
| assert file_path.exists(), f"Expected file {file_path} does not exist." | ||
|
|
@@ -448,7 +599,8 @@ def test_plot_command_creates_png_files(temp_datasets_dir: Path): | |
|
|
||
| python -m cuvs_bench.plot --dataset test-data --dataset-path datasets/ \ | ||
| --algorithms faiss_gpu_ivf_flat,faiss_gpu_ivf_sq, \ | ||
| cuvs_ivf_flat,cuvs_cagra,ggnn,cuvs_cagra_hnswlib,cuvs_ivf_pq \ | ||
| cuvs_ivf_flat,cuvs_cagra,ggnn,cuvs_cagra_hnswlib,cuvs_ivf_pq,\ | ||
| cuvs_vamana,diskann_memory \ | ||
| --batch-size 100 -k 10 --groups test -m latency | ||
|
|
||
| and then verifies that the following files are produced in the | ||
|
|
@@ -463,6 +615,11 @@ def test_plot_command_creates_png_files(temp_datasets_dir: Path): | |
|
|
||
| from cuvs_bench.plot.__main__ import main as plot_main | ||
|
|
||
| skip_diskann = is_arm_cpu() | ||
| algorithms = "faiss_gpu_ivf_flat,faiss_gpu_ivf_sq,cuvs_ivf_flat,cuvs_cagra,ggnn,cuvs_cagra_hnswlib,cuvs_ivf_pq" | ||
| if not skip_diskann: | ||
| algorithms += ",cuvs_vamana,diskann_memory" | ||
|
|
||
| runner = CliRunner() | ||
| args = [ | ||
| "--dataset", | ||
|
|
@@ -472,7 +629,7 @@ def test_plot_command_creates_png_files(temp_datasets_dir: Path): | |
| "--output-filepath", | ||
| dataset_path_arg, | ||
| "--algorithms", | ||
| "faiss_gpu_ivf_flat,faiss_gpu_ivf_sq,cuvs_ivf_flat,cuvs_cagra,ggnn,cuvs_cagra_hnswlib,cuvs_ivf_pq", # noqa: E501 | ||
| algorithms, | ||
| "--batch-size", | ||
| "100", | ||
| "-k", | ||
|
|
||
Oops, something went wrong.
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.