[petsc-dev] Hijacked MPI calls...

Eric Chamberland Eric.Chamberland at giref.ulaval.ca
Mon Sep 12 15:56:41 CDT 2016


Hi,

I just discovered that all my calls to MPI are replaced by PETSc #define 
macros...

I don't really care, but I now have this warning with clang 3.9.0:

 
/pmi/cmpbib/compilation_BIB_gcc_redhat_squash/COMPILE_AUTO/GIREF/src/commun/Parallele/PABroadcast.icc:324:41: 
warning: possible misuse of comma operator here [-Wcomma]
        int lErreurMPI = ((petsc_wait_ct++,petsc_sum_of_waits_ct++,0) || 
MPI_Wait(&(aIdComm[0]),&lStatus));
                                         ^
 
/pmi/cmpbib/compilation_BIB_gcc_redhat_squash/COMPILE_AUTO/GIREF/src/commun/Parallele/PABroadcast.icc:324:26: 
note: cast expression to void to silence warning
        int lErreurMPI = ((petsc_wait_ct++,petsc_sum_of_waits_ct++,0) || 
MPI_Wait(&(aIdComm[0]),&lStatus));
                          ^~~~~~~~~~~~~~~
                          static_cast<void>( )

I have many files to modify in my code if I want to silence this warning 
(with pragmas)...

But before doing so, I have 2 questions:

- Would you consider doing static_cast<void>( ) as suggested by clang to 
silence the warnings?
- Does PETSc lib really wants to count *my* calls to MPI functions?

I don't have a strong opinion if PETSc should #define or not all MPI 
calls, but about -Wcomma warnings, I do: I want this warning to be 
signaled into my code because all the ones I have found where unwanted 
uses of coma operator... and I want to keep the code clean into the 
future...

The "offending" macros are all in petsclog.h which is included by 
petscsys.h.

thanks,

Eric



More information about the petsc-dev mailing list