torch.xpu.memory_usage#
- torch.xpu.memory_usage(device=None)[source]#
Return the GPU memory bandwidth usage as a percentage.
The value is computed by dividing the byte-transfer delta by the time delta between two bandwidth-counter reads separated by a 100ms sampling interval, then normalizing by the peak bandwidth reported by the hardware.
- Parameters:
device (torch.device, str or int, optional) – selected device. Uses the current device, given by
current_device(), ifNone(default).- Return type:
Note
This function blocks for approximately 100ms per call due to the sampling interval required to compute an accurate bandwidth reading.
Note
This API may require elevated privileges (e.g.
sudo) to access GPU memory bandwidth usage information.