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
878e4771
Commit
878e4771
authored
May 02, 2016
by
John Regan
Committed by
Matthieu Schaller
May 15, 2016
Browse files
Removing 'ghost' references and replacing where appropriate with 'hierarchy'
parent
bced4c82
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/cell.h
View file @
878e4771
...
...
@@ -117,8 +117,8 @@ struct cell {
struct
link
*
density
,
*
force
,
*
grav
;
int
nr_density
,
nr_force
,
nr_grav
;
/* The
ghost
task to link density to interactions. */
struct
task
*
ghost
,
*
init
,
*
drift
,
*
kick
;
/* The
hierarchy
task to link density to interactions. */
struct
task
*
hierarchy
,
*
init
,
*
drift
,
*
kick
;
/* Task receiving data. */
struct
task
*
recv_xv
,
*
recv_rho
;
...
...
src/engine.c
View file @
878e4771
...
...
@@ -95,8 +95,10 @@ struct link *engine_addlink(struct engine *e, struct link *l, struct task *t) {
}
/**
* @brief Generate the
ghosts all the O(Npart)
tasks for a hierarchy of cells.
* @brief Generate the
hierarchical
tasks for a hierarchy of cells
- all the O(Npart) tasks
.
*
* Previously this was called the ghost task but has since been renamed to reflect
* it's new more general usage.
* Tasks are only created here. The dependencies will be added later on.
*
* @param e The #engine.
...
...
@@ -104,7 +106,7 @@ struct link *engine_addlink(struct engine *e, struct link *l, struct task *t) {
* @param super The super #cell.
*/
void
engine_make_
ghost
_tasks
(
struct
engine
*
e
,
struct
cell
*
c
,
void
engine_make_
hierarchical
_tasks
(
struct
engine
*
e
,
struct
cell
*
c
,
struct
cell
*
super
)
{
struct
scheduler
*
s
=
&
e
->
sched
;
...
...
@@ -135,8 +137,8 @@ void engine_make_ghost_tasks(struct engine *e, struct cell *c,
if
(
c
->
count
>
0
)
{
/* Generate the ghost task. */
c
->
ghost
=
scheduler_addtask
(
s
,
task_type_
ghost
,
task_subtype_none
,
0
,
/* Generate the
hierarchy task i.e.
ghost task. */
c
->
hierarchy
=
scheduler_addtask
(
s
,
task_type_
hierarchy
,
task_subtype_none
,
0
,
0
,
c
,
NULL
,
0
);
}
...
...
@@ -157,7 +159,7 @@ void engine_make_ghost_tasks(struct engine *e, struct cell *c,
if
(
c
->
split
)
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
engine_make_
ghost
_tasks
(
e
,
c
->
progeny
[
k
],
super
);
engine_make_
hierarchical
_tasks
(
e
,
c
->
progeny
[
k
],
super
);
}
/**
...
...
@@ -615,14 +617,14 @@ void engine_addtasks_send(struct engine *e, struct cell *ci, struct cell *cj) {
struct
task
*
t_rho
=
scheduler_addtask
(
s
,
task_type_send
,
task_subtype_none
,
2
*
ci
->
tag
+
1
,
0
,
ci
,
cj
,
0
);
/* The send_rho task depends on the cell's
ghost
task. */
scheduler_addunlock
(
s
,
ci
->
super
->
ghost
,
t_rho
);
/* The send_rho task depends on the cell's
hierarchy
task. */
scheduler_addunlock
(
s
,
ci
->
super
->
hierarchy
,
t_rho
);
/* The send_rho task should unlock the super-cell's kick task. */
scheduler_addunlock
(
s
,
t_rho
,
ci
->
super
->
kick
);
/* The send_xv task should unlock the super-cell's
ghost
task. */
scheduler_addunlock
(
s
,
t_xv
,
ci
->
super
->
ghost
);
/* The send_xv task should unlock the super-cell's
hierarchy
task. */
scheduler_addunlock
(
s
,
t_xv
,
ci
->
super
->
hierarchy
);
}
...
...
@@ -1220,10 +1222,10 @@ static inline void engine_make_hydro_loops_dependencies(struct scheduler *sched,
struct
task
*
force
,
struct
cell
*
c
)
{
/* init --> density loop --> ghost --> force loop --> kick */
/* init --> density loop -->
hierarchy (
ghost
)
--> force loop --> kick */
scheduler_addunlock
(
sched
,
c
->
super
->
init
,
density
);
scheduler_addunlock
(
sched
,
density
,
c
->
super
->
ghost
);
scheduler_addunlock
(
sched
,
c
->
super
->
ghost
,
force
);
scheduler_addunlock
(
sched
,
density
,
c
->
super
->
hierarchy
);
scheduler_addunlock
(
sched
,
c
->
super
->
hierarchy
,
force
);
scheduler_addunlock
(
sched
,
force
,
c
->
super
->
kick
);
}
...
...
@@ -1452,13 +1454,13 @@ void engine_maketasks(struct engine *e) {
depend on the sorts of its progeny. */
engine_count_and_link_tasks
(
e
);
/* Append a
ghost
task to each cell, and add kick tasks to the
/* Append a
hierarchical
task to each cell, and add kick tasks to the
super cells. */
for
(
int
k
=
0
;
k
<
nr_cells
;
k
++
)
engine_make_
ghost
_tasks
(
e
,
&
cells
[
k
],
NULL
);
engine_make_
hierarchical
_tasks
(
e
,
&
cells
[
k
],
NULL
);
/* Run through the tasks and make force tasks for each density task.
Each force task depends on the cell
ghost
s and unlocks the kick task
Each force task depends on the cell
hierarchy task
s and unlocks the kick task
of its super-cell. */
engine_make_extra_hydroloop_tasks
(
e
);
...
...
@@ -1569,7 +1571,7 @@ int engine_marktasks(struct engine *e) {
}
/* Single-cell task? */
else
if
(
t
->
type
==
task_type_self
||
t
->
type
==
task_type_
ghost
||
else
if
(
t
->
type
==
task_type_self
||
t
->
type
==
task_type_
hierarchy
||
(
t
->
type
==
task_type_sub
&&
t
->
cj
==
NULL
))
{
/* Set this task's skip. */
...
...
@@ -1933,7 +1935,7 @@ void engine_init_particles(struct engine *e) {
mask
|=
1
<<
task_type_self
;
mask
|=
1
<<
task_type_pair
;
mask
|=
1
<<
task_type_sub
;
mask
|=
1
<<
task_type_
ghost
;
mask
|=
1
<<
task_type_
hierarchy
;
submask
|=
1
<<
task_subtype_density
;
}
...
...
@@ -2113,7 +2115,7 @@ void engine_step(struct engine *e) {
mask
|=
1
<<
task_type_self
;
mask
|=
1
<<
task_type_pair
;
mask
|=
1
<<
task_type_sub
;
mask
|=
1
<<
task_type_
ghost
;
mask
|=
1
<<
task_type_
hierarchy
;
submask
|=
1
<<
task_subtype_density
;
submask
|=
1
<<
task_subtype_force
;
...
...
src/hydro/Minimal/hydro.h
View file @
878e4771
...
...
@@ -117,7 +117,7 @@ __attribute__((always_inline))
/**
* @brief Prepare a particle for the force calculation.
*
* This function is called in the
ghost
task to convert some quantities coming
* This function is called in the
hierarchy
task to convert some quantities coming
* from the density loop over neighbours into quantities ready to be used in the
* force loop over neighbours. Quantities are typically read from the density
* sub-structure and written to the force sub-structure.
...
...
src/hydro/Minimal/hydro_part.h
View file @
878e4771
...
...
@@ -22,7 +22,7 @@
*
* This structure contains the particle fields that are not used in the
* density or force loops. Quantities should be used in the kick, drift and
* potentially
ghost
tasks only.
* potentially
hierarchical
tasks only.
*/
struct
xpart
{
...
...
@@ -76,7 +76,7 @@ struct part {
* neighbours.
*
* Quantities in this sub-structure should only be accessed in the density
* loop over neighbours and the
ghost
task.
* loop over neighbours and the
hierarchy
task.
*/
struct
{
...
...
@@ -91,7 +91,7 @@ struct part {
* neighbours.
*
* Quantities in this sub-structure should only be accessed in the force
* loop over neighbours and the
ghost
and kick tasks.
* loop over neighbours and the
hierarchy
and kick tasks.
*/
struct
{
...
...
src/partition.c
View file @
878e4771
...
...
@@ -454,7 +454,7 @@ static void repart_edge_metis(int partweights, int bothweights, int nodeID,
/* Skip un-interesting tasks. */
if
(
t
->
type
!=
task_type_self
&&
t
->
type
!=
task_type_pair
&&
t
->
type
!=
task_type_sub
&&
t
->
type
!=
task_type_
ghost
&&
t
->
type
!=
task_type_sub
&&
t
->
type
!=
task_type_
hierarchy
&&
t
->
type
!=
task_type_drift
&&
t
->
type
!=
task_type_kick
&&
t
->
type
!=
task_type_init
)
continue
;
...
...
@@ -488,7 +488,7 @@ static void repart_edge_metis(int partweights, int bothweights, int nodeID,
int
cid
=
ci
-
cells
;
/* Different weights for different tasks. */
if
(
t
->
type
==
task_type_
ghost
||
t
->
type
==
task_type_drift
||
if
(
t
->
type
==
task_type_
hierarchy
||
t
->
type
==
task_type_drift
||
t
->
type
==
task_type_kick
)
{
/* Particle updates add only to vertex weight. */
if
(
taskvweights
)
weights_v
[
cid
]
+=
w
;
...
...
src/runner.c
View file @
878e4771
...
...
@@ -629,7 +629,7 @@ void runner_doinit(struct runner *r, struct cell *c, int timer) {
* @param c The cell.
*/
void
runner_do
ghost
(
struct
runner
*
r
,
struct
cell
*
c
)
{
void
runner_do
_cellhierarchy
(
struct
runner
*
r
,
struct
cell
*
c
)
{
struct
part
*
p
,
*
parts
=
c
->
parts
;
struct
xpart
*
xp
,
*
xparts
=
c
->
xparts
;
...
...
@@ -652,7 +652,7 @@ void runner_doghost(struct runner *r, struct cell *c) {
/* Recurse? */
if
(
c
->
split
)
{
for
(
int
k
=
0
;
k
<
8
;
k
++
)
if
(
c
->
progeny
[
k
]
!=
NULL
)
runner_do
ghost
(
r
,
c
->
progeny
[
k
]);
if
(
c
->
progeny
[
k
]
!=
NULL
)
runner_do
_cellhierarchy
(
r
,
c
->
progeny
[
k
]);
return
;
}
...
...
@@ -774,7 +774,7 @@ void runner_doghost(struct runner *r, struct cell *c) {
if
(
count
)
message
(
"Smoothing length failed to converge on %i particles."
,
count
);
TIMER_TOC
(
timer_do
ghost
);
TIMER_TOC
(
timer_do
_cellhierarchy
);
}
/**
...
...
@@ -1348,8 +1348,8 @@ void *runner_main(void *data) {
case
task_type_init
:
runner_doinit
(
r
,
ci
,
1
);
break
;
case
task_type_
ghost
:
runner_do
ghost
(
r
,
ci
);
case
task_type_
hierarchy
:
runner_do
_cellhierarchy
(
r
,
ci
);
break
;
case
task_type_drift
:
runner_dodrift
(
r
,
ci
,
1
);
...
...
src/runner.h
View file @
878e4771
...
...
@@ -47,7 +47,7 @@ struct runner {
};
/* Function prototypes. */
void
runner_do
ghost
(
struct
runner
*
r
,
struct
cell
*
c
);
void
runner_do
_cellhierarchy
(
struct
runner
*
r
,
struct
cell
*
c
);
void
runner_dosort
(
struct
runner
*
r
,
struct
cell
*
c
,
int
flag
,
int
clock
);
void
runner_dogsort
(
struct
runner
*
r
,
struct
cell
*
c
,
int
flag
,
int
clock
);
void
runner_dokick
(
struct
runner
*
r
,
struct
cell
*
c
,
int
timer
);
...
...
src/scheduler.c
View file @
878e4771
...
...
@@ -916,7 +916,7 @@ void scheduler_reweight(struct scheduler *s) {
}
else
t
->
weight
+=
1
*
wscale
*
t
->
ci
->
count
*
t
->
ci
->
count
;
break
;
case
task_type_
ghost
:
case
task_type_
hierarchy
:
if
(
t
->
ci
==
t
->
ci
->
super
)
t
->
weight
+=
wscale
*
t
->
ci
->
count
;
break
;
case
task_type_kick
:
...
...
@@ -1082,7 +1082,7 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
switch
(
t
->
type
)
{
case
task_type_self
:
case
task_type_sort
:
case
task_type_
ghost
:
case
task_type_
hierarchy
:
case
task_type_kick
:
case
task_type_drift
:
case
task_type_init
:
...
...
src/space.c
View file @
878e4771
...
...
@@ -350,7 +350,7 @@ void space_regrid(struct space *s, double cell_max, int verbose) {
s
->
cells
[
k
].
count
=
0
;
s
->
cells
[
k
].
gcount
=
0
;
s
->
cells
[
k
].
init
=
NULL
;
s
->
cells
[
k
].
ghost
=
NULL
;
s
->
cells
[
k
].
hierarchy
=
NULL
;
s
->
cells
[
k
].
drift
=
NULL
;
s
->
cells
[
k
].
kick
=
NULL
;
s
->
cells
[
k
].
super
=
&
s
->
cells
[
k
];
...
...
src/task.c
View file @
878e4771
...
...
@@ -48,7 +48,7 @@
/* Task type names. */
const
char
*
taskID_names
[
task_type_count
]
=
{
"none"
,
"sort"
,
"self"
,
"pair"
,
"sub"
,
"init"
,
"
ghost
"
,
"drift"
,
"kick"
,
"send"
,
"init"
,
"
hierarchy
"
,
"drift"
,
"kick"
,
"send"
,
"recv"
,
"grav_pp"
,
"grav_mm"
,
"grav_up"
,
"grav_down"
,
"grav_external"
,
"part_sort"
,
"gpart_sort"
,
"split_cell"
,
"rewait"
};
...
...
src/task.h
View file @
878e4771
...
...
@@ -39,7 +39,7 @@ enum task_types {
task_type_pair
,
task_type_sub
,
task_type_init
,
task_type_
ghost
,
task_type_
hierarchy
,
task_type_drift
,
task_type_kick
,
task_type_send
,
...
...
src/timers.h
View file @
878e4771
...
...
@@ -45,7 +45,7 @@ enum {
timer_dosub_force
,
timer_dosub_grav
,
timer_dopair_subset
,
timer_do
ghost
,
timer_do
_cellhierarchy
,
timer_dorecv_cell
,
timer_gettask
,
timer_qget
,
...
...
tests/testSPHStep.c
View file @
878e4771
...
...
@@ -141,7 +141,7 @@ int main() {
/* Compute density */
runner_doself1_density
(
&
r
,
ci
);
runner_do
ghost
(
&
r
,
ci
);
runner_do
_cellhierarchy
(
&
r
,
ci
);
message
(
"h=%f rho=%f N_ngb=%f"
,
p
->
h
,
p
->
rho
,
p
->
density
.
wcount
);
message
(
"c=%f"
,
p
->
force
.
c
);
...
...
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