Skip to content

Commit

Permalink
Heap and stack sizes in kiB and MiB (#808)
Browse files Browse the repository at this point in the history
Allow specification of guest heap and stack sizes on the command line in
more convenient units than just raw bytes.
  • Loading branch information
matthiasgoergens authored Jan 7, 2025
1 parent 845b475 commit c1b2a7c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ceno_zkvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ tracing-subscriber.workspace = true
bincode = "1"
clap = { version = "4.5", features = ["derive"] }
generic_static = "0.2"
parse-size = "1.1"
rand.workspace = true
tempfile = "3.14"
thread_local = "1.1"
Expand Down
11 changes: 9 additions & 2 deletions ceno_zkvm/src/bin/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ use transcript::{
BasicTranscript as Transcript, BasicTranscriptWithStat as TranscriptWithStat, StatisticRecorder,
};

fn parse_size(s: &str) -> Result<u32, parse_size::Error> {
parse_size::Config::new()
.with_binary()
.parse_size(s)
.map(|size| size as u32)
}

/// Prove the execution of a fixed RISC-V program.
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
Expand Down Expand Up @@ -45,11 +52,11 @@ struct Args {
hints: Option<String>,

/// Stack size in bytes.
#[arg(long, default_value = "32768")]
#[arg(long, default_value = "32k", value_parser = parse_size)]
stack_size: u32,

/// Heap size in bytes.
#[arg(long, default_value = "2097152")]
#[arg(long, default_value = "2M", value_parser = parse_size)]
heap_size: u32,
}

Expand Down

0 comments on commit c1b2a7c

Please sign in to comment.