Commit 80610af7 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting

parent b90e24d0
......@@ -89,7 +89,8 @@ void collectgroup1_apply(struct collectgroup1 *grp1, struct engine *e) {
*
* @param grp1 The #collectgroup1 to initialise
* @param updates the number of updated hydro particles on this node this step.
* @param g_updates the number of updated gravity particles on this node this step.
* @param g_updates the number of updated gravity particles on this node this
* step.
* @param s_updates the number of updated star particles on this node this step.
* @param ti_end_min the minimum end time for next time step after this step.
* @param ti_end_max the maximum end time for next time step after this step.
......@@ -98,10 +99,8 @@ void collectgroup1_apply(struct collectgroup1 *grp1, struct engine *e) {
*/
void collectgroup1_init(struct collectgroup1 *grp1, size_t updates,
size_t g_updates, size_t s_updates,
integertime_t ti_end_min,
integertime_t ti_end_max,
integertime_t ti_beg_max,
int forcerebuild) {
integertime_t ti_end_min, integertime_t ti_end_max,
integertime_t ti_beg_max, int forcerebuild) {
grp1->updates = updates;
grp1->g_updates = g_updates;
grp1->s_updates = s_updates;
......@@ -133,8 +132,7 @@ void collectgroup1_reduce(struct collectgroup1 *grp1) {
struct mpicollectgroup1 mpigrp12;
if (MPI_Allreduce(&mpigrp11, &mpigrp12, 1, mpicollectgroup1_type,
mpicollectgroup1_reduce_op, MPI_COMM_WORLD)
!= MPI_SUCCESS)
mpicollectgroup1_reduce_op, MPI_COMM_WORLD) != MPI_SUCCESS)
error("Failed to reduce mpicollection1.");
/* And update. */
......@@ -147,7 +145,6 @@ void collectgroup1_reduce(struct collectgroup1 *grp1) {
#endif
}
#ifdef WITH_MPI
/**
* @brief Do the reduction of two structs.
......@@ -176,7 +173,7 @@ static void doreduce1(struct mpicollectgroup1 *mpigrp11,
* @brief MPI reduce operator for #mpicollectgroup structures.
*/
static void mpicollectgroup1_reduce(void *in, void *inout, int *len,
MPI_Datatype *datatype) {
MPI_Datatype *datatype) {
for (int i = 0; i < *len; ++i)
doreduce1(&((struct mpicollectgroup1 *)inout)[0],
......
......@@ -48,10 +48,8 @@ void collectgroup_init();
void collectgroup1_apply(struct collectgroup1 *grp1, struct engine *e);
void collectgroup1_init(struct collectgroup1 *grp1, size_t updates,
size_t g_updates, size_t s_updates,
integertime_t ti_end_min,
integertime_t ti_end_max,
integertime_t ti_beg_max,
int forcerebuild);
integertime_t ti_end_min, integertime_t ti_end_max,
integertime_t ti_beg_max, int forcerebuild);
void collectgroup1_reduce(struct collectgroup1 *grp1);
#endif /* SWIFT_COLLECTGROUP_H */
......@@ -2849,8 +2849,8 @@ void engine_collect_timestep_and_rebuild(struct engine *e, int apply) {
}
/* Store these in the temporary collection group. */
collectgroup1_init(&e->collect_group1, updates,g_updates, s_updates,
ti_end_min,ti_end_max,ti_beg_max,e->forcerebuild);
collectgroup1_init(&e->collect_group1, updates, g_updates, s_updates,
ti_end_min, ti_end_max, ti_beg_max, e->forcerebuild);
/* Aggregate collective data from the different nodes for this step. */
#ifdef WITH_MPI
......@@ -2866,8 +2866,8 @@ void engine_collect_timestep_and_rebuild(struct engine *e, int apply) {
MPI_COMM_WORLD) != MPI_SUCCESS)
error("Failed to aggregate ti_end_min.");
if (in_i[0] != (long long)e->collect_group1.ti_end_min)
error("Failed to get same ti_end_min, is %lld, should be %lld",
in_i[0], e->collect_group1.ti_end_min);
error("Failed to get same ti_end_min, is %lld, should be %lld", in_i[0],
e->collect_group1.ti_end_min);
long long in_ll[3], out_ll[3];
out_ll[0] = updates;
......@@ -2877,29 +2877,30 @@ void engine_collect_timestep_and_rebuild(struct engine *e, int apply) {
MPI_COMM_WORLD) != MPI_SUCCESS)
error("Failed to aggregate particle counts.");
if (in_ll[0] != (long long)e->collect_group1.updates)
error("Failed to get same updates, is %lld, should be %ld",
in_ll[0], e->collect_group1.updates);
error("Failed to get same updates, is %lld, should be %ld", in_ll[0],
e->collect_group1.updates);
if (in_ll[1] != (long long)e->collect_group1.g_updates)
error("Failed to get same g_updates, is %lld, should be %ld",
in_ll[1], e->collect_group1.g_updates);
error("Failed to get same g_updates, is %lld, should be %ld", in_ll[1],
e->collect_group1.g_updates);
if (in_ll[2] != (long long)e->collect_group1.s_updates)
error("Failed to get same s_updates, is %lld, should be %ld",
in_ll[2], e->collect_group1.s_updates);
error("Failed to get same s_updates, is %lld, should be %ld", in_ll[2],
e->collect_group1.s_updates);
int buff = 0;
if (MPI_Allreduce(&e->forcerebuild, &buff, 1, MPI_INT, MPI_MAX,
MPI_COMM_WORLD) != MPI_SUCCESS)
error("Failed to aggregate the rebuild flag across nodes.");
if (!!buff != !!e->collect_group1.forcerebuild)
error("Failed to get same rebuild flag from all nodes, is %d,"
"should be %d", buff, e->collect_group1.forcerebuild);
error(
"Failed to get same rebuild flag from all nodes, is %d,"
"should be %d",
buff, e->collect_group1.forcerebuild);
}
#endif
#endif
/* Apply to the engine, if requested. */
if (apply)
collectgroup1_apply(&e->collect_group1, e);
if (apply) collectgroup1_apply(&e->collect_group1, e);
if (e->verbose)
message("took %.3f %s.", clocks_from_ticks(getticks() - tic),
......@@ -4015,7 +4016,7 @@ void engine_init(struct engine *e, struct space *s,
/* Find the time of the first output */
engine_compute_next_snapshot_time(e);
/* Construct types for MPI communications */
/* Construct types for MPI communications */
#ifdef WITH_MPI
part_create_mpi_types();
stats_create_MPI_type();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment