improve message about domain sizes and operation timings

This commit is contained in:
Alex Vlasov 2019-03-05 09:58:59 +01:00
parent a99132955a
commit 2a453c3325
2 changed files with 16 additions and 8 deletions

@ -17,8 +17,8 @@ rand = "0.4"
bit-vec = "0.4.4"
futures = "0.1"
#pairing = { git = 'https://github.com/matterinc/pairing', tag = "0.16.2" }
pairing = { path = "../pairing" }
pairing = { git = 'https://github.com/matterinc/pairing', tag = "0.16.2" }
#pairing = { path = "../pairing" }
byteorder = "1"
futures-cpupool = {version = "0.1", optional = true}
@ -32,6 +32,7 @@ git = "https://github.com/gtank/blake2-rfc"
rev = "7a5b5fc99ae483a0043db7547fb79a6fa44b88a9"
[features]
#default = ["multicore"]
default = ["multicore", "gm17", "sonic"]
#default = ["singlecore"]
multicore = ["futures-cpupool", "num_cpus", "crossbeam"]

@ -177,6 +177,8 @@ impl<E:Engine> PreparedProver<E> {
let mut a = EvaluationDomain::from_coeffs(prover.a)?;
let mut b = EvaluationDomain::from_coeffs(prover.b)?;
let mut c = EvaluationDomain::from_coeffs(prover.c)?;
if verbose {eprintln!("H query domain size is {}", a.as_ref().len())};
// here a coset is a domain where denominator (z) does not vanish
// inverse FFT is an interpolation
a.ifft(&worker);
@ -207,18 +209,23 @@ impl<E:Engine> PreparedProver<E> {
multiexp(&worker, params.get_h(a.len())?, FullDensity, a)
};
if verbose {eprintln!("{} seconds for prover for H evaluation", start.elapsed().as_secs())};
if verbose {eprintln!("{} seconds for prover for H evaluation (mostly FFT)", start.elapsed().as_millis() as f64 / 1000.0)};
let start = std::time::Instant::now();
// TODO: Check that difference in operations for different chunks is small
// TODO: parallelize if it's even helpful
// TODO: in large settings it may worth to parallelize
let input_assignment = Arc::new(prover.input_assignment.into_iter().map(|s| s.into_repr()).collect::<Vec<_>>());
let aux_assignment = Arc::new(prover.aux_assignment.into_iter().map(|s| s.into_repr()).collect::<Vec<_>>());
let input_len = input_assignment.len();
let aux_len = aux_assignment.len();
if verbose {eprintln!("H query is dense in G1,\nOther queries are {} elements in G1 and {} elements in G2",
2*(input_len + aux_len) + aux_len, input_len + aux_len)
};
// Run a dedicated process for dense vector
let l = multiexp(&worker, params.get_l(aux_assignment.len())?, FullDensity, aux_assignment.clone());
@ -280,7 +287,7 @@ impl<E:Engine> PreparedProver<E> {
g_c.add_assign(&h.wait()?);
g_c.add_assign(&l.wait()?);
if verbose {eprintln!("{} seconds for prover for point multiplication", start.elapsed().as_secs())};
if verbose {eprintln!("{} seconds for prover for point multiplication", start.elapsed().as_millis() as f64 / 1000.0)};
Ok(Proof {
a: g_a.into_affine(),
@ -439,6 +446,7 @@ pub fn create_proof<E, C, P: ParameterSource<E>>(
let mut a = EvaluationDomain::from_coeffs(prover.a)?;
let mut b = EvaluationDomain::from_coeffs(prover.b)?;
let mut c = EvaluationDomain::from_coeffs(prover.c)?;
if verbose {eprintln!("H query domain size is {}", a.as_ref().len())};
// here a coset is a domain where denominator (z) does not vanish
// inverse FFT is an interpolation
a.ifft(&worker);
@ -469,13 +477,12 @@ pub fn create_proof<E, C, P: ParameterSource<E>>(
multiexp(&worker, params.get_h(a.len())?, FullDensity, a)
};
if verbose {eprintln!("{} seconds for prover for H evaluation", start.elapsed().as_secs())};
if verbose {eprintln!("{} seconds for prover for H evaluation (mostly FFT)", start.elapsed().as_millis() as f64 / 1000.0)};
let start = std::time::Instant::now();
// TODO: Check that difference in operations for different chunks is small
// TODO: parallelize if it's even helpful
// TODO: in large settings it may worth to parallelize
let input_assignment = Arc::new(prover.input_assignment.into_iter().map(|s| s.into_repr()).collect::<Vec<_>>());
@ -542,7 +549,7 @@ pub fn create_proof<E, C, P: ParameterSource<E>>(
g_c.add_assign(&h.wait()?);
g_c.add_assign(&l.wait()?);
if verbose {eprintln!("{} seconds for prover for point multiplication", start.elapsed().as_secs())};
if verbose {eprintln!("{} seconds for prover for point multiplication", start.elapsed().as_millis() as f64 / 1000.0)};
Ok(Proof {
a: g_a.into_affine(),