Exporting a large proof takes hours on one thread; parallel walk and merge, byte-identical (builds on #61)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 8/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- cli, performance
Hướng nghiên cứu
The work is a parallel walk and merge in Export/Par.lean on top of the insertion-ordered IndexSet from #61, with --serial-walk, --serial-output and --export-mdata as the sequential fallbacks. Start by reading the sequential exporter to see its control flow and the Nat/String literal export trigger, then check the two byte-for-byte comparison tests run by lake test. Done means parallel output matches the sequential hash on the listed inputs without slowing them down.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
lean4export is single-threaded. On the formalization of the Riemann hypothesis claim (Alpöge / Sutherland / Rubinstein, 61.57 GB of NDJSON, about 1.07 billion exprs), a 16-core machine sits at one busy core for hours. With #61 applied the full export takes 1 h 53 min 37 s; without it, my run never finished (it stopped writing 7,116 bytes short of the final size and I killed it at 38 hours, details in the field report on #61). Anyone re-checking a big proof from source pays that time before the checker even starts.
What #61 already gives
#61 (by alonbase) replaces the per-object hash map entries with an insertion-ordered index. It is the reason a full-size export finishes on a 125 GiB machine at all. On the same compiled project and the same v4.33.0 tag: exit 0, output sha256 5ea74b91…6be244e, identical to the hash of the export published for this proof. The branch below is stacked on #61 and keeps its IndexSet. Thank you to the author.
What the branch adds
A parallel walk and merge, Export/Par.lean, that writes exactly the bytes the sequential exporter writes:
- a producer thread follows the sequential control flow and spawns one worker per root expression;
- workers record each root's distinct nodes in first-visit post-order;
- one merge thread assigns the global indices in the original order, so numbering is unchanged;
- entries are formatted in batches by tasks and written in order;
- the first Nat or String literal still triggers the
Nat/Char.ofNat/String.ofListexports at the same point, including the re-entrant case inTest.lean.
--serial-walk and --export-mdata keep the sequential walk, and --serial-output turns off the pipelined formatting.
Measurements (one run each at full size, AMD Ryzen 9 5950X, 125 GiB, Ubuntu 24.04, Lean 4.33.1 at the v4.33.0 tag; every output hash identical)
| Input | #61 | #61 + this branch |
|---|---|---|
| full Riemann export | 1:53:37, 86.9 GB peak RSS | 27:35, 88.8 GB peak RSS |
Mathlib.NumberTheory.LSeries.RiemannZeta |
106 to 111 s | 60 to 65 s |
On Lean 4.36.0-rc1 with #61's head as the base (6 vCPU VM): Init 18.0 s vs 9.7 s, Std 29.9 vs 18.6, Lean.Elab.Command 19.5 vs 11.6, Init --export-unsafe 17.7 vs 10.2, Init --export-mdata 15.9 vs 11.7. Ten repeated Std exports gave the same hash every time. lake test passes, with two new tests that compare sequential and parallel output byte for byte.
Costs, stated plainly
- Memory is not lower than #61: +2% peak RSS on the full export, +9 to 23% on small inputs.
- Total CPU time is higher (25 s vs 17.5 s user on
Init); wall time is what drops. - It is one machine and one toolchain pair. I have not tried other proofs at full size.
Questions
- Is this repository the right place, or should it target the exporter in Lean core for v4.35+?
- Would you rather have it as one PR stacked on #61, or wait until #61 merges and rebase?
Branch: https://github.com/abhiapsunde/lean4export/tree/parallel-export (one commit on top of #61's head).
- Ngôn ngữ chính
- Lean
- Star
- 52
- Fork
- 30
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của leanprover/lean4export
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
leanprover/lean4export#40 · 6 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
leanprover/lean4export#64 · 1 bình luận ·
-
Exported binder names and binder info depend on what else is exportedCó thể đã có người làm @JoAdo07 đã nhận 31 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
leanprover/lean4export#58 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
leanprover/lean4export#48 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
leanprover/lean4export#8 · 2 bình luận ·
Tất cả issue của leanprover/lean4export
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
tamatebako/tebako#1155 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
neondatabase/neon-pkgs#1328 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Z-LibraryĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit bug priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
SocketDev/socket-patch#2364 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày