<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 30, 2020, at 2:57 AM, Eda Oktay <<a href="mailto:eda.oktay@metu.edu.tr" class="">eda.oktay@metu.edu.tr</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Dear Matt,<div class=""><br class=""></div><div class="">First of all I figured out that I asked wrongly. It's not ParMETIS giving the same result. It is CHACO. ParMETIS gives different results when I use edge weights. </div><div class=""><br class=""></div><div class="">Thanks! </div><div class=""><br class=""></div><div class="">Dear Barry,</div><div class=""><br class=""></div><div class="">I am trying to partition the matrix to compare the edge cuts when it is partitioned with CHACO, ParMETIS and the spectral partitioning algorithm with the k-means clustering (I wrote this code in PETSc). In the end, I will conclude that if a linear system is to be solved and the coefficient matrix is large in size, then partitioning the coefficient matrix by using one of these algorithms will help one to solve the linear system faster and with small communication.</div><div class=""><br class=""></div><div class="">What is forcing matrix to have all positive values? Isn't it done by using MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights?</div><div class=""><br class=""></div><div class="">I will send the test case but I am already passing my original matrix directly to SetAdjacency (SymmA is my symmetric matrix with positive values):</div><div class=""><br class=""></div><div class=""> ierr = MatConvert(SymmA,MATMPIADJ,MAT_INITIAL_MATRIX,&AL);CHKERRQ(ierr); <br class=""> ierr = MatPartitioningCreate(MPI_COMM_WORLD,&part);CHKERRQ(ierr);<br class=""> ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr); <br class=""> ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);<br class=""></div></div></div></blockquote><div><br class=""></div> You should not need this. Just </div><div><br class=""></div><div> ierr = MatPartitioningCreate(MPI_COMM_WORLD,&part);CHKERRQ(ierr);</div><div> ierr = MatPartitioningSetAdjacency(part,SymmA);CHKERRQ(ierr); </div><div> ierr = MatPartitioningSetFromOptions(part);CHKERRQ(ierr);</div><div><div><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""> MatPartitioningSetAdjacency takes any MatType directly.</div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">So, if ParMETIS gives different edge cut as it is expected, MatPartitioningGetUseEdgeWeights and MatPartitioningSetUseEdgeWeights works correctly. Why can't CHACO?</div><div class=""><br class=""></div><div class="">Thanks!</div><div class=""><br class=""></div><div class="">Eda</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>>, 30 Ağu 2020 Paz, 03:00 tarihinde şunu yazdı:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br class="">
<br class="">
> On Aug 29, 2020, at 2:23 PM, Eda Oktay <<a href="mailto:eda.oktay@metu.edu.tr" target="_blank" class="">eda.oktay@metu.edu.tr</a>> wrote:<br class="">
> <br class="">
> Hi all,<br class="">
> <br class="">
> I am trying to partition a sparse matrix by using ParMETIS. I am converting my matrix to adjacency type and then applying partitioning.<br class="">
<br class="">
You don't need to do this. Just pass your original matrix directly into MatPartitioningSetAdjacency() it will handle any conversions needed.<br class="">
<br class="">
Edge weights need to be positive, since they represent how much communication is to take place over that link. You may need to force your matrix to have all positive values before giving it to MatPartitioningSetAdjacency and using edge weights. <br class="">
<br class="">
I this doesn't work than our code is broken, please send us a simple test case<br class="">
<br class="">
Question: Why are you partitioning a matrix? Is it for load balancing of solves or matrix vector products with the matrix? To reduce interprocess communication during solves or matrix vector products with the matrix? If so the numerical values in the matrix don't affect load balance or interprocess communication for these operations. <br class="">
<br class="">
<br class="">
Barry<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
> Default, I understood that partitioning doesn't use edge-weights. However, when I used the following codes I saw from ex15 and used "-test_use_edge_weights 1", I am getting the same results as when I don't consider edge weights.<br class="">
> <br class="">
> PetscBool use_edge_weights=PETSC_FALSE;<br class="">
> PetscOptionsGetBool(NULL,NULL,"-test_use_edge_weights",&use_edge_weights,NULL);<br class="">
> if (use_edge_weights) {<br class="">
> MatPartitioningSetUseEdgeWeights(part,use_edge_weights);<br class="">
> <br class="">
> MatPartitioningGetUseEdgeWeights(part,&use_edge_weights);<br class="">
> if (!use_edge_weights) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP, "use_edge_weights flag does not setup correctly \n");<br class="">
> }<br class="">
> <br class="">
> My matrix does not consist of 1s and 0s, so I want partitioning to consider all the nonzero elements in the matrix as edge weights. Don't MatPartitioningSetUseEdgeWeights and MatPartitioningGetUseEdgeWeights do that? Should I add something more? In the page of MatPartitioningSetUseEdgeWeights, it is written that "If set use_edge_weights to TRUE, users need to make sure legal edge weights are stored in an ADJ matrix.". How can I make sure of this? <br class="">
> <br class="">
> I am trying to compare the use of ParMETIS with the spectral partitioning algorithm when I used a weighted Laplacian.<br class="">
> <br class="">
> Thanks!<br class="">
> <br class="">
> Eda<br class="">
> <br class="">
<br class="">
</blockquote></div>
</div></blockquote></div><br class=""></body></html>