Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
c83f6d0c
Commit
c83f6d0c
authored
Mar 29, 2020
by
Matthieu Schaller
Browse files
Lock the gravity and limiter tasks when SWIFT_TASKS_WITHOUT_ATOMICS is defined
parent
a984ae3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/task.c
View file @
c83f6d0c
...
...
@@ -456,6 +456,10 @@ void task_unlock(struct task *t) {
case
task_type_self
:
case
task_type_sub_self
:
if
(
subtype
==
task_subtype_grav
)
{
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
cell_gunlocktree
(
ci
);
cell_munlocktree
(
ci
);
#endif
}
else
if
((
subtype
==
task_subtype_stars_density
)
||
(
subtype
==
task_subtype_stars_feedback
))
{
cell_sunlocktree
(
ci
);
...
...
@@ -469,6 +473,9 @@ void task_unlock(struct task *t) {
}
else
if
(
subtype
==
task_subtype_do_bh_swallow
)
{
cell_bunlocktree
(
ci
);
}
else
if
(
subtype
==
task_subtype_limiter
)
{
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
cell_unlocktree
(
ci
);
#endif
}
else
{
/* hydro */
cell_unlocktree
(
ci
);
}
...
...
@@ -477,6 +484,12 @@ void task_unlock(struct task *t) {
case
task_type_pair
:
case
task_type_sub_pair
:
if
(
subtype
==
task_subtype_grav
)
{
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
cell_gunlocktree
(
ci
);
cell_gunlocktree
(
cj
);
cell_munlocktree
(
ci
);
cell_munlocktree
(
cj
);
#endif
}
else
if
((
subtype
==
task_subtype_stars_density
)
||
(
subtype
==
task_subtype_stars_feedback
))
{
cell_sunlocktree
(
ci
);
...
...
@@ -495,6 +508,10 @@ void task_unlock(struct task *t) {
cell_bunlocktree
(
ci
);
cell_bunlocktree
(
cj
);
}
else
if
(
subtype
==
task_subtype_limiter
)
{
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
cell_unlocktree
(
ci
);
cell_unlocktree
(
cj
);
#endif
}
else
{
/* hydro */
cell_unlocktree
(
ci
);
cell_unlocktree
(
cj
);
...
...
@@ -502,12 +519,23 @@ void task_unlock(struct task *t) {
break
;
case
task_type_grav_down
:
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
cell_gunlocktree
(
ci
);
cell_munlocktree
(
ci
);
#endif
break
;
case
task_type_grav_long_range
:
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
cell_munlocktree
(
ci
);
#endif
break
;
case
task_type_grav_mm
:
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
cell_munlocktree
(
ci
);
cell_munlocktree
(
cj
);
#endif
break
;
case
task_type_star_formation
:
...
...
@@ -603,7 +631,16 @@ int task_lock(struct task *t) {
case
task_type_self
:
case
task_type_sub_self
:
if
(
subtype
==
task_subtype_grav
)
{
return
1
;
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
/* Lock the gparts and the m-pole */
if
(
ci
->
grav
.
phold
||
ci
->
grav
.
mhold
)
return
0
;
if
(
cell_glocktree
(
ci
)
!=
0
)
return
0
;
else
if
(
cell_mlocktree
(
ci
)
!=
0
)
{
cell_gunlocktree
(
ci
);
return
0
;
}
#endif
}
else
if
((
subtype
==
task_subtype_stars_density
)
||
(
subtype
==
task_subtype_stars_feedback
))
{
if
(
ci
->
stars
.
hold
)
return
0
;
...
...
@@ -628,7 +665,10 @@ int task_lock(struct task *t) {
if
(
ci
->
black_holes
.
hold
)
return
0
;
if
(
cell_blocktree
(
ci
)
!=
0
)
return
0
;
}
else
if
(
subtype
==
task_subtype_limiter
)
{
return
1
;
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
if
(
ci
->
hydro
.
hold
)
return
0
;
if
(
cell_locktree
(
ci
)
!=
0
)
return
0
;
#endif
}
else
{
/* subtype == hydro */
if
(
ci
->
hydro
.
hold
)
return
0
;
if
(
cell_locktree
(
ci
)
!=
0
)
return
0
;
...
...
@@ -638,7 +678,24 @@ int task_lock(struct task *t) {
case
task_type_pair
:
case
task_type_sub_pair
:
if
(
subtype
==
task_subtype_grav
)
{
return
1
;
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
/* Lock the gparts and the m-pole in both cells */
if
(
ci
->
grav
.
phold
||
cj
->
grav
.
phold
)
return
0
;
if
(
cell_glocktree
(
ci
)
!=
0
)
return
0
;
if
(
cell_glocktree
(
cj
)
!=
0
)
{
cell_gunlocktree
(
ci
);
return
0
;
}
else
if
(
cell_mlocktree
(
ci
)
!=
0
)
{
cell_gunlocktree
(
ci
);
cell_gunlocktree
(
cj
);
return
0
;
}
else
if
(
cell_mlocktree
(
cj
)
!=
0
)
{
cell_gunlocktree
(
ci
);
cell_gunlocktree
(
cj
);
cell_munlocktree
(
ci
);
return
0
;
}
#endif
}
else
if
((
subtype
==
task_subtype_stars_density
)
||
(
subtype
==
task_subtype_stars_feedback
))
{
/* Lock the stars and the gas particles in both cells */
...
...
@@ -691,7 +748,14 @@ int task_lock(struct task *t) {
return
0
;
}
}
else
if
(
subtype
==
task_subtype_limiter
)
{
return
1
;
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
if
(
ci
->
hydro
.
hold
||
cj
->
hydro
.
hold
)
return
0
;
if
(
cell_locktree
(
ci
)
!=
0
)
return
0
;
if
(
cell_locktree
(
cj
)
!=
0
)
{
cell_unlocktree
(
ci
);
return
0
;
}
#endif
}
else
{
/* subtype == hydro */
/* Lock the parts in both cells */
if
(
ci
->
hydro
.
hold
||
cj
->
hydro
.
hold
)
return
0
;
...
...
@@ -704,15 +768,36 @@ int task_lock(struct task *t) {
break
;
case
task_type_grav_down
:
return
1
;
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
/* Lock the gparts and the m-poles */
if
(
ci
->
grav
.
phold
||
ci
->
grav
.
mhold
)
return
0
;
if
(
cell_glocktree
(
ci
)
!=
0
)
return
0
;
else
if
(
cell_mlocktree
(
ci
)
!=
0
)
{
cell_gunlocktree
(
ci
);
return
0
;
}
#endif
break
;
case
task_type_grav_long_range
:
return
1
;
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
/* Lock the m-poles */
if
(
ci
->
grav
.
mhold
)
return
0
;
if
(
cell_mlocktree
(
ci
)
!=
0
)
return
0
;
#endif
break
;
case
task_type_grav_mm
:
return
1
;
#ifdef SWIFT_TASKS_WITHOUT_ATOMICS
/* Lock both m-poles */
if
(
ci
->
grav
.
mhold
||
cj
->
grav
.
mhold
)
return
0
;
if
(
cell_mlocktree
(
ci
)
!=
0
)
return
0
;
if
(
cell_mlocktree
(
cj
)
!=
0
)
{
cell_munlocktree
(
ci
);
return
0
;
}
#endif
break
;
case
task_type_star_formation
:
...
...
@@ -1276,10 +1361,6 @@ enum task_categories task_get_category(const struct task *t) {
case
task_type_end_grav_force
:
return
task_category_gravity
;
case
task_type_fof_self
:
case
task_type_fof_pair
:
return
task_category_fof
;
case
task_type_self
:
case
task_type_pair
:
case
task_type_sub_self
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment