Skip to content
Snippets Groups Projects
Commit fd077c1b authored by James Willis's avatar James Willis
Browse files

Placed TODOs where atomic operations may be necessary.

parent 77fd9693
No related branches found
No related tags found
1 merge request!543Fof
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment