-
Notifications
You must be signed in to change notification settings - Fork 6
Adaptive Pauli-Lindbladian shim + adaptive-evolution demo #98
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
Closed
Closed
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
177fbee
feat(python-native): Rust shim for adaptive Pauli-Lindbladian time ev…
AlexSchuckert 962ba18
feat(python): adaptive Lindbladian demo, shim tests, lazy SciPy
AlexSchuckert 1a7d054
feat(lindblad): extract ppvm-lindblad crate, non-Hermitian jumps, pur…
AlexSchuckert ea294e3
feat(python): Lindbladian pc_step, sigma_plus/minus jumps, convergenc…
AlexSchuckert 5e70242
Fix SPDX header formatting in lindblad.py
Copilot e54b88c
review: address PR #98 review comments
AlexSchuckert 9fd6ef5
review(ppvm-lindblad): swap custom CsrMatrix for sprs::CsMatI<f64, u3…
AlexSchuckert e043ae1
feat(ppvm-lindblad): add `drop_tol` to pc_step for in-Rust basis pruning
AlexSchuckert 5ad4e83
Remove action_cache from LindbladSpec
AlexSchuckert 53f7ff2
perf(ppvm-lindblad): mimalloc allocator + chunked leakage → ~50% peak…
AlexSchuckert d763aa8
feat(lindblad): K parameter for pc_step; default K=5
AlexSchuckert dfc3204
Merge remote-tracking branch 'origin/main' into lindblad-pr-fixes
AlexSchuckert a591310
feat(ppvm-lindblad): matrix-free pc_step, rk4_step, and memory opts
AlexSchuckert a8e4dcc
Update Julia version and make sure benchmarks are consistent
david-pl 6dca8a5
Merge branch 'main' into david/update-julia-benches
david-pl 13aaad4
More efficient weight calculation
david-pl 1a67b31
Inline cutoff
david-pl 1a2b8f8
Hard-code weight to avoid slicing overhead
david-pl 8ea602f
Add an early return for max_weight == usize::MAX
david-pl 0072256
Remove svg
david-pl 3fa4a0f
Merge david/fix-weight-calc (#126, faster weight calc) into lindblad-…
AlexSchuckert b2e06c9
fix(ppvm-lindblad): set max_krylov_m in ExpmOpts test constructors
AlexSchuckert fe486ff
feat(ppvm-lindblad): drive real expm action via quspin-expm (matrix-f…
AlexSchuckert 84ab1a1
refactor(ppvm-lindblad): remove retired expm engine and CSR-for-real …
AlexSchuckert b07f75d
refactor(ppvm-lindblad): address PR #98 review comments
AlexSchuckert f14edaf
refactor(ppvm-python-native): drop the mimalloc global allocator
AlexSchuckert 7c458d6
Remove jfrog sources from uv.lock
david-pl 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,20 @@ | ||
| [package] | ||
| name = "ppvm-lindblad" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
| description = "Direct Heisenberg-picture Lindbladian evolution on an adaptive Pauli-string basis." | ||
|
|
||
| [dependencies] | ||
| fxhash = "0.2.1" | ||
| num = "0.4.3" | ||
| ppvm-runtime = { version = "0.1.0", path = "../ppvm-runtime" } | ||
| rayon = "1.11" | ||
| sprs = { version = "0.11", default-features = false, features = ["multi_thread"] } | ||
|
|
||
| [dev-dependencies] | ||
| approx = "0.5.1" | ||
| criterion = "0.7.0" | ||
|
|
||
| [[bench]] | ||
| name = "spmv_scaling" | ||
| harness = false |
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,66 @@ | ||
| // SPDX-FileCopyrightText: 2026 The PPVM Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| //! Parallel SpMV scaling on a tridiagonal CSR matrix. Sweeps both matrix | ||
| //! size and thread count, so we can see where parallelism actually pays | ||
| //! off (compute-bound, L3-fitting) vs where DRAM bandwidth ceilings out | ||
| //! the speedup (large matrices). Each invocation runs inside a freshly | ||
| //! built rayon pool of the requested size. | ||
|
|
||
| use criterion::{BenchmarkId, Criterion, Throughput, criterion_group, criterion_main}; | ||
| use ppvm_lindblad::{Csr, csr_from_triplets, spmv_parallel}; | ||
|
|
||
| fn build_tridiagonal(n: usize) -> Csr { | ||
| let mut trips = Vec::with_capacity(3 * n); | ||
| for i in 0..n { | ||
| trips.push((i, i, -2.0)); | ||
| if i > 0 { | ||
| trips.push((i, i - 1, 1.0)); | ||
| } | ||
| if i + 1 < n { | ||
| trips.push((i, i + 1, 1.0)); | ||
| } | ||
| } | ||
| csr_from_triplets(n, &trips) | ||
| } | ||
|
|
||
| fn bench_spmv_scaling(c: &mut Criterion) { | ||
| // (n, label) pairs: nnz ≈ 3n. ~16 bytes per nonzero (usize indices + f64) | ||
| // + 8 bytes per row. | ||
| // | ||
| // n = 100_000 → nnz ≈ 300_000 → ~5 MB (fits L2/L3, compute-bound) | ||
| // n = 500_000 → nnz ≈ 1_500_000 → ~24 MB (L3 boundary on M-series) | ||
| // n = 2_000_000 → nnz ≈ 6_000_000 → ~96 MB (busts L3, bandwidth-bound) | ||
| // n = 8_000_000 → nnz ≈ 24_000_000 → ~384 MB (well into DRAM) | ||
| let sizes = [100_000usize, 500_000, 2_000_000, 8_000_000]; | ||
|
|
||
| for &n in &sizes { | ||
| let m = build_tridiagonal(n); | ||
| let x: Vec<f64> = (0..n).map(|i| (i as f64).sin()).collect(); | ||
|
|
||
| let mut group = c.benchmark_group(format!("spmv_parallel/n={}", n)); | ||
| group.throughput(Throughput::Elements(m.nnz() as u64)); | ||
| group.sample_size(30); | ||
| group.measurement_time(std::time::Duration::from_secs(3)); | ||
| group.warm_up_time(std::time::Duration::from_secs(1)); | ||
|
|
||
| for &threads in &[1usize, 2, 4, 8] { | ||
| let pool = rayon::ThreadPoolBuilder::new() | ||
| .num_threads(threads) | ||
| .build() | ||
| .unwrap(); | ||
| group.bench_with_input(BenchmarkId::from_parameter(threads), &threads, |b, _| { | ||
| b.iter_batched_ref( | ||
| || vec![0f64; n], | ||
| |y| pool.install(|| spmv_parallel(&m, &x, y)), | ||
| criterion::BatchSize::SmallInput, | ||
| ); | ||
| }); | ||
| } | ||
|
|
||
| group.finish(); | ||
| } | ||
| } | ||
|
|
||
| criterion_group!(benches, bench_spmv_scaling); | ||
| criterion_main!(benches); | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we post in the PR comment about the result of this benchmark for future reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obsolete: the
spmv_scalingbenchmark has been removed -- it benchmarked the now-deleted real-CSR SpMV. The matrix-exponential action is now provided by the externalquspin-expmcrate.