diff --git a/src/partition.c b/src/partition.c index d9aade781e824defedb05f5a201fec8401da7ee2..dcded26043b0c71fbde039c869052c1e37a30bb6 100644 --- a/src/partition.c +++ b/src/partition.c @@ -465,8 +465,8 @@ static void pick_metis(struct space *s, int nregions, int *vertexw, int *edgew, #if defined(WITH_MPI) && defined(HAVE_METIS) /** - * @brief Repartition the cells amongst the nodes using task timings - * as edge weights and vertex weights also from task timings + * @brief Repartition the cells amongst the nodes using task costs + * as edge weights and vertex weights also from task costs * or particle cells counts. * * @param partweights whether particle counts will be used as vertex weights. @@ -552,9 +552,9 @@ static void repart_edge_metis(int partweights, int bothweights, int nodeID, if (t->type == task_type_ghost || t->type == task_type_kick1 || t->type == task_type_kick2 || t->type == task_type_timestep || t->type == task_type_drift_part || t->type == task_type_drift_gpart) { + /* Particle updates add only to vertex weight. */ if (taskvweights) weights_v[cid] += w; - } /* Self interaction? */ @@ -586,14 +586,15 @@ static void repart_edge_metis(int partweights, int bothweights, int nodeID, if (cj->nodeID == nodeID) weights_v[cjd] += 0.5 * w; } - /* Add weights to edge. */ + /* Add weights to edge, reduced by some weight from the expected time + * of next interaction -- we want active cells to be clustered. */ int kk; for (kk = 26 * cid; inds[kk] != cjd; kk++) ; - weights_e[kk] += w; + weights_e[kk] += w / get_time_bin(ci->ti_end_max); for (kk = 26 * cjd; inds[kk] != cid; kk++) ; - weights_e[kk] += w; + weights_e[kk] += w / get_time_bin(ci->ti_end_max); } } }