<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 4, 2017 at 6:52 PM, Klaus Burkart <span dir="ltr"><<a href="mailto:k_burkart@yahoo.com" target="_blank">k_burkart@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:10px"><div id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4123" dir="ltr"><span id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4183">Thank you for the hint, the problem becomes clearer, it's looking for     libpetsc.so.3.7   which is not found  but is located in the same directory as libpetsc.so  but doesn't come with the .so ending<br></span></div><div dir="ltr" id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4459"><span id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4183"><br></span></div><div dir="ltr"><span id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4183">ldd</span></div><div dir="ltr"><span id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4183"><br></span></div><div dir="ltr" id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4480"><span id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4183">    libpetsc.so.3.7 => not found<br></span></div></div></div></blockquote><div><br></div><div>The build system you have is adding a spurious suffix to the library. You can either fix it, or make a link</div><div>to that name in the lib directory.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:10px"><div dir="ltr" id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4480"><span id="m_7363029754146128454yui_3_16_0_ym19_1_1507155984550_4183"></span></div><div class="m_7363029754146128454yahoo_quoted" style="display:block"> <div style="font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:10px"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"> <div dir="ltr"><font size="2" face="Arial"> Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> schrieb am 22:51 Mittwoch, 4.Oktober 2017:<br></font></div>  <br><br> <div class="m_7363029754146128454y_msg_container"><div dir="ltr">Klaus Burkart <<a shape="rect" href="mailto:k_burkart@yahoo.com" target="_blank">k_burkart@yahoo.com</a>> writes:<br clear="none"><br clear="none">> Adding the path to LD_LIBRARY_PATH doesn't help, the problems remain the same, it has no effect<br clear="none"><br clear="none">You're having a problem linking correctly from the plugin, and maybe<br clear="none">some error messages are being swallowed, but this is not a PETSc issue.<br clear="none">You can use ldd to check whether the plugin was linked correctly (it<br clear="none">should find libpetsc.so).<div class="m_7363029754146128454yqt8338401870" id="m_7363029754146128454yqtfd34108"><br clear="none"><br clear="none">><br clear="none">>     Jed Brown <<a shape="rect" href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> schrieb am 21:39 Mittwoch, 4.Oktober 2017:<br clear="none">>  <br clear="none">><br clear="none">>  Klaus Burkart <<a shape="rect" href="mailto:k_burkart@yahoo.com" target="_blank">k_burkart@yahoo.com</a>> writes:<br clear="none">><br clear="none">>> When I link the petsc library, the application side code is not properly compiled and the solver is not available for selection<br clear="none">>><br clear="none">>> --> FOAM FATAL IO ERROR:<br clear="none">>> Unknown asymmetric matrix solver petGMRES<br clear="none">><br clear="none">> There must be some earlier error message.<br clear="none">><br clear="none">>> Valid asymmetric matrix solvers are :<br clear="none">>><br clear="none">>> 4<br clear="none">>> (<br clear="none">>> GAMG<br clear="none">>> PBiCG<br clear="none">>> PBiCGStab<br clear="none">>> smoothSolver<br clear="none">>> )<br clear="none">>> I added the following to my makefile to link the petsc library<br clear="none">>><br clear="none">>>     -L$(PETSC_DIR)/arch-linux2-c-<wbr>debug/lib    -lpetsc<br clear="none">><br clear="none">> In this case, you'd need to add that path to LD_LIBRARY_PATH so the<br clear="none">> loader can find it.  None of these are PETSc issues, just linking<br clear="none">> dynamic libraries.<br clear="none">><br clear="none">>>    Jed Brown <<a shape="rect" href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> schrieb am 18:45 Mittwoch, 4.Oktober 2017:<br clear="none">>>  <br clear="none">>><br clear="none">>>  Klaus Burkart <<a shape="rect" href="mailto:k_burkart@yahoo.com" target="_blank">k_burkart@yahoo.com</a>> writes:<br clear="none">>><br clear="none">>>> My setup:<br clear="none">>>><br clear="none">>>> .bashrc<br clear="none">>>> export PETSC_DIR=/home/klaus/<wbr>OpenFOAM/klaus-5.0/petsc-3.7.6<br clear="none">>>> export PETSC_ARCH=arch-linux2-c-debug<br clear="none">>>> export PETSC_CONFIGDIR=${PETSC_DIR}/<wbr>lib/petsc<br clear="none">>>><br clear="none">>>><br clear="none">>>> make options<br clear="none">>>>     -I$(PETSC_CONFIGDIR)/conf \<br clear="none">>><br clear="none">>> The above should not be needed.<br clear="none">>><br clear="none">>>>     -I$(PETSC_DIR)/include \<br clear="none">>>>     -I$(PETSC_DIR)/arch-linux2-c-<wbr>debug/include<br clear="none">>>><br clear="none">>>> Installation and tests worked fine.<br clear="none">>>><br clear="none">>>> The output using:     PetscInitialize(0,0,NULL,NULL)<wbr>; at the beginning and PetscFinalize(); at the end of the code section including PETSc (solver section) is:<br clear="none">>>><br clear="none">>>> simpleFoam: symbol lookup error: /home/klaus/OpenFOAM/klaus-5.<wbr>0/platforms/<wbr>linux64GccDPInt32Opt/lib/<wbr>libpetFoam.so: undefined symbol: PetscInitialize<br clear="none">>><br clear="none">>> How have you linked libpetFoam.so to libpetsc.so and did you use RPATH?<br clear="none">>> That seems to be the problem.<br clear="none">>><br clear="none">>>> No simulation is triggered<br clear="none">>>><br clear="none">>>><br clear="none">>>> When I just declare Mat M; and call a function with M as a parameter which outputs "Petsc - Hello" and sets the matrix M to symmetric (using: MatSetOption(A, MAT_SYMMETRIC, PETSC_TRUE);), the execution of a simulation is triggered but MatSetOption is causing a problem, I assume because PetscInitialize is missing<br clear="none">>>><br clear="none">>>> Petsc - Hello nonepetGMRES:  Solving for Ux, Initial residual = 1, Final residual = 1, No Iterations 0<br clear="none">>>> Petsc - Hello nonepetGMRES:  Solving for Uz, Initial residual = 1, Final residual = 1, No Iterations 0<br clear="none">>>> simpleFoam: symbol lookup error: /home/klaus/OpenFOAM/klaus-5.<wbr>0/platforms/<wbr>linux64GccDPInt32Opt/lib/<wbr>libpetFoam.so: undefined symbol: MatSetOption<br clear="none">>>><br clear="none">>>> Maybe important to know, there's no way to enter commmand line input in the terminal while a simulation is running because the application displays continuously the intermediate simulation results. That's why I use PetscInitialize(0,0,NULL,NULL)<wbr>; There's now way to provide command line input.<br clear="none">>><br clear="none">>> That's fine.  You can use the PETSC_OPTIONS environment variable or a<br clear="none">>> configuration file to get run-time options to PETSc.<br clear="none">>><br clear="none">>>> I came back to this simple test after writing "the complete code" which showed these problems and stripped it down, step-by-step, to figure out what causes the problem i.e. everything but a declaration. <br clear="none">>>><br clear="none">>>>  <br clear="none">>>><br clear="none">>>>    Jed Brown <<a shape="rect" href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> schrieb am 17:17 Mittwoch, 4.Oktober 2017:<br clear="none">>>>  <br clear="none">>>><br clear="none">>>>  Klaus Burkart <<a shape="rect" href="mailto:k_burkart@yahoo.com" target="_blank">k_burkart@yahoo.com</a>> writes:<br clear="none">>>><br clear="none">>>>> What's the concept to interface with PETSc from another application to solve a linear system with PETSc?<br clear="none">>>>><br clear="none">>>>> The standard procedure of the job:<br clear="none">>>>><br clear="none">>>>> 1: The application provides a matrix which needs to be converted and be loaded into PETSc<br clear="none">>>>><br clear="none">>>>> 2: The application provides the rhs vector (containing pointers!) which needs to be loaded into PETSc <br clear="none">>>>><br clear="none">>>>> 3: The linear system is to be solved using PETSc<br clear="none">>>>><br clear="none">>>>> 4: The application provides the result vector x, the PETSc result needs to be copied back to the application into vector x (also expecting pointers)<br clear="none">>>>><br clear="none">>>>><br clear="none">>>>> The problem - maybe a completely wrong approach when it comes to using PETSc: <br clear="none">>>>><br clear="none">>>>> With other linear algebra libraries, I included the library functionality in the code of a new solver accessing the functionality usually via header files and created a plugin which can be called from the application when running a simulation. <br clear="none">>>>><br clear="none">>>>> Even so the mixed code including PETSc code can be compiled, the bit of the plugin, interfacing with the application is broken as soon as I include more than a PETSc declaration in the mixed code.<br clear="none">>>><br clear="none">>>> Sounds like maybe you haven't correctly linked to the PETSc library.<br clear="none">>>> Sending us the commands run and output/errors would be helpful to debug.<br clear="none">>>><br clear="none">>>>> How to interface with PETSc from a software application?  (I am using c++ and Ubuntu)<br clear="none">>>>><br clear="none">>>>> Klaus<br clear="none">>>><br clear="none">>>>    <br clear="none">>><br clear="none">>>    <br clear="none">><br clear="none">>    </div></div><br><br></div>  </div> </div>  </div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><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.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>