Skip to content

Commit 0df2781

Browse files
authored
Shorten the Test Duration of test_cagra_ace.py (#1640)
I was made aware that the CAGRA ACE Python test was taking long during CI. This shortens the test duration by reducing the test combinations. Instead, variations of `npartitions`, `ef_construction`, and `hierarchy` are tested separately to keep the test coverage high. I have also aligned the test defaults with the existing CAGRA test. Authors: - Julian Miller (https://github.com/julianmi) Approvers: - Bradley Dice (https://github.com/bdice) - Tamas Bela Feher (https://github.com/tfeher) - Ben Frederickson (https://github.com/benfred) URL: #1640
1 parent e72dd2a commit 0df2781

1 file changed

Lines changed: 30 additions & 13 deletions

File tree

python/cuvs/cuvs/tests/test_cagra_ace.py

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818

1919
def run_cagra_ace_build_search_test(
20-
n_rows=5000,
21-
n_cols=64,
22-
n_queries=10,
20+
n_rows=10000,
21+
n_cols=10,
22+
n_queries=100,
2323
k=10,
2424
dtype=np.float32,
2525
metric="sqeuclidean",
@@ -28,7 +28,7 @@ def run_cagra_ace_build_search_test(
2828
npartitions=2,
2929
ef_construction=100,
3030
use_disk=False,
31-
hierarchy="none",
31+
hierarchy="gpu",
3232
):
3333
dataset = generate_data((n_rows, n_cols), dtype)
3434
queries = generate_data((n_queries, n_cols), dtype)
@@ -151,23 +151,40 @@ def run_cagra_ace_build_search_test(
151151
assert recall > 0.7
152152

153153

154-
@pytest.mark.parametrize("dim", [64, 128])
155154
@pytest.mark.parametrize("dtype", [np.float32, np.float16, np.int8, np.uint8])
156155
@pytest.mark.parametrize("metric", ["sqeuclidean", "inner_product"])
157-
@pytest.mark.parametrize("npartitions", [2, 4])
158-
@pytest.mark.parametrize("ef_construction", [100, 200])
159156
@pytest.mark.parametrize("use_disk", [False, True])
160-
@pytest.mark.parametrize("hierarchy", ["none", "gpu"])
161-
def test_cagra_ace_dtypes_and_metrics(
162-
dim, dtype, metric, npartitions, ef_construction, use_disk, hierarchy
163-
):
157+
def test_cagra_ace_dtypes_and_metrics(dtype, metric, use_disk):
164158
"""Test ACE with different data types and metrics."""
165159
run_cagra_ace_build_search_test(
166-
n_cols=dim,
167160
dtype=dtype,
168161
metric=metric,
162+
use_disk=use_disk,
163+
)
164+
165+
166+
@pytest.mark.parametrize("npartitions", [2, 3, 8])
167+
def test_cagra_ace_partitions(npartitions):
168+
"""Test ACE with different partition sizes (disk mode only)."""
169+
run_cagra_ace_build_search_test(
170+
use_disk=True,
169171
npartitions=npartitions,
172+
)
173+
174+
175+
@pytest.mark.parametrize("ef_construction", [50, 100, 200])
176+
def test_cagra_ace_ef_construction(ef_construction):
177+
"""Test ACE with different ef_construction values (disk mode only)."""
178+
run_cagra_ace_build_search_test(
179+
use_disk=True,
170180
ef_construction=ef_construction,
171-
use_disk=use_disk,
181+
)
182+
183+
184+
@pytest.mark.parametrize("hierarchy", ["none", "gpu"])
185+
def test_cagra_ace_hierarchy(hierarchy):
186+
"""Test ACE with different hierarchy modes (disk mode only)."""
187+
run_cagra_ace_build_search_test(
188+
use_disk=True,
172189
hierarchy=hierarchy,
173190
)

0 commit comments

Comments
 (0)