<div dir="ltr"><div dir="ltr">On Fri, Jun 30, 2023 at 6:47 AM Ngoc Mai Monica Huynh <<a href="mailto:ngocmaimonica.huynh@unipv.it">ngocmaimonica.huynh@unipv.it</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 style="overflow-wrap: break-word;">Hi,<div><br></div><div>I have no problem now in compiling, thank you for providing the Fortran interface.</div><div>I have a follow up question.</div><div>When running the code, I get this error, which I’m pretty sure it is related to DMDAGetElements(), since up to that line everything works fine.</div><div><br></div><div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">[0]PETSC ERROR: ------------------------------------------------------------------------</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">[0]PETSC ERROR: or see <a href="https://petsc.org/release/faq/#valgrind" target="_blank">https://petsc.org/release/faq/#valgrind</a> and <a href="https://petsc.org/release/faq/" target="_blank">https://petsc.org/release/faq/</a></span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">[0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">[0]PETSC ERROR: No error traceback is available, the problem could be in the main program. </span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">--------------------------------------------------------------------------</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">with errorcode 59.</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo;min-height:20px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">You may or may not see output from other processes, depending on</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">exactly when Open MPI kills them.</span></div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">—————————————————————————————————————</span></div></div><div style="margin:0px;font-stretch:normal;font-size:17px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div style="margin:0px;font-stretch:normal;font-size:17px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span style="font-family:Helvetica;font-size:14px">The lines of code I’m working on are the following:</span></span></div><div><br></div><div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">      integer ierr</span></div></div><div><br></div><div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">      MPI_Comm comm</span></div></div><div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      DM da3d</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      ISLocalToGlobalMapping map</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      PetscInt nel,nen</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      PetscInt, pointer :: e_loc(:)</span></div></span></div></div></div><div><br></div><div><div style="margin:0px;font-stretch:normal;line-height:normal;font-family:Menlo"><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      </span><span style="font-variant-ligatures:no-common-ligatures">call</span><span style="font-variant-ligatures:no-common-ligatures"> DMDACreate3d(comm,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures">&</span><span style="font-variant-ligatures:no-common-ligatures">                  DM_BOUNDARY_NONE,DMDA_STENCIL_BOX,433,41,29,</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures">&</span><span style="font-variant-ligatures:no-common-ligatures">                  8,2,1,</span><span style="font-variant-ligatures:no-common-ligatures">3</span><span style="font-variant-ligatures:no-common-ligatures">,</span><span style="font-variant-ligatures:no-common-ligatures">1</span><span style="font-variant-ligatures:no-common-ligatures">,PETSC_NULL_INTEGER,</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures">&</span><span style="font-variant-ligatures:no-common-ligatures">                  PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures">&</span><span style="font-variant-ligatures:no-common-ligatures">                  da3d,ierr)</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      </span><span style="font-variant-ligatures:no-common-ligatures">call</span><span style="font-variant-ligatures:no-common-ligatures"> DMSetMatType(da3d,MATIS,ierr)</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      </span><span style="font-variant-ligatures:no-common-ligatures">call</span><span style="font-variant-ligatures:no-common-ligatures"> DMSetFromOptions(da3d,ierr)</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      </span><span style="font-variant-ligatures:no-common-ligatures">call</span><span style="font-variant-ligatures:no-common-ligatures"> DMDASetElementType(da3d,DMDA_ELEMENT_Q1,ierr)</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      </span><span style="font-variant-ligatures:no-common-ligatures">call</span><span style="font-variant-ligatures:no-common-ligatures"> DMSetUp(da3d,ierr)</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      </span><span style="font-variant-ligatures:no-common-ligatures">call</span><span style="font-variant-ligatures:no-common-ligatures"> DMGetLocalToGlobalMapping(da3d,map,ierr)</span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">      <span style="font-variant-ligatures:no-common-ligatures">call</span> DMDAGetElements(da3d,nel,nen,e_loc,ierr)</span></div></span></div></div></div><div><div><br></div><div>By printing in a dummy way any kind of message before and after DMDAGetElements(), I cannot pass over it.</div><div>Unfortunately, I cannot run with the debug option on this machine.</div><div>Am I calling the routine in a wrong way?</div></div></div></blockquote><div><br></div><div>Does</div><div><br></div><div>  src/dm/tutorials/ex11f90.F90</div><div><br></div><div>run for you?</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 style="overflow-wrap: break-word;"><div><div>Thanks,</div><div><span style="white-space:pre-wrap">    </span>Monica</div><div><br></div><div><br><blockquote type="cite"><div>On 29 Jun 2023, at 21:09, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div><br><div><div dir="ltr" style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div dir="ltr">On Thu, Jun 29, 2023 at 3:05 PM Ngoc Mai Monica Huynh <<a href="mailto:ngocmaimonica.huynh@unipv.it" target="_blank">ngocmaimonica.huynh@unipv.it</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="auto"><div dir="ltr"></div><div dir="ltr">Thank you.</div><div dir="ltr">Does this mean that DMDARestoreElements() is supported as well now? </div><div dir="ltr"></div></div></blockquote><div><br></div><div>Yes.</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="auto"><div dir="ltr">Monica</div><div dir="ltr"><br></div><div dir="ltr"><br><blockquote type="cite">Il giorno 29 giu 2023, alle ore 20:17, Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> ha scritto:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div><br></div> <span> </span>The code is ready in the branch <b style="color:rgb(200,20,201);font-family:Menlo;font-size:14px">barry/2023-06-29/add-dmdagetelements-fortran </b><a href="https://gitlab.com/petsc/petsc/-/merge_requests/6647" target="_blank">https://gitlab.com/petsc/petsc/-/merge_requests/6647</a><div><br></div><div> <span> </span>Barry</div><div><br><div><br><blockquote type="cite"><div>On Jun 29, 2023, at 12:41 PM, Ngoc Mai Monica Huynh <<a href="mailto:ngocmaimonica.huynh@unipv.it" target="_blank">ngocmaimonica.huynh@unipv.it</a>> wrote:</div><br><div><div>That would be amazing, thank you very much!<br><span style="white-space:pre-wrap"> </span>Monica<br><br><blockquote type="cite">On 29 Jun 2023, at 18:38, Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> wrote:<br><br><br>I can provide the Fortran interface this afternoon.<br><br> Barry<br><br><br><blockquote type="cite">On Jun 29, 2023, at 10:48 AM, Ngoc Mai Monica Huynh <<a href="mailto:ngocmaimonica.huynh@unipv.it" target="_blank">ngocmaimonica.huynh@unipv.it</a>> wrote:<br><br>Hi everyone,<span> </span><br><br>I would need to use the routine DMDAGetElements() in our Fortran code.<br>However, as I read from the manual, there is no Fortran support for this routine.<br>Is there any similar alternative there?<br><br>Many thanks!<br>Best regards,<br><span style="white-space:pre-wrap">      </span>Monica Huynh<br></blockquote><br></blockquote><br></div></div></blockquote></div><br></div></div></blockquote></div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">--<span> </span></span><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></div></div></div></div></div></div></div></div></div></blockquote></div><br></div></div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><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>