Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
319 changes: 120 additions & 199 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pest = "2"
pest_derive = "2"
tempfile = "3"
assert_cmd = "2"
wasmtime = { version = "41", default-features = false, features = [
wasmtime = { version = "42", default-features = false, features = [
"cranelift",
"runtime",
"wat",
Expand All @@ -51,6 +51,7 @@ wat = "1"
ron = "0.12"
tket = { version = "0.17", default-features = false }
tket-qsystem = { version = "0.23", default-features = false }
bindgen = "0.72"
cc = "1"
cxx = "1"
cxx-build = "1"
Expand Down Expand Up @@ -98,6 +99,7 @@ bitvec = { version = "1", features = ["serde"] }
ndarray = "0.17"

# RNG
fastrand = "2"
rand = "0.10"
rand_core = "0.10"
rand_xoshiro = "0.8"
Expand Down Expand Up @@ -145,6 +147,7 @@ pecos-num = { version = "0.1.1", path = "crates/pecos-num" }
pecos-quantum = { version = "0.1.1", path = "crates/pecos-quantum" }
pecos-gpu-sims = { version = "0.1.1", path = "crates/pecos-gpu-sims" }
pecos-cuquantum = { version = "0.1.1", path = "crates/pecos-cuquantum" }
pecos-cuquantum-sys = { version = "0.1.1", path = "crates/pecos-cuquantum-sys" }

# Decoder crates
pecos-decoder-core = { version = "0.1.1", path = "crates/pecos-decoder-core" }
Expand Down
9 changes: 5 additions & 4 deletions crates/benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ all-sims = ["gpu-sims", "cuquantum", "quest", "qulacs", "cppsparsesim"]

[dependencies]
# Optional simulator dependencies for benchmarking
pecos-gpu-sims = { path = "../pecos-gpu-sims", optional = true }
pecos-cuquantum = { path = "../pecos-cuquantum", optional = true }
pecos-quest = { path = "../pecos-quest", optional = true }
pecos-qulacs = { path = "../pecos-qulacs", optional = true }
pecos-gpu-sims = { workspace = true, optional = true }
pecos-cuquantum = { workspace = true, optional = true }
pecos-quest = { workspace = true, optional = true }
pecos-qulacs = { workspace = true, optional = true }
pecos-cppsparsesim = { workspace = true, optional = true }
pecos-core.workspace = true
pecos-qsim.workspace = true

[dev-dependencies]
criterion.workspace = true
cxx.workspace = true
num-complex.workspace = true
pecos = { workspace = true, features = ["runtime"] }
pecos-engines.workspace = true
Expand Down
12 changes: 10 additions & 2 deletions crates/benchmarks/benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ mod modules {
pub mod dem_sampler;
pub mod dod_statevec;
// TODO: pub mod hadamard_ops;
#[cfg(feature = "cuquantum")]
pub mod cuquantum;
#[cfg(feature = "gpu-sims")]
pub mod gpu_influence_sampler;
pub mod measurement_sampling;
pub mod native_statevec_comparison;
pub mod noise_models;
#[cfg(feature = "cppsparsesim")]
pub mod sparse_stab_vs_cpp;
Expand All @@ -34,24 +37,29 @@ mod modules {
pub mod trig;
}

#[cfg(feature = "cuquantum")]
use modules::cuquantum;
#[cfg(feature = "gpu-sims")]
use modules::gpu_influence_sampler;
#[cfg(feature = "cppsparsesim")]
use modules::sparse_stab_vs_cpp;
use modules::{
allocation_overhead, cpu_stabilizer_comparison, dem_sampler, dod_statevec,
measurement_sampling, noise_models, rng, set_ops, sparse_state_vec, stabilizer_sims,
state_vec_sims, surface_code, trig,
measurement_sampling, native_statevec_comparison, noise_models, rng, set_ops, sparse_state_vec,
stabilizer_sims, state_vec_sims, surface_code, trig,
};

fn all_benchmarks(c: &mut Criterion) {
allocation_overhead::benchmarks(c);
cpu_stabilizer_comparison::benchmarks(c);
#[cfg(feature = "cuquantum")]
cuquantum::benchmarks(c);
dem_sampler::benchmarks(c);
dod_statevec::benchmarks(c);
#[cfg(feature = "gpu-sims")]
gpu_influence_sampler::benchmarks(c);
measurement_sampling::benchmarks(c);
native_statevec_comparison::benchmarks(c);
noise_models::benchmarks(c);
rng::benchmarks(c);
set_ops::benchmarks(c);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
//! Benchmarks for pecos-cuquantum GPU simulators
// Copyright 2026 The PECOS Developers
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under
// the License.

//! Benchmarks for pecos-cuquantum GPU simulators.
//!
//! These benchmarks compare cuQuantum GPU simulation performance against
//! other backends (e.g., wgpu-based simulators).
//! Benchmarks cuQuantum state vector and stabilizer simulation performance.
//!
//! Run with: `cargo bench -p pecos-cuquantum --features integration-tests`
//! Run with: `cargo bench -p benchmarks --features cuquantum`
//!
//! **Requires cuQuantum to be installed.**

use criterion::{BenchmarkId, Criterion, Throughput, black_box, criterion_group, criterion_main};
use criterion::{BenchmarkId, Criterion, Throughput};
use pecos_core::Angle64;
use pecos_cuquantum::{CuStabilizer, CuStateVec, QubitId, TryClone, is_cuquantum_available};
use pecos_qsim::{ArbitraryRotationGateable, CliffordGateable, QuantumSimulator};
use std::f64::consts::PI;
use std::hint::black_box;

/// Benchmark state vector simulation for different qubit counts
fn bench_statevec_gates(c: &mut Criterion) {
Expand Down Expand Up @@ -368,7 +380,7 @@ fn bench_sampling(c: &mut Criterion) {
group.finish();
}

/// Benchmark Clone and TryClone operations
/// Benchmark Clone and `TryClone` operations
fn bench_clone(c: &mut Criterion) {
if !is_cuquantum_available() {
eprintln!("Skipping clone benchmarks: cuQuantum not available");
Expand Down Expand Up @@ -424,15 +436,13 @@ fn bench_clone(c: &mut Criterion) {
group.finish();
}

criterion_group!(
benches,
bench_statevec_gates,
bench_stabilizer_gates,
bench_bell_state,
bench_surface_code_syndrome,
bench_rotation_gates,
bench_two_qubit_rotation_gates,
bench_sampling,
bench_clone,
);
criterion_main!(benches);
pub fn benchmarks(c: &mut Criterion) {
bench_statevec_gates(c);
bench_stabilizer_gates(c);
bench_bell_state(c);
bench_surface_code_syndrome(c);
bench_rotation_gates(c);
bench_two_qubit_rotation_gates(c);
bench_sampling(c);
bench_clone(c);
}
Loading
Loading