Skip to content
GitLab
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
f6686095
Commit
f6686095
authored
Oct 09, 2019
by
Matthieu Schaller
Browse files
Move the time-step limiter tasks into a self-contained block loop.
parent
d33aa37e
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
f6686095
...
...
@@ -3553,6 +3553,9 @@ int cell_unskip_hydro_tasks(struct cell *c, struct scheduler *s) {
if
(
c
->
kick1
!=
NULL
)
scheduler_activate
(
s
,
c
->
kick1
);
if
(
c
->
kick2
!=
NULL
)
scheduler_activate
(
s
,
c
->
kick2
);
if
(
c
->
timestep
!=
NULL
)
scheduler_activate
(
s
,
c
->
timestep
);
if
(
c
->
hydro
.
limiter_in
!=
NULL
)
scheduler_activate
(
s
,
c
->
hydro
.
limiter_in
);
if
(
c
->
hydro
.
limiter_out
!=
NULL
)
scheduler_activate
(
s
,
c
->
hydro
.
limiter_out
);
if
(
c
->
hydro
.
end_force
!=
NULL
)
scheduler_activate
(
s
,
c
->
hydro
.
end_force
);
if
(
c
->
hydro
.
cooling
!=
NULL
)
scheduler_activate
(
s
,
c
->
hydro
.
cooling
);
#ifdef WITH_LOGGER
...
...
src/cell.h
View file @
f6686095
...
...
@@ -360,6 +360,12 @@ struct cell {
/*! Linked list of the tasks computing this cell's limiter. */
struct
link
*
limiter
;
/*! Dependency implicit task for the time-step limiter (in->limiter->out)*/
struct
task
*
limiter_in
;
/*! Dependency implicit task for the time-step limiter (in->limiter->out)*/
struct
task
*
limiter_out
;
/*! Dependency implicit task for the ghost (in->ghost->out)*/
struct
task
*
ghost_in
;
...
...
src/engine_maketasks.c
View file @
f6686095
...
...
@@ -1018,6 +1018,7 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c,
const
int
with_cooling
=
(
e
->
policy
&
engine_policy_cooling
);
const
int
with_star_formation
=
(
e
->
policy
&
engine_policy_star_formation
);
const
int
with_black_holes
=
(
e
->
policy
&
engine_policy_black_holes
);
const
int
with_limiter
=
(
e
->
policy
&
engine_policy_limiter
);
/* Are we are the level where we create the stars' resort tasks?
* If the tree is shallow, we need to do this at the super-level if the
...
...
@@ -1165,6 +1166,31 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c,
scheduler_addunlock
(
s
,
c
->
black_holes
.
black_holes_out
,
c
->
super
->
timestep
);
}
/* Time-step limiter */
if
(
with_limiter
)
{
c
->
hydro
.
limiter_in
=
scheduler_addtask
(
s
,
task_type_limiter_in
,
task_subtype_none
,
0
,
/* implicit = */
1
,
c
,
NULL
);
c
->
hydro
.
limiter_out
=
scheduler_addtask
(
s
,
task_type_limiter_out
,
task_subtype_none
,
0
,
/* implicit = */
1
,
c
,
NULL
);
scheduler_addunlock
(
s
,
c
->
super
->
kick2
,
c
->
hydro
.
limiter_in
);
scheduler_addunlock
(
s
,
c
->
hydro
.
limiter_out
,
c
->
super
->
timestep
);
scheduler_addunlock
(
s
,
c
->
hydro
.
limiter_out
,
c
->
super
->
timestep_limiter
);
if
(
with_feedback
)
{
scheduler_addunlock
(
s
,
c
->
stars
.
stars_out
,
c
->
hydro
.
limiter_in
);
}
if
(
with_black_holes
)
{
scheduler_addunlock
(
s
,
c
->
black_holes
.
black_holes_out
,
c
->
hydro
.
limiter_in
);
}
}
}
}
else
{
/* We are above the super-cell so need to go deeper */
...
...
@@ -1801,16 +1827,6 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
/* Escape early */
if
(
t
->
type
==
task_type_none
)
continue
;
#ifdef WITH_LOGGER
struct
task
*
const
ci_super_kick2_or_logger
=
ci
->
super
->
logger
;
struct
task
*
const
cj_super_kick2_or_logger
=
(
cj
==
NULL
)
?
NULL
:
cj
->
super
->
logger
;
#else
struct
task
*
const
ci_super_kick2_or_logger
=
ci
->
super
->
kick2
;
struct
task
*
const
cj_super_kick2_or_logger
=
(
cj
==
NULL
)
?
NULL
:
cj
->
super
->
kick2
;
#endif
/* Sort tasks depend on the drift of the cell (gas version). */
if
(
t_type
==
task_type_sort
&&
ci
->
nodeID
==
nodeID
)
{
scheduler_addunlock
(
sched
,
ci
->
hydro
.
super
->
hydro
.
drift
,
t
);
...
...
@@ -1957,9 +1973,10 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
}
if
(
with_limiter
)
{
scheduler_addunlock
(
sched
,
ci_super_kick2_or_logger
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
super
->
timestep
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
super
->
timestep_limiter
);
scheduler_addunlock
(
sched
,
ci
->
hydro
.
super
->
hydro
.
limiter_in
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
hydro
.
super
->
hydro
.
limiter_out
);
}
}
...
...
@@ -2147,9 +2164,10 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
}
if
(
with_limiter
)
{
scheduler_addunlock
(
sched
,
ci_super_kick2_or_logger
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
super
->
timestep
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
super
->
timestep_limiter
);
scheduler_addunlock
(
sched
,
ci
->
hydro
.
super
->
hydro
.
limiter_in
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
hydro
.
super
->
hydro
.
limiter_out
);
}
}
else
/*(ci->nodeID != nodeID) */
{
if
(
with_feedback
)
{
...
...
@@ -2225,9 +2243,10 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
}
if
(
with_limiter
)
{
scheduler_addunlock
(
sched
,
cj_super_kick2_or_logger
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
cj
->
super
->
timestep
);
scheduler_addunlock
(
sched
,
t_limiter
,
cj
->
super
->
timestep_limiter
);
scheduler_addunlock
(
sched
,
cj
->
hydro
.
super
->
hydro
.
limiter_in
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
cj
->
hydro
.
super
->
hydro
.
limiter_out
);
}
}
}
else
/*(cj->nodeID != nodeID) */
{
...
...
@@ -2393,9 +2412,10 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
}
if
(
with_limiter
)
{
scheduler_addunlock
(
sched
,
ci_super_kick2_or_logger
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
super
->
timestep
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
super
->
timestep_limiter
);
scheduler_addunlock
(
sched
,
ci
->
hydro
.
super
->
hydro
.
limiter_in
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
hydro
.
super
->
hydro
.
limiter_out
);
}
}
...
...
@@ -2587,9 +2607,10 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
}
if
(
with_limiter
)
{
scheduler_addunlock
(
sched
,
ci_super_kick2_or_logger
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
super
->
timestep
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
super
->
timestep_limiter
);
scheduler_addunlock
(
sched
,
ci
->
hydro
.
super
->
hydro
.
limiter_in
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
ci
->
hydro
.
super
->
hydro
.
limiter_out
);
}
}
else
/* ci->nodeID != nodeID */
{
...
...
@@ -2667,9 +2688,10 @@ void engine_make_extra_hydroloop_tasks_mapper(void *map_data, int num_elements,
}
if
(
with_limiter
)
{
scheduler_addunlock
(
sched
,
cj_super_kick2_or_logger
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
cj
->
super
->
timestep
);
scheduler_addunlock
(
sched
,
t_limiter
,
cj
->
super
->
timestep_limiter
);
scheduler_addunlock
(
sched
,
cj
->
hydro
.
super
->
hydro
.
limiter_in
,
t_limiter
);
scheduler_addunlock
(
sched
,
t_limiter
,
cj
->
hydro
.
super
->
hydro
.
limiter_out
);
}
}
}
else
/* cj->nodeID != nodeID */
{
...
...
src/engine_marktasks.c
View file @
f6686095
...
...
@@ -921,6 +921,12 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
if
(
cell_is_active_black_holes
(
t
->
ci
,
e
))
scheduler_activate
(
s
,
t
);
}
/* Limiter implicit tasks? */
else
if
(
t_type
==
task_type_limiter_in
||
t_type
==
task_type_limiter_out
)
{
if
(
cell_is_active_hydro
(
t
->
ci
,
e
))
scheduler_activate
(
s
,
t
);
}
/* Time-step? */
else
if
(
t_type
==
task_type_timestep
)
{
t
->
ci
->
hydro
.
updated
=
0
;
...
...
@@ -959,6 +965,8 @@ int engine_marktasks(struct engine *e) {
const
ticks
tic
=
getticks
();
int
rebuild_space
=
0
;
message
(
"MARKTASKS!"
);
/* Run through the tasks and mark as skip or not. */
size_t
extra_data
[
3
]
=
{(
size_t
)
e
,
(
size_t
)
rebuild_space
,
(
size_t
)
&
e
->
sched
};
threadpool_map
(
&
e
->
threadpool
,
engine_marktasks_mapper
,
s
->
tasks
,
s
->
nr_tasks
,
...
...
src/task.c
View file @
f6686095
...
...
@@ -71,6 +71,8 @@ const char *taskID_names[task_type_count] = {"none",
"kick2"
,
"timestep"
,
"timestep_limiter"
,
"limiter_in"
,
"limiter_out"
,
"send"
,
"recv"
,
"grav_long_range"
,
...
...
src/task.h
View file @
f6686095
...
...
@@ -65,6 +65,8 @@ enum task_types {
task_type_kick2
,
task_type_timestep
,
task_type_timestep_limiter
,
task_type_limiter_in
,
/* Implicit */
task_type_limiter_out
,
/* Implicit */
task_type_send
,
task_type_recv
,
task_type_grav_long_range
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment