EspressoSystems / jellyfish

A Rust Implementation of the PLONK ZKP System and Extensions
https://jellyfish.docs.espressosys.com
MIT License
393 stars 98 forks source link

jellyfish benches build break with --no-default-features #652

Open ggutoski opened 1 month ago

ggutoski commented 1 month ago

I'm unable to build jellyfish benches with --no-default-features. The feature parallel is on by default so I cannot run benches without parallel feature. Much confusion. Why is parallelizable_slice_iter returning a rayon::slice::Iter when parallel feature is disabled?? I expect rayon to be completely absent without parallel.

cargo check --benches --no-default-features --features test-srs
    Checking jf-relation v0.4.4 (https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbef)
    Checking jf-pcs v0.1.0 (/Users/gus/Documents/espresso/git-repos/jellyfish/pcs)
    Checking jf-relation v0.4.4 (/Users/gus/Documents/espresso/git-repos/jellyfish/relation)
error[E0599]: `rayon::slice::Iter<'_, DensePolynomial<<E as ark_ec::pairing::Pairing>::ScalarField>>` is not an iterator
   --> pcs/src/univariate_kzg/mod.rs:134:14
    |
133 |           let res = parallelizable_slice_iter(polys)
    |  ___________________-
134 | |             .map(|poly| Self::commit(prover_param, poly))
    | |             -^^^ `rayon::slice::Iter<'_, DensePolynomial<<E as ark_ec::pairing::Pairing>::ScalarField>>` is not an iterator
    | |_____________|
    | 
    |
   ::: /Users/gus/.cargo-nix/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/slice/mod.rs:785:1
    |
785 |   pub struct Iter<'data, T: Sync> {
    |   ------------------------------- doesn't satisfy `_: Iterator`
    |
    = note: the following trait bounds were not satisfied:
            `rayon::slice::Iter<'_, DensePolynomial<<E as ark_ec::pairing::Pairing>::ScalarField>>: Iterator`
            which is required by `&mut rayon::slice::Iter<'_, DensePolynomial<<E as ark_ec::pairing::Pairing>::ScalarField>>: Iterator`
    = help: items from traits can only be used if the trait is in scope
help: trait `ParallelIterator` which provides `map` is implemented but not in scope; perhaps you want to import it
    |
9   + use rayon::iter::ParallelIterator;
    |

...and many more similar build errors.

akonring commented 1 month ago

Well, this seems annoying.

I'm unable to build jellyfish benches with --no-default-features. The feature parallel is on by default so I cannot run benches without parallel feature. Much confusion. Why is parallelizable_slice_iter returning a rayon::slice::Iter when parallel feature is disabled?? I expect rayon to be completely absent without parallel.

fwiw, there exists rayon-cond here but not sure it is super helpful.

alxiong commented 1 month ago

i'd suggest we use plonky2's maybe_rayon, could closes #111 as a plus.

ggutoski commented 4 weeks ago

i'd suggest we use plonky2's maybe_rayon, could closes #111 as a plus.

omg yes! I'm not a huge fan of parallelizable_slice_iter tbh.