Skip to content

Commit

Permalink
bench: jaeger benchmarks should be able to run the dynamic Dory evalu…
Browse files Browse the repository at this point in the history
…ation proof (#289)

# Rationale for this change
It is important to be able to run benchmarks on the newly implemented
dynamic Dory evaluation proof. This PR introduces Jaeger benchmarks that
will run the dynamic Dory evaluation proof.

# What changes are included in this PR?
- Jaeger benchmarks are introduced that measure the dynamic Dory
evaluation proof time.
- To simplify calling benchmarks, the `test` flag is removed from Dory
`public_parameters` module when creating random test values.

# Are these changes tested?
Yes
  • Loading branch information
iajoiner authored Oct 21, 2024
2 parents 3dae12e + 891780d commit 2e60599
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
3 changes: 2 additions & 1 deletion crates/proof-of-sql/benches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ To run benchmarks with Jaeger, you need to do the following
2. Run a benchmark.
```bash
cargo bench -p proof-of-sql --bench jaeger_benches InnerProductProof
cargo bench -p proof-of-sql --bench jaeger_benches Dory --features="test"
cargo bench -p proof-of-sql --bench jaeger_benches Dory
cargo bench -p proof-of-sql --bench jaeger_benches DynamicDory
```
3. Navigate to http://localhost:16686/ to see the results.
4. To end the Jaeger service, run
Expand Down
29 changes: 23 additions & 6 deletions crates/proof-of-sql/benches/jaeger_benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
//! ```bash
//! docker run --rm -d --name jaeger -p 6831:6831/udp -p 16686:16686 jaegertracing/all-in-one:latest
//! cargo bench -p proof-of-sql --bench jaeger_benches InnerProductProof
//! cargo bench -p proof-of-sql --bench jaeger_benches Dory --features="test"
//! cargo bench -p proof-of-sql --bench jaeger_benches Dory
//! cargo bench -p proof-of-sql --bench jaeger_benches DynamicDory
//! ```
//! Then, navigate to <http://localhost:16686> to view the traces.

#[cfg(feature = "test")]
use ark_std::test_rng;
use blitzar::{compute::init_backend, proof::InnerProductProof};
#[cfg(feature = "test")]
use proof_of_sql::proof_primitive::dory::{
DoryEvaluationProof, DoryProverPublicSetup, DoryVerifierPublicSetup, ProverSetup,
PublicParameters, VerifierSetup,
DoryEvaluationProof, DoryProverPublicSetup, DoryVerifierPublicSetup,
DynamicDoryEvaluationProof, ProverSetup, PublicParameters, VerifierSetup,
};
mod scaffold;
use crate::scaffold::querys::QUERIES;
Expand Down Expand Up @@ -51,7 +50,6 @@ fn main() {
}
}
}
#[cfg(feature = "test")]
"Dory" => {
// Run 3 times to ensure that warm-up of the GPU has occurred.
let pp = PublicParameters::test_rand(10, &mut test_rng());
Expand All @@ -73,6 +71,25 @@ fn main() {
}
}
}
"DynamicDory" => {
// Run 3 times to ensure that warm-up of the GPU has occurred.
let public_parameters = PublicParameters::test_rand(11, &mut test_rng());
let prover_setup = ProverSetup::from(&public_parameters);
let verifier_setup = VerifierSetup::from(&public_parameters);

for _ in 0..3 {
for (title, query, columns) in QUERIES {
jaeger_scaffold::<DynamicDoryEvaluationProof>(
title,
query,
columns,
SIZE,
&&prover_setup,
&&verifier_setup,
);
}
}
}
_ => panic!("Invalid benchmark type specified."),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ impl PublicParameters {
pub fn rand<R: CryptoRng + Rng + ?Sized>(max_nu: usize, rng: &mut R) -> Self {
Self::rand_impl(max_nu, rng)
}
#[cfg(any(test, feature = "test"))]
/// Generate random public parameters for testing.
pub fn test_rand<R: Rng + ?Sized>(max_nu: usize, rng: &mut R) -> Self {
Self::rand_impl(max_nu, rng)
Expand Down

0 comments on commit 2e60599

Please sign in to comment.