[petsc-users] Problem with MPI_Allreduce

Balay, Satish balay at mcs.anl.gov
Tue Sep 18 09:49:21 CDT 2018


This warning will go away if you change the code to:

ierr = MPI_Allreduce(&lamx, &lambdax, 1, MPI_DOUBLE, MPI_MAX, PETSC_COMM_WORLD);CHKERRQ(ierr);

And its best to run code in gdb or valgrind to track down the crash.

Satish

On Tue, 18 Sep 2018, Jed Brown wrote:

> Which compiler version are you using?  This warning is harmless, but we
> should still clean up these macros to avoid the warning.
> 
> Praveen C <cpraveen at gmail.com> writes:
> 
> > Dear all
> >
> > I use MPI_Allreduce in my petsc code and when compiling I see this type of messages
> >
> > /home/soft/include/petsclog.h:376:57: warning: value computed is not used [-Wunused-value]
> >    ((petsc_allreduce_ct += PetscMPIParallelComm(comm),0) || MPI_Allreduce(sendbuf,recvbuf,count,datatype,op,comm))
> >                                                          ^
> > fdweno.c:564:4: note: in expansion of macro ‘MPI_Allreduce’
> >     MPI_Allreduce(&lamx, &lambdax, 1, MPI_DOUBLE, MPI_MAX, PETSC_COMM_WORLD);
> >     ^~~~~~~~~~~~~
> >
> > This is with petsc-3.8.3 on Linux. 
> >
> > My code crashes due to this error I think, 
> 
> This is certainly not why the code crashes.
> 
> > while I dont get this problem on my macbook which uses petsc-3.9.0
> >
> > Since the error is pointing to petsclog.h I thought I will ask here.
> >
> > Thanks
> > praveen
> 


More information about the petsc-users mailing list