Skip to content

Examples

Real-world examples demonstrating Probing's capabilities.

Overview

These examples show common debugging and profiling scenarios in AI/ML workflows.

Example Description
Training Debugging Debug training issues
64-rank Placement Validation Verify TP/PP/DP placement mapping and interaction with a CPU mock
Memory Leak Find and fix memory leaks
Performance Analysis Identify bottlenecks

Quick Examples

Check Training Progress

probing $ENDPOINT eval "
from probing.tracing import step_snapshot
snap = step_snapshot()
print(f'local_step: {snap.local_step}, global_step: {snap.global_step}')
"

Monitor GPU Memory

probing $ENDPOINT eval "
import torch
allocated = torch.cuda.memory_allocated() / 1024**3
reserved = torch.cuda.memory_reserved() / 1024**3
print(f'Allocated: {allocated:.2f} GB')
print(f'Reserved: {reserved:.2f} GB')"

Find Slow Operations

probing $ENDPOINT query "
SELECT module, AVG(duration) as avg_time
FROM python.torch_trace
WHERE step > (SELECT MAX(step) - 5 FROM python.torch_trace)
GROUP BY module
ORDER BY avg_time DESC
LIMIT 5"

Check Thread States

probing $ENDPOINT eval "
import threading
for t in threading.enumerate():
    print(f'{t.name}: alive={t.is_alive()}, daemon={t.daemon}')"

Running Examples

All examples assume a target process with Probing enabled (PROBING=1 at startup or probing inject on Linux).

Setup: Repository examples need a development environment (make develop). ML demos may need extra packages — see examples/README.md.

# Set endpoint
export ENDPOINT=12345  # Process ID
# or
export ENDPOINT=host:8080  # Remote address

# Run example commands
probing $ENDPOINT eval "..."

Contributing Examples

Have a useful debugging pattern? Contributions welcome!

  1. Fork the repository
  2. Add your example to docs/src/examples/
  3. Submit a pull request