python_vali.PyFrameUploader

class python_vali.PyFrameUploader

This class is used to upload numpy array to Surface using CUDA HtoD memcpy.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: python_vali._python_vali.PyFrameUploader, gpu_id: int) -> None

    Create a new frame uploader instance.

    Initializes a CUDA frame uploader that transfers data from host memory (numpy arrays) to device memory (Surface) using CUDA’s host-to-device memory copy operations.

    param gpu_id:

    ID of the GPU to use for memory transfers

    type gpu_id:

    int

    raises RuntimeError:

    If GPU initialization fails

  2. __init__(self: python_vali._python_vali.PyFrameUploader, gpu_id: int, stream: int) -> None

    Create a new frame uploader instance with a specific CUDA stream.

    Initializes a CUDA frame uploader that transfers data from host memory to device memory using a specific CUDA stream. This allows for better control over CUDA stream management and potential overlap with other GPU operations.

    param gpu_id:

    ID of the GPU to use for memory transfers

    type gpu_id:

    int

    param stream:

    CUDA stream to use for memory transfers

    type stream:

    int

    raises RuntimeError:

    If GPU initialization fails

Methods

Run(self, src, dst)

Perform a blocking host-to-device memory copy.

__init__(*args, **kwargs)

Overloaded function.

Run(self: python_vali._python_vali.PyFrameUploader, src: numpy.ndarray, dst: VPF::Surface) tuple[bool, python_vali._python_vali.TaskExecInfo]

Perform a blocking host-to-device memory copy.

Transfers data from a numpy array in host memory to a Surface in device memory. The operation is performed synchronously, meaning it will block until the transfer is complete.

Parameters:
  • src (numpy.ndarray) – Source numpy array containing the data to transfer

  • dst (Surface) – Destination Surface that will receive the data

Returns:

Tuple containing: - success (bool): True if the transfer was successful, False otherwise - info (TaskExecInfo): Detailed information about the transfer operation

Return type:

tuple[bool, TaskExecInfo]

Raises:

RuntimeError – If the memory transfer fails