python_vali.PySurfaceDownloader

class python_vali.PySurfaceDownloader

This class is used to copy Surface to numpy ndarray using CUDA DtoH memcpy.

__init__(*args, **kwargs)

Overloaded function.

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

    Constructor for PySurfaceDownloader with GPU ID.

    Creates a new instance of PySurfaceDownloader that will run on the specified GPU. The CUDA stream will be automatically created and managed.

    param gpu_id:

    The ID of the GPU that owns the Surface to be downloaded

    type gpu_id:

    int

    raises RuntimeError:

    If the specified GPU is not available

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

    Constructor for PySurfaceDownloader with GPU ID and CUDA stream.

    Creates a new instance of PySurfaceDownloader that will run on the specified GPU using the provided CUDA stream.

    param gpu_id:

    The ID of the GPU that owns the Surface to be downloaded

    type gpu_id:

    int

    param stream:

    The CUDA stream to use for device-to-host memory copy

    type stream:

    int

    raises RuntimeError:

    If the specified GPU is not available

Methods

Run(self, src, dst)

Perform device-to-host memory copy from Surface to numpy array.

__init__(*args, **kwargs)

Overloaded function.

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

Perform device-to-host memory copy from Surface to numpy array.

Copies the contents of a GPU Surface to a numpy array using CUDA DtoH memcpy. The numpy array must be pre-allocated with sufficient size to hold the Surface data. The GIL is released during the copy operation to allow other Python threads to run.

Parameters:
  • src (Surface) – Input Surface to be downloaded from GPU

  • dst (numpy.ndarray) – Pre-allocated numpy array to store the downloaded data

Returns:

Tuple containing: - success (bool): True if download was successful, False otherwise - info (TaskExecInfo): Detailed execution information

Return type:

tuple[bool, TaskExecInfo]

Raises:

RuntimeError – If the download operation fails or if the numpy array is too small