Skip to content

Instantly share code, notes, and snippets.

@mdouze
Created March 22, 2017 09:56
Show Gist options
  • Save mdouze/9a392de0de81614ea2f39b8c724597a3 to your computer and use it in GitHub Desktop.
Save mdouze/9a392de0de81614ea2f39b8c724597a3 to your computer and use it in GitHub Desktop.
Search perf OpenBLAS with OMP_WAIT_POLICY=PASSIVE
OMP_WAIT_POLICY=PASSIVE ipython
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
Type "copyright", "credits" or "license" for more information.
IPython 3.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
execing pythonstartup.py
In [1]:
In [1]: import numpy as np
In [2]: import faiss
Failed to load GPU Faiss: No module named swigfaiss_gpu
Faiss falling back to CPU-only.
In [3]: import time
In [4]:
In [4]: # d = 160
In [5]: d = 128
In [6]: X = np.random.random((1000000, d)).astype('float32')
In [7]:
In [7]: index = faiss.IndexFlatL2(d)
In [8]:
In [8]: index.add(X)
In [9]:
In [9]: t0 = time.time(); index.search(X[:19], 20); print time.time() - t0
0.0814518928528
In [10]:
In [10]: t0 = time.time(); index.search(X[:20], 20); print time.time() - t0
0.398850917816
In [11]: t0 = time.time(); index.search(X[:20], 20); print time.time() - t0
0.389719963074
In [12]: t0 = time.time(); index.search(X[:20], 20); print time.time() - t0
0.384557008743
In [13]: t0 = time.time(); index.search(X[:20], 20); print time.time() - t0
^[[A0.414895057678
In [14]: t0 = time.time(); index.search(X[:20], 20); print time.time() - t0
0.394572973251
In [15]: t0 = time.time(); index.search(X[:20], 20); print time.time() - t0
0.402205944061
In [16]: t0 = time.time(); index.search(X[:20], 20); print time.time() - t0
0.437525987625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment