22#ifndef zHWPM_CombBLAS_h
23#define zHWPM_CombBLAS_h
25#include "CombBLAS/CombBLAS.h"
26#include "ApproxWeightPerfectMatching.h"
58 int_t i, irow, fst_row,
j, jcol, m, n, m_loc;
68 printf(
"HWPM only supports square process grid. Retuning without a permutation.\n");
70 combblas::SpParMat < int_t, double, combblas::SpDCCols<int_t,double> > Adcsc(grid->
comm);
71 std::vector< std::vector < std::tuple<int_t,int_t,double> > > data(procs);
83 m_loc = Astore->
m_loc;
99 for (
i = 0;
i < m_loc; ++
i) {
100 for (
j = Astore->
rowptr[
i]; j < Astore->rowptr[
i+1]; ++
j) {
103 irow = perm[
i+fst_row];
104 jcol = perm[Astore->
colind[
j]];
111 p = Adcsc.Owner(m, n , irow, jcol, lirow, ljcol);
113 data[p].push_back(std::make_tuple(lirow,ljcol,nzval_abs[
j]));
117 Adcsc.SparseCommon(data, nnz_loc, m, n, std::plus<double>());
118 combblas::FullyDistVec<int_t, int_t> mateRow2Col ( Adcsc.getcommgrid(), m, (
int_t) -1);
119 combblas::FullyDistVec<int_t, int_t> mateCol2Row ( Adcsc.getcommgrid(), n, (
int_t) -1);
120 combblas::AWPM(Adcsc, mateRow2Col, mateCol2Row,
true);
123 MPI_Comm World = mateRow2Col.getcommgrid()->GetWorld();
124 int * rdispls =
new int[procs];
125 int sendcnt = mateRow2Col.LocArrSize();
126 int * recvcnt =
new int[procs];
127 MPI_Allgather(&sendcnt, 1, MPI_INT, recvcnt, 1, MPI_INT, World);
129 for(
int i=0;
i<procs-1; ++
i)
131 rdispls[
i+1] = rdispls[
i] + recvcnt[
i];
133 int_t *senddata = (
int_t *)mateRow2Col.GetLocArr();
135 MPI_Allgatherv(senddata, sendcnt, combblas::MPIType<int_t>(), ScalePermstruct->
perm_r, recvcnt, rdispls, combblas::MPIType<int_t>(), World);
double slud_z_abs1(doublecomplex *)
Definition: dcomplex_dist.c:82
double * doubleMalloc_dist(int_t n)
Definition: dmemory_dist.c:155
int j
Definition: dutil_dist.c:248
int i
Definition: dutil_dist.c:248
int int_t
Definition: superlu_defs.h:114
#define CHECK_MALLOC(pnum, where)
Definition: util_dist.h:50
#define SUPERLU_FREE(addr)
Definition: util_dist.h:48
Definition: supermatrix.h:54
void * Store
Definition: supermatrix.h:62
int_t nrow
Definition: supermatrix.h:60
int_t ncol
Definition: supermatrix.h:61
Definition: dcomplex.h:30
Definition: superlu_defs.h:388
int_t nprow
Definition: superlu_defs.h:393
int_t npcol
Definition: superlu_defs.h:394
MPI_Comm comm
Definition: superlu_defs.h:389
int iam
Definition: superlu_defs.h:392
Definition: superlu_zdefs.h:76
int_t * perm_r
Definition: superlu_zdefs.h:80
Distributed SuperLU data types and function prototypes.
void zGetHWPM(SuperMatrix *A, gridinfo_t *grid, zScalePermstruct_t *ScalePermstruct)
Definition: zHWPM_CombBLAS.hpp:55