-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
10,485 additions
and
285 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,80 @@ | ||
//! Tests end-to-end performance of wrapping a recursion proof to PLONK. | ||
fn main() {} | ||
|
||
use std::time::Instant; | ||
// //! Tests end-to-end performance of wrapping a recursion proof to PLONK. | ||
|
||
use itertools::iproduct; | ||
use sp1_core_executor::SP1Context; | ||
use sp1_core_machine::io::SP1Stdin; | ||
use sp1_prover::components::DefaultProverComponents; | ||
use sp1_prover::SP1Prover; | ||
use sp1_stark::SP1ProverOpts; | ||
use tracing_subscriber::fmt::format::FmtSpan; | ||
use tracing_subscriber::util::SubscriberInitExt; | ||
use tracing_subscriber::EnvFilter; | ||
// use std::time::Instant; | ||
|
||
fn main() { | ||
// Setup tracer. | ||
let default_filter = "off"; | ||
let log_appender = tracing_appender::rolling::never("scripts/results", "fibonacci_groth16.log"); | ||
let env_filter = EnvFilter::try_from_default_env() | ||
.unwrap_or_else(|_| EnvFilter::new(default_filter)) | ||
.add_directive("p3_keccak_air=off".parse().unwrap()) | ||
.add_directive("p3_fri=off".parse().unwrap()) | ||
.add_directive("p3_challenger=off".parse().unwrap()) | ||
.add_directive("p3_dft=off".parse().unwrap()) | ||
.add_directive("sp1_core=off".parse().unwrap()); | ||
tracing_subscriber::fmt::Subscriber::builder() | ||
.with_ansi(false) | ||
.with_file(false) | ||
.with_target(false) | ||
.with_thread_names(false) | ||
.with_env_filter(env_filter) | ||
.with_span_events(FmtSpan::CLOSE) | ||
.with_writer(log_appender) | ||
.finish() | ||
.init(); | ||
// use itertools::iproduct; | ||
// use sp1_core_executor::SP1Context; | ||
// use sp1_core_machine::io::SP1Stdin; | ||
// use sp1_prover::components::DefaultProverComponents; | ||
// use sp1_prover::SP1Prover; | ||
// use sp1_stark::SP1ProverOpts; | ||
// use tracing_subscriber::fmt::format::FmtSpan; | ||
// use tracing_subscriber::util::SubscriberInitExt; | ||
// use tracing_subscriber::EnvFilter; | ||
|
||
// Setup environment variables. | ||
std::env::set_var("RECONSTRUCT_COMMITMENTS", "false"); | ||
// fn main() { | ||
// // Setup tracer. | ||
// let default_filter = "off"; | ||
// let log_appender = tracing_appender::rolling::never("scripts/results", "fibonacci_groth16.log"); | ||
// let env_filter = EnvFilter::try_from_default_env() | ||
// .unwrap_or_else(|_| EnvFilter::new(default_filter)) | ||
// .add_directive("p3_keccak_air=off".parse().unwrap()) | ||
// .add_directive("p3_fri=off".parse().unwrap()) | ||
// .add_directive("p3_challenger=off".parse().unwrap()) | ||
// .add_directive("p3_dft=off".parse().unwrap()) | ||
// .add_directive("sp1_core=off".parse().unwrap()); | ||
// tracing_subscriber::fmt::Subscriber::builder() | ||
// .with_ansi(false) | ||
// .with_file(false) | ||
// .with_target(false) | ||
// .with_thread_names(false) | ||
// .with_env_filter(env_filter) | ||
// .with_span_events(FmtSpan::CLOSE) | ||
// .with_writer(log_appender) | ||
// .finish() | ||
// .init(); | ||
|
||
// Initialize prover. | ||
let prover = SP1Prover::<DefaultProverComponents>::new(); | ||
// // Setup environment variables. | ||
// std::env::set_var("RECONSTRUCT_COMMITMENTS", "false"); | ||
|
||
// Setup sweep. | ||
let iterations = [480000u32]; | ||
let shard_sizes = [1 << 22]; | ||
let batch_sizes = [2]; | ||
let elf = test_artifacts::FIBONACCI_ELF; | ||
let (pk, vk) = prover.setup(elf); | ||
// // Initialize prover. | ||
// let prover = SP1Prover::<DefaultProverComponents>::new(); | ||
|
||
for (shard_size, iterations, batch_size) in iproduct!(shard_sizes, iterations, batch_sizes) { | ||
tracing::info!( | ||
"running: shard_size={}, iterations={}, batch_size={}", | ||
shard_size, | ||
iterations, | ||
batch_size | ||
); | ||
std::env::set_var("SHARD_SIZE", shard_size.to_string()); | ||
// // Setup sweep. | ||
// let iterations = [480000u32]; | ||
// let shard_sizes = [1 << 22]; | ||
// let batch_sizes = [2]; | ||
// let elf = test_artifacts::FIBONACCI_ELF; | ||
// let (pk, vk, _, _) = prover.setup(elf); | ||
|
||
tracing::info!("proving leaves"); | ||
let stdin = SP1Stdin { | ||
buffer: vec![bincode::serialize::<u32>(&iterations).unwrap()], | ||
ptr: 0, | ||
proofs: vec![], | ||
}; | ||
let leaf_proving_start = Instant::now(); | ||
let proof = prover | ||
.prove_core(&pk, &stdin, SP1ProverOpts::default(), SP1Context::default()) | ||
.unwrap(); | ||
let leaf_proving_duration = leaf_proving_start.elapsed().as_secs_f64(); | ||
tracing::info!("leaf_proving_duration={}", leaf_proving_duration); | ||
// for (shard_size, iterations, batch_size) in iproduct!(shard_sizes, iterations, batch_sizes) { | ||
// tracing::info!( | ||
// "running: shard_size={}, iterations={}, batch_size={}", | ||
// shard_size, | ||
// iterations, | ||
// batch_size | ||
// ); | ||
// std::env::set_var("SHARD_SIZE", shard_size.to_string()); | ||
|
||
tracing::info!("proving inner"); | ||
let recursion_proving_start = Instant::now(); | ||
let _ = prover.compress(&vk, proof, vec![], SP1ProverOpts::default()); | ||
let recursion_proving_duration = recursion_proving_start.elapsed().as_secs_f64(); | ||
tracing::info!("recursion_proving_duration={}", recursion_proving_duration); | ||
} | ||
} | ||
// tracing::info!("proving leaves"); | ||
// let stdin = SP1Stdin { | ||
// buffer: vec![bincode::serialize::<u32>(&iterations).unwrap()], | ||
// ptr: 0, | ||
// proofs: vec![], | ||
// }; | ||
// let leaf_proving_start = Instant::now(); | ||
// let proof = prover | ||
// .prove_core(&pk, &stdin, SP1ProverOpts::default(), SP1Context::default()) | ||
// .unwrap(); | ||
// let leaf_proving_duration = leaf_proving_start.elapsed().as_secs_f64(); | ||
// tracing::info!("leaf_proving_duration={}", leaf_proving_duration); | ||
|
||
// tracing::info!("proving inner"); | ||
// let recursion_proving_start = Instant::now(); | ||
// let _ = prover.compress(&vk, proof, vec![], SP1ProverOpts::default()); | ||
// let recursion_proving_duration = recursion_proving_start.elapsed().as_secs_f64(); | ||
// tracing::info!("recursion_proving_duration={}", recursion_proving_duration); | ||
// } | ||
// } |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,91 @@ | ||
//! Sweeps end-to-end prover performance across a wide range of parameters for Fibonacci. | ||
fn main() {} | ||
|
||
use std::{fs::File, io::BufWriter, io::Write, time::Instant}; | ||
// //! Sweeps end-to-end prover performance across a wide range of parameters for Fibonacci. | ||
|
||
use itertools::iproduct; | ||
use sp1_core_executor::SP1Context; | ||
use sp1_core_machine::io::SP1Stdin; | ||
use sp1_prover::components::DefaultProverComponents; | ||
use sp1_prover::SP1Prover; | ||
use sp1_stark::SP1ProverOpts; | ||
use tracing_subscriber::EnvFilter; | ||
use tracing_subscriber::{fmt::format::FmtSpan, util::SubscriberInitExt}; | ||
// use std::{fs::File, io::BufWriter, io::Write, time::Instant}; | ||
|
||
fn main() { | ||
// Setup tracer. | ||
let default_filter = "off"; | ||
let log_appender = tracing_appender::rolling::never("scripts/results", "fibonacci_sweep.log"); | ||
let env_filter = EnvFilter::try_from_default_env() | ||
.unwrap_or_else(|_| EnvFilter::new(default_filter)) | ||
.add_directive("p3_keccak_air=off".parse().unwrap()) | ||
.add_directive("p3_fri=off".parse().unwrap()) | ||
.add_directive("p3_challenger=off".parse().unwrap()) | ||
.add_directive("p3_dft=off".parse().unwrap()) | ||
.add_directive("sp1_core=off".parse().unwrap()); | ||
tracing_subscriber::fmt::Subscriber::builder() | ||
.with_ansi(false) | ||
.with_file(false) | ||
.with_target(false) | ||
.with_thread_names(false) | ||
.with_env_filter(env_filter) | ||
.with_span_events(FmtSpan::CLOSE) | ||
.with_writer(log_appender) | ||
.finish() | ||
.init(); | ||
// use itertools::iproduct; | ||
// use sp1_core_executor::SP1Context; | ||
// use sp1_core_machine::io::SP1Stdin; | ||
// use sp1_prover::components::DefaultProverComponents; | ||
// use sp1_prover::SP1Prover; | ||
// use sp1_stark::SP1ProverOpts; | ||
// use tracing_subscriber::EnvFilter; | ||
// use tracing_subscriber::{fmt::format::FmtSpan, util::SubscriberInitExt}; | ||
|
||
// Setup environment variables. | ||
std::env::set_var("RECONSTRUCT_COMMITMENTS", "false"); | ||
// fn main() { | ||
// // Setup tracer. | ||
// let default_filter = "off"; | ||
// let log_appender = tracing_appender::rolling::never("scripts/results", "fibonacci_sweep.log"); | ||
// let env_filter = EnvFilter::try_from_default_env() | ||
// .unwrap_or_else(|_| EnvFilter::new(default_filter)) | ||
// .add_directive("p3_keccak_air=off".parse().unwrap()) | ||
// .add_directive("p3_fri=off".parse().unwrap()) | ||
// .add_directive("p3_challenger=off".parse().unwrap()) | ||
// .add_directive("p3_dft=off".parse().unwrap()) | ||
// .add_directive("sp1_core=off".parse().unwrap()); | ||
// tracing_subscriber::fmt::Subscriber::builder() | ||
// .with_ansi(false) | ||
// .with_file(false) | ||
// .with_target(false) | ||
// .with_thread_names(false) | ||
// .with_env_filter(env_filter) | ||
// .with_span_events(FmtSpan::CLOSE) | ||
// .with_writer(log_appender) | ||
// .finish() | ||
// .init(); | ||
|
||
// Initialize prover. | ||
let prover = SP1Prover::<DefaultProverComponents>::new(); | ||
// // Setup environment variables. | ||
// std::env::set_var("RECONSTRUCT_COMMITMENTS", "false"); | ||
|
||
// Setup sweep. | ||
let iterations = [480000u32]; | ||
let shard_sizes = [1 << 19, 1 << 20, 1 << 21, 1 << 22]; | ||
let batch_sizes = [2, 3, 4]; | ||
let elf = test_artifacts::FIBONACCI_ELF; | ||
let (pk, vk) = prover.setup(elf); | ||
// // Initialize prover. | ||
// let prover = SP1Prover::<DefaultProverComponents>::new(); | ||
|
||
let mut lines = | ||
vec!["iterations,shard_size,batch_size,leaf_proving_duration,recursion_proving_duration" | ||
.to_string()]; | ||
for (shard_size, iterations, batch_size) in iproduct!(shard_sizes, iterations, batch_sizes) { | ||
tracing::info!( | ||
"running: shard_size={}, iterations={}, batch_size={}", | ||
shard_size, | ||
iterations, | ||
batch_size | ||
); | ||
std::env::set_var("SHARD_SIZE", shard_size.to_string()); | ||
// // Setup sweep. | ||
// let iterations = [480000u32]; | ||
// let shard_sizes = [1 << 19, 1 << 20, 1 << 21, 1 << 22]; | ||
// let batch_sizes = [2, 3, 4]; | ||
// let elf = test_artifacts::FIBONACCI_ELF; | ||
// let (pk, vk, program, _) = prover.setup(elf); | ||
|
||
let stdin = SP1Stdin { | ||
buffer: vec![bincode::serialize::<u32>(&iterations).unwrap()], | ||
ptr: 0, | ||
proofs: vec![], | ||
}; | ||
let leaf_proving_start = Instant::now(); | ||
let proof = prover | ||
.prove_core(&pk, &stdin, SP1ProverOpts::default(), SP1Context::default()) | ||
.unwrap(); | ||
let leaf_proving_duration = leaf_proving_start.elapsed().as_secs_f64(); | ||
// let mut lines = | ||
// vec!["iterations,shard_size,batch_size,leaf_proving_duration,recursion_proving_duration" | ||
// .to_string()]; | ||
// for (shard_size, iterations, batch_size) in iproduct!(shard_sizes, iterations, batch_sizes) { | ||
// tracing::info!( | ||
// "running: shard_size={}, iterations={}, batch_size={}", | ||
// shard_size, | ||
// iterations, | ||
// batch_size | ||
// ); | ||
// std::env::set_var("SHARD_SIZE", shard_size.to_string()); | ||
|
||
let recursion_proving_start = Instant::now(); | ||
let _ = prover.compress(&vk, proof, vec![], SP1ProverOpts::default()); | ||
let recursion_proving_duration = recursion_proving_start.elapsed().as_secs_f64(); | ||
// let stdin = SP1Stdin { | ||
// buffer: vec![bincode::serialize::<u32>(&iterations).unwrap()], | ||
// ptr: 0, | ||
// proofs: vec![], | ||
// }; | ||
// let leaf_proving_start = Instant::now(); | ||
// let proof = prover | ||
// .prove_core(&pk, program, &stdin, SP1ProverOpts::default(), SP1Context::default()) | ||
// .unwrap(); | ||
// let leaf_proving_duration = leaf_proving_start.elapsed().as_secs_f64(); | ||
|
||
lines.push(format!( | ||
"{},{},{},{},{}", | ||
iterations, shard_size, batch_size, leaf_proving_duration, recursion_proving_duration | ||
)); | ||
} | ||
// let recursion_proving_start = Instant::now(); | ||
// let _ = prover.compress(&vk, proof, vec![], SP1ProverOpts::default()); | ||
// let recursion_proving_duration = recursion_proving_start.elapsed().as_secs_f64(); | ||
|
||
let file = File::create("scripts/results/fibonacci_sweep.csv").unwrap(); | ||
let mut writer = BufWriter::new(file); | ||
for line in lines.clone() { | ||
writeln!(writer, "{}", line).unwrap(); | ||
} | ||
// lines.push(format!( | ||
// "{},{},{},{},{}", | ||
// iterations, shard_size, batch_size, leaf_proving_duration, recursion_proving_duration | ||
// )); | ||
// } | ||
|
||
println!("{:#?}", lines); | ||
} | ||
// let file = File::create("scripts/results/fibonacci_sweep.csv").unwrap(); | ||
// let mut writer = BufWriter::new(file); | ||
// for line in lines.clone() { | ||
// writeln!(writer, "{}", line).unwrap(); | ||
// } | ||
|
||
// println!("{:#?}", lines); | ||
// } |
Oops, something went wrong.