# schedmd/slurm architecture

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

- Interactive diagram: https://gitdiagram.com/schedmd/slurm
- Repository: https://github.com/schedmd/slurm

## Overview

Slurm is a cluster workload manager: users request compute resources, Slurm queues and arbitrates those requests, allocates nodes, then starts and monitors work on the allocation. Accounting and persistent communication support cluster operations. The graph preserves major runtime layers and core modules named by the source index. Relationships are limited to the README’s documented product workflow and references visible in the index; unsampled implementation details are not inferred.

Main entry points: [`src/slurmctld/controller.c`](https://github.com/schedmd/slurm/blob/master/src/slurmctld/controller.c) (Controller), [`src/interfaces/accounting_storage.h`](https://github.com/schedmd/slurm/blob/master/src/interfaces/accounting_storage.h) (Accounting interface), [`src/stepmgr/stepmgr.c`](https://github.com/schedmd/slurm/blob/master/src/stepmgr/stepmgr.c) (Step manager), [`src/slurmdbd`](https://github.com/schedmd/slurm/tree/master/src/slurmdbd) (Accounting daemon)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Job workflow"]
  node_job_client["Job clients"]
  node_public_api["Slurm API"]
end

subgraph group_control["Cluster control"]
  node_controller["Controller<br/>[controller.c]"]
  node_scheduler["Job scheduling"]
  node_config["Cluster configuration<br/>[read_config.h]"]
end

subgraph group_runtime["Execution runtime"]
  node_node_daemon["Node daemon"]
  node_step_manager["Step manager<br/>[stepmgr.c]"]
  node_task_distribution["Task distribution<br/>[dist_tasks.c]"]
  node_task_affinity["Task affinity<br/>[dist_tasks.c]"]
  node_mpi["MPI integration"]
end

subgraph group_accounting["Accounting"]
  node_accounting_api["Accounting interface"]
  node_accounting_plugin["Accounting storage"]
  node_database[("MySQL storage")]
  node_accounting_service["Accounting daemon"]
end

subgraph group_foundation["Shared interfaces"]
  node_protocol["RPC definitions"]
  node_protocol_api["Protocol API"]
  node_persistent_conn["Persistent connections<br/>[persist_conn.h]"]
  node_connection_manager["Connection manager<br/>[conmgr.h]"]
  node_lists["List utilities<br/>[list.h]"]
  node_packing["Message packing<br/>[pack.h]"]
  node_logging["Logging<br/>[log.h]"]
  node_macros["Common macros<br/>[macros.h]"]
  node_errors["Error codes<br/>[slurm_errno.h]"]
  node_public_header["Public API definitions<br/>[slurm.h]"]
  node_database_protocol["Accounting RPC definitions<br/>[slurmdbd_defs.h]"]
end

node_user(("Cluster user"))

node_user -->|"submits work"| node_job_client
node_job_client -.->|"requests resources"| node_public_api
node_public_api -.->|"requests allocation"| node_controller
node_controller -->|"arbitrates requests"| node_scheduler
node_scheduler -->|"allocates resources"| node_controller
node_controller -->|"starts work"| node_node_daemon
node_node_daemon -->|"executes steps"| node_step_manager
node_step_manager -.->|"distributes tasks"| node_task_distribution
node_step_manager -.->|"binds tasks"| node_task_affinity
node_step_manager -.->|"supports parallel jobs"| node_mpi
node_controller -->|"uses accounting"| node_accounting_api
node_accounting_api -->|"dispatches storage"| node_accounting_plugin
node_accounting_plugin -.->|"stores records"| node_database
node_accounting_plugin -->|"relays requests"| node_accounting_service
node_accounting_service -->|"serves accounting"| node_accounting_api
node_persistent_conn -->|"uses transport"| node_connection_manager
node_accounting_api -->|"uses connections"| node_persistent_conn
node_accounting_api -->|"uses lists"| node_lists
node_accounting_service -->|"handles RPCs"| node_protocol
node_accounting_service -->|"uses connections"| node_persistent_conn
node_public_api -.->|"exposes definitions"| node_public_header

click node_job_client "https://github.com/schedmd/slurm/tree/master/src/sbatch"
click node_public_api "https://github.com/schedmd/slurm/tree/master/src/api"
click node_controller "https://github.com/schedmd/slurm/blob/master/src/slurmctld/controller.c"
click node_scheduler "https://github.com/schedmd/slurm/tree/master/src/slurmctld"
click node_config "https://github.com/schedmd/slurm/blob/master/src/common/read_config.h"
click node_node_daemon "https://github.com/schedmd/slurm/tree/master/src/slurmd"
click node_step_manager "https://github.com/schedmd/slurm/blob/master/src/stepmgr/stepmgr.c"
click node_task_distribution "https://github.com/schedmd/slurm/blob/master/src/plugins/select/cons_tres/dist_tasks.c"
click node_task_affinity "https://github.com/schedmd/slurm/blob/master/src/plugins/task/affinity/dist_tasks.c"
click node_mpi "https://github.com/schedmd/slurm/tree/master/src/plugins/mpi"
click node_accounting_api "https://github.com/schedmd/slurm/blob/master/src/interfaces/accounting_storage.h"
click node_accounting_plugin "https://github.com/schedmd/slurm/tree/master/src/plugins/accounting_storage"
click node_database "https://github.com/schedmd/slurm/blob/master/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c"
click node_accounting_service "https://github.com/schedmd/slurm/tree/master/src/slurmdbd"
click node_protocol "https://github.com/schedmd/slurm/blob/master/src/common/slurm_protocol_defs.h"
click node_protocol_api "https://github.com/schedmd/slurm/blob/master/src/common/slurm_protocol_api.h"
click node_persistent_conn "https://github.com/schedmd/slurm/blob/master/src/common/persist_conn.h"
click node_connection_manager "https://github.com/schedmd/slurm/blob/master/src/conmgr/conmgr.h"
click node_lists "https://github.com/schedmd/slurm/blob/master/src/common/list.h"
click node_packing "https://github.com/schedmd/slurm/blob/master/src/common/pack.h"
click node_logging "https://github.com/schedmd/slurm/blob/master/src/common/log.h"
click node_macros "https://github.com/schedmd/slurm/blob/master/src/common/macros.h"
click node_errors "https://github.com/schedmd/slurm/blob/master/slurm/slurm_errno.h"
click node_public_header "https://github.com/schedmd/slurm/blob/master/slurm/slurm.h"
click node_database_protocol "https://github.com/schedmd/slurm/blob/master/src/common/slurmdbd_defs.h"

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_job_client,node_public_api,node_user toneBlue
class node_controller,node_scheduler,node_config toneAmber
class node_node_daemon,node_step_manager,node_task_distribution,node_task_affinity,node_mpi toneMint
class node_accounting_api,node_accounting_plugin,node_database,node_accounting_service toneRose
class node_protocol,node_protocol_api,node_persistent_conn,node_connection_manager,node_lists,node_packing,node_logging,node_macros,node_errors,node_public_header,node_database_protocol toneIndigo
```

## Components

### Job workflow

- [Job clients](https://github.com/schedmd/slurm/tree/master/src/sbatch): `src/sbatch`
- [Slurm API](https://github.com/schedmd/slurm/tree/master/src/api): `src/api`

### Cluster control

- [Controller](https://github.com/schedmd/slurm/blob/master/src/slurmctld/controller.c): `src/slurmctld/controller.c`
- [Job scheduling](https://github.com/schedmd/slurm/tree/master/src/slurmctld): `src/slurmctld`
- [Cluster configuration](https://github.com/schedmd/slurm/blob/master/src/common/read_config.h): `src/common/read_config.h`

### Execution runtime

- [Node daemon](https://github.com/schedmd/slurm/tree/master/src/slurmd): `src/slurmd`
- [Step manager](https://github.com/schedmd/slurm/blob/master/src/stepmgr/stepmgr.c): `src/stepmgr/stepmgr.c`
- [Task distribution](https://github.com/schedmd/slurm/blob/master/src/plugins/select/cons_tres/dist_tasks.c): `src/plugins/select/cons_tres/dist_tasks.c`
- [Task affinity](https://github.com/schedmd/slurm/blob/master/src/plugins/task/affinity/dist_tasks.c): `src/plugins/task/affinity/dist_tasks.c`
- [MPI integration](https://github.com/schedmd/slurm/tree/master/src/plugins/mpi): `src/plugins/mpi`

### Accounting

- [Accounting interface](https://github.com/schedmd/slurm/blob/master/src/interfaces/accounting_storage.h): `src/interfaces/accounting_storage.h`
- [Accounting storage](https://github.com/schedmd/slurm/tree/master/src/plugins/accounting_storage): `src/plugins/accounting_storage`
- [MySQL storage](https://github.com/schedmd/slurm/blob/master/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c): `src/plugins/accounting_storage/mysql/accounting_storage_mysql.c`
- [Accounting daemon](https://github.com/schedmd/slurm/tree/master/src/slurmdbd): `src/slurmdbd`

### Shared interfaces

- [RPC definitions](https://github.com/schedmd/slurm/blob/master/src/common/slurm_protocol_defs.h): `src/common/slurm_protocol_defs.h`
- [Protocol API](https://github.com/schedmd/slurm/blob/master/src/common/slurm_protocol_api.h): `src/common/slurm_protocol_api.h`
- [Persistent connections](https://github.com/schedmd/slurm/blob/master/src/common/persist_conn.h): `src/common/persist_conn.h`
- [Connection manager](https://github.com/schedmd/slurm/blob/master/src/conmgr/conmgr.h): `src/conmgr/conmgr.h`
- [List utilities](https://github.com/schedmd/slurm/blob/master/src/common/list.h): `src/common/list.h`
- [Message packing](https://github.com/schedmd/slurm/blob/master/src/common/pack.h): `src/common/pack.h`
- [Logging](https://github.com/schedmd/slurm/blob/master/src/common/log.h): `src/common/log.h`
- [Common macros](https://github.com/schedmd/slurm/blob/master/src/common/macros.h): `src/common/macros.h`
- [Error codes](https://github.com/schedmd/slurm/blob/master/slurm/slurm_errno.h): `slurm/slurm_errno.h`
- [Public API definitions](https://github.com/schedmd/slurm/blob/master/slurm/slurm.h): `slurm/slurm.h`
- [Accounting RPC definitions](https://github.com/schedmd/slurm/blob/master/src/common/slurmdbd_defs.h): `src/common/slurmdbd_defs.h`

### Other components

- **Cluster user**

## Connections

- Cluster user → Job clients: submits work
- Job clients → Slurm API: requests resources
- Slurm API → Controller: requests allocation
- Controller → Job scheduling: arbitrates requests
- Job scheduling → Controller: allocates resources
- Controller → Node daemon: starts work
- Node daemon → Step manager: executes steps
- Step manager → Task distribution: distributes tasks
- Step manager → Task affinity: binds tasks
- Step manager → MPI integration: supports parallel jobs
- Controller → Accounting interface: uses accounting (evidence: `src/slurmctld/controller.c`)
- Accounting interface → Accounting storage: dispatches storage (evidence: `src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c`)
- Accounting storage → MySQL storage: stores records (evidence: `src/plugins/accounting_storage/mysql/accounting_storage_mysql.c`)
- Accounting storage → Accounting daemon: relays requests (evidence: `src/plugins/accounting_storage/slurmdbd/accounting_storage_slurmdbd.c`)
- Accounting daemon → Accounting interface: serves accounting (evidence: `src/slurmdbd/proc_req.c`)
- Persistent connections → Connection manager: uses transport (evidence: `src/common/persist_conn.h`)
- Accounting interface → Persistent connections: uses connections (evidence: `src/interfaces/accounting_storage.c`)
- Accounting interface → List utilities: uses lists (evidence: `src/interfaces/accounting_storage.c`)
- Accounting daemon → RPC definitions: handles RPCs (evidence: `src/slurmdbd/proc_req.c`)
- Accounting daemon → Persistent connections: uses connections (evidence: `src/slurmdbd/proc_req.c`)
- Slurm API → Public API definitions: exposes definitions
