How pytorch-labs/monarch works
Project type and purpose
• From the README and file tree, Monarch is an open-source, multi-language (Python + Rust) distributed execution engine for PyTorch. It exposes a Python API and CLI (in python/monarch and hyper/) while orchestrating a Rust-powered actor system, mesh scheduler, and tensor workers under the hood.
File structure
• Top-level languages:
• python/monarch: Python front-end API, bindings, utilities, controller client, scheduler, simulator, telemetry, supervisor
• rust crates (Cargo.toml at root and subcrates): controller, hyper, hyperactor (core actor runtime), hyperactor_mesh (mesh topology), hyperactor_multiprocess (multi-process scheduler), monarch_extension (controller/mesh clients), monarch_hyperactor (higher-level actor abstractions), monarch_messages (wire protocols), monarch_simulator (simulation mode), monarch_tensor_worker (tensor compute workers), telemetry, plus torch-sys and torch-sys-cuda for PyTorch/CUDA interop
• Examples and tests:
• examples/ & python/tests/ show how users drive the system
• Config & build scripts:
• Dockerfile, build-requirements.txt, clippy.toml, rust-toolchain
README for additional insights
• Monarch aims to “deliver the high-quality UX of single-GPU PyTorch at cluster scale.”
• Users install via pip and invoke examples or notebooks.
• Under the hood: Python front end → FFI bindings → Rust core.