Skip to content
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

fix: verify num_sub_vectors is valid before creating index #3056

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Only change num_partitions for CUDA test
westonpace committed Oct 28, 2024

Verified

This commit was signed with the committer’s verified signature.
wjones127 Will Jones
commit 49c70cd78699f69e4036df823d4435f6a729b2a3
6 changes: 4 additions & 2 deletions python/python/tests/test_indices.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
NUM_SUBVECTORS = 8
NUM_FRAGMENTS = 3
NUM_ROWS = NUM_ROWS_PER_FRAGMENT * NUM_FRAGMENTS
NUM_PARTITIONS = math.ceil(np.sqrt(NUM_ROWS))
NUM_PARTITIONS = round(np.sqrt(NUM_ROWS))


SMALL_ROWS_PER_FRAGMENT = 100
@@ -94,7 +94,9 @@ def test_ivf_centroids_cuda(rand_dataset):
)

assert ivf.distance_type == "l2"
assert len(ivf.centroids) == NUM_PARTITIONS
# Can't use NUM_PARTITIONS here because
# CUDA uses math.ceil and CPU uses round to calc. num_partitions
assert len(ivf.centroids) == math.ceil(np.sqrt(NUM_ROWS))


@pytest.mark.cuda