Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

CUTracer Python Module

The cutracer Python package is the cutracer command and the Python APIs behind it.

Overview

The package captures traces by running a program under cutracer.so; reads, queries and validates the traces; drives random-delay stress, oracles and reduction; runs NVIDIA Compute Sanitizer; and hosts the automated diagnosis service behind cutracer diagnose. It does not contain cutracer.so: build that from the repository root as the main README describes.

Installation

For Development

cd /path/to/CUTracer/python
pip install -e ".[dev]"

For Production Use

cd /path/to/CUTracer/python
pip install .

pip install cutracer installs the latest release from PyPI instead, and pip install --pre cutracer the nightly build.

Optional CLP Support

cutracer query on .clp archives needs the clp extra. Its yscope_clp_core dependency only ships x86_64 wheels, so the extra cannot be installed on aarch64:

pip install ".[clp]"

Package Layout

Module Contents
cutracer.cli Entry point of the cutracer command
cutracer.runner cutracer trace: finds cutracer.so, sets its environment variables and runs the target
cutracer.query Trace readers (NDJSON, Zstd, CLP), cutracer query, the SASS dumper behind cutracer sass, and the warp summary
cutracer.validation JSON Schemas and the validators behind cutracer validate and cutracer compare
cutracer.analyze The cutracer analyze group (warp-summary)
cutracer.stress cutracer stress: delay-injection search with control runs and verdicts
cutracer.oracle cutracer oracle: runs a pytest node as a stress or reduce oracle
cutracer.reduce cutracer reduce: delta debugging of delay configs
cutracer.compute_sanitizer cutracer compute-sanitizer and the racecheck log parser
cutracer.service The automated diagnosis service behind cutracer diagnose and the diagnose-* commands
cutracer.debugger Hang analysis of cuda-gdb samples: warp states and the instruction each warp is blocked on
cutracer.isa Instruction decoders, including the AMDGPU replay helpers in cutracer.isa.amdgcn
cutracer.watchdog Recognizes runs that CUTracer's own watchdog ended
cutracer.kernel_config Kernel-level configuration extracted from trace metadata
cutracer.file_utils, cutracer.runtime_version, cutracer.types, cutracer.shared_vars, cutracer.cutracer_logger Shared helpers: file identities, the runtime version, type definitions, build detection and logging

Usage

CLI

After installation, the cutracer command traces, queries, validates and analyzes CUDA kernels. The main README lists every command, and cutracer <command> --help shows its flags:

# Trace a CUDA application (needs cutracer.so; run from the repository root or pass --cutracer-so)
cutracer trace --cutracer-so /path/to/CUTracer/lib/cutracer.so -i reg_trace -- python test.py

# Validate trace files
cutracer validate kernel_trace.ndjson

# Query and filter trace data
cutracer query trace.ndjson --filter "warp=24"

# Analyze traces
cutracer analyze warp-summary trace.ndjson

# Search for a delay config that triggers a bug
cutracer stress -k my_kernel -o /tmp/stress -- ./oracle.sh

# Run NVIDIA Compute Sanitizer
cutracer compute-sanitizer --tool racecheck -- python test.py

Python API

from cutracer.validation import (
    validate_json_trace,
    validate_text_trace,
    compare_trace_formats,
)

# Validate JSON trace
result = validate_json_trace("kernel_trace.ndjson")
if result["valid"]:
    print(f"✓ Valid JSON trace with {result['record_count']} records")
else:
    print(f"✗ Validation failed: {result['errors']}")

# Validate text trace
result = validate_text_trace("kernel_trace.log")
if result["valid"]:
    print(f"✓ Valid text trace")
else:
    print(f"✗ Validation failed: {result['errors']}")

# Compare two formats
result = compare_trace_formats("kernel_trace.log", "kernel_trace.ndjson")
if result["consistent"]:
    print("✓ Formats are consistent")
else:
    print(f"✗ Inconsistencies found: {result['differences']}")

Trace capture, stress, replay and Compute Sanitizer runs also have typed configs for driving CUTracer without its command line: cutracer.runner.InstrumentationConfig, cutracer.stress.stress.StressConfig, cutracer.reduce.reduce.ReplayConfig and cutracer.compute_sanitizer.run.ComputeSanitizerConfig. The diagnosis service uses them.

Development

Running Tests

cd python/

# Run all tests
python -m unittest discover -s tests -v

# Run specific test file
python -m unittest tests.test_json_validator -v

Type Checking

cd python/
mypy cutracer/

Code Formatting

# From project root directory
./format.sh format

# Or manually with ufmt
ufmt format python/
usort format python/

Running All Checks

# Format code
./format.sh format

# Type check
mypy cutracer/

# Run tests
python -m unittest discover -s tests -v

Validation Details

JSON Trace Validation

The JSON validator checks:

  • Syntax: Valid JSON format on each line (NDJSON)
  • Schema: Correct field types and structure per JSON Schema
  • Required Fields: message_type, ctx, kernel_launch_id, trace_index, timestamp, sass, etc.
  • Register Values: Arrays of integers with proper format
  • CTA/Warp IDs: Valid integer ranges

Text Trace Validation

The text validator checks:

  • Format Patterns: Correct CTX/CTA/warp header patterns
  • Register Output: Proper hex format (e.g., Reg0_T00: 0x...)
  • Memory Access: Valid memory address patterns

Consistency Validation

The consistency validator compares:

  • Record Counts: Same number of records in both formats
  • Content Matching: Same kernel IDs, trace indices, SASS strings
  • Timestamp Order: Consistent ordering between formats

Trace Format Reference

Outputs and File Formats documents every record type and field. The two most common formats look like this.

JSON Format (NDJSON - Mode 2)

Each line is a JSON object with the following structure:

{
  "message_type": "reg_trace",
  "ctx": "0x58a0c0",
  "kernel_launch_id": 0,
  "trace_index": 0,
  "timestamp": 1762026820167834792,
  "sass": "LDC R1, c[0x0][0x28] ;",
  "pc": 0,
  "opcode_id": 0,
  "warp": 0,
  "cta": [0, 0, 0],
  "regs": [[0, 0, 0, ...]]
}

Text Format (Mode 0)

Human-readable format with CTX headers and register values:

CTX 0x58a0c0 - CTA 0,0,0 - warp 0 - LDC R1, c[0x0][0x28] ;:
    * Reg0_T00: 0x0000000000000000  Reg0_T01: 0x0000000000000000 ...

Contributing

  1. Install development dependencies: pip install -e ".[dev]"
  2. Make your changes
  3. Run tests: python -m unittest discover -s tests -v
  4. Run type checker: mypy cutracer/
  5. Format code: ./format.sh format
  6. Submit a pull request

License

MIT License - See LICENSE file for details.

Support

For issues and questions, please open an issue on the CUTracer GitHub repository.

Metadata

Release files for cutracer 0.5.2.dev20261113072219

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cutracer 0.5.2.dev20261113072219
File Size Uploaded Provenance Actions
cutracer-0.5.2.dev20261113072219.tar.gz 361.7 kB With provenance Details for cutracer-0.5.2.dev20261113072219.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cutracer 0.5.2.dev20261113072219
File Interpreter ABI Platform Actions
cutracer-0.5.2.dev20261113072219-py3-none-any.whl Python 3 none any Details for cutracer-0.5.2.dev20261113072219-py3-none-any.whl

Total release size: 715.2 kB

Release files / cutracer-0.5.2.dev20261113072219.tar.gz

Download URL cutracer-0.5.2.dev20261113072219.tar.gz
Size 361.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f6dedb7307cb3382b8f7045577eeafd91cda996a1438cc6cb43cdf2ef56a21cf
BLAKE2b-256 checksum
How to use checksums
a82b02aa2222b605182a2b6c11b70ae13411c0396449cfcff3d6a3171f7de177
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / cutracer-0.5.2.dev20261113072219-py3-none-any.whl

Download URL cutracer-0.5.2.dev20261113072219-py3-none-any.whl
Size 353.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66355cacc2d5539e05df70d696306f26561d25ba2d92568ddd357eeef63f61e1
BLAKE2b-256 checksum
How to use checksums
a99b8e7648e13a35ceedaaa8c83d5efa5531bb4e872dce432e1b6ef0f4a1d4e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Security for cutracer 0.5.2.dev20261113072219

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cutracer-0.5.2.dev20261113072219.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page