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

View File

@@ -5,6 +5,7 @@ members = [
"crates/spirv_backend", "crates/spirv_backend",
"crates/spirv_backend_builder", "crates/spirv_backend_builder",
"crates/spirv_backend_runner", "crates/spirv_backend_runner",
"crates/post",
"crates/applications/buffer_proto5", "crates/applications/buffer_proto5",
"crates/applications/multi_core_inverter", "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): renderer used in the `wavefront` example):
```rust ```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); 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 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") ![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)): output targets include ([src/render.rs](crates/coremem/src/render.rs)):
- `ColorTermRenderer`: renders 2d-slices in real-time to the terminal. - `ColorTermRenderer`: renders 2d-slices in real-time to the terminal.
- `Y4MRenderer`: outputs 2d-slices to an uncompressed `y4m` video file. - `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. - `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. 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 image = "0.24" # MIT
imageproc = "0.23" # MIT imageproc = "0.23" # MIT
indexmap = "1.9" # MIT or Apache 2.0 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 lazy_static = "1.4" # MIT or Apache 2.0
log = "0.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 more-asserts = "0.3" # CC0-1.0
natord = "1.0" # MIT
ndarray = { version = "0.15", features = ["rayon", "serde"] } # MIT or Apache 2.0 ndarray = { version = "0.15", features = ["rayon", "serde"] } # MIT or Apache 2.0
num = "0.4" # MIT or Apache 2.0 num = "0.4" # MIT or Apache 2.0
# plotly = { version = "0.6", features = ["kaleido", "plotly_ndarray"], path = "../plotly/plotly" } # plotly = { version = "0.6", features = ["kaleido", "plotly_ndarray"], path = "../plotly/plotly" }
rand = "0.8" # MIT or Apache 2.0 rand = "0.8" # MIT or Apache 2.0
rayon = "1.5" # MIT or Apache 2.0 rayon = "1.5" # MIT or Apache 2.0
serde = "1.0" # 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 threadpool = "1.8" # MIT or Apache 2.0
typetag = "0.2" # MIT or Apache 2.0 typetag = "0.2" # MIT or Apache 2.0
y4m = "0.7" # MIT y4m = "0.7" # MIT

View File

@@ -11,7 +11,6 @@ pub mod driver;
pub mod geom; pub mod geom;
pub mod mat; pub mod mat;
pub mod meas; pub mod meas;
pub mod post;
pub mod real; pub mod real;
pub mod render; pub mod render;
pub mod sim; 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 std::path::PathBuf;
use structopt::StructOpt; 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::fs;
use std::path::PathBuf; use std::path::PathBuf;
use structopt::StructOpt; 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::path::PathBuf;
use std::time::Duration; use std::time::Duration;
use structopt::StructOpt; use structopt::StructOpt;

View File

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