diff --git a/julia-benchmarks/Manifest.toml b/julia-benchmarks/Manifest.toml index d846d81c..63e0085e 100644 --- a/julia-benchmarks/Manifest.toml +++ b/julia-benchmarks/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.12.6" +julia_version = "1.12.5" manifest_format = "2.0" project_hash = "52f0dd51f0e051696bfc24b6c265049f3b4a890d" @@ -882,15 +882,17 @@ version = "2.8.5" [[deps.PauliPropagation]] deps = ["AcceleratedKernels", "BitIntegers", "Bits", "JSON", "LinearAlgebra", "PlotGraphviz", "ProfileCanvas", "Random", "StatsBase", "Test", "UUIDs"] -git-tree-sha1 = "757b43af3c247d9fad953dd056d3df76fe6e6a08" +git-tree-sha1 = "25a5e6eebc97b9680e16ab7e80dfb1969d828e24" uuid = "293282d5-3c99-4fb6-92d0-fd3280a19750" -version = "0.7.3" +version = "0.8.1" [deps.PauliPropagation.extensions] PauliPropagationCUDA = "CUDA" + PauliPropagationYao = "YaoBlocks" [deps.PauliPropagation.weakdeps] CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" + YaoBlocks = "418bc28f-b43b-5e0b-a6e7-61bbc1a2c1df" [[deps.PauliStrings]] deps = ["BitIntegers", "Combinatorics", "Dictionaries", "LinearAlgebra", "ProgressBars", "Random", "SparseArrays"] diff --git a/julia-benchmarks/benches/xbench_pp.jl b/julia-benchmarks/benches/xbench_pp.jl index 15087b28..1735f1ff 100644 --- a/julia-benchmarks/benches/xbench_pp.jl +++ b/julia-benchmarks/benches/xbench_pp.jl @@ -10,6 +10,7 @@ # julia --project=@. -t1 benches/xbench_pp.jl using PauliPropagation +import PauliPropagation.Performance using Printf const MODEL = get(ENV, "MODEL", "tfim") @@ -25,49 +26,44 @@ const THETA_SITE = 2 * HFIELD * DT """The seed observable: `Σ_i Z_i` for TFIM, `Z_1` for Heisenberg.""" function seed_operator(n::Int) - ps = PauliSum(n) if MODEL == "tfim" - for i in 1:n - add!(ps, PauliString(n, [:Z], [i])) - end - else - add!(ps, PauliString(n, [:Z], [1])) + return VectorPauliSum(n, [PauliString(n, [:Z], [i]).term for i in 1:n], ones(n)) end - return ps + return VectorPauliSum(PauliString(n, [:Z], [1])) end """One first-order Trotter step, gates in the order the shared spec fixes.""" -function trotter_step!(state, n::Int) +function trotter_step!(cache, n::Int) if MODEL == "tfim" for i in 1:n - state = propagate(PauliRotation([:X], [i], THETA_SITE), state; min_abs_coeff = ATOL) + Performance.propagate!(PauliRotation([:X], [i], THETA_SITE), cache; min_abs_coeff = ATOL) end for i in 1:(n - 1) - state = propagate( - PauliRotation([:Z, :Z], [i, i + 1], THETA_BOND), state; min_abs_coeff = ATOL + Performance.propagate!( + PauliRotation([:Z, :Z], [i, i + 1], THETA_BOND), cache; min_abs_coeff = ATOL ) end else for i in 1:(n - 1) for axes in ([:X, :X], [:Y, :Y], [:Z, :Z]) - state = propagate( - PauliRotation(axes, [i, i + 1], THETA_BOND), state; min_abs_coeff = ATOL + Performance.propagate!( + PauliRotation(axes, [i, i + 1], THETA_BOND), cache; min_abs_coeff = ATOL ) end end for i in 1:n - state = propagate(PauliRotation([:Z], [i], THETA_SITE), state; min_abs_coeff = ATOL) + Performance.propagate!(PauliRotation([:Z], [i], THETA_SITE), cache; min_abs_coeff = ATOL) end end - return state + return cache end function run_model(n::Int) - state = seed_operator(n) + cache = PropagationCache(seed_operator(n)) for _ in 1:STEPS - state = trotter_step!(state, n) + trotter_step!(cache, n) end - return state + return PauliPropagation.extractsum!(cache) end """`⟨0…0|O|0…0⟩` for TFIM; the `Z_1` autocorrelator for Heisenberg."""