<divclass="line"><aname="l00002"></a><spanclass="lineno"> 2</span> <spanclass="comment"> * Copyright (c) Facebook, Inc. and its affiliates.</span></div>
<divclass="line"><aname="l00004"></a><spanclass="lineno"> 4</span> <spanclass="comment"> * This source code is licensed under the MIT license found in the</span></div>
<divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<divclass="line"><aname="l00019"></a><spanclass="lineno"> 19</span> <spanclass="comment">/// Base class of GPU-side resource provider; hides provision of</span></div>
<divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> <spanclass="comment">/// cuBLAS handles, CUDA streams and a temporary memory manager</span></div>
<divclass="line"><aname="l00025"></a><spanclass="lineno"> 25</span> <spanclass="comment"> /// Call to pre-allocate resources for a particular device. If this is</span></div>
<divclass="line"><aname="l00026"></a><spanclass="lineno"> 26</span> <spanclass="comment"> /// not called, then resources will be allocated at the first time</span></div>
<divclass="line"><aname="l00027"></a><spanclass="lineno"> 27</span> <spanclass="comment"> /// of demand</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"> 30</span> <spanclass="comment"> /// Returns the cuBLAS handle that we use for the given device</span></div>
<divclass="line"><aname="l00033"></a><spanclass="lineno"> 33</span> <spanclass="comment"> /// Returns the stream that we order all computation on for the</span></div>
<divclass="line"><aname="l00034"></a><spanclass="lineno"> 34</span> <spanclass="comment"> /// given device</span></div>
<divclass="line"><aname="l00037"></a><spanclass="lineno"> 37</span> <spanclass="comment"> /// Returns the set of alternative streams that we use for the given device</span></div>
<divclass="line"><aname="l00040"></a><spanclass="lineno"> 40</span> <spanclass="comment"> /// Returns the temporary memory manager for the given device</span></div>
<divclass="line"><aname="l00043"></a><spanclass="lineno"> 43</span> <spanclass="comment"> /// Returns the available CPU pinned memory buffer</span></div>
<divclass="line"><aname="l00046"></a><spanclass="lineno"> 46</span> <spanclass="comment"> /// Returns the stream on which we perform async CPU <-> GPU copies</span></div>
<divclass="line"><aname="l00049"></a><spanclass="lineno"> 49</span> <spanclass="comment"> /// Calls getBlasHandle with the current device</span></div>
<divclass="line"><aname="l00052"></a><spanclass="lineno"> 52</span> <spanclass="comment"> /// Calls getDefaultStream with the current device</span></div>
<divclass="line"><aname="l00055"></a><spanclass="lineno"> 55</span> <spanclass="comment"> /// Synchronizes the CPU with respect to the default stream for the</span></div>
<divclass="line"><aname="l00056"></a><spanclass="lineno"> 56</span> <spanclass="comment"> /// given device</span></div>
<divclass="line"><aname="l00057"></a><spanclass="lineno"> 57</span> <spanclass="comment"></span><spanclass="comment">// equivalent to cudaDeviceSynchronize(getDefaultStream(device))</span></div>
<divclass="line"><aname="l00060"></a><spanclass="lineno"> 60</span> <spanclass="comment"> /// Calls syncDefaultStream for the current device</span></div>
<divclass="line"><aname="l00063"></a><spanclass="lineno"> 63</span> <spanclass="comment"> /// Calls getAlternateStreams for the current device</span></div>
<divclass="line"><aname="l00066"></a><spanclass="lineno"> 66</span> <spanclass="comment"> /// Calls getMemoryManager for the current device</span></div>
<divclass="line"><aname="l00069"></a><spanclass="lineno"> 69</span> <spanclass="comment"> /// Calls getAsyncCopyStream for the current device</span></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_aa0354aa570c24e17a9f8a6a45b153ed2"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#aa0354aa570c24e17a9f8a6a45b153ed2">faiss::gpu::GpuResources::getDefaultStreamCurrentDevice</a></div><divclass="ttdeci">cudaStream_t getDefaultStreamCurrentDevice()</div><divclass="ttdoc">Calls getDefaultStream with the current device. </div><divclass="ttdef"><b>Definition:</b><ahref="GpuResources_8cpp_source.html#l00023">GpuResources.cpp:23</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_aa2682b8503dfdab4f7f5ef867035ad29"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#aa2682b8503dfdab4f7f5ef867035ad29">faiss::gpu::GpuResources::getBlasHandle</a></div><divclass="ttdeci">virtual cublasHandle_t getBlasHandle(int device)=0</div><divclass="ttdoc">Returns the cuBLAS handle that we use for the given device. </div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_a00cb7bcbc5f1a00da673f30749149b12"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#a00cb7bcbc5f1a00da673f30749149b12">faiss::gpu::GpuResources::getBlasHandleCurrentDevice</a></div><divclass="ttdeci">cublasHandle_t getBlasHandleCurrentDevice()</div><divclass="ttdoc">Calls getBlasHandle with the current device. </div><divclass="ttdef"><b>Definition:</b><ahref="GpuResources_8cpp_source.html#l00018">GpuResources.cpp:18</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_a1dda2dc3db1bd62cde6657c5cdbfb6e1"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#a1dda2dc3db1bd62cde6657c5cdbfb6e1">faiss::gpu::GpuResources::getMemoryManagerCurrentDevice</a></div><divclass="ttdeci">DeviceMemory & getMemoryManagerCurrentDevice()</div><divclass="ttdoc">Calls getMemoryManager for the current device. </div><divclass="ttdef"><b>Definition:</b><ahref="GpuResources_8cpp_source.html#l00033">GpuResources.cpp:33</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_adf6a5653ec2bbb0e9d58a0e1dd73897f"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#adf6a5653ec2bbb0e9d58a0e1dd73897f">faiss::gpu::GpuResources::syncDefaultStreamCurrentDevice</a></div><divclass="ttdeci">void syncDefaultStreamCurrentDevice()</div><divclass="ttdoc">Calls syncDefaultStream for the current device. </div><divclass="ttdef"><b>Definition:</b><ahref="GpuResources_8cpp_source.html#l00048">GpuResources.cpp:48</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_aefb90d15fade57cdfcff03ec800183d4"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#aefb90d15fade57cdfcff03ec800183d4">faiss::gpu::GpuResources::getAsyncCopyStreamCurrentDevice</a></div><divclass="ttdeci">cudaStream_t getAsyncCopyStreamCurrentDevice()</div><divclass="ttdoc">Calls getAsyncCopyStream for the current device. </div><divclass="ttdef"><b>Definition:</b><ahref="GpuResources_8cpp_source.html#l00038">GpuResources.cpp:38</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_a622f95597cc2ed2f10f3ae9400dc685b"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#a622f95597cc2ed2f10f3ae9400dc685b">faiss::gpu::GpuResources::getAlternateStreamsCurrentDevice</a></div><divclass="ttdeci">std::vector< cudaStream_t > getAlternateStreamsCurrentDevice()</div><divclass="ttdoc">Calls getAlternateStreams for the current device. </div><divclass="ttdef"><b>Definition:</b><ahref="GpuResources_8cpp_source.html#l00028">GpuResources.cpp:28</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_a104b291ed4116033752144e90856c2e7"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#a104b291ed4116033752144e90856c2e7">faiss::gpu::GpuResources::getAsyncCopyStream</a></div><divclass="ttdeci">virtual cudaStream_t getAsyncCopyStream(int device)=0</div><divclass="ttdoc">Returns the stream on which we perform async CPU &lt;-&gt; GPU copies. </div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_a7fec58e9414f313fde4988a62f06cfab"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#a7fec58e9414f313fde4988a62f06cfab">faiss::gpu::GpuResources::getMemoryManager</a></div><divclass="ttdeci">virtual DeviceMemory & getMemoryManager(int device)=0</div><divclass="ttdoc">Returns the temporary memory manager for the given device. </div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1DeviceMemory_html"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1DeviceMemory.html">faiss::gpu::DeviceMemory</a></div><divclass="ttdoc">Manages temporary memory allocations on a GPU device. </div><divclass="ttdef"><b>Definition:</b><ahref="DeviceMemory_8h_source.html#l00044">DeviceMemory.h:44</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_ad1b018745239e03d0044b659335c17a8"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#ad1b018745239e03d0044b659335c17a8">faiss::gpu::GpuResources::getPinnedMemory</a></div><divclass="ttdeci">virtual std::pair< void *, size_t > getPinnedMemory()=0</div><divclass="ttdoc">Returns the available CPU pinned memory buffer. </div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1GpuResources_html_afb469bf3b107f43ef0d6abe4a014bb5b"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1GpuResources.html#afb469bf3b107f43ef0d6abe4a014bb5b">faiss::gpu::GpuResources::getAlternateStreams</a></div><divclass="ttdeci">virtual std::vector< cudaStream_t > getAlternateStreams(int device)=0</div><divclass="ttdoc">Returns the set of alternative streams that we use for the given device. </div></div>