diff --git a/crates/perf/run_s3.sh b/crates/perf/run_s3.sh index a9a0ef7a06..901cde6574 100755 --- a/crates/perf/run_s3.sh +++ b/crates/perf/run_s3.sh @@ -1,13 +1,21 @@ #!/bin/bash -# Check if both arguments are provided -if [ $# -ne 2 ]; then - echo "Usage: $0 " +# Set the default value for the stage argument +stage="prove" + +# Check the number of arguments +if [ $# -lt 2 ] || [ $# -gt 3 ]; then + echo "Usage: $0 [execute|prove]" exit 1 fi +# If the third argument is provided, override the default value +if [ $# -eq 3 ]; then + stage="$3" +fi + s3_path=$1 -stage=$2 +kind=$2 # Download files from S3 aws s3 cp s3://sp1-testing-suite/$s3_path/program.bin /tmp/program.bin @@ -20,4 +28,4 @@ export RUST_LOG=debug export SP1_DEBUG=1 # Run moongate-perf -cargo run -p sp1-perf -- --program /tmp/program.bin --stdin /tmp/stdin.bin --mode $stage \ No newline at end of file +cargo run -p sp1-perf -- --program /tmp/program.bin --stdin /tmp/stdin.bin --mode $kind --stage $stage \ No newline at end of file diff --git a/crates/perf/src/main.rs b/crates/perf/src/main.rs index baeffbc49b..493ab5aa0c 100644 --- a/crates/perf/src/main.rs +++ b/crates/perf/src/main.rs @@ -17,6 +17,8 @@ struct PerfArgs { pub stdin: String, #[arg(short, long)] pub mode: ProverMode, + #[arg(short, long, default_value = "prove")] + pub stage: Stage, } #[derive(Default, Debug, Clone)] @@ -41,6 +43,12 @@ enum ProverMode { Network, } +#[derive(Debug, Clone, ValueEnum, PartialEq, Eq)] +enum Stage { + Execute, + Prove, +} + pub fn time_operation T>(operation: F) -> (T, std::time::Duration) { let start = Instant::now(); let result = operation(); @@ -59,6 +67,11 @@ fn main() { let prover = SP1Prover::::new(); let (pk, vk) = prover.setup(&elf); let cycles = sp1_prover::utils::get_cycles(&elf, &stdin); + let stage = args.stage; + if stage == Stage::Execute { + println!("Program executed successfully, number of cycles: {}", cycles); + return; + } let opts = SP1ProverOpts::default(); match args.mode {