Block mala fix#10
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a PR-time benchmarking/regression framework for ParallelMCMC.jl and, alongside that, refactors core MALA/DEER paths to reduce allocations (workspaces, in-place batched primitives) and improve docs/tests around the new behaviors.
Changes:
- Add a PR regression benchmark suite + scripts and a GitHub Actions workflow to run/compare benchmarks on pull requests.
- Refactor MALA and DEER internals to use reusable workspaces and add
copy_resultbehavior inDEER.solveto control output aliasing. - Expand/adjust tests and documentation to reflect new defaults (e.g.,
:stoch_diag) and new behaviors (workspace reuse, copy semantics).
Reviewed changes
Copilot reviewed 35 out of 39 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
test/test-Jacobian-Estimator.jl |
Adds a tagged vector test to validate “x-like” storage defaults and some formatting cleanup. |
test/test-GPU-MALA.jl |
Minor formatting cleanup. |
test/test-GPU-DEER.jl |
Formatting changes to GPU recursion construction and testset layout. |
test/test-Deer-vs-MALA.jl |
Adds tests for workspace result copying/aliasing semantics and formatting cleanup. |
test/test-DEERScan.jl |
Adds a CPU scan correctness testset and tweaks tolerances/formatting. |
test/test-DEER-Turing-Logistic.jl |
Formatting changes and minor refactors in test setup. |
test/test-DEER-Interface.jl |
Adds validation test for unsupported jacobian mode and formatting cleanup. |
test/test-Adaptive-MALA.jl |
Adds tests for the new in-place step API and workspace presence in state. |
test/test-AbstractMCMC-Interface.jl |
Adds tests asserting workspace reuse in AbstractMCMC state. |
src/interface.jl |
Introduces sampler state workspaces, in-place stepping usage, new PR-sampling path, Jacobian mode validation, and additional DEER solve wiring. |
src/MALA/MALA.jl |
Adds/exports in-place step APIs and batched workspaces; refactors mass-matrix ops to in-place forms; adds batched in-place kernels. |
src/DEER/DEERScan.jl |
Refactors scan implementation (less prefix copying, early return) and formatting improvements. |
src/DEER/DEER.jl |
Adds workspace buffers, improves array-copy patterns, updates Hutchinson probe buffer allocation to be “x-like”, and adds copy_result behavior to solve. |
docs/src/index.md |
Adds logo/animation, improves landing page narrative, updates installation snippet and quickstart defaults. |
docs/src/assets/make_julia_deer_gif.jl |
Adds a script to regenerate the landing-page GIF asset. |
docs/src/95-reference.md |
Updates reference layout and adds low-level namespace docs links. |
docs/src/91-developer.md |
Updates local docs build instructions to match CI and simplifies release checklist. |
docs/src/90-contributing.md |
Rewrites contributing guidance for clarity and links to CoC. |
docs/src/20-algorithms.md |
Updates algorithm doc wording and clarifies supported Jacobian modes + copy_result semantics. |
docs/src/10-getting-started.md |
Updates default Jacobian mode in examples and adjusts AD example. |
docs/make.jl |
Updates Documenter repo configuration and HTML settings. |
benchmarks/ParallelMCMCBenchmarks/src/runners/mala_runner.jl |
Updates runner to use in-place stepping + workspace reuse. |
benchmarks/ParallelMCMCBenchmarks/src/pr_suite.jl |
Adds the PR regression benchmark suite module and result writers. |
benchmarks/ParallelMCMCBenchmarks/src/models/bayes_logreg.jl |
Refactors logistic regression model closures toward fewer allocations / buffer reuse. |
benchmarks/ParallelMCMCBenchmarks/src/ParallelMCMCBenchmarks.jl |
Exports and includes the PR benchmark suite module. |
benchmarks/ParallelMCMCBenchmarks/scripts/profile_deer_logreg_components.jl |
Adjusts profiling script formatting and sets copy_result=false for workspace reuse. |
benchmarks/ParallelMCMCBenchmarks/scripts/prof_view.jl |
Formatting and sets copy_result=false for workspace reuse. |
benchmarks/ParallelMCMCBenchmarks/scripts/pr_benchmarks.jl |
Adds CLI runner for the PR benchmark suite (TOML + Markdown outputs). |
benchmarks/ParallelMCMCBenchmarks/scripts/new_bench.jl |
Formatting + sets copy_result=false for workspace reuse. |
benchmarks/ParallelMCMCBenchmarks/scripts/compare_pr_benchmarks.jl |
Adds CI-oriented benchmark comparison + Markdown summary generator. |
benchmarks/ParallelMCMCBenchmarks/scripts/bench_mala_bayes.jl |
Formatting cleanup in benchmark script. |
benchmarks/ParallelMCMCBenchmarks/scripts/bench_deer_logreg.jl |
Updates default T sweep values and formatting improvements. |
benchmarks/ParallelMCMCBenchmarks/README.md |
Adds documentation for the PR regression benchmark suite and thresholds. |
benchmarks/ParallelMCMCBenchmarks/Project.toml |
Adds TOML dependency for result reading/writing. |
README.md |
Major README refresh with images, narrative, and updated quickstart. |
.gitignore |
Ignores benchmark output artifacts and .codex. |
.github/workflows/Benchmarks.yml |
Adds PR benchmark workflow: run base/head benchmarks, compare, upload artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (84.95%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #10 +/- ##
==========================================
+ Coverage 85.01% 88.91% +3.89%
==========================================
Files 4 6 +2
Lines 467 1046 +579
==========================================
+ Hits 397 930 +533
- Misses 70 116 +46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request introduces a comprehensive benchmarking framework for
ParallelMCMC.jl, including automated CI benchmarking on pull requests, new benchmark scripts, and improved documentation. The main goal is to detect and prevent performance regressions by comparing PRs against the base branch, with clear reporting and failure thresholds. Several code formatting and documentation improvements are also included.Automated Benchmarking and CI Integration:
Added a new GitHub Actions workflow (
.github/workflows/Benchmarks.yml) that runs benchmarks on pull requests, compares results to the base branch, and uploads detailed reports. The workflow includes environment setup, separate checkouts for base and PR, benchmark execution, result comparison, and artifact upload.Introduced a regression comparison script (
benchmarks/ParallelMCMCBenchmarks/scripts/compare_pr_benchmarks.jl) that compares benchmark results, applies configurable thresholds for warnings and failures, and generates Markdown summaries for CI job outputs.Benchmark Suite and Documentation:
Added a dedicated benchmark suite (
benchmarks/ParallelMCMCBenchmarks) with a README describing the PR regression suite, how to run and compare benchmarks locally, and notes about GPU benchmarking.Updated the benchmarks'
Project.tomlto include theTOMLdependency required by the new comparison script.Documentation and Usability Improvements:
README.mdwith a project logo, illustrative animation, algorithm description, quickstart guide, and improved contributing instructions.Code Formatting and Minor Improvements:
These changes collectively establish a robust performance regression framework, improve developer workflow, and enhance project documentation.