Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
fd077c1b
Commit
fd077c1b
authored
7 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Placed TODOs where atomic operations may be necessary.
parent
77fd9693
No related branches found
No related tags found
1 merge request
!543
Fof
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fof.c
+11
-0
11 additions, 0 deletions
src/fof.c
with
11 additions
and
0 deletions
src/fof.c
+
11
−
0
View file @
fd077c1b
...
...
@@ -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
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment