Skip to content

Instantly share code, notes, and snippets.

diff --git a/faiss/gpu/utils/Tensor-inl.cuh b/faiss/gpu/utils/Tensor-inl.cuh
--- a/faiss/gpu/utils/Tensor-inl.cuh
+++ b/faiss/gpu/utils/Tensor-inl.cuh
@@ -302,6 +302,11 @@
static_assert(sizeof(U) >= sizeof(T), "only handles greater sizes");
constexpr int kMultiple = sizeof(U) / sizeof(T);
+ // Ensure that the base pointer is sizeof(U) aligned
+ if (((uintptr_t) data_) % sizeof(U) != 0) {
+ return false;
matthijs@devfair0144:~/faiss_versions/faiss_cuda9/faiss/gpu$ make
/public/apps/cuda/9.0//bin/nvcc -I /public/apps/cuda/9.0//targets/x86_64-linux/include/ -Xcompiler -fPIC -Xcudafe --diag_suppress=unrecognized_attri
bute -gencode arch=compute_60,code="compute_60" -gencode arch=compute_61,code="compute_61" --std c++11 -lineinfo -ccbin g++ -DFAISS_USE_FLOAT16 -o te
st/demo_ivfpq_indexing_gpu test/demo_ivfpq_indexing_gpu.cpp libgpufaiss.a ../libfaiss.a -Xcompiler -fopenmp -lcublas \
-Xlinker --no-as-needed -Xlinker -rpath,/public/apps/intel/mkl/2018.0.128/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64_lin -L/public/apps
/intel/mkl/2018.0.128/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_gnu_thread -ldl -lpthread
matthijs@devfair0144:~/faiss_versions/faiss_cuda9/faiss/gpu$ test/demo_ivfpq_indexing_gpu
[1.887 s] Generating 100000 vectors in 128D for training
[2.111 s] Training the index
Training IVF quantizer on 100000 vectors in 128D
>>> import faiss
>>> import numpy as np
>>>
>>>
>>> n = 9000 # number of data points
>>> d = 32 # dimension of each data point
>>> x = np.random.rand(n, d).astype('float32')
>>> n, d = x.shape
>>> m = 8 # number of subspaces decomposed
>>> c = 4 # 0,1,2,..., 2^c (number of centroids)
#include <faiss/IndexIVF.h>
#include <faiss/AutoTune.h>
#include <VectorTransform.h>
/* Returns the cluster the embeddings belong to.
*
* @param index Index, which should be an IVF index
* (otherwise there are no clusters)
* @param query_centroid_ids
[WARNING]: No mapping options passed, 'naive' type mapping options will be used and will likely have bad performance. See help(your_layer.__call__) for setting mapping
options.
WARNING: Logging before InitGoogleLogging() is written to STDERR
W0612 10:21:10.611176 24123 rtc.cc:103] Compilation failure for nvrtc(NVRTC_ERROR_COMPILATION):
default_program(17): error: identifier "uint8" is undefined
default_program(23): error: identifier "codes" is undefined
default_program(23): error: identifier "uint8" is undefined
(fair_env) matthijs@devfair0144:~/src/low-shot-with-diffusion$ python logreg.py --mode test --nlabeled 2 --seed 1 --maxiter 29500 --lr 0.001 --wd 0.01 --batchsize 128
nb of eval classes 311
/public/apps/anaconda2/5.0.1/envs/fair_env/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
open /checkpoint/matthijs/low-shot/features/val.hdf5
read /checkpoint/matthijs/low-shot/features/val_features.npy
features loaded in 2.880 s
nb of eval classes 311
open /checkpoint/matthijs/low-shot/features/train.hdf5
read /checkpoint/matthijs/low-shot/features/train_features.npy
(fair_env) matthijs@devfair0144:~/src/low-shot-with-diffusion$ python diffusion.py --mode test --nlabeled 2 --seed 1 --nbg 1000000 --niter 3
========================== run on Test
load train + test set
nb of eval classes 311
/public/apps/anaconda2/5.0.1/envs/fair_env/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
open /checkpoint/matthijs/low-shot/features/val.hdf5
read /checkpoint/matthijs/low-shot/features/val_features.npy
features loaded in 3.415 s
nb of eval classes 311
(fair_env) matthijs@devfair0144:~/src/low-shot-with-diffusion$ bash run_logreg.bash 4
+ DDIR=/checkpoint/matthijs/low-shot/
+ export DDIR
+ stage=4
+ '[' -z 4 ']'
+ '[' 4 == 1 ']'
+ '[' 4 == 2 ']'
+ '[' 4 == 3 ']'
+ '[' 4 == 4 ']'
+ python parse_logreg.py --mode test
(fair_env) matthijs@devfair0144:~/src/low-shot-with-diffusion$ python parse_diffusion.py --mode test
============ nbg= 1000000
nl=1: 61.24 +/- 0.550, novel 43.54 +/- 0.952
nl=2: 66.62 +/- 0.719, novel 52.44 +/- 1.189
nl=5: 72.44 +/- 0.314, novel 61.92 +/- 0.511
nl=10: 76.12 +/- 0.194, novel 67.86 +/- 0.301
nl=20: 79.02 +/- 0.232, novel 72.50 +/- 0.385
============ nbg= 10000000
nl=1: 62.64 +/- 0.755, novel 45.76 +/- 1.244
nl=2: 68.24 +/- 0.811, novel 55.14 +/- 1.366
@mdouze
mdouze / a.diff
Created August 16, 2018 14:08
make SSE code compatible with AMD cpu
diff --git a/tests/test_build_blocks.py b/tests/test_build_blocks.py
index 2492eac..ffbec50 100644
--- a/tests/test_build_blocks.py
+++ b/tests/test_build_blocks.py
@@ -213,5 +213,24 @@ class TestOrthognalReconstruct(unittest.TestCase):
else:
self.assertFalse('should do an exception')
+class TestMAdd(unittest.TestCase):
+