-
Notifications
You must be signed in to change notification settings - Fork 1
Block mala fix #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Block mala fix #10
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
54a2afc
BlockMALA sampler ggo brrrrrr
rsenne fcd87fe
Update README.md
rsenne 37cf294
add benchmarking
rsenne ae2e999
Overhaul docs
rsenne 7279607
Fixes copilot issues
rsenne 4599415
fix turing errors
rsenne af8d60b
finally fix DynamicPPL + Enzyme issue
rsenne 3599e3f
Add more tests. Attempt benchjmark fix.
rsenne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| name: Benchmarks | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - ".github/workflows/Benchmarks.yml" | ||
| - "Project.toml" | ||
| - "src/**" | ||
| - "ext/**" | ||
| - "benchmarks/**" | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| benchmark: | ||
| name: PR benchmark comparison | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
|
|
||
| env: | ||
| PMCMC_BENCH_SECONDS: "0.5" | ||
| PMCMC_BENCH_SAMPLES: "8" | ||
| PMCMC_BENCH_WARN_RATIO: "1.25" | ||
| PMCMC_BENCH_FAIL_RATIO: "1.75" | ||
| JULIA_NUM_PRECOMPILE_TASKS: "1" | ||
|
|
||
| steps: | ||
| - name: Checkout base | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: ${{ github.event.pull_request.base.repo.full_name }} | ||
| ref: ${{ github.event.pull_request.base.sha }} | ||
| path: base | ||
|
|
||
| - name: Checkout PR head | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| path: head | ||
|
|
||
| - uses: julia-actions/setup-julia@v2 | ||
| with: | ||
| version: "1" | ||
| arch: x64 | ||
|
|
||
| - name: Use Julia cache | ||
| uses: julia-actions/cache@v3 | ||
|
|
||
| - name: Instantiate base package in benchmark environment | ||
| working-directory: head/benchmarks/ParallelMCMCBenchmarks | ||
| run: | | ||
| julia --project=. -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(ENV["GITHUB_WORKSPACE"], "base"))); Pkg.instantiate()' | ||
|
|
||
| - name: Run base benchmarks | ||
| run: | | ||
| julia --project="$GITHUB_WORKSPACE/head/benchmarks/ParallelMCMCBenchmarks" \ | ||
| "$GITHUB_WORKSPACE/head/benchmarks/ParallelMCMCBenchmarks/scripts/pr_benchmarks.jl" \ | ||
| --seconds "$PMCMC_BENCH_SECONDS" \ | ||
| --samples "$PMCMC_BENCH_SAMPLES" \ | ||
| --output "$GITHUB_WORKSPACE/base-benchmarks.toml" \ | ||
| --markdown "$GITHUB_WORKSPACE/base-benchmarks.md" | ||
|
|
||
| - name: Instantiate PR package in benchmark environment | ||
| working-directory: head/benchmarks/ParallelMCMCBenchmarks | ||
| run: | | ||
| julia --project=. -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(ENV["GITHUB_WORKSPACE"], "head"))); Pkg.instantiate()' | ||
|
|
||
| - name: Run PR benchmarks | ||
| run: | | ||
| julia --project="$GITHUB_WORKSPACE/head/benchmarks/ParallelMCMCBenchmarks" \ | ||
| "$GITHUB_WORKSPACE/head/benchmarks/ParallelMCMCBenchmarks/scripts/pr_benchmarks.jl" \ | ||
| --seconds "$PMCMC_BENCH_SECONDS" \ | ||
| --samples "$PMCMC_BENCH_SAMPLES" \ | ||
| --output "$GITHUB_WORKSPACE/head-benchmarks.toml" \ | ||
| --markdown "$GITHUB_WORKSPACE/head-benchmarks.md" | ||
|
|
||
| - name: Compare benchmarks | ||
| run: | | ||
| set +e | ||
| julia "$GITHUB_WORKSPACE/head/benchmarks/ParallelMCMCBenchmarks/scripts/compare_pr_benchmarks.jl" \ | ||
| --base "$GITHUB_WORKSPACE/base-benchmarks.toml" \ | ||
| --head "$GITHUB_WORKSPACE/head-benchmarks.toml" \ | ||
| --warn-ratio "$PMCMC_BENCH_WARN_RATIO" \ | ||
| --fail-ratio "$PMCMC_BENCH_FAIL_RATIO" \ | ||
| --markdown "$GITHUB_WORKSPACE/benchmark-comparison.md" | ||
| status=$? | ||
| cat "$GITHUB_WORKSPACE/benchmark-comparison.md" >> "$GITHUB_STEP_SUMMARY" | ||
| exit "$status" | ||
|
|
||
| - name: Upload benchmark results | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: pr-benchmark-results | ||
| path: | | ||
| base-benchmarks.toml | ||
| base-benchmarks.md | ||
| head-benchmarks.toml | ||
| head-benchmarks.md | ||
| benchmark-comparison.md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # ParallelMCMC Benchmarks | ||
|
|
||
| This package holds reproducible benchmark workloads for `ParallelMCMC.jl`. | ||
|
|
||
| ## PR Regression Suite | ||
|
|
||
| The pull request workflow runs a small CPU-only suite against both the PR head | ||
| and the PR base commit, then compares median runtimes. It covers: | ||
|
|
||
| - one allocation-light MALA transition, | ||
| - the diagonal affine scan used by quasi-DEER, | ||
| - a full DEER block solve on a taped Gaussian MALA trajectory, | ||
| - the public `ParallelMALASampler` path on a small Bayesian logistic regression. | ||
|
|
||
| Run the same suite locally from the repository root with: | ||
|
|
||
| ```bash | ||
| julia --project=benchmarks/ParallelMCMCBenchmarks \ | ||
| benchmarks/ParallelMCMCBenchmarks/scripts/pr_benchmarks.jl \ | ||
| --output pr-benchmarks.toml \ | ||
| --markdown pr-benchmarks.md | ||
| ``` | ||
|
|
||
| To compare two result files: | ||
|
|
||
| ```bash | ||
| julia benchmarks/ParallelMCMCBenchmarks/scripts/compare_pr_benchmarks.jl \ | ||
| --base base-benchmarks.toml \ | ||
| --head head-benchmarks.toml \ | ||
| --markdown benchmark-comparison.md | ||
| ``` | ||
|
|
||
| CI marks a benchmark as `watch` above a 1.25x median-time ratio and fails above | ||
| 1.75x. The thresholds can be adjusted with `PMCMC_BENCH_WARN_RATIO` and | ||
| `PMCMC_BENCH_FAIL_RATIO`. | ||
|
|
||
| ## Manual GPU Sweeps | ||
|
|
||
| The existing scripts in `scripts/` are still intended for deeper manual | ||
| throughput and GPU investigations. They are not part of the PR gate because | ||
| standard GitHub-hosted runners do not provide CUDA hardware. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.