<div dir="ltr">Hi Debao,<div><br></div><div>1.  see <a href="http://www.mcs.anl.gov/petsc/petsc-as/miscellaneous/petscthreads.html">http://www.mcs.anl.gov/petsc/petsc-as/miscellaneous/petscthreads.html</a></div><div><br></div>
<div>2.  There is no support for running PetscInitialize after PetscFinalize has been called.  Generally these functions are only called in main just after the program has been started and right before it exits.  You need to move PetscInitialize to before the loop and PetscFinalize to after the loop.</div>
<div><br></div><div>A</div><div><br><div class="gmail_quote">On Tue, Aug 9, 2011 at 11:58 AM, Debao Shao <span dir="ltr">&lt;<a href="mailto:Debao.Shao@brion.com">Debao.Shao@brion.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">






<div lang="ZH-CN" link="blue" vlink="blue">
<div>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">(gdb) bt<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">#0  0x000000360462e21d in raise () from /lib64/tls/libc.so.6<u></u><u></u></span></font></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">#1  0x000000360462fa1e in abort () from /lib64/tls/libc.so.6<u></u><u></u></span></font></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">#2  0x0000000002256329 in Petsc_MPI_Abort ()<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">#3  0x00000000023fa16b in PetscOptionsInsert ()<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">#4  0x00000000023fbe45 in PetscOptionsFindPair_Private ()<u></u><u></u></span></font></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">#5  0x00000000023fd5af in PetscOptionsGetString ()<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">#6  0x0000000002339d26 in MatMFFDInitializePackage ()<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">#7  0x00000000022a2660 in MatInitializePackage ()<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">#8  0x0000000002343c4e in MatCreate ()<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">1, does petsc support multiple threads, if I compiled libpetsc.a with –with-mpi=0?<u></u><u></u></span></font></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">2, is the following usage right?<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">While(1)<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">{<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">         ReceiveJobfromServer();<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">        
</span></font><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">PetscInitialize();  //to avoid a SIGTERM error, I move the call of PetscInitialize into the loop.<u></u><u></u></span></font></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">         handleJob();<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">         PetscFinalize();</span></font><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy"><u></u><u></u></span></font></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">}<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">Thanks,<u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">Debao<u></u><u></u></span></font></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div>
<p class="MsoNormal"><b><font size="2" face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma"> <a href="mailto:petsc-users-bounces@mcs.anl.gov" target="_blank">petsc-users-bounces@mcs.anl.gov</a>
 [mailto:<a href="mailto:petsc-users-bounces@mcs.anl.gov" target="_blank">petsc-users-bounces@mcs.anl.gov</a>] <b><span style="font-weight:bold">On Behalf Of
</span></b>Aron Ahmadia<br>
<b><span style="font-weight:bold">Sent:</span></b> Tuesday, August 09, 2011 4:39 PM<br>
<b><span style="font-weight:bold">To:</span></b> PETSc users list<br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [petsc-users] PETSC ERROR: PetscFinalize() line 968 in src/sys/objects/pinit.c</span></font><span lang="EN-US"><u></u><u></u></span></p>
</div><div><div></div><div class="h5">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">Debao,<u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">What is the complete traceback for this problem?  <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">A<u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">On Tue, Aug 9, 2011 at 11:12 AM, Debao Shao &lt;<a href="mailto:Debao.Shao@brion.com" target="_blank">Debao.Shao@brion.com</a>&gt; wrote:<u></u><u></u></span></font></p>

<div link="blue" vlink="purple">
<div>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="IT" style="font-size:9.0pt;font-family:Arial;color:navy">DA,
</span></font><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="IT" style="font-size:9.0pt;font-family:Arial;color:navy"> </span></font><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">Do you happen to know what may cause this error?</span></font><span lang="EN-US"><u></u><u></u></span></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">         “[0]PETSC ERROR: PetscFinalize() line 968 in src/sys/objects/pinit.c”</span></font><span lang="EN-US"><u></u><u></u></span></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy"> </span></font><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">After reporting this error, the job can run continued, but it
 will aborted when encountering next petsc related features even with calling PetscInitialize() again, and say:</span></font><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">         “Options have not been enabled.</span></font><span lang="EN-US"><u></u><u></u></span></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">         You might have forgotten to call PetscInitialize().”</span></font><span lang="EN-US"><u></u><u></u></span></p>

<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy"> </span></font><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">Here is line 968:</span></font><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="EN-US" style="font-size:9.0pt;font-family:Arial;color:navy">        
</span></font><font size="1" color="blue" face="Arial"><span lang="IT" style="font-size:9.0pt;font-family:Arial;color:blue">ierr = MPI_Finalize();CHKERRQ(ierr);</span></font><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="IT" style="font-size:9.0pt;font-family:Arial;color:navy"> </span></font><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="IT" style="font-size:9.0pt;font-family:Arial;color:navy">Thanks,</span></font><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><font size="1" color="navy" face="Arial"><span lang="IT" style="font-size:9.0pt;font-family:Arial;color:navy">Debao</span></font><span lang="EN-US"><u></u><u></u></span></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div>
<p class="MsoNormal"><font size="1" color="gray" face="Arial"><span lang="EN-US" style="font-size:7.5pt;font-family:Arial;color:gray">-- The information contained in this communication and any attachments is confidential and may be privileged, and is for the
 sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. Unless explicitly stated otherwise in the body of this communication or the attachment thereto (if any), the information is provided on an AS-IS
 basis without any express or implied warranties or liabilities. To the extent you are relying on this information, you are doing so at your own risk. If you are not the intended recipient, please notify the sender immediately by replying to this message and
 destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.</span></font><span lang="EN-US"><u></u><u></u></span></p>

</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
</div>
</div></div></div><div><div></div><div class="h5">
<br>
<hr>
<font face="Arial" color="Gray" size="1">-- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution
 is prohibited. Unless explicitly stated otherwise in the body of this communication or the attachment thereto (if any), the information is provided on an AS-IS basis without any express or implied warranties or liabilities. To the extent you are relying on
 this information, you are doing so at your own risk. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and
 complete transmission of the information contained in this communication, nor for any delay in its receipt.<br>
</font>
</div></div></div>

</blockquote></div><br></div></div>