<divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> * This source code is licensed under the BSD+Patents license found in the</span></div>
<divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<divclass="line"><aname="l00009"></a><spanclass="lineno"> 9</span> <spanclass="comment">// Copyright 2004-present Facebook. All Rights Reserved.</span></div>
<divclass="line"><aname="l00021"></a><spanclass="lineno"> 21</span> <spanclass="comment">/// Base class of GPU-side resource provider; hides provision of</span></div>
<divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="comment">/// cuBLAS handles, CUDA streams and a temporary memory manager</span></div>
<divclass="line"><aname="l00027"></a><spanclass="lineno"> 27</span> <spanclass="comment"> /// Call to pre-allocate resources for a particular device. If this is</span></div>
<divclass="line"><aname="l00028"></a><spanclass="lineno"> 28</span> <spanclass="comment"> /// not called, then resources will be allocated at the first time</span></div>
<divclass="line"><aname="l00029"></a><spanclass="lineno"> 29</span> <spanclass="comment"> /// of demand</span></div>
<divclass="line"><aname="l00032"></a><spanclass="lineno"> 32</span> <spanclass="comment"> /// Returns the cuBLAS handle that we use for the given device</span></div>
<divclass="line"><aname="l00035"></a><spanclass="lineno"> 35</span> <spanclass="comment"> /// Returns the stream that we order all computation on for the</span></div>
<divclass="line"><aname="l00036"></a><spanclass="lineno"> 36</span> <spanclass="comment"> /// given device</span></div>
<divclass="line"><aname="l00039"></a><spanclass="lineno"> 39</span> <spanclass="comment"> /// Returns the set of alternative streams that we use for the given device</span></div>
<divclass="line"><aname="l00042"></a><spanclass="lineno"> 42</span> <spanclass="comment"> /// Returns the temporary memory manager for the given device</span></div>
<divclass="line"><aname="l00045"></a><spanclass="lineno"> 45</span> <spanclass="comment"> /// Returns the available CPU pinned memory buffer</span></div>
<divclass="line"><aname="l00048"></a><spanclass="lineno"> 48</span> <spanclass="comment"> /// Returns the stream on which we perform async CPU <-> GPU copies</span></div>
<divclass="line"><aname="l00051"></a><spanclass="lineno"> 51</span> <spanclass="comment"> /// Calls getBlasHandle with the current device</span></div>
<divclass="line"><aname="l00054"></a><spanclass="lineno"> 54</span> <spanclass="comment"> /// Calls getDefaultStream with the current device</span></div>
<divclass="line"><aname="l00057"></a><spanclass="lineno"> 57</span> <spanclass="comment"> /// Synchronizes the CPU with respect to the default stream for the</span></div>
<divclass="line"><aname="l00058"></a><spanclass="lineno"> 58</span> <spanclass="comment"> /// given device</span></div>
<divclass="line"><aname="l00059"></a><spanclass="lineno"> 59</span> <spanclass="comment"></span><spanclass="comment">// equivalent to cudaDeviceSynchronize(getDefaultStream(device))</span></div>
<divclass="line"><aname="l00062"></a><spanclass="lineno"> 62</span> <spanclass="comment"> /// Calls syncDefaultStream for the current device</span></div>
<divclass="line"><aname="l00065"></a><spanclass="lineno"> 65</span> <spanclass="comment"> /// Calls getAlternateStreams for the current device</span></div>
<divclass="line"><aname="l00068"></a><spanclass="lineno"> 68</span> <spanclass="comment"> /// Calls getMemoryManager for the current device</span></div>
<divclass="line"><aname="l00071"></a><spanclass="lineno"> 71</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#l00025">GpuResources.cpp:25</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#l00020">GpuResources.cpp:20</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#l00035">GpuResources.cpp:35</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#l00050">GpuResources.cpp:50</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#l00040">GpuResources.cpp:40</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#l00030">GpuResources.cpp:30</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#l00046">DeviceMemory.h:46</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>