From 039c57bb454622264a8ca88c028cd7d74998baa5 Mon Sep 17 00:00:00 2001 From: blaise-muhirwa Date: Sun, 17 Dec 2023 00:07:29 -0800 Subject: [PATCH] patch cicd yaml --- .github/workflows/cicd.yaml | 1 + flatnav/distances/InnerProductDistance.h | 2 -- flatnav/distances/SquaredL2Distance.h | 2 -- flatnav_python/setup.py | 9 +++++++++ flatnav_python/unit_tests/test_parallel_insertions.py | 3 ++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index f16b68c..e40f354 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -36,6 +36,7 @@ jobs: - name: Build flatnav run: | cd flatnav_python + export NO_MANUAL_VECTORIZATION=1 ./install_flatnav.sh - name: Run Unit Tests diff --git a/flatnav/distances/InnerProductDistance.h b/flatnav/distances/InnerProductDistance.h index 4b3d4e5..9b337ca 100644 --- a/flatnav/distances/InnerProductDistance.h +++ b/flatnav/distances/InnerProductDistance.h @@ -33,8 +33,6 @@ class InnerProductDistance : public DistanceInterface { setDistanceFunction(); } - // ~InnerProductDistance() = default; - float distanceImpl(const void *x, const void *y, bool asymmetric = false) const { (void)asymmetric; diff --git a/flatnav/distances/SquaredL2Distance.h b/flatnav/distances/SquaredL2Distance.h index d500825..94e92dc 100644 --- a/flatnav/distances/SquaredL2Distance.h +++ b/flatnav/distances/SquaredL2Distance.h @@ -31,8 +31,6 @@ class SquaredL2Distance : public DistanceInterface { setDistanceFunction(); } - // ~SquaredL2Distance() = default; - float distanceImpl(const void *x, const void *y, bool asymmetric = false) const { (void)asymmetric; diff --git a/flatnav_python/setup.py b/flatnav_python/setup.py index 743ba88..e85ccec 100644 --- a/flatnav_python/setup.py +++ b/flatnav_python/setup.py @@ -56,6 +56,15 @@ def platform_has_avx_support(): EXTRA_COMPILE_ARGS.append("-ftree-vectorize") +no_manual_vectorization = int(os.environ.get("NO_MANUAL_VECTORIZATION", "0")) + +if no_manual_vectorization: + # Remove SIMD-related flags. Otherwise, it would crush in an environment + # where SIMD extensions (SSE, AVX) are not supported + EXTRA_COMPILE_ARGS = [ + arg for arg in EXTRA_COMPILE_ARGS if arg not in ("-mavx", "-mavx512f") + ] + ext_modules = [ Pybind11Extension( "flatnav", diff --git a/flatnav_python/unit_tests/test_parallel_insertions.py b/flatnav_python/unit_tests/test_parallel_insertions.py index a0b4624..53f0cce 100644 --- a/flatnav_python/unit_tests/test_parallel_insertions.py +++ b/flatnav_python/unit_tests/test_parallel_insertions.py @@ -5,7 +5,8 @@ from flatnav.index import L2Index from .test_utils import get_ann_benchmark_dataset, compute_recall, create_index import os -import numpy as np +import numpy as np + def test_parallel_insertions_yield_similar_recall(): training_set, queries, ground_truth, _ = get_ann_benchmark_dataset(