Faiss

- Main Page
- Namespaces
- Classes
- Files

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

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

`#include <StackDeviceMemory.h>`

Inheritance diagram for faiss::gpu::StackDeviceMemory:

## Classes
struct | Range
struct | Stack

## Public Member Functions
| StackDeviceMemory (int device, size_t allocPerDevice)
| Allocate a new region of memory that we manage.
| StackDeviceMemory (int device, void *p, size_t size, bool isOwner)
void | setCudaMallocWarning (bool b)
int | getDevice () const override
| Returns the device we are managing memory for.
DeviceMemoryReservation | getMemory (cudaStream_t stream, size_t size) override
size_t | getSizeAvailable () const override
| Returns the current size available without calling cudaMalloc.
std::string | toString () const override
| Returns a string containing our current memory manager state.
size_t | getHighWaterCudaMalloc () const override

## Protected Member Functions
void | returnAllocation (DeviceMemoryReservation &m) override

## Protected Attributes
int | device_
| Our device.
Stack | stack_
| Memory stack.

## Detailed Description

Device memory manager that provides temporary memory allocations out of a region of memory

Definition at line 20 of file StackDeviceMemory.h.

## Constructor & Destructor Documentation

faiss::gpu::StackDeviceMemory::StackDeviceMemory | ( | int | device,
|  | void * | p,
|  | size_t | size,
|  | bool | isOwner
| ) |  |

Manage a region of memory for a particular device, with or without ownership

Definition at line 184 of file StackDeviceMemory.cpp.

## Member Function Documentation

size_t faiss::gpu::StackDeviceMemory::getHighWaterCudaMalloc | ( |  | ) | const
| override virtual

Returns the high-water mark of cudaMalloc allocations for our device

Implements faiss::gpu::DeviceMemory.

Definition at line 227 of file StackDeviceMemory.cpp.

DeviceMemoryReservation faiss::gpu::StackDeviceMemory::getMemory | ( | cudaStream_t | stream,
|  | size_t | size
| ) |  |
| override virtual

Obtains a temporary memory allocation for our device, whose usage is ordered with respect to the given stream.

Implements faiss::gpu::DeviceMemory.

Definition at line 204 of file StackDeviceMemory.cpp.

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

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

Definition at line 194 of file StackDeviceMemory.cpp.

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

- /data/users/hoss/faiss/gpu/utils/StackDeviceMemory.h
- /data/users/hoss/faiss/gpu/utils/StackDeviceMemory.cpp