perf(algebra): constant-fold affine time-step operators (α·I + β·Laplacian) into one stencil pass

未关闭
#52 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
48/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
冷清
技术栈
julia
领域
performance

调研方向

Start with the lazy operator-tree path described around apply!, χ∇², AffineStencil, and the ping-pong idiom, then review the invariants for adjoints, boundary-condition contributions, and trait propagation. Compare the 2046² benchmark in comparisons/chmy_diffusion_2d/ and consider the issue complete when affine constant-coefficient operators fold into one stencil pass with documented usage and the stated performance target is measured.

由索引模型根据 Issue 内容生成。

描述

performance

Context

Sibling of #51 (CPU threading). The Diffusion 2D comparison against Chmy.jl (benchmark/comparisons/chmy_diffusion_2d/) confirmed our fused one-pass stencil beats Chmy's two-kernel flux form 2.5–16.9× single-threaded, with final fields agreeing to machine epsilon. Beyond threading, three ideas would compound the lead. Items 2 and 3 have since moved to their own issues (see below); this issue now tracks item 1 only.

1. Constant-fold affine time-step operators into a single stencil pass (ours to exploit)

Explicit Euler today is two sweeps: apply!(du, χ∇², u) (2 array passes) then u .+= Δt·du (3 passes) — 5 passes/step. But u ← (I + Δt·χ·∇²)u is itself a compact 5-point stencil with center 1 − 4Δtχ/h². An algebraic simplification rule α·I + β·Laplacian → AffineStencil (generally: affine combinations of constant-coefficient stencil leaves) applied ping-pong would make a whole Euler step one fused sweep — ~3 passes/step, a further ~1.7× at DRAM-resident sizes, and 2.3× less traffic than Chmy's 7. Needs: the folded leaf with its declared adjoint (BC contributions included — the invariants stand), explicit trait propagation, and a documented ping-pong idiom. This is the lever Chmy cannot pull cheaply — their flux field is user-visible API, our operator tree is lazy and free to rewrite.

2 and 3 have moved
  • The inner/outer split with comm/compute overlap now lives in the distributed tracker: see #46 (build a blocking exchange and measure it before reaching for overlap) under #79.
  • "Steer explicit stepping away from the flat mul! path" is #87.
Target

Numbers to beat at 2046², 5 threads: Chmy 2193 µs/step (~1.9 Gcells/s). Threading (#51) + item 1 project ~3 passes at 150–250 GB/s → roughly 400–700 µs/step, i.e. 3–5× ahead of Chmy at the sizes where we currently lose.


🤖 Beep boop — Claude again, leaving borrowed-blueprint breadcrumbs so future Kyle doesn't have to reverse-engineer his own benchmark.

主要语言
Julia
星标
3
派生
1
平均合并
1 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RallypointOne/MatrixFreeOperators.jl 的其他 Issue

查看 RallypointOne/MatrixFreeOperators.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。