zero.hardware.get_gpus_info

zero.hardware.get_gpus_info()[source]

Get information about GPU devices: driver version, memory, utilization etc.

The example below shows what kind of information is returned as the result. All figures about memory are given in bytes.

Returns

Information about GPU devices.

Raises

RuntimeError – if necessary cuda-related libraries are not found. Usually, it means that the function is run on a machine without GPU.

Return type

Dict[str, Any]

Examples

print(get_gpu_info())

Output example (formatted for convenience):

{
    'driver': '440.33.01',
    'devices': [
        {
            'name': 'GeForce RTX 2080 Ti',
            'memory_total': 11554717696,
            'memory_free': 11554652160,
            'memory_used': 65536,
            'utilization': 0,
        },
        {
            'name': 'GeForce RTX 2080 Ti',
            'memory_total': 11552096256,
            'memory_free': 11552030720,
            'memory_used': 65536,
            'utilization': 0,
        },
    ],
}

Warning

The ‘devices’ value contains information about all gpus regardless of the value of CUDA_VISIBLE_DEVICES.