Public Member Functions | Protected Member Functions | List of all members
PxCudaMemoryManager Class Referenceabstract

Allocator class for different kinds of CUDA related memory. More...

#include <PxCudaMemoryManager.h>

Public Member Functions

virtual PxCudaBufferalloc (const PxCudaBufferType &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. More...
 
virtual PxCudaBufferPtr alloc (PxCudaBufferMemorySpace::Enum memorySpace, size_t size, NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED))=0
 Basic heap allocator without PxCudaBuffer. More...
 
virtual bool free (PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr)=0
 Basic heap deallocator without PxCudaBuffer. More...
 
virtual bool realloc (PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr, size_t size, NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED))=0
 Basic heap realloc without PxCudaBuffer. More...
 
virtual void getStats (const PxCudaBufferType &type, PxCudaMemoryManagerStats &outStats)=0
 Retrieve stats for the memory of given type. See PxCudaMemoryManagerStats. More...
 
virtual bool reserve (const PxCudaBufferType &type, size_t size)=0
 
virtual bool setPageSize (const PxCudaBufferType &type, size_t size)=0
 
virtual bool setMaxMemorySize (const PxCudaBufferType &type, size_t size)=0
 
virtual size_t getBaseSize (const PxCudaBufferType &type)=0
 Returns the base size. The base memory block stays persistently allocated over the SDKs life time. More...
 
virtual size_t getPageSize (const PxCudaBufferType &type)=0
 Returns the currently set page size. The memory grows and shrinks in blocks of size (2^n pageSize) More...
 
virtual size_t getMaxMemorySize (const PxCudaBufferType &type)=0
 Returns the upper limit until which the manager is allowed to allocate additional pages from the CUDA driver. More...
 
virtual PxCudaBufferPtr getMappedPinnedPtr (PxCudaBufferPtr hostPtr)=0
 Get device mapped pinned host mem ptr. Operation only valid for memory space PxCudaBufferMemorySpace::T_PINNED_HOST. More...
 

Protected Member Functions

virtual ~PxCudaMemoryManager ()
 protected destructor More...
 

Detailed Description

Allocator class for different kinds of CUDA related memory.

Constructor & Destructor Documentation

virtual PxCudaMemoryManager::~PxCudaMemoryManager ( )
inlineprotectedvirtual

protected destructor

Member Function Documentation

virtual PxCudaBuffer* PxCudaMemoryManager::alloc ( const PxCudaBufferType 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 PxCudaBufferPtr PxCudaMemoryManager::alloc ( PxCudaBufferMemorySpace::Enum  memorySpace,
size_t  size,
NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)   
)
pure virtual

Basic heap allocator without PxCudaBuffer.

virtual bool PxCudaMemoryManager::free ( PxCudaBufferMemorySpace::Enum  memorySpace,
PxCudaBufferPtr  addr 
)
pure virtual

Basic heap deallocator without PxCudaBuffer.

virtual size_t PxCudaMemoryManager::getBaseSize ( const PxCudaBufferType type)
pure virtual

Returns the base size. The base memory block stays persistently allocated over the SDKs life time.

virtual PxCudaBufferPtr PxCudaMemoryManager::getMappedPinnedPtr ( PxCudaBufferPtr  hostPtr)
pure virtual

Get device mapped pinned host mem ptr. Operation only valid for memory space PxCudaBufferMemorySpace::T_PINNED_HOST.

virtual size_t PxCudaMemoryManager::getMaxMemorySize ( const PxCudaBufferType type)
pure virtual

Returns the upper limit until which the manager is allowed to allocate additional pages from the CUDA driver.

virtual size_t PxCudaMemoryManager::getPageSize ( const PxCudaBufferType type)
pure virtual

Returns the currently set page size. The memory grows and shrinks in blocks of size (2^n pageSize)

virtual void PxCudaMemoryManager::getStats ( const PxCudaBufferType type,
PxCudaMemoryManagerStats outStats 
)
pure virtual

Retrieve stats for the memory of given type. See PxCudaMemoryManagerStats.

virtual bool PxCudaMemoryManager::realloc ( PxCudaBufferMemorySpace::Enum  memorySpace,
PxCudaBufferPtr  addr,
size_t  size,
NV_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)   
)
pure virtual

Basic heap realloc without PxCudaBuffer.

virtual bool PxCudaMemoryManager::reserve ( const PxCudaBufferType 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 PxCudaMemoryManager::setMaxMemorySize ( const PxCudaBufferType 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 PxCudaMemoryManager::setPageSize ( const PxCudaBufferType 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-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com