Faiss

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | List of all members
faiss::gpu::StandardGpuResources Class Reference

`#include <StandardGpuResources.h>`

Inheritance diagram for faiss::gpu::StandardGpuResources:

## Public Member Functions
void | noTempMemory ()
void | setTempMemory (size_t size)
void | setPinnedMemory (size_t size)
void | setDefaultStream (int device, cudaStream_t stream)
| Called to change the stream for work ordering.
void | setDefaultNullStreamAllDevices ()
void | setCudaMallocWarning (bool b)
void | initializeForDevice (int device) override
| Internal system calls. More...
cublasHandle_t | getBlasHandle (int device) override
| Returns the cuBLAS handle that we use for the given device.
cudaStream_t | getDefaultStream (int device) override
std::vector< cudaStream_t > | getAlternateStreams (int device) override
| Returns the set of alternative streams that we use for the given device.
DeviceMemory & | getMemoryManager (int device) override
| Returns the temporary memory manager for the given device.
std::pair< void *, size_t > | getPinnedMemory () override
| Returns the available CPU pinned memory buffer.
cudaStream_t | getAsyncCopyStream (int device) override
| Returns the stream on which we perform async CPU <-> GPU copies.
Public Member Functions inherited from faiss::gpu::GpuResources
cublasHandle_t | getBlasHandleCurrentDevice ()
| Calls getBlasHandle with the current device.
cudaStream_t | getDefaultStreamCurrentDevice ()
| Calls getDefaultStream with the current device.
void | syncDefaultStream (int device)
void | syncDefaultStreamCurrentDevice ()
| Calls syncDefaultStream for the current device.
std::vector< cudaStream_t > | getAlternateStreamsCurrentDevice ()
| Calls getAlternateStreams for the current device.
DeviceMemory & | getMemoryManagerCurrentDevice ()
| Calls getMemoryManager for the current device.
cudaStream_t | getAsyncCopyStreamCurrentDevice ()
| Calls getAsyncCopyStream for the current device.

## Detailed Description

Default implementation of GpuResources that allocates a cuBLAS stream and 2 streams for use, as well as temporary memory

Definition at line 21 of file StandardGpuResources.h.

## Member Function Documentation

cudaStream_t faiss::gpu::StandardGpuResources::getDefaultStream | ( | int | device | ) |
| override virtual

Returns the stream that we order all computation on for the given device

Implements faiss::gpu::GpuResources.

Definition at line 268 of file StandardGpuResources.cpp.

void faiss::gpu::StandardGpuResources::initializeForDevice | ( | int | device | ) |
| override virtual

Internal system calls.

Initialize resources for this device

Implements faiss::gpu::GpuResources.

Definition at line 190 of file StandardGpuResources.cpp.

void faiss::gpu::StandardGpuResources::noTempMemory | ( |  | ) |

Disable allocation of temporary memory; all temporary memory requests will call cudaMalloc / cudaFree at the point of use

Definition at line 115 of file StandardGpuResources.cpp.

void faiss::gpu::StandardGpuResources::setCudaMallocWarning | ( | bool | b | ) |

Enable or disable the warning about not having enough temporary memory when cudaMalloc gets called

Definition at line 174 of file StandardGpuResources.cpp.

void faiss::gpu::StandardGpuResources::setDefaultNullStreamAllDevices | ( |  | ) |

Called to change the work ordering streams to the null stream for all devices

Definition at line 167 of file StandardGpuResources.cpp.

void faiss::gpu::StandardGpuResources::setPinnedMemory | ( | size_t | size | ) |

Set amount of pinned memory to allocate, for async GPU <-> CPU transfers

Definition at line 146 of file StandardGpuResources.cpp.

void faiss::gpu::StandardGpuResources::setTempMemory | ( | size_t | size | ) |

Specify that we wish to use a certain fixed size of memory on all devices as temporary memory. This is the upper bound for the GPU memory that we will reserve. We will never go above 1.5 GiB on any GPU; smaller GPUs (with <= 4 GiB or <= 8 GiB) will use less memory than that. To avoid any temporary memory allocation, pass 0.

Definition at line 121 of file StandardGpuResources.cpp.

The documentation for this class was generated from the following files:

- /data/users/hoss/faiss/gpu/StandardGpuResources.h
- /data/users/hoss/faiss/gpu/StandardGpuResources.cpp