Skip to content

Commit

Permalink
Removed with_min_len
Browse files Browse the repository at this point in the history
  • Loading branch information
vigna committed Nov 11, 2024
1 parent 48db29e commit dab068e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/algo/llp/label_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ impl LabelStore {
pub(crate) fn init(&mut self) {
self.volumes
.par_iter()
.with_min_len(1024)
.for_each(|v| v.store(1, Ordering::Relaxed));
self.labels
.par_iter_mut()
.enumerate()
.with_min_len(1024)
.for_each(|(i, l)| *l.get_mut() = i);
}

Expand Down
15 changes: 4 additions & 11 deletions src/algo/llp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ pub fn layered_label_propagation<R: RandomAccessGraph + Sync>(
label_store.init();
can_change
.par_iter()
.with_min_len(1024)
.for_each(|c| c.store(true, Ordering::Relaxed));

let mut obj_func = 0.0;
Expand Down Expand Up @@ -296,10 +295,7 @@ pub fn layered_label_propagation<R: RandomAccessGraph + Sync>(
// We temporarily use the update permutation to compute the sorting
// permutation of the labels.
let perm = &mut update_perm;
perm.par_iter_mut()
.enumerate()
.with_min_len(1024)
.for_each(|(i, x)| *x = i);
perm.par_iter_mut().enumerate().for_each(|(i, x)| *x = i);
// Sort by label
perm.par_sort_by(|&a, &b| label_store.label(a as _).cmp(&label_store.label(b as _)));

Expand Down Expand Up @@ -440,10 +436,7 @@ impl<'a, T> UnsafeSlice<'a, T> {
}
pub fn invert_permutation(perm: &[usize], inv_perm: &mut [usize]) {
let unsafe_slice = UnsafeSlice::new(inv_perm);
perm.par_iter()
.enumerate()
.with_min_len(1024)
.for_each(|(i, &x)| unsafe {
unsafe_slice.write(x, i);
});
perm.par_iter().enumerate().for_each(|(i, &x)| unsafe {
unsafe_slice.write(x, i);
});
}

0 comments on commit dab068e

Please sign in to comment.