Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a51265a
Add dense_distributed class enabling slab, pencil and brick domain de…
giumal Nov 2, 2026
c00c0b8
Add test distributed domain
giumal Nov 2, 2026
5115d5f
Diseable barrier in halo_distributed.h file and update CHANGELOG.md
giumal Nov 2, 2026
97cad1e
Add cg benchmark
giumal Nov 2, 2026
96182e8
Add initial porting ldc benchmark to distributed
giumal Nov 2, 2026
bf3df6e
vtk output for pencil and brick
giumal Nov 3, 2026
5b0d192
Checking correctness vtk output
giumal Nov 5, 2026
76364c7
Fixing bug brick decomposition
giumal Nov 4, 2026
8e9c37e
vtk update distributed writing
giumal Nov 5, 2026
8c16cc1
Fix spdlog version and render_ray_march.inl for amd gpus
giumal Nov 5, 2026
3c47490
Add only rank=0 printing iteration time
giumal Nov 5, 2026
6ff6ee9
merge upstream version
giumal Nov 6, 2026
aace22b
Fix decomposition check
giumal Nov 6, 2026
cacaa4b
Add two-band boundary path on dense_distributed iter_extent function …
giumal Nov 6, 2026
dca087d
Add atomic_add fix for hip on amd
giumal Nov 6, 2026
d26b7cc
Fix sycl adp CPU backend
giumal Nov 7, 2026
f5ec6b2
Add MPI backend for sycl-cpu offloading
giumal Nov 7, 2026
ebbc5f5
3D reducee with docs/reduce-2d-stage1-yz-fix-report.md
giumal Nov 7, 2026
543bdd6
add split reduction in SYCL
giumal Nov 7, 2026
a950741
Distributed LBM strong-scaling sweep; benchmark --reps, barrier timin…
massimim Nov 6, 2026
c16a411
lbm-dist-sweep: no 1-GPU runs; per-decomposition GPU counts
massimim Nov 6, 2026
638549e
LBM distributed sweep results: D3Q19 + BGK fp32, N=256..512, slab 2..…
massimim Nov 6, 2026
77c2fd4
Fix cg_poisson.cu nvtx problem
giumal Nov 23, 2026
3056bd7
merge upstream version
giumal Nov 23, 2026
3a83043
Add profiles into skeleton
giumal Nov 24, 2026
be5d640
Fix typo stddev
giumal Nov 24, 2026
601c2fd
DenseDisgDistributed grid + HaloDisgDistributed; slab specialization;…
massimim Nov 24, 2026
fd53fd0
Merge hp-halo-priority
giumal Nov 24, 2026
dc1583d
cg dense_disg
giumal Nov 24, 2026
c5fb3e9
optimise span densedistributed
giumal Nov 24, 2026
12354d8
Add template StorageKind parameter
giumal Nov 25, 2026
f5a1c36
fix cg Span
giumal Nov 25, 2026
f81ef3c
Test fix slab span performance
giumal Nov 25, 2026
cb26faf
Both view and storage template
giumal Nov 25, 2026
81a7cdb
Merga upstream
giumal Nov 26, 2026
69c8096
Fix skeleton.cpp merging upstream problem
giumal Nov 26, 2026
cce71de
Window implementation
giumal Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/cg/cg_poisson.cu
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ build_matvec(const Grid& grid,
1>& out,
double invh2,
std::string name) -> carbon::Kernel {
using Span = typename Grid::Span;
using Span = typename Grid::Span;
using Idx = typename Grid::Idx;
return carbon::Kernel::compute(
grid,
Expand Down
181 changes: 181 additions & 0 deletions benchmarks/lbm_lid_driven_cavity/scripts/lbm_sweep_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
#!/usr/bin/env python3
"""Parse and validate the sweep YAML (see ``lbm-dgx-sweep.yml``).

Single source of truth for the keys, their defaults and their validation, shared by
``lbm-dgx-sweep-run.sh`` and the plotters in ``plotting/``:

- ``load_sweep_config(text)`` / ``read_sweep_config(path)`` return every key as a Python
value (lists of ints or strings, ints, bools, strings), defaults filled in.
- Run as a script, it reads the YAML text from ``$LBM_SWEEP_CONFIG`` (empty = all
defaults) and prints ``VAR=value`` lines with the run script's env var names.

Values end up in shell variables, docker / mpiexec arguments and file names, so only
plain tokens (letters, digits, ``. _ : / -``) are accepted, and ``prefix`` must be a
single path component.
"""

from __future__ import annotations

import os
import re
import sys
from pathlib import Path

# key: (env var of lbm-dgx-sweep-run.sh, kind, default)
KEYS: dict[str, tuple[str, str, object]] = {
"configs": ("CONFIGS", "words", ["q19:bgk"]),
"precisions": ("PRECISIONS", "words", ["fp32"]),
"sizes": ("SIZES", "ints", list(range(256, 513, 64))),
"gpus": ("GPUS_LIST", "ints", list(range(1, 9))),
"grids": ("GRIDS", "words", ["dense", "disg"]),
"transports": ("TRANSPORTS", "words", ["intra", "mpi", "mpip2p"]),
"warmup": ("WARMUP", "int", 400),
"iters_per_rep": ("ITERS_PER_REP", "int", 400),
"reps": ("REPS", "int", 4),
"sm_arch": ("SM_ARCH", "arch", "auto"),
"image_intra": ("IMAGE_INTRA", "word", "carbon-cuda:local"),
"image_mpi": ("IMAGE_MPI", "word", "carbon-cuda-nccl-pinned:local"),
"prefix": ("PREFIX", "name", "lbm-dgx-sweep"),
"skip_build": ("SKIP_BUILD", "bool", False),
"force": ("FORCE", "bool", False),
"run_timeout": ("RUN_TIMEOUT", "int", 1800),
}
CHOICES = {
"configs": {"q19:bgk", "q27:bgk", "q27:kbc"},
"precisions": {"fp32", "fp64"},
"grids": {"dense", "disg"},
"transports": {"intra", "mpi", "mpip2p"},
}
TOKEN = re.compile(r"^[A-Za-z0-9._:/-]+$")
NAME = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]*$")


class SweepConfigError(ValueError):
"""Invalid sweep YAML."""


def _as_int(key: str, v: object) -> int:
minimum = 0 if key == "warmup" else 1
if isinstance(v, bool) or not isinstance(v, int) or v < minimum:
raise SweepConfigError(f"{key} must be an integer >= {minimum} (got {v!r})")
return v


def _as_list(key: str, v: object) -> list:
if isinstance(v, dict):
if set(v) != {"start", "stop", "step"}:
raise SweepConfigError(f"{key} range needs exactly start, stop, step")
start, stop, step = (_as_int(key, v[k]) for k in ("start", "stop", "step"))
return list(range(start, stop + 1, step))
if isinstance(v, str):
return v.split()
if isinstance(v, list):
return v
return [v]


def _parse_value(key: str, kind: str, value: object, choices: dict[str, set[str]]) -> object:
if kind == "int":
return _as_int(key, value)
if kind == "bool":
if not isinstance(value, bool):
raise SweepConfigError(f"{key} must be true or false (got {value!r})")
return value
if kind == "arch" and value == "auto":
return "auto"
if kind in ("ints", "arch"):
items = [
_as_int(key, int(x) if isinstance(x, str) and x.isdigit() else x)
for x in _as_list(key, value)
]
if not items:
raise SweepConfigError(f"{key} is empty")
return items
items = _as_list(key, value) if kind == "words" else [value]
if not items:
raise SweepConfigError(f"{key} is empty")
pattern = NAME if kind == "name" else TOKEN
for x in items:
if not isinstance(x, str) or not pattern.match(x):
raise SweepConfigError(f"{key} has an invalid value {x!r}")
if key in choices and x not in choices[key]:
raise SweepConfigError(f"{key} value {x!r} not in {sorted(choices[key])}")
return items if kind == "words" else items[0]


def load_sweep_config(
text: str,
keys: dict[str, tuple[str, str, object]] = KEYS,
choices: dict[str, set[str]] = CHOICES,
) -> dict[str, object]:
"""Validate YAML text; returns every key in ``keys``, omitted ones at their default.

``keys`` / ``choices`` default to this sweep's tables; other sweeps (e.g. the
distributed benchmark's) pass their own in the same format.
"""
import yaml

cfg = yaml.safe_load(text) or {}
if not isinstance(cfg, dict):
raise SweepConfigError("top level must be a mapping")
out = {key: default for key, (_, _, default) in keys.items()}
for key, value in cfg.items():
if key not in keys:
raise SweepConfigError(f"unknown key {key!r} (known: {', '.join(keys)})")
out[key] = _parse_value(key, keys[key][1], value, choices)
return out


def read_sweep_config(
path: Path,
keys: dict[str, tuple[str, str, object]] = KEYS,
choices: dict[str, set[str]] = CHOICES,
) -> dict[str, object]:
"""Load a sweep YAML file; the path must be an existing ``.yml`` / ``.yaml`` file."""
path = Path(path).resolve()
if path.suffix not in (".yml", ".yaml") or not path.is_file():
raise SweepConfigError(f"not a .yml/.yaml file: {path}")
return load_sweep_config(path.read_text(), keys, choices)


def series_prefixes(cfg: dict[str, object]) -> list[tuple[str, str, str, str]]:
"""``(series_prefix, lattice, collision, precision)`` for every configs x precisions entry.

A series prefix (``<prefix>-<lattice>-<collision>-<precision>``) is what the run script
puts in front of ``<grid>-<transport>-n<N>-g<G>.json``.
"""
out = []
for c in cfg["configs"]:
lattice, collision = c.split(":")
for precision in cfg["precisions"]:
out.append((f"{cfg['prefix']}-{lattice}-{collision}-{precision}", lattice, collision,
precision))
return out


def _shell_value(kind: str, value: object) -> str:
if kind == "bool":
return "1" if value else "0"
if kind == "arch" and value != "auto":
return ";".join(map(str, value))
if isinstance(value, list):
return " ".join(map(str, value))
return str(value)


def main(
keys: dict[str, tuple[str, str, object]] = KEYS,
choices: dict[str, set[str]] = CHOICES,
) -> int:
try:
cfg = load_sweep_config(os.environ.get("LBM_SWEEP_CONFIG", ""), keys, choices)
except SweepConfigError as e:
sys.stderr.write(f"error: config: {e}\n")
return 1
for key, (var, kind, _) in keys.items():
print(f"{var}={_shell_value(kind, cfg[key])}")
return 0


if __name__ == "__main__":
sys.exit(main())
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
decomp,n,g,dense_mlups,disg_mlups,speedup
brick,256,8,35617.407,24248.140,0.6808
brick,384,8,44884.536,28672.174,0.6388
brick,512,8,48408.605,31273.917,0.6460
pencil,256,4,30206.431,17458.764,0.5780
pencil,256,8,50375.249,32472.333,0.6446
pencil,384,4,32029.573,19010.249,0.5935
pencil,384,8,61085.733,36929.974,0.6046
pencil,512,4,32614.456,19725.893,0.6048
pencil,512,8,63194.988,38747.500,0.6131
slab,256,2,15697.892,9845.159,0.6272
slab,256,4,30201.093,19039.444,0.6304
slab,256,8,56927.116,34590.962,0.6076
slab,384,2,16354.072,10371.083,0.6342
slab,384,4,31878.404,20620.534,0.6468
slab,384,8,61392.481,39422.238,0.6421
slab,512,2,16642.525,10595.283,0.6366
slab,512,4,32548.910,21353.558,0.6560
slab,512,8,63975.557,41819.560,0.6537
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Comparison sweep: DenseDistributed vs DenseDisgDistributed.
# Same matrix as lbm-dist-sweep, both grids, hp-halo on (the fair OCC baseline).
configs: [q19:bgk]
grids: [dense_distributed, disg_distributed]
sizes: [256, 384, 512]
decompositions: [slab, pencil, brick]
gpus_slab: [2, 4, 8]
gpus_pencil: [4, 8]
gpus_brick: [8]
transports: [mpi]
hp_halo: ["on"]
overlap: standard
warmup: 400
iters_per_rep: 400
reps: 5
sm_arch: "80"
image: carbon-cuda-nccl-pinned:local
build_dir: build-dist
prefix: lbm-disg-vs-dense
skip_build: true
force: true
run_timeout: 1800
reference_dir: benchmarks/lbm_lid_driven_cavity/data/lbm-dgx-sweep/json
reference_prefix: lbm-dgx-sweep
reference_label: dense-intra
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Sweep configuration for lbm-dist-sweep-run.sh and its plotter.
#
# ./benchmarks/lbm_lid_driven_cavity_distributed/scripts/lbm-dist-sweep-run.sh \
# benchmarks/lbm_lid_driven_cavity_distributed/scripts/lbm-dist-sweep.yml
# python3 benchmarks/lbm_lid_driven_cavity_distributed/scripts/plotting/plot_dist_scaling.py \
# --config benchmarks/lbm_lid_driven_cavity_distributed/scripts/lbm-dist-sweep.yml
#
# Every run uses --grid dense_distributed under mpiexec, one rank per GPU.
# Every key is optional; omitted keys use the script defaults, and an env var
# of the same name in upper case (CONFIGS, SIZES, GPUS_LIST, ...) overrides
# the file.

# Lattice:collision pairs, each its own series (populations are always fp32):
# q19:bgk D3Q19 + BGK
# q27:bgk D3Q27 + BGK
# q27:kbc D3Q27 + KBC (KBC is only implemented for D3Q27)
configs: [q19:bgk]

# Domain edge lengths N: a list, or an inclusive {start, stop, step} range.
sizes: {start: 256, stop: 512, step: 64}

# Process decompositions, one plot panel each:
# slab split z
# pencil split y and z
# brick split x, y and z
decompositions: [slab, pencil, brick]

# GPU counts (= MPI ranks, all >= 2) of each decomposition. ProcessGrid
# factorises the rank count, so pencil only differs from a slab at 4 (1x2x2)
# and 8 (1x2x4), and brick only at 8 (2x2x2); the plots print the process
# grid under each GPU count.
gpus_slab: {start: 2, stop: 8, step: 1}
gpus_pencil: [4, 8]
gpus_brick: [8]

# 1-GPU efficiency baseline: no 1-GPU run is done here. For size N the
# plotter reads
# <reference_dir>/<reference_prefix>-<lattice>-<collision>-fp32-<reference_label>-n<N>-g1.json
# (reference_dir relative to the carbon repo root), by default the Dense
# Peeraccess run of the single-process DGX sweep.
reference_dir: benchmarks/lbm_lid_driven_cavity/data/lbm-dgx-sweep/json
reference_prefix: lbm-dgx-sweep
reference_label: dense-intra

# Halo transports, one curve each:
# mpi NCCL (default)
# mpip2p MPI point-to-point (CARBON_DIST_TRANSPORT=mpi)
transports: [mpi]

# Halo stream priority, one curve each: off = normal priority, on = --hp-halo
# (Skeleton halo_stream_priority = High). Only meaningful with overlap != none.
hp_halo: ["off", "on"]

# Skeleton OCC mode of every run: none, standard, extended, twoway-extended.
overlap: standard

# Timing: warmup untimed solver steps, then reps repetitions of
# iters_per_rep solver steps, each closed by a GPU drain and an MPI barrier.
warmup: 400
iters_per_rep: 1000
reps: 5

# CUDA compute capability the binary is compiled for
# (CMAKE_CUDA_ARCHITECTURES). auto detects it from the GPUs via nvidia-smi.
# Changing it needs a rebuild, so keep skip_build: false for that run.
sm_arch: auto

# Docker image that builds the binary and does every run. Its NCCL must match
# the host driver: carbon-cuda:local ships an NCCL that needs driver >= 580,
# carbon-cuda-nccl-pinned:local pins NCCL 2.27.7 (CUDA 12.2).
image: carbon-cuda-nccl-pinned:local

# CUDA+MPI build tree, relative to the carbon repo root. Kept apart from the
# single-process sweep's build-mpi/, which is configured in another image.
build_dir: build-dist

# Report prefix and output folder:
# benchmarks/lbm_lid_driven_cavity_distributed/data/<prefix>/json/
prefix: lbm-dist-sweep

# true reuses the existing build tree; false (re)builds it first.
skip_build: false
# true redoes runs whose JSON already exists; false skips them (resume).
force: true
# Per-run timeout in seconds; a hung run is logged in failed.txt.
run_timeout: 1800
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
#
# benchmarks/lbm_lid_driven_cavity_distributed/data/lbm-dist-sweep/reproduce.sh
#
# Reproduces this result set: runs the sweep described by lbm-dist-sweep.yml
# (the frozen copy next to this script) and renders every plot in this folder.
#
# D3Q19 + BGK, fp32, --grid dense_distributed, --overlap standard;
# N = 256..512 step 64; one MPI rank per GPU; slab on 2..8 GPUs, pencil on
# 4 and 8, brick on 8; NCCL halos with --hp-halo off and on;
# 400 warmup steps, then 5 timed repetitions of 1000 solver steps.
# Efficiency is relative to the 1-GPU Dense Peeraccess runs of
# benchmarks/lbm_lid_driven_cavity/data/lbm-dgx-sweep/json (no 1-GPU run here).
#
# Original run: 8x A100-SXM4-40GB (NVLink), driver 535.161.08, carbon commit
# 0d504c5, image carbon-cuda-nccl-pinned:local (NCCL 2.27.7, CUDA 12.2).
#
# Usage:
# ./benchmarks/lbm_lid_driven_cavity_distributed/data/lbm-dist-sweep/reproduce.sh [--plot-only]
#
# (no flag) build build-dist/ in Docker, redo every run (force: true
# overwrites json/), then plot; takes about an hour on 8 GPUs
# --plot-only only re-render the PNGs from the reports already in json/
#
# Needs docker with the NVIDIA container toolkit, the image named in the yml,
# and python3 with PyYAML and matplotlib. Run it from tmux (or similar) because
# the sweep outlives an SSH session.

set -euo pipefail

plot_only=0
case "${1:-}" in
"") ;;
--plot-only) plot_only=1 ;;
*)
echo "usage: $0 [--plot-only]" >&2
exit 2
;;
esac

here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(cd "${here}/../../../.." && pwd)"
scripts="${repo_root}/benchmarks/lbm_lid_driven_cavity_distributed/scripts"
config="${here}/lbm-dist-sweep.yml"

if [[ "${plot_only}" -eq 0 ]]; then
"${scripts}/lbm-dist-sweep-run.sh" "${config}"
fi

python3 "${scripts}/plotting/plot_dist_scaling.py" --config "${config}" --output-dir "${here}"
echo "==> plots written to ${here}"
Loading
Loading