Skip to content

Prototype SciMLOperators-backed lazy operators#230

Open
cmdr-chara wants to merge 1 commit into
qojulia:masterfrom
cmdr-chara:user/sciml-lazy-operators
Open

Prototype SciMLOperators-backed lazy operators#230
cmdr-chara wants to merge 1 commit into
qojulia:masterfrom
cmdr-chara:user/sciml-lazy-operators

Conversation

@cmdr-chara

Copy link
Copy Markdown

Summary

  • add an optional extension for SciMLOperators with sciml_lazy_operator and cache_sciml_lazy_operator
  • convert LazySum, LazyProduct, and LazyTensor while preserving basis_l and basis_r
  • support dense/sparse conversion, ket/bra mul!, scalar ops, arithmetic, mixed dense multiplication, dagger, and transpose
  • add focused correctness tests and a BenchmarkTools suite that compares the existing lazy path with uncached and cached SciML application

Benchmarks

Short local run on Julia 1.10.10 with SciMLOperators 1.22.0. Times are minimums from 8 samples with a 0.5s budget per benchmark, so they are directional PR data.

case existing lazy uncached wrapper cached wrapper
sum n=6 10.6 us 29.1 us 12.0 us
product n=6 12.3 us 24.8 us 10.0 us
tensor n=8 9.0 us 6.8 us 2.0 us
two-site product n=8 8.3 us 13.1 us 6.3 us
mixed Hamiltonian n=6 50.4 us 81.2 us 55.5 us

The cached SciML path is faster for tensor-heavy cases in this sample, especially LazyTensor and the larger two-site tensor-product composition. Local sums and the mixed Hamiltonian are still slower or close to the current kernels, so the benchmark is evidence for where this path helps and where it does not.

Tests

  • package load without SciMLOperators: passed
  • extension load with SciMLOperators: passed
  • test_sciml_lazy_operators: 12 passed
  • test_aqua: 11 passed, 1 existing broken piracy check
  • git diff --check: clean

Refs qojulia/QuantumOptics.jl#522

AI disclosure: I used GPT-5.5 Extra High/Codex interactively for implementation support. I reviewed the code, corrected issues found during local testing, and ran the checks above.

@cmdr-chara cmdr-chara force-pushed the user/sciml-lazy-operators branch from 797bcef to c1f882a Compare June 8, 2026 21:27
@amilsted

amilsted commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Just a suggestion for benchmarking lazy tensor operators: Be sure to check sparse as well as dense tensor factors, a variety of site dimensions, and cases where the tensor operators act on non-edge sites (i.e. not 1 and n, for an n-site composite system).

@cmdr-chara

Copy link
Copy Markdown
Author

Just a suggestion for benchmarking lazy tensor operators: Be sure to check sparse as well as dense tensor factors, a variety of site dimensions, and cases where the tensor operators act on non-edge sites (i.e. not 1 and n, for an n-site composite system).

Thanks for the suggestion. I expanded the benchmark suite in 4196c61 to cover sparse and dense tensor factors, edge and non-edge tensor sites, and both spin-1/2 and spin-1 local site dimensions.

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.73%. Comparing base (c470242) to head (6fb73a1).

Files with missing lines Patch % Lines
ext/QuantumOpticsBaseSciMLOperatorsExt.jl 95.74% 6 Missing ⚠️
src/QuantumOpticsBase.jl 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #230      +/-   ##
==========================================
+ Coverage   90.76%   91.73%   +0.96%     
==========================================
  Files          26       28       +2     
  Lines        3314     3459     +145     
==========================================
+ Hits         3008     3173     +165     
+ Misses        306      286      -20     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cmdr-chara

cmdr-chara commented Jun 10, 2026

Copy link
Copy Markdown
Author

The OpenCL job in Buildkite build 96 shows as passed with exit status 0, but the GitHub status for buildkite/quantumopticsbase-dot-jl/pr/quantumopticsbase-tests-opencl still appears stuck as pending from when the job started.

The aggregate Buildkite status is green, and the OpenCL log shows Testing QuantumOpticsBase tests passed with Exited with status 0.

@cmdr-chara

Copy link
Copy Markdown
Author

@amilsted Sorry to ping directly. The OpenCL GitHub status still appears stale, while Buildkite build 96 shows the OpenCL job passed with exit status 0. Would you be able to rerun or refresh the Buildkite status for this PR?

@cmdr-chara cmdr-chara force-pushed the user/sciml-lazy-operators branch 3 times, most recently from b72b447 to 03f64df Compare June 11, 2026 15:40
@cmdr-chara cmdr-chara force-pushed the user/sciml-lazy-operators branch from 03f64df to 6fb73a1 Compare June 11, 2026 15:52
@cmdr-chara

Copy link
Copy Markdown
Author

Small note on the force-pushes: I squashed the branch back to one focused commit, then force-pushed follow-ups to fix CI-only Buildkite downstream resolver issues exposed by the rerun.

The current head is 6fb73a1; Buildkite and Codecov are green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants