Rate this Page

Examples#

This directory contains examples demonstrating how to use Monarch for distributed computing.

Python Script Examples#

These examples are formatted for sphinx-gallery and will be automatically converted to HTML documentation:

  • ping_pong.py: Demonstrates the basics of Monarch’s Actor/endpoint API with a ping-pong communication example

  • crawler.py: Demonstrates Monarch’s actor API and many-to-one communications with a web crawler example

  • spmd_ddp.py: Shows how to run PyTorch’s Distributed Data Parallel (DDP) within Monarch actors

  • grpo_actor.py: Implements a distributed PPO-like reinforcement learning algorithm using the Monarch actor framework

  • distributed_tensors.py: Shows how to dispatch tensors and tensor level operations to a distributed mesh of workers and GPUs

  • debugging.py: Shows how to use the Monarch debugger to debug a distributed program