← Back

Module lib

<p>Joule Standard Library - Machine Learning Energy-aware machine learning primitives</p> <p>The Joule ML module treats energy consumption as a first-class optimization target. Every operation is annotated with energy costs, and the framework provides tools for:</p> <ul> <li>Real-time power monitoring and energy tracking</li> <li>Energy-budget constrained training</li> <li>Cost models for operation energy estimation</li> <li>Roofline analysis for identifying bottlenecks</li> <li>Energy-aware optimizers that adapt based on efficiency</li> <li>Device abstraction with thermal awareness</li> </ul> <p>Core philosophy: “Joules per compute” matters as much as accuracy.</p>

fn cuda_available() -> bool

Check if CUDA is available

Source: lib.joule:341

fn metal_available() -> bool

Check if Metal is available

Source: lib.joule:349

fn neural_engine_available() -> bool

Check if Neural Engine is available

Source: lib.joule:357

fn best_device() -> DeviceId

Get best available device for ML workloads

Source: lib.joule:365

fn init() -> Result<(), device::DeviceError>

Initialize ML subsystem

Source: lib.joule:385

fn start_power_monitoring(interval_ms: u64)

Start power monitoring on all devices

Source: lib.joule:391

fn stop_power_monitoring()

Stop power monitoring

Source: lib.joule:398

fn total_energy() -> Joules

Get total energy consumed across all devices

Source: lib.joule:403

fn total_power() -> Watts

Get current total power draw

Source: lib.joule:408

fn parse_model_source(source: &str) -> Result<ModelSource, InferenceError>

Parse model source string into ModelSource enum

Source: lib.joule:435

fn estimate_model_efficiency(model_path: &str) -> Result<f64, FormatError>

Source: lib.joule:501