[petsc-users] Trying to develop my own Krylov solver

Matthew Knepley knepley at gmail.com
Tue Jun 25 12:11:43 CDT 2024


On Tue, Jun 25, 2024 at 12:05 PM Julien BRUCHON via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Hi, Based on 'cg. c', I'm trying to develop my own Krylov solver (a
> projected conjugate gradient). I want to integrate this into my C++ code,
> where I already have an interface for PETSC which works well. However, I
> have the following questions
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
>
> ZjQcmQRYFpfptBannerEnd
> Hi,
>
> Based on 'cg.c', I'm trying to develop my own Krylov solver (a projected
> conjugate gradient). I want to integrate this into my C++ code, where I
> already have an interface for PETSC which works well. However, I have the
> following questions :
>
> - Where am I sensed to put my 'cg_projected.c' and 'pcgimpl.h' files?
> Should they go in a directory petsc/src/ksp/ksp/impls/pcg/? If so, how do I
> compile that? Is it simply by adding this directory to the Makefile in
> petsc/src/ksp/ksp/impls/?
>

Yes.

  Thanks,

    Matt


> - I have also tried the basic approach of putting these two files in
> directories of my own C++ code  and compiling. However, I have this error
> at the link edition:
> [100%] Linking CXX shared library libcoeur.so
> /usr/bin/ld: src/solvers/libsolvers.a(cg_projected.c.o): warning:
> relocation against `petscstack' in read-only section `.text'
> /usr/bin/ld: src/solvers/libsolvers.a(cg_projected.c.o): relocation
> R_X86_64_PC32 against symbol `petscstack' can not be used when making a
> shared object; recompilé avec -fPIC
> /usr/bin/ld : échec de l'édition de liens finale : bad value
> collect2: error: ld returned 1 exit status
> make[2]: *** [CMakeFiles/coeur.dir/build.make:121 : libcoeur.so] Erreur 1
> make[1]: *** [CMakeFiles/Makefile2:286 : CMakeFiles/coeur.dir/all] Erreur 2
> make: *** [Makefile:91 : all] Erreur 2
>
> Could you please tell me what is the right way to proceed?
>
> Thank you,
>
> Julien
> --
> Julien Bruchon
> Professeur IMT - Responsable du département MPE
> LGF - UMR CNRS 5307 - https://urldefense.us/v3/__https://www.mines-stetienne.fr/lgf/__;!!G_uCfscf7eWS!ZSMOgmxB-aRx34PmTC3s7ZkDC-zT09xxpmLjhj_vx8oVkTvDSORUOeoTe8ZdEFCHVCUxSrs3eOz34zZTK5ep$ 
> <https://urldefense.us/v3/__https://www.mines-stetienne.fr/lgf/__;!!G_uCfscf7eWS!dQgv-IRWC7OgdDf1X9Oew4nHSgleq2ty0AszuRPj70bBiFeCcT4RibQVAvv6FFeD081W1yY8IczRHAHopA0crg$>
> Mines Saint-Étienne, une école de l'Institut Mines-Télécom
> Librairie Éléments Finis Coeur
> <https://urldefense.us/v3/__https://gitlab.emse.fr/bruchon/Coeur/-/wikis/home__;!!G_uCfscf7eWS!dQgv-IRWC7OgdDf1X9Oew4nHSgleq2ty0AszuRPj70bBiFeCcT4RibQVAvv6FFeD081W1yY8IczRHAG6pz3FrQ$>
> 0477420072
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ZSMOgmxB-aRx34PmTC3s7ZkDC-zT09xxpmLjhj_vx8oVkTvDSORUOeoTe8ZdEFCHVCUxSrs3eOz341kHHQmb$  <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ZSMOgmxB-aRx34PmTC3s7ZkDC-zT09xxpmLjhj_vx8oVkTvDSORUOeoTe8ZdEFCHVCUxSrs3eOz346S6E1L_$ >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240625/41a2a9fe/attachment.html>


More information about the petsc-users mailing list