Implement a 'SerializerRenderer' output format
It's CBOR, which seems to pack not so efficiently (250*250*20 * 12 floats takes 400 MB per frame, whereas this many doubles could pack into 120 MB). serde_cbor also seems to be extremely slow: taking multiple minutes per frame. This could be parallelized to be less problematic though (it already is -- just bump the parallelism). Might be worth testing other formats.
This commit is contained in:
@@ -462,3 +462,24 @@ impl Renderer for MultiRenderer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SerializerRenderer {
|
||||
out_base: String
|
||||
}
|
||||
|
||||
impl SerializerRenderer {
|
||||
pub fn new(out_base: &str) -> Self {
|
||||
Self {
|
||||
out_base: out_base.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Renderer for SerializerRenderer {
|
||||
fn render(&self, state: &dyn GenericSim, measurements: &[Box<dyn AbstractMeasurement>]) {
|
||||
let snap = state.to_static();
|
||||
let name = format!("{}{}.cbor", self.out_base, snap.step_no());
|
||||
let out = File::create(name).unwrap();
|
||||
serde_cbor::to_writer(out, &snap).unwrap();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user