pxtask::CudaMemoryManager Class Reference
Allocator class for different kinds of CUDA related memory. More...
#include <PxCudaMemoryManager.h>
Public Member Functions | |
virtual NvCudaBuffer * | alloc (const CudaBufferType &type, size_t size, NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED))=0 |
Allocate memory of given type and size. Returns a CudaBuffer if successful. Returns NULL if failed. | |
virtual CudaBufferPtr | alloc (CudaBufferMemorySpace::Enum memorySpace, size_t size, NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED))=0 |
Basic heap allocator without NvCudaBuffer. | |
virtual bool | free (CudaBufferMemorySpace::Enum memorySpace, CudaBufferPtr addr)=0 |
Basic heap deallocator without NvCudaBuffer. | |
virtual bool | realloc (CudaBufferMemorySpace::Enum memorySpace, CudaBufferPtr addr, size_t size, NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED))=0 |
Basic heap realloc without NvCudaBuffer. | |
virtual void | getStats (const CudaBufferType &type, CudaMemoryManagerStats &outStats)=0 |
Retrieve stats for the memory of given type. See CudaMemoryManagerStats. | |
virtual bool | reserve (const CudaBufferType &type, size_t size)=0 |
virtual bool | setPageSize (const CudaBufferType &type, size_t size)=0 |
virtual bool | setMaxMemorySize (const CudaBufferType &type, size_t size)=0 |
virtual size_t | getBaseSize (const CudaBufferType &type)=0 |
Returns the base size. The base memory block stays persistently allocated over the SDKs life time. | |
virtual size_t | getPageSize (const CudaBufferType &type)=0 |
Returns the currently set page size. The memory grows and shrinks in blocks of size (2^n pageSize). | |
virtual size_t | getMaxMemorySize (const CudaBufferType &type)=0 |
Returns the upper limit until which the manager is allowed to allocate additional pages from the CUDA driver. | |
Protected Member Functions | |
virtual | ~CudaMemoryManager () |
protected destructor |
Detailed Description
Allocator class for different kinds of CUDA related memory.Constructor & Destructor Documentation
virtual pxtask::CudaMemoryManager::~CudaMemoryManager | ( | ) | [inline, protected, virtual] |
protected destructor
Member Function Documentation
virtual CudaBufferPtr pxtask::CudaMemoryManager::alloc | ( | CudaBufferMemorySpace::Enum | memorySpace, | |
size_t | size, | |||
NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED) | ||||
) | [pure virtual] |
Basic heap allocator without NvCudaBuffer.
virtual NvCudaBuffer* pxtask::CudaMemoryManager::alloc | ( | const CudaBufferType & | type, | |
size_t | size, | |||
NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED) | ||||
) | [pure virtual] |
Allocate memory of given type and size. Returns a CudaBuffer if successful. Returns NULL if failed.
virtual bool pxtask::CudaMemoryManager::free | ( | CudaBufferMemorySpace::Enum | memorySpace, | |
CudaBufferPtr | addr | |||
) | [pure virtual] |
Basic heap deallocator without NvCudaBuffer.
virtual size_t pxtask::CudaMemoryManager::getBaseSize | ( | const CudaBufferType & | type | ) | [pure virtual] |
Returns the base size. The base memory block stays persistently allocated over the SDKs life time.
virtual size_t pxtask::CudaMemoryManager::getMaxMemorySize | ( | const CudaBufferType & | type | ) | [pure virtual] |
Returns the upper limit until which the manager is allowed to allocate additional pages from the CUDA driver.
virtual size_t pxtask::CudaMemoryManager::getPageSize | ( | const CudaBufferType & | type | ) | [pure virtual] |
Returns the currently set page size. The memory grows and shrinks in blocks of size (2^n pageSize).
virtual void pxtask::CudaMemoryManager::getStats | ( | const CudaBufferType & | type, | |
CudaMemoryManagerStats & | outStats | |||
) | [pure virtual] |
Retrieve stats for the memory of given type. See CudaMemoryManagerStats.
virtual bool pxtask::CudaMemoryManager::realloc | ( | CudaBufferMemorySpace::Enum | memorySpace, | |
CudaBufferPtr | addr, | |||
size_t | size, | |||
NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED) | ||||
) | [pure virtual] |
Basic heap realloc without NvCudaBuffer.
virtual bool pxtask::CudaMemoryManager::reserve | ( | const CudaBufferType & | type, | |
size_t | size | |||
) | [pure virtual] |
Ensure that a given amount of free memory is available. Triggers CUDA allocations in size of (2^n * pageSize) if necessary. Returns false if page allocations failed.
virtual bool pxtask::CudaMemoryManager::setMaxMemorySize | ( | const CudaBufferType & | type, | |
size_t | size | |||
) | [pure virtual] |
Set the upper limit until which pages of a given memory type can be allocated. Reducing the max when it is already hit does not shrink the memory until it is deallocated by releasing the buffers which own the memory.
virtual bool pxtask::CudaMemoryManager::setPageSize | ( | const CudaBufferType & | type, | |
size_t | size | |||
) | [pure virtual] |
Set the page size. The managed memory grows by blocks 2^n * pageSize. Page allocations trigger CUDA driver allocations, so the page size should be reasonably big. Returns false if input size was invalid, i.e. not power of two. Default is 2 MB.
The documentation for this class was generated from the following file:
Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com