Skip to content

Commit

Permalink
add earlier python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
blaise-muhirwa committed Dec 17, 2023
1 parent c730e36 commit c50fe88
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
# TODO: Get macos-latest to work as well
os: [ubuntu-latest]
python-version: [3.9, 3.11]
python-version: [3.7, 3.8, 3.9, 3.10, 3.11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
Expand Down
7 changes: 5 additions & 2 deletions flatnav_python/unit_tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
compute_recall,
create_index,
)
import pytest
import pytest


def test_flatnav_l2_index_random_dataset():
dataset_to_index = generate_random_data(dataset_length=30_000, dim=784)
Expand All @@ -34,6 +35,7 @@ def test_flatnav_l2_index_random_dataset():
ground_truth=ground_truth,
)


@pytest.mark.skip(reason="Difficult to run on GitHub actions env due to data download")
def test_flatnav_l2_index_mnist_dataset():
training_set, queries, ground_truth, _ = get_ann_benchmark_dataset(
Expand Down Expand Up @@ -61,7 +63,7 @@ def test_flatnav_l2_index_mnist_dataset():
)


#TODO: Figure out why this test is failing. Skipping it for now
# TODO: Figure out why this test is failing. Skipping it for now
@pytest.mark.skip(reason=None)
def test_flatnav_ip_index_random_dataset():
dataset_to_index = generate_random_data(dataset_length=30_000, dim=225)
Expand All @@ -87,6 +89,7 @@ def test_flatnav_ip_index_random_dataset():
ground_truth=ground_truth,
)


@pytest.mark.skip(reason="Difficult to run on GitHub actions env due to data download")
def test_flatnav_index_with_reordering():
training_set, queries, ground_truth, _ = get_ann_benchmark_dataset(
Expand Down
7 changes: 4 additions & 3 deletions flatnav_python/unit_tests/test_parallel_insertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_parallel_insertions_yield_similar_recall():
training_set = generate_random_data(dataset_length=30_000, dim=784)
queries = generate_random_data(dataset_length=5_000, dim=784)
ground_truth = np.random.randint(low=0, high=50, size=(5_000, 100))

index = create_index(
distance_type="l2",
dim=training_set.shape[1],
Expand All @@ -28,6 +28,7 @@ def test_parallel_insertions_yield_similar_recall():

assert index.max_edges_per_node == 16

# This is not necessary. By default, FlatNav will use all available cores
index.num_threads = os.cpu_count()

start = time.time()
Expand All @@ -36,7 +37,7 @@ def test_parallel_insertions_yield_similar_recall():

parallel_construction_time = end - start
print(
f"Index construction time (parallel): = {parallel_construction_time} seconds."
f"\nIndex construction time (parallel): = {parallel_construction_time} seconds."
f"Num-threads = {index.num_threads}"
)

Expand All @@ -52,7 +53,7 @@ def test_parallel_insertions_yield_similar_recall():

single_threaded_index_construction_time = end - start
print(
f"Index construction time (single thread): = {single_threaded_index_construction_time}"
f"\nIndex construction time (single thread): = {single_threaded_index_construction_time}"
)

recall_with_single_threaded_index = compute_recall(
Expand Down

0 comments on commit c50fe88

Please sign in to comment.