Re: [petsc-users] undefined reference to `petsc_allreduce_ct_th'
Thanks, it turns out there was another installation of PETSc, and it was linking with the wrong one. It builds now. On Thu, Jan 18, 2024 at 12:03 PM Barry Smith wrote: > >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 > 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 > > >
Re: [petsc-users] undefined reference to `petsc_allreduce_ct_th'
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 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
Re: [petsc-users] undefined reference to `petsc_allreduce_ct_th'
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@pj01:~/petsc/arch-linux-c-debug/lib$ nm -Ao libpetsc.so |grep petsc_allreduce_ct_th libpetsc.so:04279a50 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 Or build it with -DPETSC_HAVE_BROKEN_RECURSIVE_MACRO compiler option Satish
[petsc-users] undefined reference to `petsc_allreduce_ct_th'
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