[Hardware][XPU] Align memory usage with cuda on xpu (#37029)
Signed-off-by: Kunshang Ji <jikunshang95@gmail.com> Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>
This commit is contained in:
@@ -236,6 +236,7 @@ class XPUPlatform(Platform):
|
|||||||
def get_current_memory_usage(
|
def get_current_memory_usage(
|
||||||
cls, device: torch.types.Device | None = None
|
cls, device: torch.types.Device | None = None
|
||||||
) -> float:
|
) -> float:
|
||||||
|
torch.xpu.empty_cache()
|
||||||
torch.xpu.reset_peak_memory_stats(device)
|
torch.xpu.reset_peak_memory_stats(device)
|
||||||
return torch.xpu.max_memory_allocated(device)
|
return torch.xpu.max_memory_allocated(device)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user