Skip to content

Commit

Permalink
Fix compiler warnings and get rid of CSC for Laplacian
Browse files Browse the repository at this point in the history
  • Loading branch information
thilinarmtb committed May 14, 2023
1 parent b60ae89 commit 4fe6a6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 48 deletions.
6 changes: 3 additions & 3 deletions src/con-unique-vertices.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ static slong number_segments(struct array *local, struct array *shared,
return st + lt;
}

static int number_points(struct array *elems, const struct array *local,
const struct array *shared, const struct comm *c,
buffer *bfr) {
static void number_points(struct array *elems, const struct array *local,
const struct array *shared, const struct comm *c,
buffer *bfr) {
// First number local points and then number shared points.
slong out[2][1], wrk[2][1], in = local->n;
comm_scan(out, c, gs_long, gs_add, &in, 1, wrk);
Expand Down
45 changes: 1 addition & 44 deletions src/laplacian.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,6 @@ static int par_csr_init(struct laplacian *l, const struct rsb_element *elems,
return 0;
}

static int par_csc_init(struct laplacian *l, const struct rsb_element *elems,
const uint nelt, const int nv, const struct comm *c,
buffer *bfr) {
struct crystal cr;
crystal_init(&cr, c);

struct array nbrs, eij;
find_nbrs_rsb(&nbrs, elems, nelt, nv, c, &cr, bfr);
compress_nbrs(&eij, &nbrs, bfr);

struct csr_laplacian *L = l->data = tcalloc(struct csr_laplacian, 1);
struct par_mat *M = L->M = par_csc_setup_ext(&eij, 1, bfr);
L->gsh = setup_Q(L->M, c, bfr);

uint nnz = M->rn > 0 ? M->adj_off[M->rn] + M->rn : 0;
L->buf = tcalloc(scalar, nnz);

crystal_free(&cr);

array_free(&nbrs);
array_free(&eij);

return 0;
}

static int par_csr(scalar *v, const struct laplacian *l, scalar *u,
buffer *bfr) {
struct csr_laplacian *L = (struct csr_laplacian *)l->data;
Expand All @@ -125,20 +100,6 @@ static int par_csr(scalar *v, const struct laplacian *l, scalar *u,
return 1;
}

static int par_csc(scalar *v, const struct laplacian *l, scalar *u,
buffer *bfr) {
#if 0
struct csr_laplacian *L = (struct csr_laplacian *)l->data;
if (L != NULL) {
mat_vec_csr(v, u, L->M, L->gsh, L->buf, bfr);
return 0;
}
return 1;
#else
return 1;
#endif
}

static int par_csr_free(struct laplacian *l) {
if (l->data != NULL) {
struct csr_laplacian *L = (struct csr_laplacian *)l->data;
Expand Down Expand Up @@ -217,7 +178,7 @@ static int gs_weighted_free(struct laplacian *l) {
if (gl->diag != NULL)
free(gl->diag);
gs_free(gl->gsh);
free(l->data);
free(l->data), l->data = NULL;
return 0;
}

Expand All @@ -233,8 +194,6 @@ struct laplacian *laplacian_init(struct rsb_element *elems, uint nel, int nv,

if (type & CSR)
par_csr_init(l, elems, nel, nv, c, buf);
else if (type & CSC)
par_csc_init(l, elems, nel, nv, c, buf);
else if (type & GS)
gs_weighted_init(l, elems, nel, nv, c, buf);
else
Expand All @@ -246,8 +205,6 @@ struct laplacian *laplacian_init(struct rsb_element *elems, uint nel, int nv,
int laplacian(scalar *v, struct laplacian *l, scalar *u, buffer *buf) {
if (l->type & CSR)
par_csr(v, l, u, buf);
else if (l->type & CSC)
par_csc(v, l, u, buf);
else if (l->type & GS)
gs_weighted(v, l, u, buf);
else
Expand Down
1 change: 0 additions & 1 deletion src/parrsb-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ uint get_components_v2(sint *component, struct array *elems, unsigned nv,
//
#define GS 1
#define CSR 2
#define CSC 4

struct laplacian;
struct laplacian *laplacian_init(struct rsb_element *elems, uint nel, int nv,
Expand Down

0 comments on commit 4fe6a6b

Please sign in to comment.