From 9d96f02430915c63d231133177aba13e7f4b1bdb Mon Sep 17 00:00:00 2001 From: Matthijs Douze Date: Wed, 28 Apr 2021 09:05:50 +0200 Subject: [PATCH 1/6] Update config.yml --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b332a0760c..5c5f8fc7ba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -104,6 +104,9 @@ jobs: OMP_NUM_THREADS: 10 steps: - checkout + - add_ssh_keys: + fingerprints: + - "ea:af:e4:cc:96:1b:87:11:e2:88:88:80:8d:b4:cc:5c" - run: name: Install Homebrew packages command: | From b2565625893977da4de13115e941b6f468005dd2 Mon Sep 17 00:00:00 2001 From: Matthijs Douze Date: Wed, 28 Apr 2021 09:42:27 +0200 Subject: [PATCH 2/6] Disable threading for the relevant config --- tests/test_index_binary.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_index_binary.py b/tests/test_index_binary.py index 60aa877d81..639ec0464e 100644 --- a/tests/test_index_binary.py +++ b/tests/test_index_binary.py @@ -351,6 +351,13 @@ def test_replicas(self): Dref, Iref = index_ref.search(xq, 10) + # there is a OpenMP bug in this configuration, so disable threading + if sys.platform == "darwin" and "Clang 12" in sys.version: + nthreads = faiss.omp_get_max_threads() + faiss.omp_set_num_threads(1) + else: + nthreads = None + nrep = 5 index = faiss.IndexBinaryReplicas() for _i in range(nrep): @@ -371,6 +378,9 @@ def test_replicas(self): index2.add(xb) D2, I2 = index2.search(xq, 10) + if nthreads is not None: + faiss.omp_set_num_threads(nthreads) + self.assertTrue((Dref == D2).all()) self.assertTrue((Iref == I2).all()) From 1a09faa893803dc38f0640df0c3b6cc8936bcead Mon Sep 17 00:00:00 2001 From: Matthijs Douze Date: Wed, 28 Apr 2021 10:19:16 +0200 Subject: [PATCH 3/6] Update test_index_binary.py --- tests/test_index_binary.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_index_binary.py b/tests/test_index_binary.py index 639ec0464e..939b988a9b 100644 --- a/tests/test_index_binary.py +++ b/tests/test_index_binary.py @@ -6,6 +6,7 @@ """this is a basic test script for simple indices work""" from __future__ import absolute_import, division, print_function, unicode_literals +import sys import numpy as np import unittest import faiss From 9a77478f23ac21d5531f644a1b43a9f7c8522882 Mon Sep 17 00:00:00 2001 From: Matthijs Douze Date: Wed, 28 Apr 2021 10:20:32 +0200 Subject: [PATCH 4/6] Update test_meta_index.py --- tests/test_meta_index.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_meta_index.py b/tests/test_meta_index.py index 3edd4eba83..14bc912da6 100644 --- a/tests/test_meta_index.py +++ b/tests/test_meta_index.py @@ -86,6 +86,13 @@ def test_shards(self): _Dref, Iref = ref_index.search(xq, k) print(Iref[:5, :6]) + # there is a OpenMP bug in this configuration, so disable threading + if sys.platform == "darwin" and "Clang 12" in sys.version: + nthreads = faiss.omp_get_max_threads() + faiss.omp_set_num_threads(1) + else: + nthreads = None + shard_index = faiss.IndexShards(d) shard_index_2 = faiss.IndexShards(d, True, False) @@ -130,7 +137,9 @@ def test_shards(self): print('%d / %d differences' % (ndiff, nq * k)) assert(ndiff < nq * k / 1000.) - + + if nthreads is not None: + faiss.omp_set_num_threads(nthreads) class Merge(unittest.TestCase): From a41439afe68c440e94ba55e7202c87fc8877b1ba Mon Sep 17 00:00:00 2001 From: Matthijs Douze Date: Wed, 28 Apr 2021 10:28:40 +0200 Subject: [PATCH 5/6] Update test_meta_index.py --- tests/test_meta_index.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_meta_index.py b/tests/test_meta_index.py index 14bc912da6..2559509d71 100644 --- a/tests/test_meta_index.py +++ b/tests/test_meta_index.py @@ -7,6 +7,7 @@ # translation of test_meta_index.lua +import sys import numpy as np import faiss import unittest From 82c3b40f9830c801ed2fc842636e800190e083e2 Mon Sep 17 00:00:00 2001 From: Matthijs Douze Date: Wed, 28 Apr 2021 15:31:20 +0200 Subject: [PATCH 6/6] Update IndexIVFPQR.h --- faiss/IndexIVFPQR.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faiss/IndexIVFPQR.h b/faiss/IndexIVFPQR.h index c558d7983c..cb41498259 100644 --- a/faiss/IndexIVFPQR.h +++ b/faiss/IndexIVFPQR.h @@ -46,7 +46,7 @@ struct IndexIVFPQR : IndexIVFPQ { idx_t n, const float* x, const idx_t* xids, - const idx_t* precomputed_idx = nullptr); + const idx_t* precomputed_idx) override; void reconstruct_from_offset(int64_t list_no, int64_t offset, float* recons) const override;