Zoltan incorrectly reads MatrixMarket matrices
Created by: rsln-s
@trilinos/zoltan
Expectations
Zoltan should correctly read MatrixMarket format matrices and interpret them in row-net fashion (i.e. each row in the matrix corresponds to a hyperedge and each column to a vertex).
Current Behavior
As pointed out by @SebastianSchlag, on matrix VDOL/hangGlider_3 after reading in the hypergraph the number of edges in it is 10259, vertices -- 10260 and pins (nonzeros) -- 44643. However, the matrix contains 10260 vertices, 10260 edges and 92703 nonzeros. @SebastianSchlag points out that this results in incorrect cut computations when compared to hMetis, for example. Please note that this problem has been tested in serial mode (i.e. on one processor, without MPI).
Motivation and Context
I have previously attempted to fix this problem, but recently discovered (thanks, again, to @SebastianSchlag) that my fix is indeed incorrect. I will close the corresponding pull request #1198
Definition of Done
After the fix Zoltan should read the matrix in correctly. For example, for VDOL/hangGlider_3 the following should be true at the most fine level:
hg->nVtx == 10260
hg->nEdge == 10260
hg->nPins == 92703
Steps to Reproduce
To check the number of vertices, hyperedges and nonzeros I have introduced the following three lines in 'phg/phg.c' (after line 475):
printf("RS_VERTEX_NUM=%d\n", hg->nVtx);
printf("RS_HEDGE_NUM=%d\n", hg->nEdge);
printf("RS_PINS_NUM=%d\n", hg->nPins);
Then to build and run:
cd /home/rshaydu/dev/Trilinos/build
cmake -D CMAKE_INSTALL_PREFIX:FILEPATH="/home/rshaydu/dev/Trilinos/build" -D Trilinos_ENABLE_ALL_PACKAGES:BOOL=OFF -D Trilinos_ENABLE_Zoltan:BOOL=ON -D Zoltan_ENABLE_EXAMPLES:BOOL=ON -D TPL_ENABLE_MPI:BOOL=OFF -D Trilinos_ENABLE_Fortran:BOOL=OFF -D Zoltan_ENABLE_TESTS:BOOL=ON ..
cd ~/test_dir
cp ~/Trilinos/build/packages/zoltan/src/driver/*.exe .
./zdrive.exe zdrive.inp.hangGlider_3.agg.2.110
Where zdrive.inp.hangGlider_3.agg.2.110
:
Decomposition Method = hypergraph
Zoltan Parameters = HYPERGRAPH_PACKAGE=phg
Zoltan Parameters = lb_approach=partition
File Type = matrixmarket
File Name = hangGlider_3
Parallel Disk Info = number=0
Zoltan Parameters = NUM_GLOBAL_PARTITIONS = 2
Zoltan Parameters = PHG_COARSENING_METHOD= agg
Zoltan Parameters = PHG_CUT_OBJECTIVE=HYPEREDGES
Zoltan Parameters = IMBALANCE_TOL= 1.1