From c9d610ec10686a3bf6465ad50815d69d62dfbabe Mon Sep 17 00:00:00 2001 From: Sebastien La Duca Date: Sun, 24 Jul 2022 17:47:14 -0400 Subject: [PATCH] use maybe_rayon in starky and evm --- evm/Cargo.toml | 4 +++- evm/src/memory/memory_stark.rs | 2 +- evm/src/permutation.rs | 2 +- evm/src/proof.rs | 2 +- evm/src/prover.rs | 2 +- starky/Cargo.toml | 6 +++++- starky/src/permutation.rs | 2 +- starky/src/proof.rs | 2 +- starky/src/prover.rs | 2 +- 9 files changed, 15 insertions(+), 9 deletions(-) diff --git a/evm/Cargo.toml b/evm/Cargo.toml index c10ab104..48ef12d7 100644 --- a/evm/Cargo.toml +++ b/evm/Cargo.toml @@ -17,7 +17,7 @@ log = "0.4.14" once_cell = "1.13.0" pest = "2.1.3" pest_derive = "2.1.0" -rayon = "1.5.1" +maybe_rayon = { path = "../maybe_rayon" } rand = "0.8.5" rand_chacha = "0.3.1" rlp = "0.5.1" @@ -28,7 +28,9 @@ keccak-hash = "0.9.0" hex = "0.4.3" [features] +default = ["parallel"] asmtools = ["hex"] +parallel = ["maybe_rayon/parallel"] [[bin]] name = "assemble" diff --git a/evm/src/memory/memory_stark.rs b/evm/src/memory/memory_stark.rs index 82e10869..c16ef2be 100644 --- a/evm/src/memory/memory_stark.rs +++ b/evm/src/memory/memory_stark.rs @@ -10,7 +10,7 @@ use plonky2::hash::hash_types::RichField; use plonky2::timed; use plonky2::util::timing::TimingTree; use plonky2::util::transpose; -use rayon::prelude::*; +use maybe_rayon::*; use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer}; use crate::cross_table_lookup::Column; diff --git a/evm/src/permutation.rs b/evm/src/permutation.rs index a4039ad2..42400a94 100644 --- a/evm/src/permutation.rs +++ b/evm/src/permutation.rs @@ -16,7 +16,7 @@ use plonky2::plonk::plonk_common::{ reduce_with_powers, reduce_with_powers_circuit, reduce_with_powers_ext_circuit, }; use plonky2::util::reducing::{ReducingFactor, ReducingFactorTarget}; -use rayon::prelude::*; +use maybe_rayon::*; use crate::config::StarkConfig; use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer}; diff --git a/evm/src/proof.rs b/evm/src/proof.rs index b1275844..97c27bd4 100644 --- a/evm/src/proof.rs +++ b/evm/src/proof.rs @@ -12,7 +12,7 @@ use plonky2::hash::merkle_tree::MerkleCap; use plonky2::iop::ext_target::ExtensionTarget; use plonky2::iop::target::Target; use plonky2::plonk::config::GenericConfig; -use rayon::prelude::*; +use maybe_rayon::*; use crate::config::StarkConfig; use crate::permutation::GrandProductChallengeSet; diff --git a/evm/src/prover.rs b/evm/src/prover.rs index 346224a5..b4073c29 100644 --- a/evm/src/prover.rs +++ b/evm/src/prover.rs @@ -15,7 +15,7 @@ use plonky2::timed; use plonky2::util::timing::TimingTree; use plonky2::util::transpose; use plonky2_util::{log2_ceil, log2_strict}; -use rayon::prelude::*; +use maybe_rayon::*; use crate::all_stark::{AllStark, Table}; use crate::config::StarkConfig; diff --git a/starky/Cargo.toml b/starky/Cargo.toml index 4e67856d..80a26bfc 100644 --- a/starky/Cargo.toml +++ b/starky/Cargo.toml @@ -4,6 +4,10 @@ description = "Implementation of STARKs" version = "0.1.0" edition = "2021" +[features] +default = ["parallel"] +parallel = ["maybe_rayon/parallel"] + [dependencies] plonky2 = { path = "../plonky2" } plonky2_util = { path = "../util" } @@ -11,4 +15,4 @@ anyhow = "1.0.40" env_logger = "0.9.0" itertools = "0.10.0" log = "0.4.14" -rayon = "1.5.1" +maybe_rayon = { path = "../maybe_rayon"} diff --git a/starky/src/permutation.rs b/starky/src/permutation.rs index 88361003..e1e1c2af 100644 --- a/starky/src/permutation.rs +++ b/starky/src/permutation.rs @@ -13,7 +13,7 @@ use plonky2::iop::target::Target; use plonky2::plonk::circuit_builder::CircuitBuilder; use plonky2::plonk::config::{AlgebraicHasher, GenericConfig, Hasher}; use plonky2::util::reducing::{ReducingFactor, ReducingFactorTarget}; -use rayon::prelude::*; +use maybe_rayon::*; use crate::config::StarkConfig; use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer}; diff --git a/starky/src/proof.rs b/starky/src/proof.rs index c321b484..fad8a7f1 100644 --- a/starky/src/proof.rs +++ b/starky/src/proof.rs @@ -12,7 +12,7 @@ use plonky2::hash::merkle_tree::MerkleCap; use plonky2::iop::ext_target::ExtensionTarget; use plonky2::iop::target::Target; use plonky2::plonk::config::GenericConfig; -use rayon::prelude::*; +use maybe_rayon::*; use crate::config::StarkConfig; use crate::permutation::PermutationChallengeSet; diff --git a/starky/src/prover.rs b/starky/src/prover.rs index 6cdb1384..d446dabb 100644 --- a/starky/src/prover.rs +++ b/starky/src/prover.rs @@ -16,7 +16,7 @@ use plonky2::timed; use plonky2::util::timing::TimingTree; use plonky2::util::transpose; use plonky2_util::{log2_ceil, log2_strict}; -use rayon::prelude::*; +use maybe_rayon::*; use crate::config::StarkConfig; use crate::constraint_consumer::ConstraintConsumer;