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
4d965cd1
Commit
4d965cd1
authored
8 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Add engine_drift() function so that we can time drifts
parent
cc6a8d95
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!241
Drift all particles before repartitioning
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/engine.c
+18
-6
18 additions, 6 deletions
src/engine.c
src/engine.h
+1
-0
1 addition, 0 deletions
src/engine.h
with
19 additions
and
6 deletions
src/engine.c
+
18
−
6
View file @
4d965cd1
...
...
@@ -2282,8 +2282,7 @@ void engine_prepare(struct engine *e, int nodrift) {
/* Drift all particles to the current time if needed. */
if
(
!
nodrift
)
{
e
->
drift_all
=
1
;
threadpool_map
(
&
e
->
threadpool
,
runner_do_drift_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
e
);
engine_drift
(
e
);
/* Restore the default drifting policy */
e
->
drift_all
=
(
e
->
policy
&
engine_policy_drift_all
);
...
...
@@ -2670,8 +2669,7 @@ void engine_step(struct engine *e) {
/* Drift everybody to the snapshot position */
e
->
drift_all
=
1
;
threadpool_map
(
&
e
->
threadpool
,
runner_do_drift_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
e
);
engine_drift
(
e
);
/* Restore the default drifting policy */
e
->
drift_all
=
(
e
->
policy
&
engine_policy_drift_all
);
...
...
@@ -2713,8 +2711,7 @@ void engine_step(struct engine *e) {
* if we are about to repartition. */
int
repart
=
(
e
->
forcerepart
!=
REPART_NONE
);
e
->
drift_all
=
repart
||
e
->
drift_all
;
threadpool_map
(
&
e
->
threadpool
,
runner_do_drift_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
e
);
engine_drift
(
e
);
/* Re-distribute the particles amongst the nodes? */
if
(
repart
)
engine_repartition
(
e
);
...
...
@@ -2805,6 +2802,21 @@ int engine_is_done(struct engine *e) {
return
!
(
e
->
ti_current
<
max_nr_timesteps
);
}
/**
* @brief Drift particles using the current engine drift policy.
*
* @param e The #engine.
*/
void
engine_drift
(
struct
engine
*
e
)
{
ticks
tic
=
getticks
();
threadpool_map
(
&
e
->
threadpool
,
runner_do_drift_mapper
,
e
->
s
->
cells_top
,
e
->
s
->
nr_cells
,
sizeof
(
struct
cell
),
1
,
e
);
if
(
e
->
verbose
)
message
(
"took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
}
/**
* @brief Create and fill the proxies.
*
...
...
This diff is collapsed.
Click to expand it.
src/engine.h
+
1
−
0
View file @
4d965cd1
...
...
@@ -209,6 +209,7 @@ struct engine {
/* Function prototypes. */
void
engine_barrier
(
struct
engine
*
e
,
int
tid
);
void
engine_compute_next_snapshot_time
(
struct
engine
*
e
);
void
engine_drift
(
struct
engine
*
e
);
void
engine_dump_snapshot
(
struct
engine
*
e
);
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
const
struct
swift_params
*
params
,
int
nr_nodes
,
int
nodeID
,
...
...
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