The `cloud-tpu-diagnostics` library provides tools to monitor, debug, and profile jobs running on Cloud TPUs. It captures Python stack traces upon faults (e.g., segmentation faults, floating-point exceptions) and periodically collects traces to diagnose unresponsive or hung programs. Currently at version 0.1.5, it maintains an active release cadence with frequent updates focused on stability and minor feature enhancements.
pip install cloud-tpu-diagnosticsVerified import paths — ran on the pinned version, not inferred.
To use the diagnostics, install the package on all Cloud TPU VMs and wrap your main application logic within `diagnostic.diagnose()` context manager. This example configures stack trace collection every 5 minutes and uploads them to Cloud Logging. Customize `collect_stack_trace` and `stack_trace_to_cloud` based on your debugging needs.
Upgrade to `cloud-tpu-diagnostics>=0.1.4` to benefit from fixes for graceful daemon thread exits and signal handling.
Upgrade to `cloud-tpu-diagnostics>=0.1.1` to ensure robust stack trace collection for a wider range of exceptions.
Ensure `pip install cloud-tpu-diagnostics` is run on all worker VMs (e.g., using `gcloud compute tpus tpu-vm ssh --worker=all ...`) and that the `diagnostic.diagnose()` context manager wraps the entry point of your application on all instances.
Verify that you are running the correct and current JAX runtime version for your TPU VM. Check the Cloud TPU release notes and ensure your `gcloud` configuration specifies a compatible `--version` for your TPU type.
Verify your Google Cloud project, zone, and TPU VM name. Check that your VPC network's firewall rules allow SSH (TCP:22) access. Ensure your SSH keys are correctly propagated or try running the `gcloud compute tpus tpu-vm ssh` command again.
Ensure `stack_trace_config.collect_stack_trace` is set to `True`. If `stack_trace_to_cloud` is `True`, verify that the Cloud Logging agent is active and has the necessary permissions. Also, confirm that your application's `main` method is correctly wrapped by `diagnostic.diagnose()`. You can view logs in Logs Explorer using the query `logName="projects/<project_name>/logs/tpu.googleapis.com%2Fruntime_monitor" jsonPayload.verb="stacktraceanalyzer"`.
No dependency data recorded yet.