Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
thilinarmtb committed Oct 20, 2023
1 parent f489ea1 commit 870ea3f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
8 changes: 3 additions & 5 deletions src/con-unique-vertices.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ static void sort_segments_shared(struct array *shared, int dim, struct comm *c,
bin = find_bin_cr(gids[index], &active, verbose - 1, bfr);
}
parrsb_print(&active, verbose,
"\t\t\tsss_find_bin_algo_%d_parity_%d: done.", algo,
parity);
"\t\t\tsss_find_bin_algo_%d_parity_%d: done.", algo, parity);
assert(bin >= 0 && bin <= (sint)active.np);

// index >= 0 --> gids[index] >= 0 --> segments[index].n > 0
Expand Down Expand Up @@ -503,8 +502,6 @@ int find_unique_vertices(Mesh mesh, struct comm *c, scalar tol, int verbose,

for (int t = 0; t < ndim; t++) {
for (int d = 0; d < ndim; d++) {
parrsb_print(c, verbose, "\tlocglob: %d %d", t + 1, d + 1);

// Sort both local and shared segments.
parrsb_print(c, verbose - 1, "\t\tsort_shared_segments ...");
sort_segments_shared(&shared, d, c, verbose - 1, bfr);
Expand All @@ -524,7 +521,8 @@ int find_unique_vertices(Mesh mesh, struct comm *c, scalar tol, int verbose,
// Number the segments.
parrsb_print(c, verbose - 1, "\t\tnumber_segments ...");
slong nseg = number_segments(&local, &shared, c);
parrsb_print(c, verbose, " %lld %lld", nseg, npts);
parrsb_print(c, verbose, "\tlocglob: %d %d %lld %lld", t + 1, d + 1, nseg,
npts);
}
}
// Number points consecutively -- shared points after local and then load
Expand Down
2 changes: 0 additions & 2 deletions src/con.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdarg.h>

#include "con-impl.h"

int PRE_TO_SYM_VERTEX[GC_MAX_VERTICES] = {0, 1, 3, 2, 4, 5, 7, 6};
Expand Down
10 changes: 5 additions & 5 deletions src/parrsb.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "metrics.h"
#include "parrsb-impl.h"

#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -160,8 +162,6 @@ static size_t load_balance(struct array *elist, uint nel, int nv,

free(pe);

parrsb_print(c, verbose, "load_balance: done");

return unit_size;
}

Expand Down Expand Up @@ -260,7 +260,7 @@ static void initialize_levels(struct comm *const comms, int *const levels_,
if (levels > 1)
comm_dup(&comms[levels - 1], &nc);
*levels_ = levels;
parrsb_print(c, verbose, "initialize_levels: done");
parrsb_print(c, verbose, "initialize_levels: levels = %u", levels);

comm_free(&nc);
}
Expand Down Expand Up @@ -301,7 +301,7 @@ static void parrsb_part_mesh_v0(int *part, const long long *const vtx,
levels, options->levels);
}

parrsb_print(c, verbose, "parrsb_part_mesh_v0: Running partitioner ...");
parrsb_print(c, verbose, "parrsb_part_mesh_v0: running partitioner ...");
if (elist.n > 0) {
int ndim = (nv == 8) ? 3 : 2;
switch (options->partitioner) {
Expand All @@ -323,7 +323,7 @@ static void parrsb_part_mesh_v0(int *part, const long long *const vtx,
for (uint l = 0; l < (uint)options->levels; l++)
comm_free(&comms[l]);

parrsb_print(c, verbose, "parrsb_part_mesh_v0: Restore original input ...");
parrsb_print(c, verbose, "parrsb_part_mesh_v0: restore original input");
restore_original(part, cr, &elist, esize, bfr);

array_free(&elist);
Expand Down
4 changes: 2 additions & 2 deletions src/rsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ void rsb(struct array *elements, int nv, const parrsb_options *const options,
for (uint level = 0; level < levels; level++) {
// Find the maximum number of RSB cuts in current level.
uint ncuts = get_level_cuts(level, levels, comms);
parrsb_print(gc, verbose, "rsb: Level=%u/%u number of cuts = %u",
level + 1, levels, ncuts);
parrsb_print(gc, verbose, "rsb: Level=%u/%u number of cuts = %u", level + 1,
levels, ncuts);

struct comm lc;
comm_dup(&lc, &comms[level]);
Expand Down
5 changes: 2 additions & 3 deletions src/sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,8 @@ void sarray_transfer_chunk(struct array *arr, const size_t usize,
comm_allreduce(c, gs_long, gs_max, &bmax, 1, wrk);
comm_allreduce(c, gs_long, gs_min, &cmin, 1, wrk);
comm_allreduce(c, gs_long, gs_min, &bmin, 1, wrk);
parrsb_print(c, 0,
"\t\t\t %d/%d brr.n = %u/%lld/%lld crr.n = %u/%lld/%lld", t,
nt, brr.n, bmin, bmax, crr.n, cmin, cmax);
parrsb_print(c, 0, "\t\t\t %d/%d brr.n = %u/%lld/%lld crr.n = %u/%lld/%lld",
t, nt, brr.n, bmin, bmax, crr.n, cmin, cmax);
}
array_free(&brr);

Expand Down

0 comments on commit 870ea3f

Please sign in to comment.