Skip to content

Commit

Permalink
fix: set core opts from SHARD* env vars (#889)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtguibas authored Jun 7, 2024
2 parents 7eaa793 + 722b805 commit 0377fcb
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 0377fcb

Please sign in to comment.