Represents a block of Cuda data in memory either on host, device side or both if using UVM. More...
#include <PvCudaBuffer.h>
Public Member Functions | |
| PvCudaBuffer (PvPayloadType aPayloadType=PvPayloadTypeImage) | |
| Constructor. | |
| virtual | ~PvCudaBuffer () |
| Destructor. | |
| PvPayloadType | GetPayloadType () const |
| Returns the payload type currently used by the buffer. | |
| PvCudaMemorySpaceType | GetMemorySpaceType () const |
| Get the buffer's CUDA memory space. | |
| const uint8_t * | GetDataPointer () const |
| Get the buffer's data pointer. | |
| uint8_t * | GetDataPointer () |
| Get the buffer's data pointer. | |
| PvPixelType | GetPixelType () const |
| Get the buffer's pixel type. | |
| uint32_t | GetSize () const |
| Get the buffer's allocated or attached size (total capacity) in bytes. | |
| PvResult | AllocCudaHost (uint32_t aSize, PvPixelType aPixelType) |
| Allocates memory for this PvCudaBuffer on CUDA host side. | |
| PvResult | AllocCudaDevice (uint32_t aSize, PvPixelType aPixelType) |
| Allocates memory for this PvCudaBuffer on CUDA device side. | |
| PvResult | AllocCudaUVM (uint32_t aSize, PvPixelType aPixelType) |
| Allocates memory for this PvCudaBuffer with CUDA UVM. | |
| bool | IsAllocated () const |
| Returns true if the buffer has been allocated. | |
| void | Free () |
| Frees (de-allocates) the buffer's internal memory. This works for any CUDA memory space Host/Device/UVM. | |
| PvResult | Reallocate (uint32_t aSize) |
| Reallocate a PvCudaBuffer with the same memory space and pixel type but with a different size. Avoid doing this frequently as possible to achieve an optimal performance. | |
| PvResult | CopyFrom (const PvBuffer *aSrcPvBuffer, unsigned int aSize) |
| Copy value from a source PvBuffer to the current PvCudaBuffer. | |
| PvResult | CopyTo (PvBuffer *aDstPvBuffer, unsigned int aSize) |
| Copy value from the current PvCudaBuffer to a destination PvBuffer. | |
| PvResult | CopyFrom (const PvCudaBuffer *aSrcPvCudaBuffer, unsigned int aSize) |
| Copy value from a source PvCudaBuffer to the current PvCudaBuffer. | |
| PvResult | CopyTo (PvCudaBuffer *aDstPvCudaBuffer, unsigned int aSize) |
| Copy value from the current PvCudaBuffer to a destination PvCudaBuffer. | |
Friends | |
| class | PvCudaBufferConverter |
Represents a block of Cuda data in memory either on host, device side or both if using UVM.
A PvCudaBuffer represents a block of CUDA array in host/device/UVM memory. It can only be accessed from the correct memory space, i.e. from host if the array is stored on the host, from device if it is on device, or from both if using UVM. A CudaBuffer is a CUDA-ready buffer for further CPU/GPU tasks e.g. image processing or inferencing an AI model on GPU. To learn about using PvCudaBuffer, see sample code #GpuPixelConversionAndImageProcessing.
| PvCudaBuffer::PvCudaBuffer | ( | PvPayloadType | aPayloadType = PvPayloadTypeImage | ) |
Constructor.
| [in] | aPayloadType | The block type (default PvPayloadTypeImage). |
| PvResult PvCudaBuffer::AllocCudaDevice | ( | uint32_t | aSize, |
| PvPixelType | aPixelType | ||
| ) |
Allocates memory for this PvCudaBuffer on CUDA device side.
| [in] | aSize | The size of the buffer, in bytes. |
| [in] | aPixelType | a PvPixelType. |
| PvResult PvCudaBuffer::AllocCudaHost | ( | uint32_t | aSize, |
| PvPixelType | aPixelType | ||
| ) |
Allocates memory for this PvCudaBuffer on CUDA host side.
| [in] | aSize | The size of the buffer, in bytes. |
| [in] | aPixelType | a PvPixelType. |
| PvResult PvCudaBuffer::AllocCudaUVM | ( | uint32_t | aSize, |
| PvPixelType | aPixelType | ||
| ) |
Allocates memory for this PvCudaBuffer with CUDA UVM.
| [in] | aSize | The size of the buffer, in bytes. |
| [in] | aPixelType | a PvPixelType. |
| void PvCudaBuffer::Free | ( | ) |
Frees (de-allocates) the buffer's internal memory. This works for any CUDA memory space Host/Device/UVM.
Frees (de-allocates) the buffer's internal memory.
| uint8_t * PvCudaBuffer::GetDataPointer | ( | ) |
Get the buffer's data pointer.
Get the buffer's data.
| const uint8_t * PvCudaBuffer::GetDataPointer | ( | ) | const |
Get the buffer's data pointer.
The GetDataPointer method returns a pointer to the buffer. To set the memory location, use #Alloc or #Attach.
Const version.
| PvCudaMemorySpaceType PvCudaBuffer::GetMemorySpaceType | ( | ) | const |
Get the buffer's CUDA memory space.
Const version.
| PvPayloadType PvCudaBuffer::GetPayloadType | ( | ) | const |
Returns the payload type currently used by the buffer.
| PvPixelType PvCudaBuffer::GetPixelType | ( | ) | const |
Get the buffer's pixel type.
| uint32_t PvCudaBuffer::GetSize | ( | ) | const |
Get the buffer's allocated or attached size (total capacity) in bytes.
| bool PvCudaBuffer::IsAllocated | ( | ) | const |
Returns true if the buffer has been allocated.
Copyright (c) 2002-2026 Pleora Technologies Inc.
www.pleora.com