<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Here is a specific example. I have 10 global edges and 10 global vertices. The vertices and edges represent neurons and synapses in the brain, respectively. Vertices 0-7  and 7-9 have excitation and depression effect on the target vertices. The first rank owns
 5 edges (0-4) and 6 vertices ( 0-4 local and 8 ghost). The second rank owns 5 edges (5-9) and 6 vertices (5-9 local and 4 ghost). Note that edges 4 (neuron 8 depresses neuron 4) and 8 (neuron 4 excite neuron 8) that share the same vertices on different ranks.
 The generated Plex is correct based on the cone and support outputs. However, the SF object is completely wrong as shown below. The first rank supposed to have 10 roots and one leaf (vertex 8), and the second rank suppose to have the same number of roots and
 leaf (vertex 4) as the first rank. My guess is something went wrong in <i>sfPoint
</i>when determining the shared local vertices. I can provide more outputs from DMPlex if it helps, please let me know. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
DM Object: 2 MPI processes
<div>  type: network</div>
<div>  NSubnets: 1; NEdges: 10; NVertices: 10; NSharedVertices: 0.</div>
<div>  [0] nEdges: 5; nVertices: 6; nSharedVertices: 0</div>
<div>     Subnet 0: nEdges 5, nVertices(include shared vertices) 6</div>
<div>       edge 0: 4 ----> 0</div>
<div>       edge 1: 4 ----> 1</div>
<div>       edge 2: 4 ----> 2</div>
<div>       edge 3: 4 ----> 3</div>
<div>       edge 4: 8 ----> 4</div>
<div>  [1] nEdges: 5; nVertices: 6; nSharedVertices: 0</div>
<div>     Subnet 0: nEdges 5, nVertices(include shared vertices) 6</div>
<div>       edge 5: 4 ----> 5</div>
<div>       edge 6: 4 ----> 6</div>
<div>       edge 7: 4 ----> 7</div>
<div>       edge 8: 4 ----> 8</div>
<span>       edge 9: 4 ----> 9</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cones:
<div>[0] Max cone size: 2</div>
<div>[0]: 0 <---- 9 (0)</div>
<div>[0]: 0 <---- 5 (0)</div>
<div>[0]: 1 <---- 9 (0)</div>
<div>[0]: 1 <---- 6 (0)</div>
<div>[0]: 2 <---- 9 (0)</div>
<div>[0]: 2 <---- 7 (0)</div>
<div>[0]: 3 <---- 9 (0)</div>
<div>[0]: 3 <---- 8 (0)</div>
<div>[0]: 4 <---- 10 (0)</div>
<div>[0]: 4 <---- 9 (0)</div>
<div>[1] Max cone size: 2</div>
<div>[1]: 0 <---- 5 (0)</div>
<div>[1]: 0 <---- 6 (0)</div>
<div>[1]: 1 <---- 5 (0)</div>
<div>[1]: 1 <---- 7 (0)</div>
<div>[1]: 2 <---- 5 (0)</div>
<div>[1]: 2 <---- 8 (0)</div>
<div>[1]: 3 <---- 5 (0)</div>
<div>[1]: 3 <---- 9 (0)</div>
<div>[1]: 4 <---- 5 (0)</div>
<span>[1]: 4 <---- 10 (0)</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>PetscSF Object: 2 MPI processes
<div>  type: basic</div>
<div>  [0] Number of roots=11, leaves=2, remote ranks=1</div>
<div>  [0] 9 <- (1,5)</div>
<div>  [0] 10 <- (1,9)</div>
<div>  [1] Number of roots=11, leaves=0, remote ranks=0</div>
<div>  [0] Roots referenced by my leaves, by rank</div>
<div>  [0] 1: 2 edges</div>
<div>  [0]    9 <- 5</div>
<div>  [0]    10 <- 9</div>
<div>  [1] Roots referenced by my leaves, by rank</div>
<span>  MultiSF sort=rank-order</span><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><br>
</span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Abhyankar, Shrirang G <shrirang.abhyankar@pnnl.gov><br>
<b>Sent:</b> Wednesday, December 1, 2021 4:17 PM<br>
<b>To:</b> Knepley, Matthew G (VISIT) <knepley@gmail.com>; Barry Smith <bsmith@petsc.dev><br>
<b>Cc:</b> petsc-dev <petsc-dev@mcs.anl.gov>; Zhang, Hong <hzhang@mcs.anl.gov>; Betrie, Getnet <gbetrie@anl.gov><br>
<b>Subject:</b> Re: DMPLEX cannot support two different edges for the same two vertices, hence DMPLEX cannot?</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
span.x_EmailStyle18
        {font-family:"Times New Roman",serif;
        color:windowtext}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
        {}
-->
</style>
<div lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman",serif">“</span>You can certainly have many fields on a given edge, but I don't know what it would mean to have two edges since no topological query could tell the difference.”</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">The two edges in a power grid represent two parallel power lines that are connected between two locations (vertices). There are line ids (stored in the component data) to distinguish the two lines.
<span style="font-size:12.0pt; font-family:"Times New Roman",serif"></span></p>
<p class="x_MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman",serif"> </span></p>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman",serif">Thanks,</span></p>
<p class="x_MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman",serif">Shri </span></p>
</div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman",serif"> </span></p>
<p class="x_MsoNormal"><span style="font-size:12.0pt; font-family:"Times New Roman",serif"> </span></p>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt; color:black">From:
</span></b><span style="font-size:12.0pt; color:black">Matthew Knepley <knepley@gmail.com><br>
<b>Date: </b>Wednesday, December 1, 2021 at 4:07 PM<br>
<b>To: </b>Barry Smith <bsmith@petsc.dev><br>
<b>Cc: </b>"Abhyankar, Shrirang G" <shrirang.abhyankar@pnnl.gov>, PETSc Development <petsc-dev@mcs.anl.gov>, "Zhang, Hong" <hzhang@mcs.anl.gov>, Getnet Betrie <gbetrie@anl.gov><br>
<b>Subject: </b>Re: DMPLEX cannot support two different edges for the same two vertices, hence DMPLEX cannot?</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">On Wed, Dec 1, 2021 at 4:51 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:</p>
</div>
<div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt; margin-left:4.8pt; margin-right:0in">
<div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">  It may not happen with one rank. Or it may.</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<p class="x_MsoNormal" style="margin-left:.5in">  With more than one rank one may run a code and think it is working correctly but that does not mean the PetscSF is correct. It is generating "extra" degrees of freedom for these vertices each associated with
 a different edge and not properly connecting them. You can tell by doing a full DMView on the dmplex and PetscSF and seeing more roots than there should be listed. Hence the numerics will be wrong even though it does not crash or complain.</p>
</div>
</blockquote>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Okay, I think we need specific tests to see what is going on.</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Theoretically, having multiple edges between vertices does not make sense since the edge _means_ (v_i, v_j) topologically. You can certainly have many fields on a given edge, but I don't know what it would mean
 to have two edges since no topological query could tell the difference.</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">However, you can certainly tell Plex anything you want to tell it. DMPlexBuildFromCellListParallel() gets only cells and vertices, so you are saying that there is a duplicate cell. That is allowed and should work
 properly, EXCEPT if you wanted to identify a cell only by its cone (then you could not tell them apart). I do this for faces, but I did not think I ever did it for cells.</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">  Thanks,</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">     Matt</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt; margin-left:4.8pt; margin-right:0in">
<div>
<div>
<div>
<blockquote style="margin-top:5.0pt; margin-bottom:5.0pt">
<div>
<p class="x_MsoNormal" style="margin-left:.5in">On Dec 1, 2021, at 4:37 PM, Abhyankar, Shrirang G <<a href="mailto:shrirang.abhyankar@pnnl.gov" target="_blank">shrirang.abhyankar@pnnl.gov</a>> wrote:</p>
</div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
<div>
<div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"><span style="font-size:12.0pt; font-family:"Times New Roman",serif">Barry,</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"><span style="font-size:12.0pt; font-family:"Times New Roman",serif"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"><span style="font-size:12.0pt; font-family:"Times New Roman",serif">“</span>Is there anything we can do to support having multiple edges between the same two vertices”</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Some of my power grid datasets have multiple edges between the same two vertices and I’ve not faced an issue with DMNetwork. However, all the data was read on rank 0 only (and then distributed).</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Maybe the issue is with the edges being passed on different ranks?</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"><span style="font-size:12.0pt; font-family:"Times New Roman",serif"> </span></p>
</div>
<div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"><span style="font-size:12.0pt; font-family:"Times New Roman",serif">Thanks,</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"><span style="font-size:12.0pt; font-family:"Times New Roman",serif">Shri </span></p>
</div>
</div>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt">From: </span></b><span style="font-size:12.0pt">Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>><br>
<b>Date: </b>Wednesday, December 1, 2021 at 3:19 PM<br>
<b>To: </b>"Knepley, Matthew G (VISIT)" <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>, PETSc Development <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>>, "Abhyankar, Shrirang G" <<a href="mailto:shrirang.abhyankar@pnnl.gov" target="_blank">shrirang.abhyankar@pnnl.gov</a>>,
 "Zhang, Hong" <<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</a>>, Getnet Betrie <<a href="mailto:gbetrie@anl.gov" target="_blank">gbetrie@anl.gov</a>><br>
<b>Subject: </b>DMPLEX cannot support two different edges for the same two vertices, hence DMPLEX cannot?</span></p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in">Check twice before you click! This email originated from outside PNNL.</p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in">   Matt,</p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in">     If DMPlexBuildFromCellListParallel() is called with two edges that have the same two vertices what will happen? It looks like it ends up with an incorrect PetscSF if the two edges are passed on different
 ranks. Hence the DMPLEX is not valid and produces garbage.</p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in">     Neurons can be connected to themselves which seems to be breaking DMPLEX and hence DMNETWORK.</p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in">     Is there anything we can do to support having multiple edges between the same two vertices? If not is there a way we can have DMPlexBuildFromCellListParallel() generate an error automatically if there are
 such extra edges in the input data.</p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in">   Thanks</p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in">  Barry</p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
<div>
<div style="margin-left:.5in">
<p class="x_MsoNormal" style="margin-left:.5in">In this work, the neurons are represented by vertices in the network and each synapse is a graph edge.</p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
</blockquote>
</div>
<p class="x_MsoNormal" style="margin-left:.5in"><br clear="all">
</p>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<p class="x_MsoNormal" style="margin-left:.5in">-- </p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">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</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"><a href="https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Cshrirang.abhyankar%40pnnl.gov%7Ce56f4d6ffa10474f3c7508d9b516feb5%7Cd6faa5f90ae240338c0130048a38deeb%7C0%7C0%7C637739932634554446%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=WwSfLYl2hPyHwrfkJ1SuBmp6l88d6xJulwBPBvu%2BbK0%3D&reserved=0" target="_blank">https://www.cse.buffalo.edu/~knepley/</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>