Skip to main content

all_sum

Function all_sum 

Source
pub fn all_sum(x: &Array, group: Option<&Group>) -> Array
Expand description

The element-wise sum of x over the ranks of group (the default group if None), as MLX’s all_sum: every rank gets the same bits.

use nuvec_core::{array, distributed};

// Without a configured group, the group is this process alone.
let x = array![1.0, 2.0];
assert_eq!(distributed::all_sum(&x, None).to_vec::<f32>().unwrap(), [1.0, 2.0]);