Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanting Zhang committed Dec 3, 2023
1 parent 13fe808 commit 9966c21
Show file tree
Hide file tree
Showing 10 changed files with 7,810 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ tempfile = "3.6.0"
camino = "1.1.6"
thiserror = "1.0.44"
tracing = "0.1.37"
tracing-texray = "0.2.0"
tracing-texray = { git = "https://github.com/winston-h-zhang/tracing-texray", branch = "shim" }
tracing-subscriber = "0.3.17"

[[bin]]
Expand Down
1,691 changes: 1,691 additions & 0 deletions benches/dev/600.txt

Large diffs are not rendered by default.

3,132 changes: 3,132 additions & 0 deletions benches/dev/900.txt

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions benches/fibonacci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ use lurk::{
field::LurkField,
lem::{eval::evaluate, multiframe::MultiFrame, pointers::Ptr, store::Store},
proof::nova::NovaProver,
proof::Prover,
public_parameters::{
instance::{Instance, Kind},
public_params,
},
proof::{nova::public_params, Prover},
state::State,
};

use tracing_subscriber::{fmt, prelude::*, EnvFilter, Registry};
use tracing_texray::TeXRayLayer;

mod common;
use common::set_bench_config;

Expand Down Expand Up @@ -111,14 +110,8 @@ fn fibonacci_prove<M: measurement::Measurement>(
let lang_pallas = Lang::<pallas::Scalar, Coproc<pallas::Scalar>>::new();
let lang_rc = Arc::new(lang_pallas.clone());

// use cached public params
let instance = Instance::new(
prove_params.reduction_count,
lang_rc.clone(),
true,
Kind::NovaPublicParams,
);
let pp = public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap();
let pp =
public_params::<_, _, MultiFrame<'_, _, _>>(prove_params.reduction_count, lang_rc.clone());

// Track the number of `Lurk frames / sec`
let rc = prove_params.reduction_count as u64;
Expand Down Expand Up @@ -148,7 +141,8 @@ fn fibonacci_prove<M: measurement::Measurement>(
b.iter_batched(
|| frames,
|frames| {
let result = prover.prove(&pp, frames, &store);
let result = tracing_texray::examine(tracing::info_span!("bang!"))
.in_scope(|| prover.prove(&pp, frames, &store));
let _ = black_box(result);
},
BatchSize::LargeInput,
Expand All @@ -159,12 +153,17 @@ fn fibonacci_prove<M: measurement::Measurement>(

fn fibonacci_benchmark(c: &mut Criterion) {
// Uncomment to record the logs. May negatively impact performance
//tracing_subscriber::fmt::init();
let subscriber = Registry::default()
.with(fmt::layer().pretty())
.with(EnvFilter::from_default_env())
.with(TeXRayLayer::new().width(120));
tracing::subscriber::set_global_default(subscriber).unwrap();

set_bench_config();
tracing::debug!("{:?}", lurk::config::LURK_CONFIG);

let reduction_counts = rc_env().unwrap_or_else(|_| vec![100]);
let batch_sizes = [100, 200];
let batch_sizes = [249, 374, 499];

let state = State::init_lurk_state().rccell();

Expand All @@ -187,6 +186,8 @@ fn fibonacci_benchmark(c: &mut Criterion) {
}
}

// RUST_LOG=info LURK_RC=600 LURK_PERF=max-parallel-simple cargo criterion --bench fibonacci --features "cuda" 2> ./benches/gpu-spmvm/600.txt
// RUST_LOG=info LURK_RC=900 LURK_PERF=max-parallel-simple cargo criterion --bench fibonacci --features "cuda" 2> ./benches/dev/900.txt
cfg_if::cfg_if! {
if #[cfg(feature = "flamegraph")] {
criterion_group! {
Expand Down
2,540 changes: 2,540 additions & 0 deletions benches/gpu-spmvm/1200.txt

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions benches/gpu-spmvm/600.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Compiling sppark v0.1.5
Compiling pasta-msm v0.1.4 (https://github.com/lurk-lab/pasta-msm?branch=dev#182b971d)
423 changes: 423 additions & 0 deletions benches/gpu-spmvm/900.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/lem/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ fn build_frames<
let mut pc = 0;
let mut frames = vec![];
let mut iterations = 0;
tracing::info!("{}", &log_fmt(0, &input, &[], store));
tracing::debug!("{}", &log_fmt(0, &input, &[], store));
for _ in 0..limit {
let mut emitted = vec![];
let (frame, must_break) =
compute_frame(lurk_step, cprocs_run, &input, store, lang, &mut emitted, pc)?;

iterations += 1;
input = frame.output.clone();
tracing::info!("{}", &log_fmt(iterations, &input, &emitted, store));
tracing::debug!("{}", &log_fmt(iterations, &input, &emitted, store));
let expr = frame.output[0];
frames.push(frame);

Expand Down
1 change: 1 addition & 0 deletions src/lem/multiframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ impl<'a, F: LurkField, C: Coprocessor<F>> nova::traits::circuit::StepCircuit<F>
2 * self.lurk_step.input_params.len()
}

#[tracing::instrument(skip_all, name = "synthesize")]
fn synthesize<CS>(
&self,
cs: &mut CS,
Expand Down
3 changes: 1 addition & 2 deletions src/lem/var_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::hash_map::Entry;

use anyhow::{bail, Result};
use fxhash::FxHashMap;
use tracing::info;

use super::Var;

Expand All @@ -29,7 +28,7 @@ impl<V> VarMap<V> {
}
Entry::Occupied(mut o) => {
let v = o.insert(v);
info!("Variable {} has been overwritten", o.key());
tracing::debug!("Variable {} has been overwritten", o.key());
Some(v)
}
}
Expand Down

0 comments on commit 9966c21

Please sign in to comment.