Skip to main content

schedule

Function schedule 

Source
pub fn schedule(arrays: &[Array]) -> Scheduled
Expand description

arrays with the work they need put in order, to be started later by Scheduled::async_eval or Scheduled::eval with less delay: ordering a large graph takes a while, which can then overlap other work, such as the GPU running the previous step while the next one waits for its result.

The arrays are evaluated as async_eval or eval would at the time they are started; nodes evaluated in between (by another evaluation) are skipped.

use nuvec_core::{Result, array, schedule};

let x = array![1.0, 2.0];
let y = &(&x * 3.0) + 1.0;
let scheduled = schedule(std::slice::from_ref(&y));
// ... wait for something else here ...
scheduled.async_eval()?;
assert_eq!(y.to_vec::<f32>()?, [4.0, 7.0]);