CLI tool to view TPU metrics
Actively maintained. Last release 5 months ago, commits in 11 of the last 26 weeks. A safe choice.
pip install tpu-infotpu-info CLI
tpu-info is a simple CLI tool for detecting Cloud TPU devices and reading
runtime metrics from libtpu, including memory usage and duty cycle. It
supports both a static, one-time snapshot and a live streaming mode to monitor
metrics continuously.
Note: to access libtpu utilization metrics, you must have a workload
running with a supported ML framework, such as JAX or PyTorch/XLA. See the
Usage section for more information.
What's New in Version 0.14.2
🚀 New Features
- Add support for Pygrain metrics from the local Prometheus server
- Add support for Orbax performance and operational metrics from the local Prometheus server
🛠️ Bug Fixes
- [0.14.2] Fix fatal check failure when importing
tpu_infodirectly - [0.14.1] Fix ZeroDivisionError in HLO execution timing metrics calculation when the TPU is idle
- [0.14.1] Fix potential Rich markup rendering injection vulnerabilities where malicious telemetry data or error messages could trigger unexpected styles or cause crashes
Installing
Install the latest release using pip:
pip install tpu-info
Alternatively, install tpu-info from source:
pip install git+https://github.com/AI-Hypercomputer/cloud-accelerator-diagnostics/#subdirectory=tpu_info
Usage
To view current TPU utilization data, tpu-info requires a running TPU workload
with supported ML framework1 such as JAX or PyTorch/XLA. For example:
# JAX
>>> import jax
>>> jax.device_count()
4
# Create a tensor on the TPU
>>> t = jax.numpy.ones((300, 300))
# PyTorch/XLA
>>> import torch
>>> import torch_xla
>>> t = torch.randn((300, 300), device=torch_xla.device())
Then, on the same machine, you can run the tpu-info command in your terminal.
Static Mode
Run the following command for a one-time snapshot of the current metrics.