# pmodels/mpich architecture

> Architecture diagram of the GitHub repository pmodels/mpich, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pmodels/mpich
- Repository: https://github.com/pmodels/mpich

## Overview

MPICH implements MPI for parallel applications. The main workflow is an application calling MPI through language bindings, establishing communication contexts and datatypes, then exchanging or transforming data through collective and point-to-point operations over a configured device/network module. Hydra separately launches ranks across nodes. The README also documents GPU support, threading, and alternate CH4 netmods; the tree includes RMA and ROMIO integration. Some runtime wiring is inferred from the documented product architecture because most implementation files were not sampled.

Main entry points: [`src/mpi`](https://github.com/pmodels/mpich/tree/main/src/mpi) (MPI runtime API), [`src/mpi/coll`](https://github.com/pmodels/mpich/tree/main/src/mpi/coll) (Collective operations), [`src/pm/hydra`](https://github.com/pmodels/mpich/tree/main/src/pm/hydra) (Hydra process manager), [`src/binding`](https://github.com/pmodels/mpich/tree/main/src/binding) (Language bindings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["MPI interfaces"]
  node_bindings["Language bindings"]
  node_mpi_runtime["MPI runtime API"]
end

subgraph group_core["MPI runtime"]
  node_comm["Communicators<br/>[comm_impl.c]"]
  node_context["Context IDs<br/>[contextid.c]"]
  node_datatypes["Datatypes<br/>[datatype_impl.c]"]
  node_typerep["Type representation"]
end

subgraph group_communication["Communication"]
  node_collectives["Collective operations"]
  node_collective_select["Algorithm selection<br/>[csel.c]"]
  node_pt2pt["Point-to-point<br/>[mpir_pt2pt.h]"]
  node_ch4["CH4 device"]
  node_ofi["OFI netmod"]
end

subgraph group_execution["Process execution"]
  node_hydra["Hydra process manager"]
  node_resource_manager["Node allocation"]
  node_rank_processes["Launched ranks"]
end

subgraph group_integrations["Runtime integrations"]
  node_gpu["GPU support<br/>[gpu_query.c]"]
  node_rma["RMA operations"]
  node_romio["MPI-IO integration<br/>[glue_romio.c]"]
end

node_application(("MPI application"))
node_peer_ranks(("Peer ranks"))
node_scheduler(("Cluster scheduler"))

node_application -->|"calls MPI"| node_bindings
node_bindings -->|"dispatches calls"| node_mpi_runtime
node_mpi_runtime -->|"uses communicators"| node_comm
node_comm -->|"allocates contexts"| node_context
node_mpi_runtime -->|"uses types"| node_datatypes
node_datatypes -->|"encodes data"| node_typerep
node_mpi_runtime -->|"invokes collectives"| node_collectives
node_collectives -->|"selects algorithms"| node_collective_select
node_collectives -->|"exchanges messages"| node_pt2pt
node_pt2pt -->|"dispatches traffic"| node_ch4
node_ch4 -.->|"uses netmod"| node_ofi
node_ofi -->|"transfers data"| node_peer_ranks
node_collectives -->|"packs and unpacks"| node_typerep
node_mpi_runtime -->|"queries support"| node_gpu
node_mpi_runtime -.->|"issues RMA"| node_rma
node_mpi_runtime -.->|"uses MPI-IO"| node_romio
node_application -->|"requests launch"| node_hydra
node_hydra -->|"queries nodes"| node_resource_manager
node_resource_manager -.->|"reads allocation"| node_scheduler
node_hydra -->|"starts ranks"| node_rank_processes
node_rank_processes -->|"runs MPI calls"| node_mpi_runtime

click node_bindings "https://github.com/pmodels/mpich/tree/main/src/binding"
click node_mpi_runtime "https://github.com/pmodels/mpich/tree/main/src/mpi"
click node_comm "https://github.com/pmodels/mpich/blob/main/src/mpi/comm/comm_impl.c"
click node_context "https://github.com/pmodels/mpich/blob/main/src/mpi/comm/contextid.c"
click node_datatypes "https://github.com/pmodels/mpich/blob/main/src/mpi/datatype/datatype_impl.c"
click node_typerep "https://github.com/pmodels/mpich/tree/main/src/mpi/datatype/typerep/src"
click node_collectives "https://github.com/pmodels/mpich/tree/main/src/mpi/coll"
click node_collective_select "https://github.com/pmodels/mpich/blob/main/src/mpi/coll/src/csel.c"
click node_pt2pt "https://github.com/pmodels/mpich/blob/main/src/include/mpir_pt2pt.h"
click node_ch4 "https://github.com/pmodels/mpich/tree/main/src/mpid/ch4"
click node_ofi "https://github.com/pmodels/mpich/tree/main/src/mpid/ch4/netmod/ofi"
click node_gpu "https://github.com/pmodels/mpich/blob/main/src/mpi/misc/gpu_query.c"
click node_rma "https://github.com/pmodels/mpich/blob/main/src/mpid/ch3/src/ch3u_rma_pkthandler.c"
click node_romio "https://github.com/pmodels/mpich/blob/main/src/glue/romio/glue_romio.c"
click node_hydra "https://github.com/pmodels/mpich/tree/main/src/pm/hydra"
click node_resource_manager "https://github.com/pmodels/mpich/blob/main/src/pm/hydra/lib/tools/bootstrap/src/bsci_query_node_list.c"
click node_rank_processes "https://github.com/pmodels/mpich/tree/main/src/pm/hydra"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bindings,node_mpi_runtime toneBlue
class node_comm,node_context,node_datatypes,node_typerep toneAmber
class node_collectives,node_collective_select,node_pt2pt,node_ch4,node_ofi toneMint
class node_hydra,node_resource_manager,node_rank_processes,node_scheduler toneRose
class node_gpu,node_rma,node_romio,node_application,node_peer_ranks toneIndigo
```

## Components

### MPI interfaces

- [Language bindings](https://github.com/pmodels/mpich/tree/main/src/binding): `src/binding`
- [MPI runtime API](https://github.com/pmodels/mpich/tree/main/src/mpi): `src/mpi`

### MPI runtime

- [Communicators](https://github.com/pmodels/mpich/blob/main/src/mpi/comm/comm_impl.c): `src/mpi/comm/comm_impl.c`
- [Context IDs](https://github.com/pmodels/mpich/blob/main/src/mpi/comm/contextid.c): `src/mpi/comm/contextid.c`
- [Datatypes](https://github.com/pmodels/mpich/blob/main/src/mpi/datatype/datatype_impl.c): `src/mpi/datatype/datatype_impl.c`
- [Type representation](https://github.com/pmodels/mpich/tree/main/src/mpi/datatype/typerep/src): `src/mpi/datatype/typerep/src`

### Communication

- [Collective operations](https://github.com/pmodels/mpich/tree/main/src/mpi/coll): `src/mpi/coll`
- [Algorithm selection](https://github.com/pmodels/mpich/blob/main/src/mpi/coll/src/csel.c): `src/mpi/coll/src/csel.c`
- [Point-to-point](https://github.com/pmodels/mpich/blob/main/src/include/mpir_pt2pt.h): `src/include/mpir_pt2pt.h`
- [CH4 device](https://github.com/pmodels/mpich/tree/main/src/mpid/ch4): `src/mpid/ch4`
- [OFI netmod](https://github.com/pmodels/mpich/tree/main/src/mpid/ch4/netmod/ofi): `src/mpid/ch4/netmod/ofi`

### Process execution

- [Hydra process manager](https://github.com/pmodels/mpich/tree/main/src/pm/hydra): `src/pm/hydra`
- [Node allocation](https://github.com/pmodels/mpich/blob/main/src/pm/hydra/lib/tools/bootstrap/src/bsci_query_node_list.c): `src/pm/hydra/lib/tools/bootstrap/src/bsci_query_node_list.c`
- [Launched ranks](https://github.com/pmodels/mpich/tree/main/src/pm/hydra): `src/pm/hydra`

### Runtime integrations

- [GPU support](https://github.com/pmodels/mpich/blob/main/src/mpi/misc/gpu_query.c): `src/mpi/misc/gpu_query.c`
- [RMA operations](https://github.com/pmodels/mpich/blob/main/src/mpid/ch3/src/ch3u_rma_pkthandler.c): `src/mpid/ch3/src/ch3u_rma_pkthandler.c`
- [MPI-IO integration](https://github.com/pmodels/mpich/blob/main/src/glue/romio/glue_romio.c): `src/glue/romio/glue_romio.c`

### Other components

- **MPI application**
- **Peer ranks**
- **Cluster scheduler**

## Connections

- MPI application → Language bindings: calls MPI
- Language bindings → MPI runtime API: dispatches calls
- MPI runtime API → Communicators: uses communicators
- Communicators → Context IDs: allocates contexts
- MPI runtime API → Datatypes: uses types
- Datatypes → Type representation: encodes data
- MPI runtime API → Collective operations: invokes collectives
- Collective operations → Algorithm selection: selects algorithms
- Collective operations → Point-to-point: exchanges messages
- Point-to-point → CH4 device: dispatches traffic
- CH4 device → OFI netmod: uses netmod
- OFI netmod → Peer ranks: transfers data
- Collective operations → Type representation: packs and unpacks
- MPI runtime API → GPU support: queries support
- MPI runtime API → RMA operations: issues RMA
- MPI runtime API → MPI-IO integration: uses MPI-IO
- MPI application → Hydra process manager: requests launch
- Hydra process manager → Node allocation: queries nodes
- Node allocation → Cluster scheduler: reads allocation
- Hydra process manager → Launched ranks: starts ranks
- Launched ranks → MPI runtime API: runs MPI calls
