memopro/lib.rs
1//! memopro core: framework-agnostic memory toolkit for deep learning workloads.
2//!
3//! The crate knows nothing about PyTorch or any other framework; it works on byte buffers,
4//! dtypes and shapes. Python bindings live in the separate `memopro-py` crate.
5//!
6//! Modules:
7//! - [`hwinfo`]: host memory, container limit and disk capacity for the per-pool budget (v0.1)
8//! - [`verify`]: reads of original file regions checked by digest (v0.1)
9//! - [`codec`]: byte shuffle + zstd for lossless in-RAM compression (v0.1)
10//! - [`csv`]: row and key kernels for `memopro.sort` / `memopro.join` (E069)
11//! - [`edr`]: bf16 weights as a 1-byte base (a draft) and a 4-bit residual, lossless (0308)
12//! - [`rt`]: runtime C-R: large buffers under a hard memory budget, dropped and re-read from
13//! their original files or compressed, never written to disk (0109, 0112)
14//!
15//! Unbuilt functions return [`Error::NotImplemented`] with the planned milestone; nothing panics.
16
17pub mod codec;
18pub mod csv;
19pub mod edr;
20pub mod error;
21pub mod hwinfo;
22#[cfg(unix)]
23pub mod residency;
24pub mod rt;
25pub mod verify;
26
27pub use error::{Error, Result};
28
29/// The README's example compiles and runs (`cargo test --doc`), so the crates.io page stays true.
30#[cfg(doctest)]
31#[doc = include_str!("../README.md")]
32pub struct ReadmeDoctests;
33
34/// Version of the memopro core, taken from the crate manifest.
35pub const VERSION: &str = env!("CARGO_PKG_VERSION");
36
37/// Returns the version of the memopro core.
38pub fn version() -> &'static str {
39 VERSION
40}
41
42#[cfg(test)]
43mod tests {
44 use super::*;
45
46 #[test]
47 fn version_matches_manifest() {
48 assert_eq!(version(), env!("CARGO_PKG_VERSION"));
49 assert!(!version().is_empty());
50 }
51}