Pleora Technologies Inc. eBUS SDK v7.0.1.7536 API



Loading...
Searching...
No Matches
PvCudaBuffer Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PvCudaBuffer()

PvCudaBuffer::PvCudaBuffer ( PvPayloadType  aPayloadType = PvPayloadTypeImage)

Constructor.

Parameters
[in]aPayloadTypeThe block type (default PvPayloadTypeImage).

Member Function Documentation

◆ AllocCudaDevice()

PvResult PvCudaBuffer::AllocCudaDevice ( uint32_t  aSize,
PvPixelType  aPixelType 
)

Allocates memory for this PvCudaBuffer on CUDA device side.

Parameters
[in]aSizeThe size of the buffer, in bytes.
[in]aPixelTypea PvPixelType.
Returns
Includes:

◆ AllocCudaHost()

PvResult PvCudaBuffer::AllocCudaHost ( uint32_t  aSize,
PvPixelType  aPixelType 
)

Allocates memory for this PvCudaBuffer on CUDA host side.

Parameters
[in]aSizeThe size of the buffer, in bytes.
[in]aPixelTypea PvPixelType.
Returns
Includes:

◆ AllocCudaUVM()

PvResult PvCudaBuffer::AllocCudaUVM ( uint32_t  aSize,
PvPixelType  aPixelType 
)

Allocates memory for this PvCudaBuffer with CUDA UVM.

Parameters
[in]aSizeThe size of the buffer, in bytes.
[in]aPixelTypea PvPixelType.
Returns
Includes:

◆ Free()

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.

◆ GetDataPointer() [1/2]

uint8_t * PvCudaBuffer::GetDataPointer ( )

Get the buffer's data pointer.

Get the buffer's data.

Returns
A pointer to the memory pointer.

◆ GetDataPointer() [2/2]

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.

Returns
A pointer to the memory pointer.

◆ GetMemorySpaceType()

PvCudaMemorySpaceType PvCudaBuffer::GetMemorySpaceType ( ) const

Get the buffer's CUDA memory space.

Const version.

Returns
A PvCudaMemorySpaceType.
A PvCudaMemorySpaceType.

◆ GetPayloadType()

PvPayloadType PvCudaBuffer::GetPayloadType ( ) const

Returns the payload type currently used by the buffer.

Returns
PvPayloadType The current payload type for the PvCudaBuffer. See PvPayloadType enum.

◆ GetPixelType()

PvPixelType PvCudaBuffer::GetPixelType ( ) const

Get the buffer's pixel type.

Returns
A pointer to the memory pointer.

◆ GetSize()

uint32_t PvCudaBuffer::GetSize ( ) const

Get the buffer's allocated or attached size (total capacity) in bytes.

Returns
The buffer's (allocated or attached) size in bytes

◆ IsAllocated()

bool PvCudaBuffer::IsAllocated ( ) const

Returns true if the buffer has been allocated.

Returns
True if allocated.

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

Copyright (c) 2002-2026 Pleora Technologies Inc.
www.pleora.com