fastvideo.v1.platforms.cuda#

Code inside this file can safely assume cuda platform, e.g. importing pynvml. However, it should not initialize cuda context.

Module Contents#

Classes#

Functions#

Data#

API#

fastvideo.v1.platforms.cuda.CudaPlatform[source]#

None

class fastvideo.v1.platforms.cuda.CudaPlatformBase[source]#

Bases: fastvideo.v1.platforms.interface.Platform

device_control_env_var: str[source]#

β€˜CUDA_VISIBLE_DEVICES’

device_name: str[source]#

β€˜cuda’

device_type: str[source]#

β€˜cuda’

dispatch_key: str[source]#

β€˜CUDA’

classmethod get_attn_backend_cls(selected_backend: fastvideo.v1.platforms.interface.AttentionBackendEnum | None, head_size: int, dtype: torch.dtype) β†’ str[source]#
classmethod get_current_memory_usage(device: torch.types.Device | None = None) β†’ float[source]#
abstract classmethod get_device_capability(device_id: int = 0) β†’ fastvideo.v1.platforms.interface.DeviceCapability | None[source]#
classmethod get_device_communicator_cls() β†’ str[source]#
abstract classmethod get_device_name(device_id: int = 0) β†’ str[source]#
abstract classmethod get_device_total_memory(device_id: int = 0) β†’ int[source]#
classmethod is_async_output_supported(enforce_eager: bool | None) β†’ bool[source]#
classmethod log_warnings() β†’ None[source]#
class fastvideo.v1.platforms.cuda.NonNvmlCudaPlatform[source]#

Bases: fastvideo.v1.platforms.cuda.CudaPlatformBase

classmethod get_device_capability(device_id: int = 0) β†’ fastvideo.v1.platforms.interface.DeviceCapability[source]#
classmethod get_device_name(device_id: int = 0) β†’ str[source]#
classmethod get_device_total_memory(device_id: int = 0) β†’ int[source]#
class fastvideo.v1.platforms.cuda.NvmlCudaPlatform[source]#

Bases: fastvideo.v1.platforms.cuda.CudaPlatformBase

classmethod get_device_capability(device_id: int = 0) β†’ fastvideo.v1.platforms.interface.DeviceCapability | None[source]#
classmethod get_device_name(device_id: int = 0) β†’ str[source]#
classmethod get_device_total_memory(device_id: int = 0) β†’ int[source]#
classmethod get_device_uuid(device_id: int = 0) β†’ str[source]#
classmethod has_device_capability(capability: tuple[int, int] | int, device_id: int = 0) β†’ bool[source]#

query if the set of gpus are fully connected by nvlink (1 hop)

classmethod log_warnings() β†’ None[source]#
fastvideo.v1.platforms.cuda.device_id_to_physical_device_id(device_id: int) β†’ int[source]#
fastvideo.v1.platforms.cuda.logger[source]#

β€˜init_logger(…)’

fastvideo.v1.platforms.cuda.nvml_available[source]#

False

fastvideo.v1.platforms.cuda.pynvml[source]#

β€˜import_pynvml(…)’

fastvideo.v1.platforms.cuda.with_nvml_context(fn: collections.abc.Callable[fastvideo.v1.platforms.cuda._P, fastvideo.v1.platforms.cuda._R]) β†’ collections.abc.Callable[fastvideo.v1.platforms.cuda._P, fastvideo.v1.platforms.cuda._R][source]#