Rate this Page

torch.xpu.utilization#

torch.xpu.utilization(device=None)[source]#

Return the GPU engine utilization as a percentage.

The value is computed by dividing the active-time delta by the time delta between two engine-activity reads separated by a 100ms sampling interval.

Parameters:

device (torch.device, str or int, optional) – selected device. Uses the current device, given by current_device(), if None (default).

Return type:

float

Note

This function blocks for approximately 100ms per call due to the sampling interval required to compute an accurate utilization reading.

Note

This API may require elevated privileges (e.g. sudo) to access GPU utilization information.