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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
5ddd0761
Commit
5ddd0761
authored
Mar 10, 2017
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Formatting
parent
bd803b48
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!290
Only repartition when required
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/main.c
+3
-3
3 additions, 3 deletions
examples/main.c
src/engine.c
+12
-10
12 additions, 10 deletions
src/engine.c
src/partition.c
+7
-3
7 additions, 3 deletions
src/partition.c
with
22 additions
and
16 deletions
examples/main.c
+
3
−
3
View file @
5ddd0761
...
...
@@ -514,9 +514,9 @@ int main(int argc, char *argv[]) {
if
(
myrank
==
0
)
clocks_gettime
(
&
tic
);
struct
engine
e
;
engine_init
(
&
e
,
&
s
,
params
,
nr_nodes
,
myrank
,
nr_threads
,
N_total
[
0
],
N_total
[
1
],
with_aff
,
engine_policies
,
talking
,
&
reparttype
,
&
us
,
&
prog_const
,
&
hydro_properties
,
&
gravity_properties
,
&
potential
,
&
cooling_func
,
&
sourceterms
);
N_total
[
1
],
with_aff
,
engine_policies
,
talking
,
&
reparttype
,
&
us
,
&
prog_const
,
&
hydro_properties
,
&
gravity_properties
,
&
potential
,
&
cooling_func
,
&
sourceterms
);
if
(
myrank
==
0
)
{
clocks_gettime
(
&
toc
);
message
(
"engine_init took %.3f %s."
,
clocks_diff
(
&
tic
,
&
toc
),
...
...
...
...
This diff is collapsed.
Click to expand it.
src/engine.c
+
12
−
10
View file @
5ddd0761
...
...
@@ -3040,9 +3040,10 @@ void engine_step(struct engine *e) {
e
->
wallclock_time
);
fflush
(
stdout
);
fprintf
(
e
->
file_timesteps
,
" %6d %14e %14e %10zu %10zu %10zu %21.3f %3d %3d
\n
"
,
e
->
step
,
e
->
time
,
e
->
timeStep
,
e
->
updates
,
e
->
g_updates
,
e
->
s_updates
,
e
->
wallclock_time
,
(
e
->
lastrebuild
>
0
),
fprintf
(
e
->
file_timesteps
,
" %6d %14e %14e %10zu %10zu %10zu %21.3f %3d %3d
\n
"
,
e
->
step
,
e
->
time
,
e
->
timeStep
,
e
->
updates
,
e
->
g_updates
,
e
->
s_updates
,
e
->
wallclock_time
,
(
e
->
lastrebuild
>
0
),
(
e
->
lastrepart
!=
REPART_NONE
));
fflush
(
e
->
file_timesteps
);
}
...
...
@@ -3053,8 +3054,7 @@ void engine_step(struct engine *e) {
/* Old style if trigger is >1 or this is the second step. */
if
(
e
->
reparttype
->
trigger
>
1
||
e
->
step
==
2
)
{
if
(
e
->
reparttype
->
trigger
>
1
)
{
if
(
e
->
step
%
(
int
)
e
->
reparttype
->
trigger
==
2
)
e
->
forcerepart
=
1
;
if
(
e
->
step
%
(
int
)
e
->
reparttype
->
trigger
==
2
)
e
->
forcerepart
=
1
;
}
else
{
e
->
forcerepart
=
1
;
}
...
...
@@ -3107,8 +3107,10 @@ void engine_step(struct engine *e) {
if
(
elapsed_cputimes
[
k
]
<
mintime
)
mintime
=
elapsed_cputimes
[
k
];
}
if
((
e
->
updates
>
1
&&
e
->
updates
>=
e
->
total_nr_parts
*
e
->
reparttype
->
minfrac
)
||
(
e
->
g_updates
>
1
&&
e
->
g_updates
>=
e
->
total_nr_gparts
*
e
->
reparttype
->
minfrac
))
{
if
((
e
->
updates
>
1
&&
e
->
updates
>=
e
->
total_nr_parts
*
e
->
reparttype
->
minfrac
)
||
(
e
->
g_updates
>
1
&&
e
->
g_updates
>=
e
->
total_nr_gparts
*
e
->
reparttype
->
minfrac
))
{
/* Are we out of balance? */
if
(((
maxtime
-
mintime
)
/
mintime
)
>
e
->
reparttype
->
trigger
)
{
...
...
...
...
This diff is collapsed.
Click to expand it.
src/partition.c
+
7
−
3
View file @
5ddd0761
...
...
@@ -1076,15 +1076,19 @@ void partition_init(struct partition *partition,
/* Get the fraction CPU time difference between nodes (<1) or the number
* of steps between repartitions (>1). */
repartition
->
trigger
=
parser_get_opt_param_float
(
params
,
"DomainDecomposition:trigger"
,
0
.
05
f
);
repartition
->
trigger
=
parser_get_opt_param_float
(
params
,
"DomainDecomposition:trigger"
,
0
.
05
f
);
if
(
repartition
->
trigger
<=
0
)
error
(
"Invalid DomainDecomposition:trigger, must be greater than zero"
);
/* Fraction of particles that should be updated before a repartition
* based on CPU time is considered. */
repartition
->
minfrac
=
parser_get_opt_param_float
(
params
,
"DomainDecomposition:minfrac"
,
0
.
9
f
);
repartition
->
minfrac
=
parser_get_opt_param_float
(
params
,
"DomainDecomposition:minfrac"
,
0
.
9
f
);
if
(
repartition
->
minfrac
<=
0
||
repartition
->
minfrac
>
1
)
error
(
"Invalid DomainDecomposition:minfrac, must be greater than 0 and less than equal to 1"
);
error
(
"Invalid DomainDecomposition:minfrac, must be greater than 0 and less "
"than equal to 1"
);
#else
error
(
"SWIFT was not compiled with MPI support"
);
...
...
...
...
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
sign in
to comment