[petsc-users] warning query

Matthew Knepley knepley at gmail.com
Sun Feb 8 11:51:22 CST 2015


On Sun, Feb 8, 2015 at 11:43 AM, Gideon Simpson <gideon.simpson at gmail.com>
wrote:

> What should I make of the following warning, where I have used an
> MPI_Allreduce on a quantity computed on each processor.
>
> include -I/opt/local/include -I/opt/local/include/mpich-gcc48
> -I/opt/local/include   `pwd`/petsc_trapz1.c
> In file included from /opt/local/lib/petsc/include/petscsys.h:1794:0,
>                  from /opt/local/lib/petsc/include/petscis.h:7,
>                  from /opt/local/lib/petsc/include/petscvec.h:9,
>                  from /Users/gideon/code/trapz/petsc_trapz1.c:3:
> /Users/gideon/code/trapz/petsc_trapz1.c: In function 'main':
> /opt/local/lib/petsc/include/petsclog.h:370:57: warning: value computed is
> not used [-Wunused-value]
>    ((petsc_allreduce_ct += PetscMPIParallelComm(comm),0) ||
> MPI_Allreduce(sendbuf,recvbuf,count,datatype,op,comm))
>                                                          ^
> /Users/gideon/code/trapz/petsc_trapz1.c:110:3: note: in expansion of macro
> 'MPI_Allreduce'
>    MPI_Allreduce(&local_trapz, &global_trapz, 1, MPI_DOUBLE, MPI_SUM,
> PETSC_COMM_WORLD);
>

It looks like you are not checking the return code:

ierr = MPI_Allreduce(&local_trapz, &global_trapz, 1, MPI_DOUBLE, MPI_SUM,
PETSC_COMM_WORLD);CHKERRQ(ierr);

   Matt


>
> -gideon
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150208/4fc0e8cc/attachment.html>


More information about the petsc-users mailing list