TensorRT  7.0.0.11
nvinfer1::IGpuAllocator Class Referenceabstract

Application-implemented class for controlling allocation on the GPU. More...

#include <NvInferRuntimeCommon.h>

Public Member Functions

virtual void * allocate (uint64_t size, uint64_t alignment, uint32_t flags)=0
 
virtual void free (void *memory)=0
 
virtual ~IGpuAllocator ()
 

Detailed Description

Application-implemented class for controlling allocation on the GPU.

Constructor & Destructor Documentation

virtual nvinfer1::IGpuAllocator::~IGpuAllocator ( )
inlinevirtual

Destructor declared virtual as general good practice for a class with virtual methods. TensorRT never calls the destructor for an IGpuAllocator defined by the application.

Member Function Documentation

virtual void* nvinfer1::IGpuAllocator::allocate ( uint64_t  size,
uint64_t  alignment,
uint32_t  flags 
)
pure virtual

A callback implemented by the application to handle acquisition of GPU memory.

Parameters
sizeThe size of the memory required.
alignmentThe required alignment of memory. Alignment will zero or a power of 2 not exceeding the alignment guaranteed by cudaMalloc. Thus this allocator can be safely implemented with cudaMalloc/cudaFree. An alignment value of zero indicates any alignment is acceptable.
flagsReserved for future use. In the current release, 0 will be passed.

If an allocation request of size 0 is made, nullptr should be returned.

If an allocation request cannot be satisfied, nullptr should be returned.

virtual void nvinfer1::IGpuAllocator::free ( void *  memory)
pure virtual

A callback implemented by the application to handle release of GPU memory.

TensorRT may pass a nullptr to this function if it was previously returned by allocate().

Parameters
memoryThe acquired memory.

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