Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
PQCodeDistances.cuh
1 /**
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD+Patents license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 // Copyright 2004-present Facebook. All Rights Reserved.
10 
11 #pragma once
12 
13 #include "../utils/Tensor.cuh"
14 #include "../utils/NoTypeTensor.cuh"
15 #include <cublas_v2.h>
16 
17 namespace faiss { namespace gpu {
18 
19 class DeviceMemory;
20 
21 /// pqCentroids is of the form (sub q)(sub dim)(code id)
22 /// Calculates the distance from the (query - centroid) residual to
23 /// each sub-code vector, for the given list of query results in
24 /// topQueryToCentroid
25 void runPQCodeDistances(Tensor<float, 3, true>& pqCentroids,
26  Tensor<float, 2, true>& queries,
27  Tensor<float, 2, true>& coarseCentroids,
28  Tensor<int, 2, true>& topQueryToCentroid,
29  NoTypeTensor<4, true>& outCodeDistances,
30  bool useFloat16Lookup,
31  cudaStream_t stream);
32 
33 void runPQCodeDistancesMM(Tensor<float, 3, true>& pqCentroids,
34  Tensor<float, 2, true>& queries,
35  Tensor<float, 2, true>& coarseCentroids,
36  Tensor<int, 2, true>& topQueryToCentroid,
37  NoTypeTensor<4, true>& outCodeDistances,
38  bool useFloat16Lookup,
39  DeviceMemory& mem,
40  cublasHandle_t handle,
41  cudaStream_t stream);
42 
43 } } // namespace