Crates.io | para |
lib.rs | para |
version | 0.2.0 |
source | src |
created_at | 2020-11-04 21:02:09.895243 |
updated_at | 2020-11-17 23:39:13.321941 |
description | A dataflow/pipeline parallelization framework |
homepage | |
repository | https://github.com/kmaork/para |
max_upload_size | |
id | 308732 |
size | 14,161 |
This project is a work in progress. Feel free to contribute.
Efficient parallelization of pipelined computations on multiple cores with a simple interface.
The interface should look something like:
let data = vec!(0, 1, 2);
let mut sum = 0;
pipeline!(4, data
=> (|x| (x * 2, x) => |(x2, x)| x2 - x,
|x| -x)
=> |x| sum += x);
In this example, the tasks to be done are:
data
|x| (x * 2, x)
and |x| -x
closures.|x| (x * 2, x)
to |(x2, x)| x2 - x
|(x2, x)| x2 - x
and |x| -x
into the sum
variable.This constructs a graph in which each node is a closure. Data flows between the closures and gets processed.
Except for the first and the last nodes in this example (the iteration and the sum nodes),
all nodes are completely parallelizable. The pipeline!
macro will instantiate a scheduler
which will use 4 threads to run all nodes and maximize computation throughput.
consume
interface to return a boolean and use try_lock
when executing functions in a mutex.
This might be less problematic once we implement work stealing. Also, we might wanna use a refcell instead of a mutex.