Skip to content

Commit 4f916ad

Browse files
PeaBraneclaude
andcommitted
add profiling infra: bench profile, profile feature, inline(never) attrs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4c7c958 commit 4f916ad

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@
1414
| metropolis + PT | 0.081 |
1515

1616
Run: `.venv/bin/python benchmarks/sweep_modes.py`
17+
18+
## Performance notes
19+
20+
- Bottleneck is cache pressure + dependent load chains, not compute — see `refs/cache-optimization.md`
21+
- Sweep ordering options (checkerboard, typewriter, random, etc.) — see `refs/sweep-orderings.md`

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ pyo3 = { version = "0.24", features = ["extension-module"] }
1717
numpy = "0.24"
1818
indicatif = "0.17"
1919
ctrlc = "3"
20+
21+
[profile.bench]
22+
inherits = "release"
23+
debug = true

spin-sim/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ repository = "https://github.com/PeaBrane/peapods"
99
keywords = ["ising", "monte-carlo", "spin-glass", "parallel-tempering", "cluster-algorithm"]
1010
categories = ["science", "simulation"]
1111

12+
[features]
13+
profile = []
14+
1215
[dependencies]
1316
rand = "0.8"
1417
rand_xoshiro = "0.6"

spin-sim/src/mcmc/tempering.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use rand_xoshiro::Xoshiro256StarStar;
88
///
99
/// `energies`: per-replica average energy (energy per spin)
1010
/// `n_spins`: total number of spins (for converting to total energy)
11+
#[cfg_attr(feature = "profile", inline(never))]
1112
pub fn parallel_tempering(
1213
energies: &[f32],
1314
temperatures: &[f32],

0 commit comments

Comments
 (0)