Skip to content

Commit

Permalink
fix: set core opts from SHARD* env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
chiefbiiko committed Jun 5, 2024
1 parent 1cd2636 commit 722b805
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core/src/utils/options.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
use std::env;

const DEFAULT_SHARD_SIZE: usize = 1 << 22;
const DEFAULT_SHARD_BATCH_SIZE: usize = 16;

#[derive(Debug, Clone, Copy)]
pub struct SP1CoreOpts {
pub shard_size: usize,
Expand All @@ -9,8 +14,14 @@ pub struct SP1CoreOpts {
impl Default for SP1CoreOpts {
fn default() -> Self {
Self {
shard_size: 1 << 22,
shard_batch_size: 16,
shard_size: env::var("SHARD_SIZE").map_or_else(
|_| DEFAULT_SHARD_SIZE,
|s| s.parse::<usize>().unwrap_or(DEFAULT_SHARD_SIZE),
),
shard_batch_size: env::var("SHARD_BATCH_SIZE").map_or_else(
|_| DEFAULT_SHARD_BATCH_SIZE,
|s| s.parse::<usize>().unwrap_or(DEFAULT_SHARD_BATCH_SIZE),
),
shard_chunking_multiplier: 1,
reconstruct_commitments: true,
}
Expand Down

0 comments on commit 722b805

Please sign in to comment.