All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
faiss::gpu::StackDeviceMemory::Stack Struct Reference

## Public Member Functions

| Stack (int device, size_t size)
| Constructor that allocates memory via cudaMalloc.
| Stack (int device, void *p, size_t size, bool isOwner)
| Constructor that references a pre-allocated region of memory.
size_t | getSizeAvailable () const
char * | getAlloc (size_t size, cudaStream_t stream)
void | returnAlloc (char *p, size_t size, cudaStream_t stream)
| Returns an allocation.
std::string | toString () const
| Returns the stack state.
size_t | getHighWaterCudaMalloc () const
| Returns the high-water mark of cudaMalloc activity.

## Public Attributes

int | device_
| Device this allocation is on.
bool | isOwner_
| Do we own our region of memory?
char * | start_
char * | end_
size_t | size_
| Total size end_ - start_.
char * | head_
| Stack head within [start, end)
std::list< Range > | lastUsers_
size_t | mallocCurrent_
| How much cudaMalloc memory is currently outstanding?
size_t | highWaterMemoryUsed_
size_t | highWaterMalloc_

## Detailed Description

Definition at line 59 of file StackDeviceMemory.h.

## Member Function Documentation

char * faiss::gpu::StackDeviceMemory::Stack::getAlloc | ( | size_t | size,
|  | cudaStream_t | stream
| ) |  |

Obtains an allocation; all allocations are guaranteed to be 16 byte aligned

Definition at line 63 of file StackDeviceMemory.cpp.

size_t faiss::gpu::StackDeviceMemory::Stack::getSizeAvailable | ( |  | ) | const

Returns how much size is available for an allocation without calling cudaMalloc

Definition at line 58 of file StackDeviceMemory.cpp.

## Member Data Documentation

size_t faiss::gpu::StackDeviceMemory::Stack::highWaterMalloc_

What's the high water mark in terms of memory allocated via cudaMalloc?

Definition at line 114 of file StackDeviceMemory.h.

size_t faiss::gpu::StackDeviceMemory::Stack::highWaterMemoryUsed_

What's the high water mark in terms of memory used from the temporary buffer?

Definition at line 110 of file StackDeviceMemory.h.

std::list<Range> faiss::gpu::StackDeviceMemory::Stack::lastUsers_

List of previous last users of allocations on our stack, for possible synchronization purposes

Definition at line 103 of file StackDeviceMemory.h.

char* faiss::gpu::StackDeviceMemory::Stack::start_

Where our allocation begins and ends [start_, end_) is valid

Definition at line 92 of file StackDeviceMemory.h.

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

- /data/users/matthijs/github_faiss/faiss/gpu/utils/StackDeviceMemory.h
- /data/users/matthijs/github_faiss/faiss/gpu/utils/StackDeviceMemory.cpp