pub fn async_eval(arrays: &[Array]) -> Result<()>Expand description
Starts evaluating arrays and returns without waiting for GPU work: reading the arrays
(or evaluating them) later waits for exactly the work they need. As in MLX, use it to
overlap building the next computation with the GPU running this one.
CPU work runs on the calling thread before this returns. Errors are sticky: an error already known is returned; a GPU error is reported by the first read or evaluation of an affected array. Submission blocks while too many command buffers are in flight.
use nuvec_core::{Array, Result, async_eval};
let x = Array::from_slice(&[1.0f32, 2.0], &[2])?;
let y = &x * 3.0;
async_eval(std::slice::from_ref(&y))?;
// ... build the next computation here ...
assert_eq!(y.to_vec::<f32>()?, [3.0, 6.0]); // waits for `y` only