reprospect.tools.device_properties module

Lightweight wrapper around CUDA driver and runtime libraries.

Provides a minimal interface for interacting with CUDA-capable devices and querying their properties.

Note

This module has some functional overlap with cuda-bindings. The API and the implementation may evolve to better complement or integrate with the NVIDIA CUDA Python bindings.

class reprospect.tools.device_properties.Cuda(flags: int = 0)View on GitHub

Bases: object

__init__(flags: int = 0) NoneView on GitHub
classmethod check_driver_api_call(*, func: str) AnyView on GitHub

Wrap CUDA driver API call func to raise an exception if the call is not successful.

classmethod check_driver_status(*, status: CudaDriverError, info: Any) NoneView on GitHub

Check that status is successful, raise otherwise.

classmethod check_runtime_api_call(*, func: str) AnyView on GitHub

Wrap CUDA runtime API call func to raise an exception if the call is not successful.

classmethod check_runtime_status(*, status: CudaRuntimeError, info: Any) NoneView on GitHub

Check that status is successful, raise otherwise.

property device_count: intView on GitHub

Wrap cudaGetDeviceCount.

get_device_attribute(*, value_type: type, attribute: CUdevice_attribute, device: int) AnyView on GitHub

Retrieve an attribute of device.

get_device_compute_capability(*, device: int) ComputeCapabilityView on GitHub

Get compute capability of device.

get_device_name(*, device: int, length: int = 150) strView on GitHub

Get name of device.

get_device_total_memory(*, device: int) intView on GitHub

Get device total memory.

libcuda: CDLL | None = None
libcudart: CDLL | None = None
classmethod load() NoneView on GitHub

Load CUDA library.

class reprospect.tools.device_properties.CudaDriverError(value: int)View on GitHub

Bases: object

CUDA driver error code.

__init__(value: int) None
get(libcuda: CDLL) tuple[str, str]View on GitHub

Get error name and string.

property success: boolView on GitHub
value: int
class reprospect.tools.device_properties.CudaRuntimeError(value: int)View on GitHub

Bases: object

CUDA runtime error code.

__init__(value: int) None
get(libcudart: CDLL) tuple[str, str]View on GitHub

Get error name and string.

property success: boolView on GitHub
value: int