From c50fe886bc10a238d286f48e57c7558590375dd8 Mon Sep 17 00:00:00 2001 From: blaise-muhirwa Date: Sun, 17 Dec 2023 01:09:12 -0800 Subject: [PATCH] add earlier python versions --- .github/workflows/cicd.yaml | 2 +- flatnav_python/unit_tests/test_index.py | 7 +++++-- flatnav_python/unit_tests/test_parallel_insertions.py | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 946747b..74f6468 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -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 diff --git a/flatnav_python/unit_tests/test_index.py b/flatnav_python/unit_tests/test_index.py index b4fb825..9896b6f 100644 --- a/flatnav_python/unit_tests/test_index.py +++ b/flatnav_python/unit_tests/test_index.py @@ -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) @@ -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( @@ -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) @@ -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( diff --git a/flatnav_python/unit_tests/test_parallel_insertions.py b/flatnav_python/unit_tests/test_parallel_insertions.py index 18cfb5d..41b855c 100644 --- a/flatnav_python/unit_tests/test_parallel_insertions.py +++ b/flatnav_python/unit_tests/test_parallel_insertions.py @@ -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], @@ -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() @@ -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}" ) @@ -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(