balancer 0.2.0

Use rayon and mpi to achieve simple forms of internode + intranode parallelism.
Documentation
  • Coverage
  • 42.86%
    6 out of 14 items documented0 out of 8 items with examples
  • Size
  • Source code size: 35.06 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.15 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 45s Average build duration of successful builds.
  • all releases: 45s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • cavemanloverboy/balancer
    3 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • cavemanloverboy

balancer: simple multinode parallelism

With the power of rayon and mpi, internode and intranode parallelism is achieved for simple tasks.

Example Usage

See examples/simple.rs.

use std::sync::Arc;

use balancer::Balancer;
use mpi::environment::Universe;

fn main() {
    let universe = Arc::new(mpi::initialize().unwrap());
    experiment(universe.clone());
    experiment(universe.clone());
}

fn experiment(universe: Arc<Universe>) {
    // Get relevant portion of data on this node
    let data: Vec<f64> = (0..100_000).map(|x| x as f64 / 100_000.0).collect();

    // Define task
    let work = |x: &f64| x * x;

    // Initialize balancer, work and collect
    let verbose = false;
    let balancer = Balancer::new(universe, verbose);
    balancer.work_local(&data, work);
    let output = balancer.collect();

    // That's it!
    // Let's do some verification
    if balancer.rank == 0 {
        for (expected, actual) in data.iter().map(work).zip(output.as_ref().unwrap()) {
            assert_eq!(expected, *actual);
        }
    }
}