[petsc-users] undefined reference to `petsc_allreduce_ct_th'

Satish Balay balay at mcs.anl.gov
Thu Jan 18 11:02:05 CST 2024


On Thu, 18 Jan 2024, Aaron Scheinberg 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? 

This symbol should be in libpetsc.so. Are you including petsc.h - but not linking in -lpetsc - from your code?

balay at pj01:~/petsc/arch-linux-c-debug/lib$ nm -Ao libpetsc.so |grep petsc_allreduce_ct_th
libpetsc.so:0000000004279a50 B petsc_allreduce_ct_th

> Can I configure it to avoid that? I consulted google,
> the FAQ and skimmed other documentation but didn't see anything. Thanks!

If you wish to avoid petsc logging of MPI messages (but include petsc.h in your code?) - you can use in your code:

>>>>
#define PETSC_HAVE_BROKEN_RECURSIVE_MACRO
#include <petsc.h>
<<<<

Or build it with -DPETSC_HAVE_BROKEN_RECURSIVE_MACRO compiler option

Satish


More information about the petsc-users mailing list