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
3742104d
Commit
3742104d
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Make the time-step limiter tasks lock-free
parent
15106d9f
No related branches found
No related tags found
1 merge request
!1048
Atomic gravity and time-step limiter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/task.c
+8
-2
8 additions, 2 deletions
src/task.c
src/timestep_limiter_iact.h
+1
-1
1 addition, 1 deletion
src/timestep_limiter_iact.h
with
9 additions
and
3 deletions
src/task.c
+
8
−
2
View file @
3742104d
...
@@ -468,7 +468,8 @@ void task_unlock(struct task *t) {
...
@@ -468,7 +468,8 @@ void task_unlock(struct task *t) {
cell_unlocktree
(
ci
);
cell_unlocktree
(
ci
);
}
else
if
(
subtype
==
task_subtype_do_bh_swallow
)
{
}
else
if
(
subtype
==
task_subtype_do_bh_swallow
)
{
cell_bunlocktree
(
ci
);
cell_bunlocktree
(
ci
);
}
else
{
}
else
if
(
subtype
==
task_subtype_limiter
)
{
}
else
{
/* hydro */
cell_unlocktree
(
ci
);
cell_unlocktree
(
ci
);
}
}
break
;
break
;
...
@@ -493,7 +494,8 @@ void task_unlock(struct task *t) {
...
@@ -493,7 +494,8 @@ void task_unlock(struct task *t) {
}
else
if
(
subtype
==
task_subtype_do_bh_swallow
)
{
}
else
if
(
subtype
==
task_subtype_do_bh_swallow
)
{
cell_bunlocktree
(
ci
);
cell_bunlocktree
(
ci
);
cell_bunlocktree
(
cj
);
cell_bunlocktree
(
cj
);
}
else
{
}
else
if
(
subtype
==
task_subtype_limiter
)
{
}
else
{
/* hydro */
cell_unlocktree
(
ci
);
cell_unlocktree
(
ci
);
cell_unlocktree
(
cj
);
cell_unlocktree
(
cj
);
}
}
...
@@ -625,6 +627,8 @@ int task_lock(struct task *t) {
...
@@ -625,6 +627,8 @@ int task_lock(struct task *t) {
}
else
if
(
subtype
==
task_subtype_do_bh_swallow
)
{
}
else
if
(
subtype
==
task_subtype_do_bh_swallow
)
{
if
(
ci
->
black_holes
.
hold
)
return
0
;
if
(
ci
->
black_holes
.
hold
)
return
0
;
if
(
cell_blocktree
(
ci
)
!=
0
)
return
0
;
if
(
cell_blocktree
(
ci
)
!=
0
)
return
0
;
}
else
if
(
subtype
==
task_subtype_limiter
)
{
return
1
;
}
else
{
/* subtype == hydro */
}
else
{
/* subtype == hydro */
if
(
ci
->
hydro
.
hold
)
return
0
;
if
(
ci
->
hydro
.
hold
)
return
0
;
if
(
cell_locktree
(
ci
)
!=
0
)
return
0
;
if
(
cell_locktree
(
ci
)
!=
0
)
return
0
;
...
@@ -686,6 +690,8 @@ int task_lock(struct task *t) {
...
@@ -686,6 +690,8 @@ int task_lock(struct task *t) {
cell_bunlocktree
(
ci
);
cell_bunlocktree
(
ci
);
return
0
;
return
0
;
}
}
}
else
if
(
subtype
==
task_subtype_limiter
)
{
return
1
;
}
else
{
/* subtype == hydro */
}
else
{
/* subtype == hydro */
/* Lock the parts in both cells */
/* Lock the parts in both cells */
if
(
ci
->
hydro
.
hold
||
cj
->
hydro
.
hold
)
return
0
;
if
(
ci
->
hydro
.
hold
||
cj
->
hydro
.
hold
)
return
0
;
...
...
This diff is collapsed.
Click to expand it.
src/timestep_limiter_iact.h
+
1
−
1
View file @
3742104d
...
@@ -88,7 +88,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
...
@@ -88,7 +88,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_limiter(
if
(
pj
->
time_bin
>
pi
->
time_bin
+
time_bin_neighbour_max_delta_bin
)
{
if
(
pj
->
time_bin
>
pi
->
time_bin
+
time_bin_neighbour_max_delta_bin
)
{
/* Store the smallest time bin that woke up this particle */
/* Store the smallest time bin that woke up this particle */
pj
->
limiter_data
.
wakeup
=
max
(
pj
->
limiter_data
.
wakeup
,
-
pi
->
time_bin
);
atomic_max_c
(
&
pj
->
limiter_data
.
wakeup
,
-
pi
->
time_bin
);
}
}
}
}
...
...
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