Metadata-Version: 2.4
Name: denpex-pytorch
Version: 0.1.1
Summary: PyTorch, torchrun, FSDP, DeepSpeed, and Hugging Face Trainer crash diagnostics integration for Denpex.
Author-email: Denpex <support@denpex.com>
License: MIT
Project-URL: Homepage, https://denpex.com
Project-URL: Documentation, https://denpex.com/docs/integrations
Project-URL: API Reference, https://denpex.com/docs/api
Project-URL: Python Agent & CLI, https://denpex.com/docs/agent
Project-URL: CI & GitHub Action, https://denpex.com/docs/ci
Project-URL: VS Code Extension, https://denpex.com/vscode
Project-URL: Open VSX Extension, https://denpex.com/openvsx
Project-URL: GPU Failure Encyclopedia, https://denpex.com/failures
Project-URL: Free GPU Debugging Tools, https://denpex.com/tools
Project-URL: Changelog, https://denpex.com/changelog
Project-URL: Repository, https://github.com/Denpex/gpu-failure-cheatsheet
Project-URL: Issue Tracker, https://denpex.com/contact
Keywords: pytorch,torchrun,gpu,cuda,nccl,fsdp,deepspeed,ddp,vllm,slurm,distributed-training,crash-diagnostics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: denpex-sdk>=0.2.4

# `denpex-pytorch`: Distributed PyTorch, `torchrun`, FSDP & NCCL Crash Forensics

`denpex-pytorch` integrates **Denpex GPU & Distributed Training Diagnostics** directly into your PyTorch, `torchrun`, FSDP, DDP, and DeepSpeed training scripts.

When any rank crashes with a CUDA Out-of-Memory (`CUDA out of memory`), NCCL collective timeout (`Watchdog caught collective operation timeout`), device-side assert, or NVIDIA Xid hardware fault, `denpex-pytorch` captures the distributed rank metadata (`RANK`, `LOCAL_RANK`, `WORLD_SIZE`, `SLURM_JOB_ID`) along with the traceback and isolates the root-cause rank (`Patient Zero`).

## Installation

```bash
pip install denpex-pytorch
```

## Quickstart

```python
from denpex_pytorch import install_pytorch_excepthook

install_pytorch_excepthook(job_name="llama3-70b-fsdp")
```

Or use the context manager around your training loop:

```python
from denpex_pytorch import DenpexPyTorchWatchdog

with DenpexPyTorchWatchdog(job_name="ddp-pretrain"):
    train_model()
```

## Official Denpex Ecosystem & Documentation

| Resource | URL | Description |
| :--- | :--- | :--- |
| **Denpex Platform** | [https://denpex.com](https://denpex.com) | GPU crash forensics and distributed training diagnostics |
| **Interactive Console** | [https://denpex.com/console](https://denpex.com/console) | Browser-based log analyzer with zero-egress local mode |
| **Documentation Hub** | [https://denpex.com/docs](https://denpex.com/docs) | Full integration guides for Kubernetes, Slurm, and PyTorch |
| **5-Minute Quickstart** | [https://denpex.com/docs/quickstart](https://denpex.com/docs/quickstart) | Get your first GPU crash diagnosis in under 5 minutes |
| **Python Agent & CLI** | [https://denpex.com/docs/agent](https://denpex.com/docs/agent) | Single-file agent and `pip install denpex` CLI reference |
| **REST API & SDKs** | [https://denpex.com/docs/api](https://denpex.com/docs/api) | HTTP endpoints, Python SDK, TypeScript SDK, and MCP server |
| **CI & GitHub Action** | [https://denpex.com/docs/ci](https://denpex.com/docs/ci) | Automated preflight and post-failure diagnosis in CI |
| **VS Code Extension** | [https://denpex.com/vscode](https://denpex.com/vscode) | Offline log diagnostics for Visual Studio Code |
| **Open VSX Extension** | [https://denpex.com/openvsx](https://denpex.com/openvsx) | Extension for Cursor, Windsurf, VSCodium, and Gitpod |
| **Failure Encyclopedia** | [https://denpex.com/failures](https://denpex.com/failures) | Searchable database of 700+ GPU, CUDA, and NCCL failure signatures |
| **Free GPU Calculators** | [https://denpex.com/tools](https://denpex.com/tools) | VRAM calculators, NCCL timeout calculators, and topology tools |
| **NVIDIA Xid Reference** | [https://denpex.com/xid](https://denpex.com/xid) | Hardware fault guide for Xid 31, 43, 48, 63, 74, 79, 94, 95, 119 |
| **NCCL Error Guide** | [https://denpex.com/nccl-errors](https://denpex.com/nccl-errors) | Root-cause analysis for collective timeouts and IB fabric drops |
| **CUDA Error Guide** | [https://denpex.com/cuda-errors](https://denpex.com/cuda-errors) | OOM, device-side assert, illegal memory access, and driver mismatches |
| **vLLM Error Guide** | [https://denpex.com/vllm-errors](https://denpex.com/vllm-errors) | KV cache exhaustion, PagedAttention, and tensor-parallel hangs |
| **Slurm GPU Guide** | [https://denpex.com/slurm-gpu-errors](https://denpex.com/slurm-gpu-errors) | Epilog scripts, cgroup OOM kills, and srun rank failures |
