<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">/// Default implementation of GpuResources that allocates a cuBLAS</span></div>
<divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="comment">/// stream and 2 streams for use, as well as temporary memory</span></div>
<divclass="line"><aname="l00029"></a><spanclass="lineno"> 29</span> <spanclass="comment"> /// Disable allocation of temporary memory; all temporary memory</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"> 30</span> <spanclass="comment"> /// requests will call cudaMalloc / cudaFree at the point of use</span></div>
<divclass="line"><aname="l00033"></a><spanclass="lineno"> 33</span> <spanclass="comment"> /// Specify that we wish to use a certain fixed size of memory on</span></div>
<divclass="line"><aname="l00034"></a><spanclass="lineno"> 34</span> <spanclass="comment"> /// all devices as temporary memory</span></div>
<divclass="line"><aname="l00037"></a><spanclass="lineno"> 37</span> <spanclass="comment"> /// Specify that we wish to use a certain fraction of memory on</span></div>
<divclass="line"><aname="l00038"></a><spanclass="lineno"> 38</span> <spanclass="comment"> /// all devices as temporary memory</span></div>
<divclass="line"><aname="l00041"></a><spanclass="lineno"> 41</span> <spanclass="comment"> /// Set amount of pinned memory to allocate, for async GPU <-> CPU</span></div>
<divclass="line"><aname="l00045"></a><spanclass="lineno"> 45</span> <spanclass="comment"> /// Called to change the stream for work ordering</span></div>
<divclass="line"><aname="l00048"></a><spanclass="lineno"> 48</span> <spanclass="comment"> /// Called to change the work ordering streams to the null stream</span></div>
<divclass="line"><aname="l00049"></a><spanclass="lineno"> 49</span> <spanclass="comment"> /// for all devices</span></div>
<divclass="line"><aname="l00069"></a><spanclass="lineno"> 69</span> <spanclass="comment"> /// Our default stream that work is ordered on, one per each device</span></div>
<divclass="line"><aname="l00072"></a><spanclass="lineno"> 72</span> <spanclass="comment"> /// This contains particular streams as set by the user for</span></div>
<divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</span> <spanclass="comment"> /// ordering, if any</span></div>
<divclass="line"><aname="l00076"></a><spanclass="lineno"> 76</span> <spanclass="comment"> /// Other streams we can use, per each device</span></div>
<divclass="line"><aname="l00079"></a><spanclass="lineno"> 79</span> <spanclass="comment"> /// Async copy stream to use for GPU <-> CPU pinned memory copies</span></div>
<divclass="line"><aname="l00085"></a><spanclass="lineno"> 85</span> <spanclass="comment"> /// Temporary memory provider, per each device</span></div>
<divclass="line"><aname="l00088"></a><spanclass="lineno"> 88</span> <spanclass="comment"> /// Pinned memory allocation for use with this GPU</span></div>
<divclass="line"><aname="l00092"></a><spanclass="lineno"> 92</span> <spanclass="comment"> /// By default, we reserve this fraction of memory on all devices</span></div>
<divclass="line"><aname="l00095"></a><spanclass="lineno"> 95</span> <spanclass="comment"> /// Another option is to use a specified amount of memory on all</span></div>
<divclass="line"><aname="l00099"></a><spanclass="lineno"> 99</span> <spanclass="comment"> /// Whether we look at tempMemFraction_ or tempMemSize_</span></div>
<divclass="line"><aname="l00102"></a><spanclass="lineno"> 102</span> <spanclass="comment"> /// Amount of pinned memory we should allocate</span></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1StandardGpuResources_html_a5924b424c36dba8300866f1b98c438cb"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1StandardGpuResources.html#a5924b424c36dba8300866f1b98c438cb">faiss::gpu::StandardGpuResources::setDefaultStream</a></div><divclass="ttdeci">void setDefaultStream(int device, cudaStream_t stream)</div><divclass="ttdoc">Called to change the stream for work ordering. </div><divclass="ttdef"><b>Definition:</b><ahref="StandardGpuResources_8cpp_source.html#l00103">StandardGpuResources.cpp:103</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1StandardGpuResources_html_a7560435c7f45fd59d94ee947330a58da"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1StandardGpuResources.html#a7560435c7f45fd59d94ee947330a58da">faiss::gpu::StandardGpuResources::getBlasHandle</a></div><divclass="ttdeci">cublasHandle_t getBlasHandle(int device) override</div><divclass="ttdoc">Returns the cuBLAS handle that we use for the given device. </div><divclass="ttdef"><b>Definition:</b><ahref="StandardGpuResources_8cpp_source.html#l00205">StandardGpuResources.cpp:205</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1StandardGpuResources_html_adb2729678638ed89f7b8b38470f96056"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1StandardGpuResources.html#adb2729678638ed89f7b8b38470f96056">faiss::gpu::StandardGpuResources::initializeForDevice</a></div><divclass="ttdeci">void initializeForDevice(int device) override</div><divclass="ttdoc">Internal system calls. </div><divclass="ttdef"><b>Definition:</b><ahref="StandardGpuResources_8cpp_source.html#l00122">StandardGpuResources.cpp:122</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1StandardGpuResources_html_adf89d4731c826df889f51fe42287b15d"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1StandardGpuResources.html#adf89d4731c826df889f51fe42287b15d">faiss::gpu::StandardGpuResources::getAsyncCopyStream</a></div><divclass="ttdeci">cudaStream_t getAsyncCopyStream(int device) override</div><divclass="ttdoc">Returns the stream on which we perform async CPU &lt;-&gt; GPU copies. </div><divclass="ttdef"><b>Definition:</b><ahref="StandardGpuResources_8cpp_source.html#l00233">StandardGpuResources.cpp:233</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1StandardGpuResources_html_a35da92117dd4b47ee773444af716d634"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1StandardGpuResources.html#a35da92117dd4b47ee773444af716d634">faiss::gpu::StandardGpuResources::getMemoryManager</a></div><divclass="ttdeci">DeviceMemory & getMemoryManager(int device) override</div><divclass="ttdoc">Returns the temporary memory manager for the given device. </div><divclass="ttdef"><b>Definition:</b><ahref="StandardGpuResources_8cpp_source.html#l00222">StandardGpuResources.cpp:222</a></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_1StandardGpuResources_html_ae7418f127cac2ac663ac0ae2e6f88e8d"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1StandardGpuResources.html#ae7418f127cac2ac663ac0ae2e6f88e8d">faiss::gpu::StandardGpuResources::getPinnedMemory</a></div><divclass="ttdeci">std::pair< void *, size_t > getPinnedMemory() override</div><divclass="ttdoc">Returns the available CPU pinned memory buffer. </div><divclass="ttdef"><b>Definition:</b><ahref="StandardGpuResources_8cpp_source.html#l00228">StandardGpuResources.cpp:228</a></div></div>
<divclass="ttc"id="classfaiss_1_1gpu_1_1StandardGpuResources_html_a9ebf68604864cb890a4c2e3d0a6f9952"><divclass="ttname"><ahref="classfaiss_1_1gpu_1_1StandardGpuResources.html#a9ebf68604864cb890a4c2e3d0a6f9952">faiss::gpu::StandardGpuResources::getAlternateStreams</a></div><divclass="ttdeci">std::vector< cudaStream_t > getAlternateStreams(int device) override</div><divclass="ttdoc">Returns the set of alternative streams that we use for the given device. </div><divclass="ttdef"><b>Definition:</b><ahref="StandardGpuResources_8cpp_source.html#l00217">StandardGpuResources.cpp:217</a></div></div>