[petsc-users] undefined reference to `petsc_allreduce_ct_th'

Barry Smith bsmith at petsc.dev
Thu Jan 18 11:03:28 CST 2024


   The PETSc petsclog.h  (included by petscsys.h) uses C macro magic to log calls to MPI routines. This is how the symbol is getting into your code. But normally 
if you use PetscInitialize() and link to the PETSc library the symbol would get resolved.

   If that part of the code does not need PETSc at all you can not include petscsys.h and instead include mpi.h otherwise you need to track down why when your code gets linked against PETSc libraries that symbol is not resolved.

  Barry


> On Jan 18, 2024, at 11:55 AM, Aaron Scheinberg <alscheinberg at gmail.com> wrote:
> 
> Hello,
> 
> I'm getting this error when linking:
> 
> undefined reference to `petsc_allreduce_ct_th'
> 
> The instances are regular MPI_Allreduces in my code that are not located in parts of the code related to PETSc, so I'm wondering what is happening to involve PETSc here? Can I configure it to avoid that? I consulted google, the FAQ and skimmed other documentation but didn't see anything. Thanks!
> 
> Aaron

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240118/b34bf378/attachment.html>


More information about the petsc-users mailing list