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
2722f6fc
Commit
2722f6fc
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Reintroduce task-marking to prevent enqueing unnecessary tasks.
parent
e293da45
No related branches found
No related tags found
2 merge requests
!136
Master
,
!79
First version of the multiple time-stepping
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/engine.c
+92
-93
92 additions, 93 deletions
src/engine.c
with
92 additions
and
93 deletions
src/engine.c
+
92
−
93
View file @
2722f6fc
...
...
@@ -1331,121 +1331,123 @@ int engine_marktasks(struct engine *e) {
struct
scheduler
*
s
=
&
e
->
sched
;
int
k
,
nr_tasks
=
s
->
nr_tasks
,
*
ind
=
s
->
tasks_ind
;
struct
task
*
t
,
*
tasks
=
s
->
tasks
;
//
float t_end = e->time;
float
t_end
=
e
->
time
;
struct
cell
*
ci
,
*
cj
;
// ticks tic = getticks();
/*
/\*
Much less to do here if we're on a fixed time-step.
*\/
*/
/*
if
(!
(e->policy & engine_policy_
multistep)) { */
/* Much less to do here if we're on a fixed time-step. */
if
(
e
->
policy
&
engine_policy_
fixdt
)
{
/*
/
\
* Run through the tasks and mark as skip or not.
*\/
*/
/*
for (k = 0; k < nr_tasks; k++) {
*/
/* Run through the tasks and mark as skip or not. */
for
(
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
/*
/
\
* Get a handle on the kth task.
*\/
*/
/*
t = &tasks[ind[k]];
*/
/* Get a handle on the kth task. */
t
=
&
tasks
[
ind
[
k
]];
/*
/
\
* Pair?
*\/
*/
/*
if (t->type == task_type_pair ||
*/
/*
(t->type == task_type_sub && t->cj != NULL)) {
*/
/* Pair? */
if
(
t
->
type
==
task_type_pair
||
(
t
->
type
==
task_type_sub
&&
t
->
cj
!=
NULL
))
{
/*
/
\
* Local pointers.
*\/
*/
/*
ci = t->ci;
*/
/*
cj = t->cj;
*/
/* Local pointers. */
ci
=
t
->
ci
;
cj
=
t
->
cj
;
/* /\* Too much particle movement? *\/ */
/* if (t->tight && */
/* (fmaxf(ci->h_max, cj->h_max) + ci->dx_max + cj->dx_max > cj->dmin
* || */
/* ci->dx_max > space_maxreldx * ci->h_max || */
/* cj->dx_max > space_maxreldx * cj->h_max)) */
/* return 1; */
/* Too much particle movement? */
if
(
t
->
tight
&&
(
fmaxf
(
ci
->
h_max
,
cj
->
h_max
)
+
ci
->
dx_max
+
cj
->
dx_max
>
cj
->
dmin
||
ci
->
dx_max
>
space_maxreldx
*
ci
->
h_max
||
cj
->
dx_max
>
space_maxreldx
*
cj
->
h_max
))
return
1
;
/* } */
/* /\* Sort? *\/ */
/* else if (t->type == task_type_sort) { */
}
/* /\* If all the sorts have been done, make this task implicit. *\/ */
/* if (!(t->flags & (t->flags ^ t->ci->sorted))) t->implicit = 1; */
/* } */
/* } */
/* Sort? */
else
if
(
t
->
type
==
task_type_sort
)
{
/* } else { */
/* If all the sorts have been done, make this task implicit. */
if
(
!
(
t
->
flags
&
(
t
->
flags
^
t
->
ci
->
sorted
)))
t
->
implicit
=
1
;
}
}
/*
Run through the tasks and mark as skip or not.
*/
for
(
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
/*
Multiple-timestep case
*/
}
else
{
/*
Get a handle on the kth task
. */
t
=
&
tasks
[
ind
[
k
]];
/*
Run through the tasks and mark as skip or not
. */
for
(
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
/* Sort-task? Note that due to the task ranking, the sorts
will all come before the pairs. */
if
(
t
->
type
==
task_type_sort
)
{
/* Get a handle on the kth task. */
t
=
&
tasks
[
ind
[
k
]];
/*
Re-set the flags. */
t
->
flags
=
0
;
t
->
skip
=
1
;
/*
Sort-task? Note that due to the task ranking, the sorts
will all come before the pairs. */
if
(
t
->
type
==
task_type_sort
)
{
}
/* Re-set the flags. */
t
->
flags
=
0
;
t
->
skip
=
1
;
/* Single-cell task? */
else
if
(
t
->
type
==
task_type_self
||
t
->
type
==
task_type_ghost
||
(
t
->
type
==
task_type_sub
&&
t
->
cj
==
NULL
))
{
}
/* Set this task's skip. */
// t->skip = (t->ci->t_end_min >= t_end);
/* Single-cell task? */
else
if
(
t
->
type
==
task_type_self
||
t
->
type
==
task_type_ghost
||
(
t
->
type
==
task_type_sub
&&
t
->
cj
==
NULL
))
{
}
/* Set this task's skip. */
t
->
skip
=
(
t
->
ci
->
t_end_min
>
t_end
);
}
/* Pair? */
else
if
(
t
->
type
==
task_type_pair
||
(
t
->
type
==
task_type_sub
&&
t
->
cj
!=
NULL
))
{
/* Local pointers. */
ci
=
t
->
ci
;
cj
=
t
->
cj
;
/* Set this task's skip. */
// t->skip = (ci->t_end_min >= t_end && cj->t_end_min >= t_end);
/* Too much particle movement? */
if
(
t
->
tight
&&
(
fmaxf
(
ci
->
h_max
,
cj
->
h_max
)
+
ci
->
dx_max
+
cj
->
dx_max
>
cj
->
dmin
||
ci
->
dx_max
>
space_maxreldx
*
ci
->
h_max
||
cj
->
dx_max
>
space_maxreldx
*
cj
->
h_max
))
return
1
;
/* Set the sort flags. */
if
(
!
t
->
skip
&&
t
->
type
==
task_type_pair
)
{
if
(
!
(
ci
->
sorted
&
(
1
<<
t
->
flags
)))
{
ci
->
sorts
->
flags
|=
(
1
<<
t
->
flags
);
ci
->
sorts
->
skip
=
0
;
}
if
(
!
(
cj
->
sorted
&
(
1
<<
t
->
flags
)))
{
cj
->
sorts
->
flags
|=
(
1
<<
t
->
flags
);
cj
->
sorts
->
skip
=
0
;
/* Pair? */
else
if
(
t
->
type
==
task_type_pair
||
(
t
->
type
==
task_type_sub
&&
t
->
cj
!=
NULL
))
{
/* Local pointers. */
ci
=
t
->
ci
;
cj
=
t
->
cj
;
/* Set this task's skip. */
t
->
skip
=
(
ci
->
t_end_min
>
t_end
&&
cj
->
t_end_min
>
t_end
);
/* Too much particle movement? */
if
(
t
->
tight
&&
(
fmaxf
(
ci
->
h_max
,
cj
->
h_max
)
+
ci
->
dx_max
+
cj
->
dx_max
>
cj
->
dmin
||
ci
->
dx_max
>
space_maxreldx
*
ci
->
h_max
||
cj
->
dx_max
>
space_maxreldx
*
cj
->
h_max
))
return
1
;
/* Set the sort flags. */
if
(
!
t
->
skip
&&
t
->
type
==
task_type_pair
)
{
if
(
!
(
ci
->
sorted
&
(
1
<<
t
->
flags
)))
{
ci
->
sorts
->
flags
|=
(
1
<<
t
->
flags
);
ci
->
sorts
->
skip
=
0
;
}
if
(
!
(
cj
->
sorted
&
(
1
<<
t
->
flags
)))
{
cj
->
sorts
->
flags
|=
(
1
<<
t
->
flags
);
cj
->
sorts
->
skip
=
0
;
}
}
}
}
}
/* Kick? */
else
if
(
t
->
type
==
task_type_kick
)
t
->
skip
=
0
;
/* Kick? */
else
if
(
t
->
type
==
task_type_kick
)
{
t
->
skip
=
(
t
->
ci
->
t_end_min
>
t_end
);
}
/* Drift? */
else
if
(
t
->
type
==
task_type_drift
)
t
->
skip
=
0
;
/* Drift? */
else
if
(
t
->
type
==
task_type_drift
)
t
->
skip
=
0
;
/* Init? */
else
if
(
t
->
type
==
task_type_init
)
t
->
skip
=
0
;
/* Init? */
else
if
(
t
->
type
==
task_type_init
)
{
/* Set this task's skip. */
t
->
skip
=
(
t
->
ci
->
t_end_min
>
t_end
);
}
/* None? */
else
if
(
t
->
type
==
task_type_none
)
t
->
skip
=
1
;
/* None? */
else
if
(
t
->
type
==
task_type_none
)
t
->
skip
=
1
;
}
}
//}
// message( "took %.3f ms." , (double)(getticks() - tic)/CPU_TPS*1000 );
...
...
@@ -1666,9 +1668,6 @@ void engine_collect_kick(struct cell *c) {
c
->
ang
[
2
]
=
ang
[
2
];
}
/**
* @brief Launch the runners.
*
...
...
@@ -2125,7 +2124,7 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
}
}
#endif
/* Store the values. */
e
->
s
=
s
;
e
->
nr_threads
=
nr_threads
;
...
...
@@ -2167,7 +2166,7 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
/* Print policy */
engine_policy
(
e
);
/* Construct types for MPI communications */
/* Construct types for MPI communications */
#ifdef WITH_MPI
part_create_mpi_type
(
&
e
->
part_mpi_type
);
xpart_create_mpi_type
(
&
e
->
xpart_mpi_type
);
...
...
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