Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(prover): add CLI option to run prover with max allocation #2794

Merged
merged 6 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions prover/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ circuit_sequencer_api = "=0.150.4"
zkevm_test_harness = "=0.150.4"

# GPU proving dependencies
wrapper_prover = { package = "zksync-wrapper-prover", version = "=0.150.4" }
shivini = "=0.150.4"
wrapper_prover = { package = "zksync-wrapper-prover", version = "=0.150.6" }
shivini = "=0.150.6"

# Core workspace dependencies
zksync_multivm = { path = "../core/lib/multivm", version = "0.1.0" }
Expand Down
12 changes: 10 additions & 2 deletions prover/crates/bin/prover_fri/src/gpu_prover_job_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub mod gpu_prover {
use anyhow::Context as _;
use shivini::{
gpu_proof_config::GpuProofConfig, gpu_prove_from_external_witness_data, ProverContext,
ProverContextConfig,
};
use tokio::task::JoinHandle;
use zksync_config::configs::{fri_prover_group::FriProverGroupConfig, FriProverConfig};
Expand Down Expand Up @@ -82,7 +83,15 @@ pub mod gpu_prover {
address: SocketAddress,
zone: Zone,
protocol_version: ProtocolSemanticVersion,
max_allocation: Option<usize>,
) -> Self {
let prover_context = match max_allocation {
Some(max_allocation) => ProverContext::create_with_config(
ProverContextConfig::default().with_maximum_device_allocation(max_allocation),
)
.expect("failed initializing gpu prover context"),
None => ProverContext::create().expect("failed initializing gpu prover context"),
};
Prover {
blob_store,
public_blob_store,
Expand All @@ -91,8 +100,7 @@ pub mod gpu_prover {
setup_load_mode,
circuit_ids_for_round_to_be_proven,
witness_vector_queue,
prover_context: ProverContext::create()
.expect("failed initializing gpu prover context"),
prover_context,
address,
zone,
protocol_version,
Expand Down
6 changes: 6 additions & 0 deletions prover/crates/bin/prover_fri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ async fn main() -> anyhow::Result<()> {
public_blob_store,
pool,
circuit_ids_for_round_to_be_proven,
opt.max_allocation,
notify,
)
.await
Expand Down Expand Up @@ -178,6 +179,7 @@ async fn get_prover_tasks(
public_blob_store: Option<Arc<dyn ObjectStore>>,
pool: ConnectionPool<Prover>,
circuit_ids_for_round_to_be_proven: Vec<CircuitIdRoundTuple>,
_max_allocation: Option<usize>,
_init_notifier: Arc<Notify>,
) -> anyhow::Result<Vec<JoinHandle<anyhow::Result<()>>>> {
use crate::prover_job_processor::{load_setup_data_cache, Prover};
Expand Down Expand Up @@ -213,6 +215,7 @@ async fn get_prover_tasks(
public_blob_store: Option<Arc<dyn ObjectStore>>,
pool: ConnectionPool<Prover>,
circuit_ids_for_round_to_be_proven: Vec<CircuitIdRoundTuple>,
max_allocation: Option<usize>,
init_notifier: Arc<Notify>,
) -> anyhow::Result<Vec<JoinHandle<anyhow::Result<()>>>> {
use gpu_prover_job_processor::gpu_prover;
Expand Down Expand Up @@ -245,6 +248,7 @@ async fn get_prover_tasks(
address.clone(),
zone.clone(),
protocol_version,
max_allocation,
);
let producer = shared_witness_vector_queue.clone();

Expand Down Expand Up @@ -295,4 +299,6 @@ pub(crate) struct Cli {
pub(crate) config_path: Option<std::path::PathBuf>,
#[arg(long)]
pub(crate) secrets_path: Option<std::path::PathBuf>,
#[arg(long)]
pub(crate) max_allocation: Option<usize>,
}
Loading