<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Barry,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I found the following snippet in PetscInitialize_DynamicLibraries:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#if defined(PETSC_HAVE_THREADSAFETY)<o:p></o:p></p>
<p class="MsoNormal"> /* These must be all initialized here because it is not safe for individual threads to call these initialize routines */<o:p></o:p></p>
<p class="MsoNormal"> preload = PETSC_TRUE;<o:p></o:p></p>
<p class="MsoNormal">#endif<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">and ‘PetscLoadDynamicLibrary("", &found)’ is called only if preload==true and petsc is built as a shared lib. We have not faced this issue before we add ‘—with-thread-safety’.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What we are doing is:<o:p></o:p></p>
<p class="MsoNormal">Compile petsc/slepc as shared libraries, ship both executable and libpetsc.so libslepc.so to other users.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Does this error message indicate that what we are doing is not robust and it is better to use static libraries instead?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you<o:p></o:p></p>
<p class="MsoNormal">Di<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Barry Smith <bsmith@petsc.dev> <br>
<b>Sent:</b> Thursday, September 21, 2023 2:44 PM<br>
<b>To:</b> Di Miao <dimiao@synopsys.com><br>
<b>Cc:</b> petsc-users@mcs.anl.gov; Udit Pillai <uditp@synopsys.com><br>
<b>Subject:</b> Re: [petsc-users] 'Unable to locate PETSc dynamic library' error<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"> The recommended approach is to use --with-prefix=directory where you want PETSc installed instead of copying files manually after configure and make<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"> I don't see why —with-thread-safety would affect this but<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Sep 21, 2023, at 5:07 PM, Di Miao via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">To whom it may concern,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">In our build system, PETSc/SLEPc is compiled in one place and the *.so lib are then moved to another place for future use. Before we add the ‘—with-thread-safety’ flag, this works well. Now, we would like to run PETSc on multiple threads.
As suggested by the manual, we added ‘—with-thread-safety’ flag. The udpated libpetsc.so leads to the following error message:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Unable to locate PETSc dynamic library<span class="apple-converted-space"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> You cannot move the dynamic libraries!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">My question is other than compile PETSc as a static library, is there any other solutions that can let us compile libpetsc.so in one place and distribute it to other folders without causing this error?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Di<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: Unable to open file<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: Unable to locate PETSc dynamic library<span class="apple-converted-space"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> You cannot move the dynamic libraries!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: See<span class="apple-converted-space"> </span><a href="https://urldefense.com/v3/__https:/petsc.org/release/faq/__;!!A4F2R9G_pg!fam7m9EAcUH3ksmrAcDKqw2b56d-5BMr-p7YSieNL7fFnEN9xuYzPbkyxhVcvvp16WSAXnrY-j8Q5wI00Q$">https://petsc.org/release/faq/</a><span class="apple-converted-space"> </span>for
trouble shooting.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: Petsc Release Version 3.19.2, Jun 01, 2023<span class="apple-converted-space"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: Unknown Name on a arch-linux-c-opt named<span class="apple-converted-space"> </span><a href="http://tcadprod39.synopsys.com/">tcadprod39.synopsys.com</a><span class="apple-converted-space"> </span>by tcad Wed Sep 20 02:37:04
2023<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: Configure options <a href="mailto:--with-mpi-dir=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/../tcad_mpi_mpich">
--with-mpi-dir=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/../tcad_mpi_mpich</a> --with-64-bit-indices=true
<a href="mailto:--with-blaslapack-dir=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/../mkl">
--with-blaslapack-dir=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/../mkl</a> --with-shared-libraries --with-clean=true --with-debugging=0
<a href="mailto:--with-mkl_pardiso-dir=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/../mkl">
--with-mkl_pardiso-dir=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/../mkl</a> COPTFLAGS=-O3 CXXOPTFLAGS=-O3 FOPTFLAGS=-O3
<a href="mailto:--download-mumps=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/MUMPS_5.6.0.tar.gz">
--download-mumps=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/MUMPS_5.6.0.tar.gz</a>
<a href="mailto:--download-scalapack=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/v2.2.0.tar.gz">
--download-scalapack=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/v2.2.0.tar.gz</a>
<a href="mailto:--with-ssl-dir=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/../libressl">
--with-ssl-dir=/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/../libressl</a> --with-openmp=true --with-threadsafety=true --with-log=0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: #1 PetscInitialize_DynamicLibraries() at <a href="mailto:/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/petsc-3.19.2/src/sys/dll/reg.c:88">
/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/petsc-3.19.2/src/sys/dll/reg.c:88</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: #2 PetscInitialize_Common() at <a href="mailto:/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/petsc-3.19.2/src/sys/objects/pinit.c:1030">
/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/petsc-3.19.2/src/sys/objects/pinit.c:1030</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: #3 PetscInitialize() at <a href="mailto:/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/petsc-3.19.2/src/sys/objects/pinit.c:1276">
/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/petsc/petsc-3.19.2/src/sys/objects/pinit.c:1276</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: #4 SlepcInitialize() at <a href="mailto:/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/slepc/slepc-3.19.2/src/sys/slepcinit.c:264">
/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/slepc/slepc-3.19.2/src/sys/slepcinit.c:264</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: #5 EPSCreate() at <a href="mailto:/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/slepc/slepc-3.19.2/src/eps/interface/epsbasic.c:56">
/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/slepc/slepc-3.19.2/src/eps/interface/epsbasic.c:56</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: #6 EPSCreate() at <a href="mailto:/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/slepc/slepc-3.19.2/src/eps/interface/epsbasic.c:56">
/SCRATCH/tcad/ci_2_0/workspace/incremental_build_main@2/slepc/slepc-3.19.2/src/eps/interface/epsbasic.c:56</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Start calculating extreme eigenvalues..<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: ------------------------------------------------------------------------<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: or see<span class="apple-converted-space"> </span><a href="https://urldefense.com/v3/__https:/petsc.org/release/faq/*valgrind__;Iw!!A4F2R9G_pg!fam7m9EAcUH3ksmrAcDKqw2b56d-5BMr-p7YSieNL7fFnEN9xuYzPbkyxhVcvvp16WSAXnrY-j895HpbMw$">https://petsc.org/release/faq/#valgrind</a><span class="apple-converted-space"> </span>and<span class="apple-converted-space"> </span><a href="https://urldefense.com/v3/__https:/petsc.org/release/faq/__;!!A4F2R9G_pg!fam7m9EAcUH3ksmrAcDKqw2b56d-5BMr-p7YSieNL7fFnEN9xuYzPbkyxhVcvvp16WSAXnrY-j8Q5wI00Q$">https://petsc.org/release/faq/</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: to get more information on the crash.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[0]PETSC ERROR: Run with -malloc_debug to check if memory corruption is causing the crash.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=59<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">system msg for write_line failure : Bad file descriptor<o:p></o:p></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>