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
9b772201
Commit
9b772201
authored
Dec 12, 2018
by
Alexei Borissov
Browse files
Added star feedback tasks
parent
3e0b00c6
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/cell.h
View file @
9b772201
...
...
@@ -504,6 +504,9 @@ struct cell {
/*! Linked list of the tasks computing this cell's star density. */
struct
link
*
density
;
// ALEXEI: DOES THIS NEED TO BE HERE?
struct
link
*
feedback
;
/*! Number of #spart updated in this cell. */
int
updated
;
...
...
src/engine_maketasks.c
View file @
9b772201
...
...
@@ -1022,6 +1022,8 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements,
engine_addlink
(
e
,
&
ci
->
grav
.
grav
,
t
);
}
else
if
(
t
->
subtype
==
task_subtype_stars_density
)
{
engine_addlink
(
e
,
&
ci
->
stars
.
density
,
t
);
}
else
if
(
t
->
subtype
==
task_subtype_stars_feedback
)
{
engine_addlink
(
e
,
&
ci
->
stars
.
feedback
,
t
);
}
/* Link pair tasks to cells. */
...
...
@@ -1038,6 +1040,9 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements,
}
else
if
(
t
->
subtype
==
task_subtype_stars_density
)
{
engine_addlink
(
e
,
&
ci
->
stars
.
density
,
t
);
engine_addlink
(
e
,
&
cj
->
stars
.
density
,
t
);
}
else
if
(
t
->
subtype
==
task_subtype_stars_feedback
)
{
engine_addlink
(
e
,
&
ci
->
stars
.
feedback
,
t
);
engine_addlink
(
e
,
&
cj
->
stars
.
feedback
,
t
);
}
#ifdef SWIFT_DEBUG_CHECKS
else
if
(
t_subtype
==
task_subtype_external_grav
)
{
...
...
@@ -1057,6 +1062,8 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements,
engine_addlink
(
e
,
&
ci
->
grav
.
grav
,
t
);
}
else
if
(
t
->
subtype
==
task_subtype_stars_density
)
{
engine_addlink
(
e
,
&
ci
->
stars
.
density
,
t
);
}
else
if
(
t
->
subtype
==
task_subtype_stars_feedback
)
{
engine_addlink
(
e
,
&
ci
->
stars
.
feedback
,
t
);
}
/* Link sub-pair tasks to cells. */
...
...
@@ -1073,6 +1080,9 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements,
}
else
if
(
t
->
subtype
==
task_subtype_stars_density
)
{
engine_addlink
(
e
,
&
ci
->
stars
.
density
,
t
);
engine_addlink
(
e
,
&
cj
->
stars
.
density
,
t
);
}
else
if
(
t
->
subtype
==
task_subtype_stars_feedback
)
{
engine_addlink
(
e
,
&
ci
->
stars
.
feedback
,
t
);
engine_addlink
(
e
,
&
cj
->
stars
.
feedback
,
t
);
}
#ifdef SWIFT_DEBUG_CHECKS
else
if
(
t_subtype
==
task_subtype_external_grav
)
{
...
...
@@ -1601,9 +1611,16 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements,
/* Now, build all the dependencies for the stars */
engine_make_stars_loops_dependencies
(
sched
,
t
,
t
->
ci
);
if
(
t
->
ci
==
t
->
ci
->
super
)
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
stars
.
ghost_out
,
t
->
ci
->
super
->
end_force
);
}
if
(
t
->
type
==
task_type_self
&&
t
->
subtype
==
task_subtype_stars_feedback
)
{
/* Make the self-feedback tasks depend on the stars ghost task. */
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
stars
.
ghost_out
,
t
);
/* Make end_force depend on feedback */
if
(
t
->
ci
==
t
->
ci
->
super
)
{
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
super
->
end_force
);
}
}
/* Otherwise, pair interaction? */
...
...
@@ -1640,6 +1657,16 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements,
}
}
else
if
(
t
->
type
==
task_type_pair
&&
t
->
subtype
==
task_subtype_stars_feedback
)
{
/* Make feedback task depend on ghost */
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
stars
.
ghost_out
,
t
);
/* Make end_force depend on feedback */
if
(
t
->
ci
==
t
->
ci
->
super
)
{
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
super
->
end_force
);
}
}
/* Otherwise, sub-self interaction? */
else
if
(
t
->
type
==
task_type_sub_self
&&
...
...
@@ -1658,6 +1685,22 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements,
}
else
error
(
"oo"
);
}
else
if
(
t
->
type
==
task_type_sub_self
&&
t
->
subtype
==
task_subtype_stars_feedback
)
{
/* Make all feedback tasks depend on the drift and sorts. */
//scheduler_addunlock(sched, t->ci->super->hydro.drift, t);
//scheduler_addunlock(sched, t->ci->super->hydro.sorts, t);
//scheduler_addunlock(sched, t->ci->super->grav.drift, t);
//scheduler_addunlock(sched, t->ci->super->stars.sorts, t);
/* Now, build all the dependencies for the stars for the cells */
/* that are local and are not descendant of the same super-cells */
//if (t->ci->nodeID == nodeID) {
// engine_make_stars_loops_dependencies(sched, t, t->ci);
//} else
// error("oo");
}
/* Otherwise, sub-pair interaction? */
else
if
(
t
->
type
==
task_type_sub_pair
&&
...
...
@@ -1692,6 +1735,38 @@ void engine_link_stars_tasks_mapper(void *map_data, int num_elements,
engine_make_stars_loops_dependencies
(
sched
,
t
,
t
->
cj
);
}
}
else
if
(
t
->
type
==
task_type_sub_pair
&&
t
->
subtype
==
task_subtype_stars_feedback
)
{
/* Make all feedback tasks depend on the drift. */
//if (t->cj->nodeID == engine_rank)
// scheduler_addunlock(sched, t->cj->super->hydro.drift, t);
//scheduler_addunlock(sched, t->cj->super->hydro.sorts, t);
//if (t->cj->nodeID == engine_rank)
// scheduler_addunlock(sched, t->cj->super->grav.drift, t);
//scheduler_addunlock(sched, t->ci->super->stars.sorts, t);
//if (t->ci->super != t->cj->super) {
// if (t->ci->nodeID == engine_rank)
// scheduler_addunlock(sched, t->ci->super->hydro.drift, t);
// scheduler_addunlock(sched, t->ci->super->hydro.sorts, t);
// if (t->ci->nodeID == engine_rank)
// scheduler_addunlock(sched, t->ci->super->grav.drift, t);
// scheduler_addunlock(sched, t->cj->super->stars.sorts, t);
//}
/* Now, build all the dependencies for the stars for the cells */
/* that are local and are not descendant of the same super-cells */
//if (t->ci->nodeID == nodeID) {
// engine_make_stars_loops_dependencies(sched, t, t->ci);
//}
//if (t->cj->nodeID == nodeID) {
// if (t->ci->super != t->cj->super)
// engine_make_stars_loops_dependencies(sched, t, t->cj);
//}
}
}
}
...
...
@@ -1736,9 +1811,12 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements,
if
(
ci
->
stars
.
count
==
0
&&
ci
->
hydro
.
count
==
0
)
continue
;
/* If the cells is local build a self-interaction */
if
(
ci
->
nodeID
==
nodeID
)
if
(
ci
->
nodeID
==
nodeID
)
{
scheduler_addtask
(
sched
,
task_type_self
,
task_subtype_stars_density
,
0
,
0
,
ci
,
NULL
);
scheduler_addtask
(
sched
,
task_type_self
,
task_subtype_stars_feedback
,
0
,
0
,
ci
,
NULL
);
}
/* Now loop over all the neighbours of this cell */
for
(
int
ii
=
-
1
;
ii
<
2
;
ii
++
)
{
...
...
@@ -1767,6 +1845,8 @@ void engine_make_starsloop_tasks_mapper(void *map_data, int num_elements,
const
int
sid
=
sortlistID
[(
kk
+
1
)
+
3
*
((
jj
+
1
)
+
3
*
(
ii
+
1
))];
scheduler_addtask
(
sched
,
task_type_pair
,
task_subtype_stars_density
,
sid
,
0
,
ci
,
cj
);
scheduler_addtask
(
sched
,
task_type_pair
,
task_subtype_stars_feedback
,
sid
,
0
,
ci
,
cj
);
}
}
}
...
...
src/runner.c
View file @
9b772201
...
...
@@ -2765,6 +2765,8 @@ void *runner_main(void *data) {
runner_do_grav_external
(
r
,
ci
,
1
);
else
if
(
t
->
subtype
==
task_subtype_stars_density
)
runner_doself_stars_density
(
r
,
ci
,
1
);
else
if
(
t
->
subtype
==
task_subtype_stars_feedback
)
runner_doself_stars_feedback
(
r
,
ci
,
1
);
else
error
(
"Unknown/invalid task subtype (%d)."
,
t
->
subtype
);
break
;
...
...
@@ -2782,6 +2784,8 @@ void *runner_main(void *data) {
runner_dopair_recursive_grav
(
r
,
ci
,
cj
,
1
);
else
if
(
t
->
subtype
==
task_subtype_stars_density
)
runner_dopair_stars_density
(
r
,
ci
,
cj
,
1
);
else
if
(
t
->
subtype
==
task_subtype_stars_feedback
)
runner_dopair_stars_feedback
(
r
,
ci
,
cj
,
1
);
else
error
(
"Unknown/invalid task subtype (%d)."
,
t
->
subtype
);
break
;
...
...
@@ -2797,6 +2801,8 @@ void *runner_main(void *data) {
runner_dosub_self2_force
(
r
,
ci
,
1
);
else
if
(
t
->
subtype
==
task_subtype_stars_density
)
runner_dosub_self_stars_density
(
r
,
ci
,
1
);
else
if
(
t
->
subtype
==
task_subtype_stars_feedback
)
runner_dosub_self_stars_feedback
(
r
,
ci
,
1
);
else
error
(
"Unknown/invalid task subtype (%d)."
,
t
->
subtype
);
break
;
...
...
@@ -2812,6 +2818,8 @@ void *runner_main(void *data) {
runner_dosub_pair2_force
(
r
,
ci
,
cj
,
t
->
flags
,
1
);
else
if
(
t
->
subtype
==
task_subtype_stars_density
)
runner_dosub_pair_stars_density
(
r
,
ci
,
cj
,
t
->
flags
,
1
);
else
if
(
t
->
subtype
==
task_subtype_stars_feedback
)
runner_dosub_pair_stars_feedback
(
r
,
ci
,
cj
,
t
->
flags
,
1
);
else
error
(
"Unknown/invalid task subtype (%d)."
,
t
->
subtype
);
break
;
...
...
src/stars/Default/stars_iact.h
View file @
9b772201
...
...
@@ -37,6 +37,7 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj,
si
->
ids_ngbs_density
[
si
->
num_ngb_density
]
=
pj
->
id
;
++
si
->
num_ngb_density
;
#endif
message
(
"here"
);
}
/**
...
...
@@ -54,4 +55,6 @@ runner_iact_nonsym_stars_density(float r2, const float *dx, float hi, float hj,
__attribute__
((
always_inline
))
INLINE
static
void
runner_iact_nonsym_stars_feedback
(
float
r2
,
const
float
*
dx
,
float
hi
,
float
hj
,
struct
spart
*
restrict
si
,
struct
part
*
restrict
pj
,
float
a
,
float
H
)
{}
struct
part
*
restrict
pj
,
float
a
,
float
H
)
{
message
(
"here"
);
}
src/task.c
View file @
9b772201
...
...
@@ -86,7 +86,7 @@ const char *taskID_names[task_type_count] = {"none",
const
char
*
subtaskID_names
[
task_subtype_count
]
=
{
"none"
,
"density"
,
"gradient"
,
"force"
,
"grav"
,
"external_grav"
,
"tend"
,
"xv"
,
"rho"
,
"gpart"
,
"multipole"
,
"spart"
,
"stars_density"
};
"multipole"
,
"spart"
,
"stars_density"
,
"stars_feedback"
};
#ifdef WITH_MPI
/* MPI communicators for the subtypes. */
...
...
src/task.h
View file @
9b772201
...
...
@@ -93,6 +93,7 @@ enum task_subtypes {
task_subtype_multipole
,
task_subtype_spart
,
task_subtype_stars_density
,
task_subtype_stars_feedback
,
task_subtype_count
}
__attribute__
((
packed
));
...
...
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