more parallelization

This commit is contained in:
Charles Chen
2022-12-16 10:03:30 -05:00
parent 81073dfee1
commit 5d6985b799
2 changed files with 6 additions and 11 deletions

View File

@@ -76,7 +76,7 @@ where
.collect();
let selector_commitments = selector_oracles
.iter()
.par_iter()
.map(|poly| PCS::commit(&pcs_prover_param, poly))
.collect::<Result<Vec<_>, _>>()?;

View File

@@ -9,7 +9,7 @@ use arithmetic::{fix_variables, VirtualPolynomial};
use ark_ff::PrimeField;
use ark_poly::DenseMultilinearExtension;
use ark_std::{end_timer, start_timer, vec::Vec};
use rayon::prelude::IntoParallelIterator;
use rayon::prelude::{IntoParallelIterator, IntoParallelRefIterator};
use std::sync::Arc;
#[cfg(feature = "parallel")]
@@ -71,7 +71,7 @@ impl<F: PrimeField> SumCheckProver<F> for IOPProverState<F> {
let mut flattened_ml_extensions: Vec<DenseMultilinearExtension<F>> = self
.poly
.flattened_ml_extensions
.iter()
.par_iter()
.map(|x| x.as_ref().clone())
.collect();
@@ -132,9 +132,7 @@ impl<F: PrimeField> SumCheckProver<F> for IOPProverState<F> {
}
})
.collect::<Vec<F>>();
for val in evals.iter() {
*e += val
}
*e += evals.par_iter().sum::<F>();
}
} else {
for (t, e) in products_sum.iter_mut().enumerate() {
@@ -161,10 +159,7 @@ impl<F: PrimeField> SumCheckProver<F> for IOPProverState<F> {
tmp
})
.collect::<Vec<F>>();
for i in products.iter() {
*e += i
}
*e += products.par_iter().sum::<F>();
}
}
}
@@ -190,7 +185,7 @@ impl<F: PrimeField> SumCheckProver<F> for IOPProverState<F> {
// update prover's state to the partial evaluated polynomial
self.poly.flattened_ml_extensions = flattened_ml_extensions
.iter()
.par_iter()
.map(|x| Arc::new(x.clone()))
.collect();