<divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment"> * This source code is licensed under the CC-by-NC license found in the</span></div>
<divclass="line"><aname="l00007"></a><spanclass="lineno"> 7</span> <spanclass="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="comment">// Copyright 2004-present Facebook. All Rights Reserved.</span></div>
<divclass="line"><aname="l00026"></a><spanclass="lineno"> 26</span> <spanclass="comment">/// Base inverted list functionality for IVFFlat and IVFPQ</span></div>
<divclass="line"><aname="l00037"></a><spanclass="lineno"> 37</span> <spanclass="comment"> /// Reserve GPU memory in our inverted lists for this number of vectors</span></div>
<divclass="line"><aname="l00040"></a><spanclass="lineno"> 40</span> <spanclass="comment"> /// Clear out all inverted lists, but retain the coarse quantizer</span></div>
<divclass="line"><aname="l00041"></a><spanclass="lineno"> 41</span> <spanclass="comment"> /// and the product quantizer info</span></div>
<divclass="line"><aname="l00044"></a><spanclass="lineno"> 44</span> <spanclass="comment"> /// Return the number of dimensions we are indexing</span></div>
<divclass="line"><aname="l00047"></a><spanclass="lineno"> 47</span> <spanclass="comment"> /// After adding vectors, one can call this to reclaim device memory</span></div>
<divclass="line"><aname="l00048"></a><spanclass="lineno"> 48</span> <spanclass="comment"> /// to exactly the amount needed. Returns space reclaimed in bytes</span></div>
<divclass="line"><aname="l00054"></a><spanclass="lineno"> 54</span> <spanclass="comment"> /// For debugging purposes, return the list length of a particular</span></div>
<divclass="line"><aname="l00058"></a><spanclass="lineno"> 58</span> <spanclass="comment"> /// Return the list indices of a particular list back to the CPU</span></div>
<divclass="line"><aname="l00062"></a><spanclass="lineno"> 62</span> <spanclass="comment"> /// Reclaim memory consumed on the device for our inverted lists</span></div>
<divclass="line"><aname="l00063"></a><spanclass="lineno"> 63</span> <spanclass="comment"> /// `exact` means we trim exactly to the memory needed</span></div>
<divclass="line"><aname="l00066"></a><spanclass="lineno"> 66</span> <spanclass="comment"> /// Update all device-side list pointer and size information</span></div>
<divclass="line"><aname="l00069"></a><spanclass="lineno"> 69</span> <spanclass="comment"> /// For a set of list IDs, update device-side list pointer and size</span></div>
<divclass="line"><aname="l00074"></a><spanclass="lineno"> 74</span> <spanclass="comment"> /// Shared function to copy indices from CPU to GPU</span></div>
<divclass="line"><aname="l00080"></a><spanclass="lineno"> 80</span> <spanclass="comment"> /// Collection of GPU resources that we use</span></div>
<divclass="line"><aname="l00095"></a><spanclass="lineno"> 95</span> <spanclass="comment"> /// How are user indices stored on the GPU?</span></div>
<divclass="line"><aname="l00098"></a><spanclass="lineno"> 98</span> <spanclass="comment"> /// Device representation of all inverted list data</span></div>
<divclass="line"><aname="l00099"></a><spanclass="lineno"> 99</span> <spanclass="comment"> /// id -> data</span></div>
<divclass="line"><aname="l00102"></a><spanclass="lineno"> 102</span> <spanclass="comment"> /// Device representation of all inverted list index pointers</span></div>
<divclass="line"><aname="l00103"></a><spanclass="lineno"> 103</span> <spanclass="comment"> /// id -> data</span></div>
<divclass="line"><aname="l00106"></a><spanclass="lineno"> 106</span> <spanclass="comment"> /// Device representation of all inverted list lengths</span></div>
<divclass="line"><aname="l00107"></a><spanclass="lineno"> 107</span> <spanclass="comment"> /// id -> length</span></div>
<divclass="line"><aname="l00113"></a><spanclass="lineno"> 113</span> <spanclass="comment"> /// Device memory for each separate list, as managed by the host.</span></div>
<divclass="line"><aname="l00114"></a><spanclass="lineno"> 114</span> <spanclass="comment"> /// Device memory as stored in DeviceVector is stored as unique_ptr</span></div>
<divclass="line"><aname="l00115"></a><spanclass="lineno"> 115</span> <spanclass="comment"> /// since deviceListSummary_ pointers must remain valid despite</span></div>
<divclass="line"><aname="l00116"></a><spanclass="lineno"> 116</span> <spanclass="comment"> /// resizing of deviceLists_</span></div>
<divclass="line"><aname="l00120"></a><spanclass="lineno"> 120</span> <spanclass="comment"> /// If we are storing indices on the CPU (indicesOptions_ is</span></div>
<divclass="line"><aname="l00121"></a><spanclass="lineno"> 121</span> <spanclass="comment"> /// INDICES_CPU), then this maintains a CPU-side map of what</span></div>
<divclass="line"><aname="l00122"></a><spanclass="lineno"> 122</span> <spanclass="comment"> /// (inverted list id, offset) maps to which user index</span></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_accc4d96c14643e5f471220cb1e92ac70"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#accc4d96c14643e5f471220cb1e92ac70">faiss::gpu::IVFBase::numLists_</a></div><divclass="ttdeci">const int numLists_</div><divclass="ttdoc">Number of inverted lists we maintain. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cuh_source.html#l00090">IVFBase.cuh:90</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_ae25ea0901fb628844868413f51c85bda"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#ae25ea0901fb628844868413f51c85bda">faiss::gpu::IVFBase::maxListLength_</a></div><divclass="ttdeci">int maxListLength_</div><divclass="ttdoc">Maximum list length seen. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cuh_source.html#l00111">IVFBase.cuh:111</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_a53f3c382a79b7f89630a85dfbc3a1fed"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#a53f3c382a79b7f89630a85dfbc3a1fed">faiss::gpu::IVFBase::listOffsetToUserIndex_</a></div><divclass="ttdeci">std::vector< std::vector< long >> listOffsetToUserIndex_</div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cuh_source.html#l00123">IVFBase.cuh:123</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1FlatIndex_html"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1FlatIndex.html">faiss::gpu::FlatIndex</a></div><divclass="ttdoc">Holder of GPU resources for a particular flat index. </div><divclass="ttdef"><b>Definition:</b><ahref="FlatIndex_8cuh_source.html#l00023">FlatIndex.cuh:23</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_a4d44e8aebc380b7c846a8d8e6e835540"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#a4d44e8aebc380b7c846a8d8e6e835540">faiss::gpu::IVFBase::getDim</a></div><divclass="ttdeci">int getDim() const </div><divclass="ttdoc">Return the number of dimensions we are indexing. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cu_source.html#l00099">IVFBase.cu:99</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_a02e1e2d080ee31bf7835f89b9f2a13a9"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#a02e1e2d080ee31bf7835f89b9f2a13a9">faiss::gpu::IVFBase::reserveMemory</a></div><divclass="ttdeci">void reserveMemory(size_t numVecs)</div><divclass="ttdoc">Reserve GPU memory in our inverted lists for this number of vectors. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cu_source.html#l00044">IVFBase.cu:44</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html">faiss::gpu::IVFBase</a></div><divclass="ttdoc">Base inverted list functionality for IVFFlat and IVFPQ. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cuh_source.html#l00027">IVFBase.cuh:27</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_a3a1c2031a4763f7d55bc8a400c63af66"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#a3a1c2031a4763f7d55bc8a400c63af66">faiss::gpu::IVFBase::deviceListLengths_</a></div><divclass="ttdeci">thrust::device_vector< int > deviceListLengths_</div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cuh_source.html#l00108">IVFBase.cuh:108</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_a05e6400358ec1f529a67209d3f24cc63"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#a05e6400358ec1f529a67209d3f24cc63">faiss::gpu::IVFBase::resources_</a></div><divclass="ttdeci">GpuResources * resources_</div><divclass="ttdoc">Collection of GPU resources that we use. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cuh_source.html#l00081">IVFBase.cuh:81</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_a319568b832518392fed33ea4f8bfc613"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#a319568b832518392fed33ea4f8bfc613">faiss::gpu::IVFBase::bytesPerVector_</a></div><divclass="ttdeci">const int bytesPerVector_</div><divclass="ttdoc">Number of bytes per vector in the list. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cuh_source.html#l00093">IVFBase.cuh:93</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_acc695610c9513952b8d234dc0db78e5c"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#acc695610c9513952b8d234dc0db78e5c">faiss::gpu::IVFBase::updateDeviceListInfo_</a></div><divclass="ttdeci">void updateDeviceListInfo_(cudaStream_t stream)</div><divclass="ttdoc">Update all device-side list pointer and size information. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cu_source.html#l00137">IVFBase.cu:137</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_a4a4ed220b9433aa788ed32db8f20a9db"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#a4a4ed220b9433aa788ed32db8f20a9db">faiss::gpu::IVFBase::getListIndices</a></div><divclass="ttdeci">std::vector< long > getListIndices(int listId) const </div><divclass="ttdoc">Return the list indices of a particular list back to the CPU. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cu_source.html#l00206">IVFBase.cu:206</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_afb6d10e23d6448c10f472b9234e0bcab"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#afb6d10e23d6448c10f472b9234e0bcab">faiss::gpu::IVFBase::indicesOptions_</a></div><divclass="ttdeci">const IndicesOptions indicesOptions_</div><divclass="ttdoc">How are user indices stored on the GPU? </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cuh_source.html#l00096">IVFBase.cuh:96</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_aba3e3cfa469e5187f2d553fff10e0250"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#aba3e3cfa469e5187f2d553fff10e0250">faiss::gpu::IVFBase::dim_</a></div><divclass="ttdeci">const int dim_</div><divclass="ttdoc">Expected dimensionality of the vectors. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cuh_source.html#l00087">IVFBase.cuh:87</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_a5027720549de98f4e609d6339099df35"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#a5027720549de98f4e609d6339099df35">faiss::gpu::IVFBase::addIndicesFromCpu_</a></div><divclass="ttdeci">void addIndicesFromCpu_(int listId, const long *indices, size_t numVecs)</div><divclass="ttdoc">Shared function to copy indices from CPU to GPU. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cu_source.html#l00244">IVFBase.cu:244</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1IVFBase_html_abd66dc9d32e6150b930d78f74d7dd2d7"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1IVFBase.html#abd66dc9d32e6150b930d78f74d7dd2d7">faiss::gpu::IVFBase::getNumLists</a></div><divclass="ttdeci">size_t getNumLists() const </div><divclass="ttdoc">Returns the number of inverted lists. </div><divclass="ttdef"><b>Definition:</b><ahref="IVFBase_8cu_source.html#l00194">IVFBase.cu:194</a></div></div>