Skip to content

Commit

Permalink
Fix multigpu (zkcrypto#8)
Browse files Browse the repository at this point in the history
* bugfix: dont chunk when n is zero

* cut exponents
  • Loading branch information
keyvank authored and dignifiedquire committed Oct 15, 2019
1 parent 71c6715 commit 8663b10
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gpu/multiexp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,18 @@ impl<E> MultiexpKernel<E> where E: Engine {
n: usize)
-> GPUResult<(<G as CurveAffine>::Projective)>
where G: CurveAffine {
if n == 0 {
return Ok(<G as CurveAffine>::Projective::zero());
}

let num_devices = self.0.len();
let chunk_size = ((n as f64) / (num_devices as f64)).ceil() as usize;

// Bases are skipped by `self.1` elements, when converted from (Arc<Vec<G>>, usize) to Source
// https://github.com/zkcrypto/bellman/blob/10c5010fd9c2ca69442dc9775ea271e286e776d8/src/multiexp.rs#L38
let bases = &bases[skip..];

let exps = &exps[..n];

match thread::scope(|s| {
let mut acc = <G as CurveAffine>::Projective::zero();
Expand Down

0 comments on commit 8663b10

Please sign in to comment.