From f18b365e8af6b49d42966081dea1364dee76a9e8 Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Thu, 3 Aug 2017 18:04:12 +0100 Subject: [PATCH] Weight edges by 1/timebin to give higher weight to active cells Only skip tasks with zero costs, note previous method had a bug and no weights for task_type_sub_pair was given --- src/partition.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/partition.c b/src/partition.c index d9aade781e..dcded26043 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); } } } -- GitLab