diff --git a/src/fof.c b/src/fof.c index 0c1b904975e56e0f80cb0566bc24ee6df1924eb2..d63d3d71bc65dc9539ab4f32d5d6300611afc0ca 100644 --- a/src/fof.c +++ b/src/fof.c @@ -32,6 +32,9 @@ __attribute__((always_inline)) INLINE static int fof_find(const int i, int *group_id) { int root = i; + /* TODO: May need this atomic here: + * while (root != atomic_cas(&group_id[root], group_id[root], group_id[root])) + * root = atomic_cas(&group_id[root], group_id[root], group_id[root]); */ while (root != group_id[root]) root = group_id[root]; /* Perform path compression. */ @@ -298,11 +301,15 @@ void fof_search_cell(struct space *s, struct cell *c) { /* If the root ID of pj is lower than pi's root ID set pi's root to point to pj's. * Otherwise set pj's to root to point to pi's.*/ if (root_j < root_i) { + /* TODO: May need this atomic here: + * atomic_cas(&group_id[root_i], group_id[root_i], root_j); */ group_id[root_i] = root_j; /* Update root_i on the fly. */ root_i = root_j; } else + /* TODO: May need this atomic here: + atomic_cas(&group_id[root_j], group_id[root_j], root_i); */ group_id[root_j] = root_i; } @@ -382,11 +389,15 @@ void fof_search_pair_cells(struct space *s, struct cell *ci, struct cell *cj) { /* If the root ID of pj is lower than pi's root ID set pi's root to point to pj's. * Otherwise set pj's to root to point to pi's.*/ if (root_j < root_i) { + /* TODO: May need this atomic here: + atomic_cas(&group_id[root_i], group_id[root_i], root_j); */ group_id[root_i] = root_j; /* Update root_i on the fly. */ root_i = root_j; } else + /* TODO: May need this atomic here: + atomic_cas(&group_id[root_j], group_id[root_j], root_i); */ group_id[root_j] = root_i; }