Optimize release builds and preserve profiling symbols - #77
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
profilingprofile optimized while retaining full debug information and symbols.nativeprofile.Before/after benchmarks
Both variants use the same source and default features. "Before" uses Cargo's default release settings (
lto=false,codegen-units=16,strip="none") throughcargo --configoverrides; "after" uses this PR's release profile. Benchmarks ran on the same 12-logical-CPU host with fixed Rayon thread counts.End-to-end RHF:
samples/ethanol/6-31g/calculation.toml, local basis fixture, downloads disabled, JSON output. The 1-thread data uses Hyperfine with 2 warmups and 10 runs per binary. The 4-thread data uses 10 alternating before/after pairs to control for run-order effects.The JSON results are identical, including the RHF total energy of -153.9984834558699 Hartree. The release binary shrinks from 22.56 MB to 13.44 MB (40.5%).
MP2 kernel: The existing
benches/mp2_timings.rsbenchmark runs synthetic RHF MP2 at 80 AO functions, 26 occupied orbitals, and a fixed 1 GB memory budget. Each invocation warms up and reports the median of three blocked-contraction timings; the table summarizes five alternating invocations per variant. The benchmark also checks blocked and dense energies agree.The MP2 differences are small relative to their variation, so this benchmark does not establish a kernel speedup. Four threads matter substantially for the full calculation; the original 1-thread-only benchmark was insufficient. Fat LTO with one codegen unit was tested first and regressed the 4-thread HF workload by roughly 27%; thin LTO was selected based on the multithreaded result.
Verification
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo build --release --lockedbuildscargo build --release --bench mp2_timings --features bench-support --lockedbuildsRUSTIQ_MP2_SIZES=80 RUSTIQ_MP2_MEMORY=1GB RAYON_NUM_THREADS=4for the MP2 comparisonThe full Cargo test suite was not run to completion; validation focused on execution time as requested.