Commit b91a5ff3 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Improve descriptive content

parent 19f735d0
......@@ -317,7 +317,7 @@ void engine_redistribute(struct engine *e) {
MPI_COMM_WORLD) != MPI_SUCCESS)
error("Failed to allreduce particle transfer counts.");
/* Report how many particles have been moved. */
/* Report how many particles will be moved. */
if (e->verbose) {
if (e->nodeID == 0) {
size_t total = 0;
......@@ -329,8 +329,8 @@ void engine_redistribute(struct engine *e) {
r++;
}
}
message("of %ld particles %ld are not transferred (%.2f%%)", total,
unmoved, 100.0 * (double)unmoved / (double)total);
message("%ld of %ld (%.2f%%) of particles moved", total - unmoved,
total, 100.0 * (double)(total - unmoved) / (double)total);
}
}
......
......@@ -396,17 +396,18 @@ static void pick_metis(struct space *s, int nregions, int *vertexw, int *edgew,
/* We want a solution in which the current regions of the space are
* preserved when possible, to avoid unneccesary particle movement.
* So try mapping the current regions to the new regions and reassigning
* those with the greatest number of common cells... */
int keymax = nregions * nregions;
struct indexval *ivs = malloc(sizeof(struct indexval) * keymax);
bzero(ivs, sizeof(struct indexval) * keymax);
* So create a 2d-array of cells counts that are common to all pairs
* of old and new ranks. Each element of the array has a cell count and
* an unique index so we can sort into decreasing counts. */
int indmax = nregions * nregions;
struct indexval *ivs = malloc(sizeof(struct indexval) * indmax);
bzero(ivs, sizeof(struct indexval) * indmax);
for (int k = 0; k < ncells; k++) {
int index = regionid[k] + nregions * s->cells_top[k].nodeID;
ivs[index].count++;
ivs[index].index = index;
}
qsort(ivs, keymax, sizeof(struct indexval), indexvalcmp);
qsort(ivs, indmax, sizeof(struct indexval), indexvalcmp);
/* Go through the ivs using the largest counts first, these are the
* regions with the most cells in common, old partition to new. */
......@@ -416,7 +417,7 @@ static void pick_metis(struct space *s, int nregions, int *vertexw, int *edgew,
oldmap[k] = -1;
newmap[k] = -1;
}
for (int k = 0; k < keymax; k++) {
for (int k = 0; k < indmax; k++) {
/* Stop when all regions with common cells have been considered. */
if (ivs[k].count == 0) break;
......
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