Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
starbucksDave opened this issue Aug 17, 2023 · 1 comment
Open

Comments

@starbucksDave
Copy link

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
Copy link

gfaster commented Sep 22, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants