Skip to content

Commit

Permalink
Set producer_stride to never exceed cache_window_nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
porcuquine committed Oct 6, 2020
1 parent f121730 commit 1233043
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions storage-proofs/porep/src/stacked/vanilla/create_label/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,13 @@ fn create_layer_labels(
let lookahead = settings.multicore_sdr_lookahead;
let num_producers = settings.multicore_sdr_producers;

let producer_stride = settings.multicore_sdr_producer_stride;
// NOTE: Stride must not exceed `sdr_parents_cache_window_nodes`.
// If it does, the process will deadlock with producers and consumers
// waiting for each other.
let cache_window_nodes = parents_cache.size() / (4 * DEGREE);
assert!(
producer_stride <= cache_window_nodes as u64,
"sdr_producer_stride ({}) exceeds sdr_parents_cache_window_nodes ({})",
producer_stride,
cache_window_nodes
);
let producer_stride = settings
.multicore_sdr_producer_stride
.min(cache_window_nodes as u64);

const BYTES_PER_NODE: usize = (NODE_SIZE * DEGREE) + 64;

Expand Down

0 comments on commit 1233043

Please sign in to comment.