Skip to content
Snippets Groups Projects
Commit 5ddd0761 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Formatting

parent bd803b48
Branches
Tags
1 merge request!290Only repartition when required
......@@ -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),
......
......
......@@ -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) {
......
......
......@@ -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.05f);
repartition->trigger =
parser_get_opt_param_float(params, "DomainDecomposition:trigger", 0.05f);
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.9f);
repartition->minfrac =
parser_get_opt_param_float(params, "DomainDecomposition:minfrac", 0.9f);
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");
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment