From a09649eb66b396fd22a3878b1da1dafc6aba44b7 Mon Sep 17 00:00:00 2001 From: Shahar Samocha Date: Thu, 7 Nov 2024 10:49:52 +0200 Subject: [PATCH] FFT bench print CPU info --- Cargo.lock | 83 ++++++++++++++++++++++++++++++++++++ crates/prover/Cargo.toml | 1 + crates/prover/benches/fft.rs | 15 +++++++ 3 files changed, 99 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index c14183025..06ea81c60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -278,6 +278,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cpufeatures" version = "0.2.12" @@ -601,6 +607,15 @@ dependencies = [ "walkdir", ] +[[package]] +name = "ntapi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" +dependencies = [ + "winapi", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -994,6 +1009,7 @@ dependencies = [ "serde", "starknet-crypto", "starknet-ff", + "sysinfo", "test-log", "thiserror", "tracing", @@ -1029,6 +1045,20 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sysinfo" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ae3f4f7d64646c46c4cae4e3f01d1c5d255c7406fdd7c7f999a94e488791" +dependencies = [ + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "rayon", + "windows", +] + [[package]] name = "test-log" version = "0.2.15" @@ -1326,6 +1356,59 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core", + "windows-targets", +] + +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-targets", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.52.0" diff --git a/crates/prover/Cargo.toml b/crates/prover/Cargo.toml index 508c86e18..1fe2e685b 100644 --- a/crates/prover/Cargo.toml +++ b/crates/prover/Cargo.toml @@ -24,6 +24,7 @@ starknet-crypto = "0.6.2" starknet-ff = "0.3.7" thiserror.workspace = true tracing.workspace = true +sysinfo = "0.32.0" rayon = { version = "1.10.0", optional = true } serde = { version = "1.0", features = ["derive"] } diff --git a/crates/prover/benches/fft.rs b/crates/prover/benches/fft.rs index 35841d7e8..b3ac0b0ec 100644 --- a/crates/prover/benches/fft.rs +++ b/crates/prover/benches/fft.rs @@ -14,10 +14,18 @@ use stwo_prover::core::backend::simd::fft::transpose_vecs; use stwo_prover::core::backend::simd::m31::PackedBaseField; use stwo_prover::core::fields::m31::BaseField; use stwo_prover::core::poly::circle::CanonicCoset; +use sysinfo::System; pub fn simd_ifft(c: &mut Criterion) { let mut group = c.benchmark_group("iffts"); + println!("Running ifft benches!!"); + let mut sys = System::new_all(); + sys.refresh_all(); + let cpus = sys.cpus(); + for (i, cpu) in cpus.iter().enumerate() { + println!("CPU {}: {}", i, cpu.brand()); + } for log_size in 16..=28 { let domain = CanonicCoset::new(log_size).circle_domain(); let twiddle_dbls = get_itwiddle_dbls(domain.half_coset); @@ -102,7 +110,14 @@ pub fn simd_ifft_parts(c: &mut Criterion) { pub fn simd_rfft(c: &mut Criterion) { const LOG_SIZE: u32 = 20; + println!("Running rfft benches!!"); + let mut sys = System::new_all(); + sys.refresh_all(); + let cpus = sys.cpus(); + for (i, cpu) in cpus.iter().enumerate() { + println!("CPU {}: {}", i, cpu.brand()); + } let domain = CanonicCoset::new(LOG_SIZE).circle_domain(); let twiddle_dbls = get_twiddle_dbls(domain.half_coset); let twiddle_dbls_refs = twiddle_dbls.iter().map(|x| x.as_slice()).collect_vec();