Rate this Page

torch.xpu.memory.get_per_process_memory_fraction#

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

Retrieve the memory fraction currently set for a process on a given XPU device. This fraction represents the portion of the total device memory that the caching allocator is allowed to use. The allowed memory is calculated as:

allowed_memory=total_memory×fraction\text{allowed\_memory} = \text{total\_memory} \times \text{fraction}
Parameters

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

Returns

The memory fraction in the range 0.0 to 1.0.

Return type

float