Rate this Page

torch.xpu.memory.mem_get_info#

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

Return the global free and total GPU memory for a given device.

Parameters:

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

Returns:

a tuple of two integers (free_memory, total_memory) in bytes.

The first value is the free memory on the device (available across all processes and applications), The second value is the device’s total hardware memory capacity.

Return type:

tuple[int, int]