Skip to content

Commit

Permalink
Back to updating splats every 5 iterations, better GPU util
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurBrussee committed Nov 19, 2024
1 parent ba0dbd2 commit 5664cd2
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions crates/brush-viewer/src/train_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ use web_time::Instant;

use crate::viewer::ViewerMessage;

const UPDATE_EVERY: u32 = 5;

#[derive(Debug, Clone)]
pub enum TrainMessage {
Paused(bool),
Expand Down Expand Up @@ -152,20 +154,22 @@ pub(crate) fn train_loop<T: AsyncRead + Unpin + 'static>(
.await?;
splats = new_splats;

// Log out train stats.
emitter
.emit(ViewerMessage::Splats {
iter: trainer.iter,
splats: Box::new(splats.valid()),
})
.await;
emitter
.emit(ViewerMessage::TrainStep {
stats: Box::new(stats),
iter: trainer.iter,
timestamp: Instant::now(),
})
.await;
if trainer.iter % UPDATE_EVERY == 0 {
// Log out train stats.
emitter
.emit(ViewerMessage::Splats {
iter: trainer.iter,
splats: Box::new(splats.valid()),
})
.await;
emitter
.emit(ViewerMessage::TrainStep {
stats: Box::new(stats),
iter: trainer.iter,
timestamp: Instant::now(),
})
.await;
}
}
}

Expand Down

0 comments on commit 5664cd2

Please sign in to comment.