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

Use two producers in all layers. #1296

Merged
merged 1 commit into from
Sep 28, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ fn create_layer_labels(
) -> Result<()> {
info!("Creating labels for layer {}", cur_layer);
// num_producers is the number of producer threads
let (lookahead, num_producers, producer_stride) = if cur_layer == 1 {
(400, 1, 16)
} else {
let (lookahead, num_producers, 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.
Expand Down
14 changes: 4 additions & 10 deletions storage-proofs/porep/src/stacked/vanilla/memory_handling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,12 @@ impl<T: FromByteSlice> CacheReader<T> {
std::slice::from_raw_parts_mut((*self.bufs.get()).as_mut_ptr(), 2)
}

// TODO: is this actually needed?
#[allow(dead_code)]
// This is unused, but included to document the meaning of its components.
// This allows splitting the reset in order to avoid a pause.
pub fn reset(&self) -> Result<()> {
let buf0 = Self::map_buf(0, self.window_size, &self.file)?;
// FIXME: If window_size is more than half of size, then buf1 will map past end of file.
// This should never be accessed, but we should not map it.
let buf1 = Self::map_buf(self.window_size as u64, self.window_size, &self.file)?;
let bufs = unsafe { self.get_mut_bufs() };
bufs[0] = buf0;
bufs[1] = buf1;
self.cur_window.store(0, SeqCst);
self.cur_window_safe.store(0, SeqCst);
self.start_reset();
self.finish_reset();
Ok(())
}

Expand Down