[V1] Move usage stats to worker and start logging TPU hardware (#16211)

This commit is contained in:
Daniel Li
2025-04-25 13:06:01 -07:00
committed by GitHub
parent a5450f11c9
commit 48cb2109b6
6 changed files with 22 additions and 10 deletions

View File

@@ -174,6 +174,15 @@ class UsageMessage:
cuda_get_device_properties(0, ("name", "total_memory")))
if current_platform.is_cuda():
self.cuda_runtime = torch.version.cuda
if current_platform.is_tpu():
try:
import torch_xla
self.gpu_count = torch_xla.runtime.world_size()
self.gpu_type = torch_xla.tpu.get_tpu_type()
self.gpu_memory_per_device = (
torch_xla.core.xla_model.get_memory_info()["bytes_limit"])
except Exception:
pass
self.provider = _detect_cloud_provider()
self.architecture = platform.machine()
self.platform = platform.platform()