[#9432][fix] Resolve NameError in memory profiler for v0.12.0-jetson branch. (#9610)

Signed-off-by: bonginn <caco.sc11@nycu.edu.tw>
This commit is contained in:
bonginn 2025-12-17 07:57:14 +08:00 committed by GitHub
parent 20a7cec991
commit 9d38cb7d1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -154,6 +154,14 @@ def host_memory_info(pid: Optional[int] = None) -> Tuple[int, int, int]:
def device_memory_info( def device_memory_info(
device: Optional[Union[torch.device, device: Optional[Union[torch.device,
int]] = None) -> Tuple[int, int, int]: int]] = None) -> Tuple[int, int, int]:
if on_jetson_l4t:
if not getattr(device_memory_info, "_has_logged_jetson_warning", False):
logger.warning(
"Device memory monitoring is not fully supported on Jetson/Tegra. Reporting 0 usage."
)
device_memory_info._has_logged_jetson_warning = True
return 0, 0, 0
if pynvml is not None: if pynvml is not None:
if device is None: if device is None:
device = torch.cuda.current_device() device = torch.cuda.current_device()