Typo: I mean “Assuming initializer is only needed once for entire session”<br><br>On Saturday, June 20, 2020, Sam Guo <<a href="mailto:sam.guo@cd-adapco.com">sam.guo@cd-adapco.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Assuming finalizer is only needed once for entire session(?), I can put initializer into the static block to call it once but where do I call finalizer?<div><br></div><div><br>On Saturday, June 20, 2020, Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank">junchao.zhang@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The counter num_attr should be recycled. But first try to call PETSc initialize/Finalize only once to see it fixes the error.<br clear="all"><div><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 20, 2020 at 12:48 AM Sam Guo <<a href="mailto:sam.guo@cd-adapco.com" target="_blank">sam.guo@cd-adapco.com</a>> wrote:<br></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">To clarify, I call PETSc initialize and PETSc finalize everytime I call SLEPc:<div><br><div><pre width="80" style="white-space:pre-wrap;color:rgb(0,0,0)"> PetscInitializeNoPointers(argc<wbr>,args,nullptr,nullptr);<br></pre><pre width="80" style="white-space:pre-wrap;color:rgb(0,0,0)"> SlepcInitialize(&argc,&args,st<wbr>atic_cast<char*>(nullptr),help<wbr>);</pre><pre width="80" style="white-space:pre-wrap;color:rgb(0,0,0)"> //calling slepc</pre><pre width="80" style="white-space:pre-wrap;color:rgb(0,0,0)"> SlepcFinalize();</pre><pre width="80" style="white-space:pre-wrap;color:rgb(0,0,0)"><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(34,34,34)"> PetscFinalize();</span> </pre></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 19, 2020 at 10:32 PM Sam Guo <<a href="mailto:sam.guo@cd-adapco.com" target="_blank">sam.guo@cd-adapco.com</a>> wrote:<br></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">Dear PETSc team,<div> When I called SLEPc multiple time, I eventually got following error: </div><div><br></div><div><span style="color:rgb(80,0,80)">MPI operation not supported by PETSc's sequential MPI wrappers<br></span>[0]PETSC ERROR: #1 PetscInitialize() line 967 in ../../../petsc/src/sys/objects<wbr>/pinit.c<br>[0]PETSC ERROR: #2 SlepcInitialize() line 262 in ../../../slepc/src/sys/slepcin<wbr>it.c<br>[0]PETSC ERROR: #3 SlepcInitializeNoPointers() line 359 in ../../../slepc/src/sys/slepcin<wbr>it.c<span style="color:rgb(80,0,80)"><br>PETSC ERROR: Logging has not been enabled.<br>You might have forgotten to call PetscInitialize().</span> <br></div><div><br></div><div> I debugged: it is because of following in petsc/src/sys/mpiuni/mpi.c</div><div><br></div><div><div>if (num_attr >= MAX_ATTR)<br></div></div><div><br></div><div>in function int MPI_Comm_create_keyval(MPI_Cop<wbr>y_function *copy_fn,MPI_Delete_function *delete_fn,int *keyval,void *extra_state)</div><div><br></div><div>num_attr is declared static and keeps increasing every time MPI_Comm_create_keyval is called.</div><div><br></div><div>I am using petsc 3.11.3 but found 3.13.2 has the same logic.</div><div><br></div><div>Is this a bug or I didn't use it correctly?</div><div><br></div><div>Thanks,</div><div>Sam</div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote>