lift the post-processing tools (viewer, csv, decimate) into their own crate

- these tools shouldn't need access to coremem internals.
- lifting them out reduces some dependencies in coremem-the-library.
- separation allows faster iteration in the coremem library while
  temporarily breaking the post-processing tools (specifically,
  those tools could take deps on a specific coremem version and thereby
  we split the update process into two, smaller steps).
This commit is contained in:
2022-07-17 15:47:39 -07:00
parent 89be8bf8dd
commit a2d35782a1
10 changed files with 41 additions and 18 deletions

18
Cargo.lock generated
View File

@@ -334,12 +334,9 @@ dependencies = [
"image",
"imageproc",
"indexmap",
"itertools",
"lazy_static",
"log",
"lru",
"more-asserts",
"natord",
"ndarray",
"num",
"rand 0.8.5",
@@ -350,13 +347,26 @@ dependencies = [
"spirv-std-macros",
"spirv_backend",
"spirv_backend_runner",
"structopt",
"threadpool",
"typetag",
"wgpu",
"y4m",
]
[[package]]
name = "coremem_post"
version = "0.1.0"
dependencies = [
"bincode",
"coremem",
"crossterm",
"itertools",
"lru",
"natord",
"rayon",
"structopt",
]
[[package]]
name = "crc32fast"
version = "1.3.2"

View File

@@ -5,6 +5,7 @@ members = [
"crates/spirv_backend",
"crates/spirv_backend_builder",
"crates/spirv_backend_runner",
"crates/post",
"crates/applications/buffer_proto5",
"crates/applications/multi_core_inverter",

View File

@@ -121,7 +121,7 @@ allowing you to dig further into the simulation in an _interactive_ way (versus
renderer used in the `wavefront` example):
```rust
// serialize frames for later viewing with `cargo run --release --bin viewer`
// serialize frames for later viewing with `cargo run -p coremem_post --release --bin viewer`
driver.add_serializer_renderer(&*format!("{}frame-", prefix), 36000, None);
```
@@ -134,7 +134,7 @@ $ cargo run --release --example sr_latch
and then investigate the results with
```
$ pushd crates/coremem ; cargo run --bin viewer ../../out/applications/sr_latch ; popd
$ cargo run -p coremem_post --bin viewer ./out/applications/sr_latch
```
![screencapture of Viewer for SR latch at t=2.8ns. it shows two rings spaced horizontally, with arrows circulating them](readme_images/sr_latch_EzBxy_2800ps.png "SR latch at t=2.8ns")
@@ -252,7 +252,7 @@ measurements include ([src/meas.rs](crates/coremem/src/meas.rs)):
output targets include ([src/render.rs](crates/coremem/src/render.rs)):
- `ColorTermRenderer`: renders 2d-slices in real-time to the terminal.
- `Y4MRenderer`: outputs 2d-slices to an uncompressed `y4m` video file.
- `SerializerRenderer`: dumps the full 3d simulation state to disk. parseable after the fact with [src/bin/viewer.rs](crates/coremem/src/bin/viewer.rs).
- `SerializerRenderer`: dumps the full 3d simulation state to disk. parseable after the fact with [src/bin/viewer.rs](crates/post/src/bin/viewer.rs).
- `CsvRenderer`: dumps the output of all measurements into a `csv` file.
historically there was also a plotly renderer, but that effort was redirected into developing the viewer tool better.

View File

@@ -25,19 +25,15 @@ futures = "0.3" # MIT or Apache 2.0
image = "0.24" # MIT
imageproc = "0.23" # MIT
indexmap = "1.9" # MIT or Apache 2.0
itertools = "0.10" # MIT or Apache 2.0
lazy_static = "1.4" # MIT or Apache 2.0
log = "0.4" # MIT or Apache 2.0
lru = "0.7" # MIT
more-asserts = "0.3" # CC0-1.0
natord = "1.0" # MIT
ndarray = { version = "0.15", features = ["rayon", "serde"] } # MIT or Apache 2.0
num = "0.4" # MIT or Apache 2.0
# plotly = { version = "0.6", features = ["kaleido", "plotly_ndarray"], path = "../plotly/plotly" }
rand = "0.8" # MIT or Apache 2.0
rayon = "1.5" # MIT or Apache 2.0
serde = "1.0" # MIT or Apache 2.0
structopt = "0.3" # MIT or Apache 2.0
threadpool = "1.8" # MIT or Apache 2.0
typetag = "0.2" # MIT or Apache 2.0
y4m = "0.7" # MIT

View File

@@ -11,7 +11,6 @@ pub mod driver;
pub mod geom;
pub mod mat;
pub mod meas;
pub mod post;
pub mod real;
pub mod render;
pub mod sim;

15
crates/post/Cargo.toml Normal file
View File

@@ -0,0 +1,15 @@
[package]
name = "coremem_post"
version = "0.1.0"
authors = ["Colin <colin@uninsane.org>"]
edition = "2021"
[dependencies]
coremem = { path = "../coremem" }
crossterm = "0.24" # MIT
bincode = "1.3" # MIT
itertools = "0.10" # MIT or Apache 2.0
lru = "0.7" # MIT
natord = "1.0" # MIT
rayon = "1.5" # MIT or Apache 2.0
structopt = "0.3" # MIT or Apache 2.0

View File

@@ -1,4 +1,5 @@
use coremem::post::{Loader, LoaderCache};
// use crate::{Loader, LoaderCache};
use coremem_post::{Loader, LoaderCache};
use std::path::PathBuf;
use structopt::StructOpt;

View File

@@ -1,4 +1,5 @@
use coremem::post::Loader;
// use crate::Loader;
use coremem_post::Loader;
use std::fs;
use std::path::PathBuf;
use structopt::StructOpt;

View File

@@ -1,4 +1,4 @@
use coremem::post::{Loader, Viewer};
use coremem_post::{Loader, Viewer};
use std::path::PathBuf;
use std::time::Duration;
use structopt::StructOpt;

View File

@@ -1,7 +1,7 @@
//! Post-processing tools
use crate::meas::AbstractMeasurement;
use crate::render::{ColorTermRenderer, Renderer as _, RenderConfig, SerializedFrame};
use crate::sim::{SimState, StaticSim};
use coremem::meas::AbstractMeasurement;
use coremem::render::{ColorTermRenderer, Renderer as _, RenderConfig, SerializedFrame};
use coremem::sim::{SimState, StaticSim};
use itertools::Itertools as _;
use lru::LruCache;