Skip to main content

Monitor, debug and profile the jobs running on Cloud TPU.

Project description

Cloud TPU Diagnostics

This is a comprehensive library to monitor, debug and profile the jobs running on Cloud TPU. To learn about Cloud TPU, refer to the full documentation.

Features

1. Debugging

1.1 Collect Stack Traces

This module will dump the python traces when a fault such as Segmentation fault, Floating-point exception, Illegal operation exception occurs in the program. Additionally, it will also periodically collect stack traces to help debug when a program running on Cloud TPU is stuck or hung somewhere.

Installation

To install the package, run the following command on TPU VM:

pip install cloud-tpu-diagnostics

Usage

To use this package, first import the module:

from cloud_tpu_diagnostics import diagnostic
from cloud_tpu_diagnostics.configuration import debug_configuration
from cloud_tpu_diagnostics.configuration import diagnostic_configuration
from cloud_tpu_diagnostics.configuration import stack_trace_configuration

Then, create configuration object for stack traces. The module will only collect stack traces when collect_stack_trace parameter is set to True. There are following scenarios supported currently:

Scenario 1: Do not collect stack traces on faults
stack_trace_config = stack_trace_configuration.StackTraceConfig(
                      collect_stack_trace=False)

This configuration will prevent you from collecting stack traces in the event of a fault or process hang.

Scenario 2: Collect stack traces on faults and display on console
stack_trace_config = stack_trace_configuration.StackTraceConfig(
                      collect_stack_trace=True,
                      stack_trace_to_cloud=False)

If there is a fault or process hang, this configuration will show the stack traces on the console (stderr).

Scenario 3: Collect stack traces on faults and upload on cloud
stack_trace_config = stack_trace_configuration.StackTraceConfig(
                      collect_stack_trace=True,
                      stack_trace_to_cloud=True)

This configuration will temporary collect stack traces inside /tmp/debugging directory on TPU host if there is a fault or process hang. Additionally, the traces collected in TPU host memory will be uploaded to Google Cloud Logging, which will make it easier to troubleshoot and fix the problems. You can view the traces in Logs Explorer using the following query:

logName="projects/<project_name>/logs/tpu.googleapis.com%2Fruntime_monitor"
jsonPayload.verb="stacktraceanalyzer"

By default, stack traces will be collected every 10 minutes. In order to change the duration between two stack trace collection events, add the following configuration:

stack_trace_config = stack_trace_configuration.StackTraceConfig(
                      collect_stack_trace=True,
                      stack_trace_to_cloud=True,
                      stack_trace_interval_seconds=300)

This configuration will collect the stack traces on cloud after every 5 minutes.

Then, create configuration object for debug.

debug_config = debug_configuration.DebugConfig(
                stack_trace_config=stack_trace_config)

Then, create configuration object for diagnostic.

diagnostic_config = diagnostic_configuration.DiagnosticConfig(
                      debug_config=debug_config)

Finally, call the diagnose() method using with and wrap the statements inside the context manager for which you want to collect the stack traces.

with diagnostic.diagnose(diagnostic_config):
    run_job(...)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloud_tpu_diagnostics-1.1.14.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloud_tpu_diagnostics-1.1.14-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file cloud_tpu_diagnostics-1.1.14.tar.gz.

File metadata

  • Download URL: cloud_tpu_diagnostics-1.1.14.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for cloud_tpu_diagnostics-1.1.14.tar.gz
Algorithm Hash digest
SHA256 c1bcabe044dcb7a5f351a333e433fb5ff8b238c77a187bb8936d4f80c4a406dc
MD5 0115e47cb615c61107743ba58abfe903
BLAKE2b-256 88cb45f25d6ddd02895d81e37dd3fa5d169eb0c6ce073dd89b6fa525c2cc95c6

See more details on using hashes here.

File details

Details for the file cloud_tpu_diagnostics-1.1.14-py3-none-any.whl.

File metadata

File hashes

Hashes for cloud_tpu_diagnostics-1.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 58142910274f2d45fb02fe3157063c57e75868046e018f67a82df48379dc115c
MD5 7a7dc471f9ed812b5b310b994f7ddd6d
BLAKE2b-256 90eb359c35e6e818e0c71843ca0838993aac929618859f00a0ae063053d0a5d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page