<div dir="ltr"><div dir="ltr">On Thu, Aug 25, 2022 at 1:08 PM Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Thu, Aug 25, 2022 at 12:38 PM Alexandre Halbach <<a href="mailto:alexandre.halbach@gmail.com" target="_blank">alexandre.halbach@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello,</div><div><br></div><div>I am using the metis package provided by the latest petsc version, using --download-metis (Linux, 32 bits). This question is arguably more a metis issue but since metis is used in petsc and mumps this seems relevant to ask here too.<br></div><div><br></div><div>I systematically get a segmentation fault on this metis version (didn't try others) when I partition even simple and not too large graphs ( O(5 millions)). I tried a lot of cases as well as both the 32 and 64 bits version of petsc and also increasing ulimit (on Linux).</div>Here is the shortest possible representative example with that problem (c++). I double checked it and I hope there is no mistake in this example.<br>The below example constructs the containers for a 1D line graph (n vertices connected by edges one by one as in a chain. Both end vertices only have a single neighbor while all other vertices have two neighbors).<br>Either this is something I am doing wrong or there is a bug in at least the metis version proposed in petsc.<br><br><div>Here is the example producing a segfault. If you don't get a segfault try a 10 millions or more vertices graph.</div></div></blockquote><div><br></div><div>You are exceeding the stack space. I will rewrite to malloc() and take a look.</div></div></div></blockquote><div><br></div><div>I do not SEGV with the attached code.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thank you for your help and your great work!</div><div><br></div><div>Alex<br></div><br><br>#include "metis.h"<br><br>int main(void)<br>{<br>    // Number of vertices:<br>    int n = 1000000;<br>    // Addresses should for example be [0 1 3 5 7 8] for 5 vertices <br>    idx_t addresses[n+1];<br>    addresses[0] = 0; addresses[1] = 1;<br>    for (int i = 2; i < n; i++)<br>        addresses[i] = addresses[i-1] + 2;<br>    addresses[n] = addresses[n-1]+1;<br>    <br>    // Connected vertices should for example be [1 0 2 1 3 2 4 3] for 5 vertices<br>    idx_t connectivities[2*(n-1)];<br>    connectivities[0] = 1;<br>    for (int i = 1; i < n-1; i++)<br>    {<br>        connectivities[2*i-1] = i-1;<br>        connectivities[2*i+0] = i+1;<br>    }<br>    connectivities[2*(n-1)-1] = connectivities[2*(n-1)-2]-1;<br>    <br>    idx_t nvtxs = n;<br>    idx_t nEdges = n-1;<br>    <br>    idx_t metisOptions[METIS_NOPTIONS];<br>    METIS_SetDefaultOptions(metisOptions);<br>    metisOptions[METIS_OPTION_NUMBERING] = 0; // c numbering (start at 0)<br><br>    idx_t ncon = 1;<br>    idx_t nParts = 2;<br>    idx_t objval;<br>    idx_t part[nvtxs];<br>    <br>    int ret = METIS_PartGraphRecursive ( &nvtxs, &ncon, addresses, connectivities, NULL, NULL, NULL, &nParts, NULL, NULL, metisOptions, &objval, part );<br>}<br></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>