|
NVIDIA NvNeural SDK
2021.1
GPU inference framework for NVIDIA Nsight Deep Learning Designer
|
ScopedMemoryAllocation is a helper function for allocating memory blocks from the backend while adding the security and ease of use of the RAII idiom. More...
#include <ScopedMemoryAllocation.h>
Public Member Functions | |
| void * | asPointer () |
| Returns the pointer to the allocated memory block. More... | |
| MemoryHandle | handle () const |
| Returns the memory handle of the allocated memory block. More... | |
| operator bool () const | |
| Returns true if the memory allocation is valid (non-null handle). | |
| ScopedMemoryAllocation & | operator= (const ScopedMemoryAllocation ©From)=delete |
| ScopedMemoryAllocation & | operator= (ScopedMemoryAllocation &&moveFrom) |
| Takes ownership of an allocation from another ScopedMemoryAllocation. More... | |
| ScopedMemoryAllocation (const ScopedMemoryAllocation ©From)=delete | |
| ScopedMemoryAllocation (INetworkBackend *pBackend, size_t bufferSize) | |
| Creates a temporary memory allocation using a network backend. More... | |
| ScopedMemoryAllocation (ScopedMemoryAllocation &&moveFrom) | |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| ~ScopedMemoryAllocation () | |
| Frees the allocation. | |
ScopedMemoryAllocation is a helper function for allocating memory blocks from the backend while adding the security and ease of use of the RAII idiom.
Usage notes: This is meant to be used only temporarily within a particular block of code. The class doesn't take a reference to the network backend. Check handle() for nullptr, which is the failure of allocation. Memory is freed automatically once out of scope.
|
inline |
Creates a temporary memory allocation using a network backend.
The memory allocated is in the backend's address space (cuDevicePtr for CUDA).
| pBackend | Backend performing the allocation |
| bufferSize | Size of buffer to request, in bytes |
|
inline |
Returns the pointer to the allocated memory block.
|
inline |
Returns the memory handle of the allocated memory block.
|
inline |
Takes ownership of an allocation from another ScopedMemoryAllocation.
| moveFrom | rvalue reference to the source allocation object |