mirror of
https://github.com/facebookresearch/faiss.git
synced 2025-06-03 21:54:02 +08:00
Summary: ## Description This PR added support for LSQ on GPU. Only the encoding part is running on GPU and the others are still running on CPU. Multi-GPU is also supported. ## Usage ``` python lsq = faiss.LocalSearchQuantizer(d, M, nbits) ngpus = faiss.get_num_gpus() lsq.icm_encoder_factory = faiss.GpuIcmEncoderFactory(ngpus) # we use all gpus lsq.train(xt) codes = lsq.compute_codes(xb) decoded = lsq.decode(codes) ``` ## Performance on SIFT1M On 1 GPU: ``` ===== lsq-gpu: mean square error = 17337.878528 training time: 40.9857234954834 s encoding time: 27.12640070915222 s ``` On 2 GPUs: ``` ===== lsq-gpu: mean square error = 17364.658176 training time: 25.832106113433838 s encoding time: 14.879548072814941 s ``` On CPU: ``` ===== lsq: mean square error = 17305.880576 training time: 152.57522344589233 s encoding time: 110.01779270172119 s ``` Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1978 Test Plan: buck test mode/dev-nosan //faiss/gpu/test/:test_gpu_index_py -- TestLSQIcmEncoder Reviewed By: wickedfoo Differential Revision: D29609763 Pulled By: mdouze fbshipit-source-id: b6ffa2a3c02bf696a4e52348132affa0dd838870