# eugr/spark-vllm-docker architecture

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

- Interactive diagram: https://gitdiagram.com/eugr/spark-vllm-docker
- Repository: https://github.com/eugr/spark-vllm-docker

## Overview

This repository packages and runs vLLM optimized for DGX Spark, from a single host or a multi-node cluster. The primary workflow is to select a YAML recipe, optionally prepare an image and download model weights, then launch a configured vLLM server; cluster setup also supports topology discovery and distributed execution. Separate branches cover runtime patches and startup-memory profiling. The README documents the deployment flow and capabilities; profiling links are limited to the sampled collector/card code, so unsampled stages are not connected speculatively.

Main entry points: [`run-recipe.py`](https://github.com/eugr/spark-vllm-docker/blob/main/run-recipe.py) (Recipe runner), [`launch-cluster.sh`](https://github.com/eugr/spark-vllm-docker/blob/main/launch-cluster.sh) (Cluster launcher), [`hf-download.sh`](https://github.com/eugr/spark-vllm-docker/blob/main/hf-download.sh) (Model download), [`mods/memory-profile/profile_card.py`](https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/profile_card.py) (Profile card)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_deploy["Deployment workflow"]
  node_recipe["Recipe definitions"]
  node_runner["Recipe runner<br/>[run-recipe.py]"]
  node_imageprep["Image preparation<br/>[build-and-copy.sh]"]
  node_modeldownload["Model download<br/>[hf-download.sh]"]
  node_cache["Model cache<br/>[hf-cache.py]"]
end

subgraph group_cluster["Cluster operations"]
  node_topology["Topology discovery"]
  node_launcher["Cluster launcher<br/>[launch-cluster.sh]"]
end

subgraph group_runtime["Inference runtime"]
  node_image["vLLM image"]
  node_vllm["vLLM serving"]
  node_patches["Runtime adaptations"]
end

subgraph group_profile["Memory profiling"]
  node_probe["Startup instrumentation<br/>[probe.py]"]
  node_collect["Profile collection<br/>[collect.py]"]
  node_card["Profile card<br/>[profile_card.py]"]
  node_capacity["Capacity analysis<br/>[capacity.py]"]
  node_report["Profile reporting<br/>[report.py]"]
end

node_operator(("Operator"))
node_huggingface[("Hugging Face")]
node_spark(("Spark hosts"))

node_operator -->|"runs recipe"| node_runner
node_runner -->|"loads settings"| node_recipe
node_runner -->|"prepares image"| node_imageprep
node_runner -->|"downloads weights"| node_modeldownload
node_modeldownload -->|"fetches models"| node_huggingface
node_modeldownload -.->|"stores weights"| node_cache
node_imageprep -->|"builds or pulls"| node_image
node_runner -->|"resolves nodes"| node_topology
node_runner -->|"launches command"| node_launcher
node_operator -->|"runs server"| node_launcher
node_launcher -->|"starts containers"| node_spark
node_launcher -->|"runs inference"| node_vllm
node_image -->|"provides runtime"| node_vllm
node_patches -->|"adapts runtime"| node_vllm
node_collect -->|"writes profile"| node_card
node_card -.->|"analyzes profile"| node_capacity
node_card -.->|"renders report"| node_report

click node_recipe "https://github.com/eugr/spark-vllm-docker/tree/main/recipes"
click node_runner "https://github.com/eugr/spark-vllm-docker/blob/main/run-recipe.py"
click node_imageprep "https://github.com/eugr/spark-vllm-docker/blob/main/build-and-copy.sh"
click node_image "https://github.com/eugr/spark-vllm-docker/blob/main/Dockerfile"
click node_modeldownload "https://github.com/eugr/spark-vllm-docker/blob/main/hf-download.sh"
click node_cache "https://github.com/eugr/spark-vllm-docker/blob/main/hf-cache.py"
click node_topology "https://github.com/eugr/spark-vllm-docker/blob/main/cluster_topology.py"
click node_launcher "https://github.com/eugr/spark-vllm-docker/blob/main/launch-cluster.sh"
click node_patches "https://github.com/eugr/spark-vllm-docker/tree/main/mods"
click node_probe "https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/probe.py"
click node_collect "https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/collect.py"
click node_card "https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/profile_card.py"
click node_capacity "https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/capacity.py"
click node_report "https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/report.py"

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_recipe,node_runner,node_imageprep,node_modeldownload,node_cache toneBlue
class node_topology,node_launcher,node_huggingface toneAmber
class node_image,node_vllm,node_patches toneMint
class node_probe,node_collect,node_card,node_capacity,node_report toneRose
class node_operator,node_spark toneIndigo
```

## Components

### Deployment workflow

- [Recipe definitions](https://github.com/eugr/spark-vllm-docker/tree/main/recipes): `recipes`
- [Recipe runner](https://github.com/eugr/spark-vllm-docker/blob/main/run-recipe.py): `run-recipe.py`
- [Image preparation](https://github.com/eugr/spark-vllm-docker/blob/main/build-and-copy.sh): `build-and-copy.sh`
- [Model download](https://github.com/eugr/spark-vllm-docker/blob/main/hf-download.sh): `hf-download.sh`
- [Model cache](https://github.com/eugr/spark-vllm-docker/blob/main/hf-cache.py): `hf-cache.py`

### Cluster operations

- [Topology discovery](https://github.com/eugr/spark-vllm-docker/blob/main/cluster_topology.py): `cluster_topology.py`
- [Cluster launcher](https://github.com/eugr/spark-vllm-docker/blob/main/launch-cluster.sh): `launch-cluster.sh`

### Inference runtime

- [vLLM image](https://github.com/eugr/spark-vllm-docker/blob/main/Dockerfile): `Dockerfile`
- **vLLM serving**
- [Runtime adaptations](https://github.com/eugr/spark-vllm-docker/tree/main/mods): `mods`

### Memory profiling

- [Startup instrumentation](https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/probe.py): `mods/memory-profile/probe.py`
- [Profile collection](https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/collect.py): `mods/memory-profile/collect.py`
- [Profile card](https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/profile_card.py): `mods/memory-profile/profile_card.py`
- [Capacity analysis](https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/capacity.py): `mods/memory-profile/capacity.py`
- [Profile reporting](https://github.com/eugr/spark-vllm-docker/blob/main/mods/memory-profile/report.py): `mods/memory-profile/report.py`

### Other components

- **Operator**
- **Hugging Face**
- **Spark hosts**

## Connections

- Operator → Recipe runner: runs recipe (evidence: `README.md`)
- Recipe runner → Recipe definitions: loads settings (evidence: `README.md`)
- Recipe runner → Image preparation: prepares image (evidence: `README.md`)
- Recipe runner → Model download: downloads weights (evidence: `README.md`)
- Model download → Hugging Face: fetches models (evidence: `README.md`)
- Model download → Model cache: stores weights
- Image preparation → vLLM image: builds or pulls (evidence: `README.md`)
- Recipe runner → Topology discovery: resolves nodes (evidence: `run-recipe.py`)
- Recipe runner → Cluster launcher: launches command (evidence: `README.md`)
- Operator → Cluster launcher: runs server (evidence: `README.md`)
- Cluster launcher → Spark hosts: starts containers (evidence: `README.md`)
- Cluster launcher → vLLM serving: runs inference (evidence: `README.md`)
- vLLM image → vLLM serving: provides runtime (evidence: `README.md`)
- Runtime adaptations → vLLM serving: adapts runtime (evidence: `README.md`)
- Profile collection → Profile card: writes profile (evidence: `mods/memory-profile/collect.py`)
- Profile card → Capacity analysis: analyzes profile
- Profile card → Profile reporting: renders report (evidence: `mods/memory-profile/report.py`)
