Skip to content

Commit

Permalink
avoid splitting datasets with a size of 0 when testing merge API
Browse files Browse the repository at this point in the history
  • Loading branch information
rhdong committed Feb 14, 2025
1 parent d6f6236 commit 9ca7806
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 1 addition & 7 deletions cpp/src/neighbors/detail/nn_descent.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -972,13 +972,7 @@ int insert_to_ordered_list(InternalID_t<Index_t>* list,
int idx_insert = width;
bool position_found = false;
for (int i = 0; i < width; i++) {
if (list[i].id() == neighb_id.id()) {
if (dist_list[i] == std::numeric_limits<DistData_t>::max()) {
idx_insert = i;
dist_list[i] = dist;
}
return idx_insert;
}
if (list[i].id() == neighb_id.id()) { return width; }
if (!position_found && dist_list[i] > dist) {
idx_insert = i;
position_found = true;
Expand Down
3 changes: 3 additions & 0 deletions cpp/tests/neighbors/ann_cagra.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,9 @@ class AnnCagraIndexMergeTest : public ::testing::TestWithParam<AnnCagraInputs> {
(ps.k * ps.dim * 8 / 5 /*(=magic number)*/ < ps.n_rows))
GTEST_SKIP();

// Avoid splitting datasets with a size of 0
if (ps.n_rows <= 3) GTEST_SKIP();

// IVF_PQ requires the `n_rows >= n_lists`.
if (ps.n_rows < 8 && ps.build_algo == graph_build_algo::IVF_PQ) GTEST_SKIP();

Expand Down

0 comments on commit 9ca7806

Please sign in to comment.