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
a13630c6
Commit
a13630c6
authored
8 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
don't activate drift tasks, just mark the cells.
parent
846e08b4
No related branches found
No related tags found
1 merge request
!343
Subset sorting
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cell.c
+38
-22
38 additions, 22 deletions
src/cell.c
with
38 additions
and
22 deletions
src/cell.c
+
38
−
22
View file @
a13630c6
...
@@ -1316,6 +1316,29 @@ int cell_is_drift_needed(struct cell *c, const struct engine *e) {
...
@@ -1316,6 +1316,29 @@ int cell_is_drift_needed(struct cell *c, const struct engine *e) {
return
0
;
return
0
;
}
}
/**
* @brief Activate the drifts on the given cell.
*/
void
cell_activate_drift_part
(
struct
cell
*
c
,
struct
scheduler
*
s
)
{
/* If this cell is already marked for drift, quit early. */
if
(
c
->
do_drift
)
return
;
/* Mark this cell for drifting. */
c
->
do_drift
=
1
;
/* Set the do_sub_drifts all the way up and activate the super drift
if this has not yet been done. */
for
(
struct
cell
*
parent
=
c
->
parent
;
parent
!=
NULL
&&
!
parent
->
do_sub_drift
;
parent
=
parent
->
parent
)
{
parent
->
do_sub_drift
=
1
;
if
(
parent
==
c
->
super
)
{
scheduler_activate
(
s
,
parent
->
drift_part
);
break
;
}
}
}
/**
/**
* @brief Traverse a sub-cell task and activate the sort tasks along the way.
* @brief Traverse a sub-cell task and activate the sort tasks along the way.
*/
*/
...
@@ -1576,8 +1599,8 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
...
@@ -1576,8 +1599,8 @@ void cell_activate_subcell_tasks(struct cell *ci, struct cell *cj,
cj
->
dx_max_sort_old
=
cj
->
dx_max_sort
;
cj
->
dx_max_sort_old
=
cj
->
dx_max_sort
;
/* Activate the drifts if the cells are local. */
/* Activate the drifts if the cells are local. */
if
(
ci
->
nodeID
==
engine_rank
)
scheduler
_activate
(
s
,
ci
->
drift_part
);
if
(
ci
->
nodeID
==
engine_rank
)
cell
_activate
_
drift_part
(
ci
,
s
);
if
(
cj
->
nodeID
==
engine_rank
)
scheduler
_activate
(
s
,
cj
->
drift_part
);
if
(
cj
->
nodeID
==
engine_rank
)
cell
_activate
_
drift_part
(
cj
,
s
);
/* Do we need to sort ci ? */
/* Do we need to sort ci ? */
if
(
ci
->
dx_max_sort
>
space_maxreldx
*
ci
->
dmin
)
{
if
(
ci
->
dx_max_sort
>
space_maxreldx
*
ci
->
dmin
)
{
...
@@ -1660,7 +1683,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
...
@@ -1660,7 +1683,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
if
(
!
(
ci
->
sorted
&
(
1
<<
t
->
flags
))
||
ci
->
nodeID
!=
engine_rank
)
{
if
(
!
(
ci
->
sorted
&
(
1
<<
t
->
flags
))
||
ci
->
nodeID
!=
engine_rank
)
{
atomic_or
(
&
ci
->
sorts
->
flags
,
(
1
<<
t
->
flags
));
atomic_or
(
&
ci
->
sorts
->
flags
,
(
1
<<
t
->
flags
));
scheduler_activate
(
s
,
ci
->
sorts
);
scheduler_activate
(
s
,
ci
->
sorts
);
if
(
ci
->
nodeID
==
engine_rank
)
scheduler
_activate
(
s
,
ci
->
drift_part
);
if
(
ci
->
nodeID
==
engine_rank
)
cell
_activate
_
drift_part
(
ci
,
s
);
}
}
if
(
cj
->
dx_max_sort
>
space_maxreldx
*
cj
->
dmin
)
{
if
(
cj
->
dx_max_sort
>
space_maxreldx
*
cj
->
dmin
)
{
for
(
struct
cell
*
finger
=
cj
;
finger
!=
NULL
;
for
(
struct
cell
*
finger
=
cj
;
finger
!=
NULL
;
...
@@ -1675,7 +1698,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
...
@@ -1675,7 +1698,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
if
(
!
(
cj
->
sorted
&
(
1
<<
t
->
flags
))
||
cj
->
nodeID
!=
engine_rank
)
{
if
(
!
(
cj
->
sorted
&
(
1
<<
t
->
flags
))
||
cj
->
nodeID
!=
engine_rank
)
{
atomic_or
(
&
cj
->
sorts
->
flags
,
(
1
<<
t
->
flags
));
atomic_or
(
&
cj
->
sorts
->
flags
,
(
1
<<
t
->
flags
));
scheduler_activate
(
s
,
cj
->
sorts
);
scheduler_activate
(
s
,
cj
->
sorts
);
if
(
cj
->
nodeID
==
engine_rank
)
scheduler
_activate
(
s
,
cj
->
drift_part
);
if
(
cj
->
nodeID
==
engine_rank
)
cell
_activate
_
drift_part
(
cj
,
s
);
}
}
}
}
/* Store current values of dx_max and h_max. */
/* Store current values of dx_max and h_max. */
...
@@ -1713,11 +1736,8 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
...
@@ -1713,11 +1736,8 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
scheduler_activate
(
s
,
l
->
t
);
scheduler_activate
(
s
,
l
->
t
);
/* Drift both cells, the foreign one at the level which it is sent. */
/* Drift both cells, the foreign one at the level which it is sent. */
if
(
l
->
t
->
ci
->
drift_part
)
cell_activate_drift_part
(
l
->
t
->
ci
,
s
);
scheduler_activate
(
s
,
l
->
t
->
ci
->
drift_part
);
if
(
t
->
type
==
task_type_pair
)
cell_activate_drift_part
(
cj
,
s
);
else
error
(
"Drift task missing !"
);
if
(
t
->
type
==
task_type_pair
)
scheduler_activate
(
s
,
cj
->
drift_part
);
if
(
cell_is_active
(
cj
,
e
))
{
if
(
cell_is_active
(
cj
,
e
))
{
...
@@ -1763,11 +1783,8 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
...
@@ -1763,11 +1783,8 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
scheduler_activate
(
s
,
l
->
t
);
scheduler_activate
(
s
,
l
->
t
);
/* Drift both cells, the foreign one at the level which it is sent. */
/* Drift both cells, the foreign one at the level which it is sent. */
if
(
l
->
t
->
ci
->
drift_part
)
cell_activate_drift_part
(
l
->
t
->
ci
,
s
);
scheduler_activate
(
s
,
l
->
t
->
ci
->
drift_part
);
if
(
t
->
type
==
task_type_pair
)
cell_activate_drift_part
(
ci
,
s
);
else
error
(
"Drift task missing !"
);
if
(
t
->
type
==
task_type_pair
)
scheduler_activate
(
s
,
ci
->
drift_part
);
if
(
cell_is_active
(
ci
,
e
))
{
if
(
cell_is_active
(
ci
,
e
))
{
...
@@ -1794,13 +1811,13 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
...
@@ -1794,13 +1811,13 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
}
}
else
if
(
t
->
type
==
task_type_pair
)
{
/* ci and cj on same node */
else
if
(
t
->
type
==
task_type_pair
)
{
/* ci and cj on same node */
scheduler
_activate
(
s
,
ci
->
drift_part
);
cell
_activate
_
drift_part
(
ci
,
s
);
scheduler
_activate
(
s
,
cj
->
drift_part
);
cell
_activate
_
drift_part
(
cj
,
s
);
}
}
#else
#else
if
(
t
->
type
==
task_type_pair
)
{
if
(
t
->
type
==
task_type_pair
)
{
scheduler
_activate
(
s
,
ci
->
drift_part
);
cell
_activate
_
drift_part
(
ci
,
s
);
scheduler
_activate
(
s
,
cj
->
drift_part
);
cell
_activate
_
drift_part
(
cj
,
s
);
}
}
#endif
#endif
}
}
...
@@ -1909,11 +1926,11 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
...
@@ -1909,11 +1926,11 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
/* Update the time of the last drift */
/* Update the time of the last drift */
c
->
ti_old_part
=
ti_current
;
c
->
ti_old_part
=
ti_current
;
/* Clear the drift flags. */
/* Clear the drift flags. */
c
->
do_drift
=
0
;
c
->
do_drift
=
0
;
c
->
do_sub_drift
=
0
;
c
->
do_sub_drift
=
0
;
}
else
if
(
force
&&
ti_current
>
ti_old_part
)
{
}
else
if
(
force
&&
ti_current
>
ti_old_part
)
{
/* Loop over all the gas particles in the cell */
/* Loop over all the gas particles in the cell */
...
@@ -1960,10 +1977,9 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
...
@@ -1960,10 +1977,9 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) {
/* Update the time of the last drift */
/* Update the time of the last drift */
c
->
ti_old_part
=
ti_current
;
c
->
ti_old_part
=
ti_current
;
/* Clear the drift flags. */
/* Clear the drift flags. */
c
->
do_drift
=
0
;
c
->
do_drift
=
0
;
c
->
do_sub_drift
=
0
;
}
}
}
}
...
...
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