Skip to content

Commit 0a0f034

Browse files
authored
Update dev2
* Adding Rust state-vector sim * Adding Angle Type
1 parent 4db36fb commit 0a0f034

56 files changed

Lines changed: 11564 additions & 3291 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 372 additions & 1819 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[workspace]
22
resolver = "2"
33
members = [
4+
"python/pecos-rslib/rust",
45
"crates/pecos*",
56
"crates/benchmarks",
67
]
@@ -20,27 +21,44 @@ keywords = ["scientific", "quantum", "QEC"]
2021
categories = ["science", "simulation"]
2122

2223
[workspace.dependencies]
24+
rand = "0.9"
25+
rand_chacha = "0.9"
26+
rand_xoshiro = "0.7"
27+
uuid = { version = "1", features = ["v4"] }
2328
pyo3 = "0.23"
24-
rand = "0.8"
25-
rand_chacha = "0.3"
26-
rand_xoshiro = "0.6"
29+
pyo3-build-config = { version = "0.24", features = ["resolve-config"] }
30+
log = "0.4"
31+
env_logger = "0.11"
32+
memmap2 = "0.9"
33+
serde = { version = "1", features = ["derive"] }
34+
os_pipe = "1"
35+
lazy_static = "1"
36+
parking_lot = "0.12"
37+
serde_json = "1"
38+
num-complex = "0.4"
39+
num-traits = "0.2"
40+
criterion = "0.5"
2741

2842
pecos-core = { version = "0.1.1", path = "crates/pecos-core" }
2943
pecos-qsim = { version = "0.1.1", path = "crates/pecos-qsim" }
3044
pecos-qec = { version = "0.1.1", path = "crates/pecos-qec" }
3145
pecos = { version = "0.1.1", path = "crates/pecos" }
32-
pecos-python = { version = "0.1.1", path = "crates/pecos-python" }
46+
pecos-rslib = { version = "0.1.1", path = "python/pecos-rslib/rust"}
3347

3448
[profile.release]
3549
codegen-units = 1
3650
lto = "fat"
3751

3852
[workspace.lints.clippy]
3953
# For more details see: https://doc.rust-lang.org/clippy/lints.html
40-
suspicious = "warn"
41-
complexity = "warn"
42-
perf = "warn"
43-
style = "warn"
44-
pedantic = "warn"
54+
suspicious = { level = "warn", priority = -1 }
55+
complexity = { level = "warn", priority = -1 }
56+
perf = { level = "warn", priority = -1 }
57+
style = { level = "warn", priority = -1 }
58+
pedantic = { level = "warn", priority = -1 }
4559
# restriction = "warn"
46-
cargo = "warn"
60+
cargo = { level = "warn", priority = -1 }
61+
multiple-crate-versions = "allow" # TODO: remove when possible
62+
63+
[workspace.metadata.commands]
64+
test-py = ["./scripts/setup-env.sh", "cargo", "test", "-p", "pecos-python"]

Makefile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,24 @@ installreqs: ## Install Python project requirements to root .venv
2424
# ---------------------------------
2525
.PHONY: build
2626
build: installreqs ## Compile and install for development
27-
cd python/pecos-rslib/ && uv run maturin develop --uv
28-
cd python/quantum-pecos && uv pip install -e .[all]
27+
@unset CONDA_PREFIX && cd python/pecos-rslib/ && uv run maturin develop --uv
28+
@unset CONDA_PREFIX && cd python/quantum-pecos && uv pip install -e .[all]
2929

3030
.PHONY: build-basic
3131
build-basic: installreqs ## Compile and install for development but do not include install extras
32-
cd python/pecos-rslib/ && uv run maturin develop --uv
33-
cd python/quantum-pecos && uv pip install -e .
32+
@unset CONDA_PREFIX && cd python/pecos-rslib/ && uv run maturin develop --uv
33+
@unset CONDA_PREFIX && cd python/quantum-pecos && uv pip install -e .
3434

3535
.PHONY: build-release
3636
build-release: installreqs ## Build a faster version of binaries
37-
cd python/pecos-rslib/ && uv run maturin develop --uv --release
38-
cd python/quantum-pecos && uv pip install -e .[all]
37+
@unset CONDA_PREFIX && cd python/pecos-rslib/ && uv run maturin develop --uv --release
38+
@unset CONDA_PREFIX && cd python/quantum-pecos && uv pip install -e .[all]
3939

4040
.PHONY: build-native
4141
build-native: installreqs ## Build a faster version of binaries with native CPU optimization
42-
cd python/pecos-rslib/ && RUSTFLAGS='-C target-cpu=native' \
42+
@unset CONDA_PREFIX && cd python/pecos-rslib/ && RUSTFLAGS='-C target-cpu=native' \
4343
&& uv run maturin develop --uv --release
44-
cd python/quantum-pecos && uv pip install -e .[all]
44+
@unset CONDA_PREFIX && cd python/quantum-pecos && uv pip install -e .[all]
4545

4646
# Documentation
4747
# -------------
@@ -79,14 +79,15 @@ rstest: ## Run Rust tests
7979
.PHONY: pytest
8080
pytest: ## Run tests on the Python package (not including optional dependencies). ASSUMES: previous build command
8181
uv run pytest ./python/tests/ -m "not optional_dependency"
82+
uv run pytest ./python/pecos-rslib/tests/
8283

8384
.PHONY: pytest-dep
8485
pytest-dep: ## Run tests on the Python package only for optional dependencies. ASSUMES: previous build command
8586
uv run pytest ./python/tests/ -m optional_dependency
8687

8788
.PHONY: pytest-all
88-
pytest-all: ## Run all tests on the Python package ASSUMES: previous build command
89-
uv run pytest ./python/tests/
89+
pytest-all: pytest ## Run all tests on the Python package ASSUMES: previous build command
90+
uv run pytest ./python/tests/ -m "optional_dependency"
9091

9192
# .PHONY: pytest-doc
9293
# pydoctest: ## Run doctests with pytest. ASSUMES: A build command was ran previously. ASSUMES: previous build command
@@ -103,13 +104,13 @@ test: rstest pytest-all ## Run all tests. ASSUMES: previous build command
103104
clean: ## Clean up caches and build artifacts
104105
@rm -rf *.egg-info
105106
@rm -rf dist
106-
@rm -rf **/build/
107+
@find . -type d -name "build" -exec rm -rf {} +
107108
@rm -rf python/docs/_build
108-
@rm -rf **/.pytest_cache/
109-
@rm -rf **/.ipynb_checkpoints
109+
@find . -type d -name ".pytest_cache" -exec rm -rf {} +
110+
@find . -type d -name ".ipynb_checkpoints" -exec rm -rf {} +
110111
@rm -rf .ruff_cache/
111-
@rm -rf **/.hypothesis/
112-
@rm -rf **/junit/
112+
@find . -type d -name ".hypothesis" -exec rm -rf {} +
113+
@find . -type d -name "junit" -exec rm -rf {} +
113114
@cargo clean
114115

115116
.PHONY: pip-install-uv

crates/benchmarks/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ categories.workspace = true
1111
publish = false
1212

1313
[dev-dependencies]
14-
criterion = "0.5"
14+
criterion = { workspace = true }
1515
pecos = { workspace = true }
16-
pecos-core = { workspace = true }
17-
pecos-qsim = { workspace = true }
18-
pecos-qec = { workspace = true }
1916

2017
[[bench]]
2118
name = "benchmarks"

crates/benchmarks/benches/modules/element_ops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// the License.
1212

1313
use criterion::{black_box, measurement::Measurement, BenchmarkGroup, Criterion};
14-
use pecos_core::IndexableElement;
14+
use pecos::prelude::*;
1515

1616
pub fn benchmarks<M: Measurement>(c: &mut Criterion<M>) {
1717
let mut group = c.benchmark_group("Element Operations");
@@ -30,7 +30,7 @@ fn bench_conversion<E: IndexableElement + From<u16>, M: Measurement>(
3030
b.iter(|| {
3131
let mut sum = 0_usize;
3232
for i in 0..1000_u16 {
33-
sum += E::from(i).to_usize();
33+
sum += E::from(i).to_index();
3434
}
3535
black_box(sum)
3636
});
@@ -50,7 +50,7 @@ fn bench_memory_access<E: IndexableElement + From<u16>, M: Measurement>(
5050
b.iter(|| {
5151
let mut sum = E::from(0_u16);
5252
for &item in &vec {
53-
sum = E::from((sum.to_usize() + item.to_usize()) as u16);
53+
sum = E::from((sum.to_index() + item.to_index()) as u16);
5454
}
5555
black_box(sum)
5656
});

crates/benchmarks/benches/modules/set_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// the License.
1212

1313
use criterion::{black_box, measurement::Measurement, BenchmarkGroup, Criterion};
14-
use pecos_core::{IndexableElement, Set, VecSet};
14+
use pecos::prelude::*;
1515

1616
pub fn benchmarks<M: Measurement>(c: &mut Criterion<M>) {
1717
let mut group = c.benchmark_group("Set Operations");

crates/pecos-core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ description = "Provides core definitions and functions for PECOS simulations."
1414
rand = { workspace = true }
1515
rand_chacha = { workspace = true }
1616
rand_xoshiro = { workspace = true }
17+
num-traits = { workspace = true }
18+
num-complex = { workspace = true }
19+
serde = { workspace = true, features = ["derive"] }
1720

1821
[lints]
1922
workspace = true

0 commit comments

Comments
 (0)