KarypisLab / METIS

METIS - Serial Graph Partitioning and Fill-reducing Matrix Ordering
Other
665 stars 134 forks source link

Segfault while parting graph with extreme edge-weight ratios #73

Open starbucksDave opened 1 year ago

starbucksDave commented 1 year ago

This small(ish) sample segfaults while parting a graph with rather extreme edge-weight ratios. The smallest weight is 1 and the largest is 55. If we make the ratio smaller, e.g. by bumping all the weights from 1 to 4 Metis manages to part the graph just fine. main.cpp.txt

Metis starts off by performing a few RecursiveBisections on the graph. After doing this a couple of times we get a small graph of 6 vertices and 16 adjacencies. xadj : +0 +3 +6 +9 +11 +12 +15 adjncy : +3 +1 +5 +0 +2 +5 +5 +1 -33686019 +0 +4 +3 +1 +0 +2 +1 adjwgt : +21 +32 +6 +32 +43 +28 +8 +57 +12 +21 +23 +23 +28 +22 +42 +28

It then tries to access the something on location -33686019

Here is the callstack

>   test.exe!libmetis__Compute2WayPartitionParams(ctrl_t * ctrl, graph_t * graph) Line 120  C
    test.exe!libmetis__GrowBisection(ctrl_t * ctrl, graph_t * graph, float * ntpwgts, int niparts) Line 292 C
    test.exe!libmetis__Init2WayPartition(ctrl_t * ctrl, graph_t * graph, float * ntpwgts, int niparts) Line 48  C
    test.exe!libmetis__MultilevelBisect(ctrl_t * ctrl, graph_t * graph, float * tpwgts) Line 245    C
    test.exe!libmetis__MlevelRecursiveBisection(ctrl_t * ctrl, graph_t * graph, int nparts, int * part, float * tpwgts, int fpart) Line 183 C
    test.exe!libmetis__MlevelRecursiveBisection(ctrl_t * ctrl, graph_t * graph, int nparts, int * part, float * tpwgts, int fpart) Line 207 C
    test.exe!libmetis__MlevelRecursiveBisection(ctrl_t * ctrl, graph_t * graph, int nparts, int * part, float * tpwgts, int fpart) Line 207 C
    test.exe!libmetis__MlevelRecursiveBisection(ctrl_t * ctrl, graph_t * graph, int nparts, int * part, float * tpwgts, int fpart) Line 207 C
    test.exe!libmetis__MlevelRecursiveBisection(ctrl_t * ctrl, graph_t * graph, int nparts, int * part, float * tpwgts, int fpart) Line 209 C
    test.exe!libmetis__MlevelRecursiveBisection(ctrl_t * ctrl, graph_t * graph, int nparts, int * part, float * tpwgts, int fpart) Line 207 C
    test.exe!METIS_PartGraphRecursive(int * nvtxs, int * ncon, int * xadj, int * adjncy, int * vwgt, int * vsize, int * adjwgt, int * nparts, float * tpwgts, float * ubvec, int * options, int * objval, int * part) Line 133  C
    test.exe!libmetis__InitKWayPartitioning(ctrl_t * ctrl, graph_t * graph) Line 200    C
    test.exe!libmetis__MlevelKWayPartitioning(ctrl_t * ctrl, graph_t * graph, int * part) Line 127  C
    test.exe!METIS_PartGraphKway(int * nvtxs, int * ncon, int * xadj, int * adjncy, int * vwgt, int * vsize, int * adjwgt, int * nparts, float * tpwgts, float * ubvec, int * options, int * objval, int * part) Line 74    C
    test.exe!main() Line 107    C++
    [External Code] 
gfaster commented 11 months ago

your adjncy format is incorrect - the elements in adjncy are adjacent vertices. Your adjncy says that vertex 2 has an edge to vertex -33686019.