Skip to content

Commit

Permalink
add -j to pil cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo Alt authored and lvella committed Oct 25, 2023
1 parent 521407d commit 7881d80
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions powdr_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ enum Commands {
#[arg(default_value_t = CsvRenderMode::Hex)]
#[arg(value_parser = clap_enum_variants!(CsvRenderMode))]
csv_mode: CsvRenderMode,

/// Just execute in the RISCV/Powdr executor
#[arg(short, long)]
#[arg(default_value_t = false)]
just_execute: bool,

},
/// Compiles (no-std) rust code to riscv assembly, then to powdr assembly
/// and finally to PIL and generates fixed and witness columns.
Expand Down Expand Up @@ -385,24 +391,32 @@ fn run_command(command: Commands) {
prove_with,
export_csv,
csv_mode,
just_execute,
} => {
match call_with_field!(compile_with_csv_export::<field>(
file,
output_directory,
inputs,
force,
prove_with,
export_csv,
csv_mode
)) {
Ok(()) => {}
Err(errors) => {
eprintln!("Errors:");
for e in errors {
eprintln!("{e}");
if just_execute {
// assume input is riscv asm and just execute it
let contents = fs::read_to_string(file).unwrap();
let inputs = split_inputs(&inputs);
riscv_executor::execute::<GoldilocksField>(&contents, &inputs);
} else {
match call_with_field!(compile_with_csv_export::<field>(
file,
output_directory,
inputs,
force,
prove_with,
export_csv,
csv_mode
)) {
Ok(()) => {}
Err(errors) => {
eprintln!("Errors:");
for e in errors {
eprintln!("{e}");
}
}
}
};
};
}
}
Commands::Prove {
file,
Expand Down Expand Up @@ -676,6 +690,7 @@ mod test {
prove_with: Some(BackendType::PilStarkCli),
export_csv: true,
csv_mode: CsvRenderMode::Hex,
just_execute: false,
};
run_command(pil_command);

Expand Down

0 comments on commit 7881d80

Please sign in to comment.