[petsc-dev] Hijacked MPI calls...

Satish Balay balay at mcs.anl.gov
Tue Sep 13 10:45:26 CDT 2016


On Tue, 13 Sep 2016, Barry Smith wrote:

> 
> > On Sep 13, 2016, at 10:13 AM, Satish Balay <balay at mcs.anl.gov> wrote:
> > 
> > There is stuff like:
> > 
> > src/mat/order/fn1wd.c
> > 
> > -    kstop = (i__2 = xadj[node + 1], (PetscInt)PetscAbsInt(i__2)) - 1;
> > +    kstop = (PetscInt)PetscAbsInt(xadj[node + 1]) - 1;
> > 
> > Perhaps PetscAbsInt() type stuff should be switched over to static inline?
> > Or use a different notation?
> > 
> > i__2  = xadj[node + 1];
> > kstop = (PetscInt)PetscAbsInt(i__2) - 1;
> 
>    This is the way any normal person would write it :-)

I think the first one is what is more intutive. The second one is
clearly encoding an optimization - as the code is aware PetscAbsInt()
is a macro - not a proper function. Hence the thought about 'static inline'

The first change compiles fine [with clang - both c, complex - but
don't know if there are problem compilers]

I'm now inclined to just preserve the current usage with void:

    kstop = ((void)(i__2 = xadj[node + 1]), (PetscInt)PetscAbsInt(i__2)) - 1;

> 
> > 
> > And for the following - use 'void' as compiler suggests?
> > 
> > a/src/mat/utils/pheap.c
> > -  while (par = Parent(loc), Value(h,par) > val) {
> > +  while ((void)(par = Parent(loc)), Value(h,par) > val) {
> > 
> > a/src/dm/impls/plex/plexdistribute.c
> > -      for (q = 0; q < numAdj || (adj[numAdj++] = support[s],0); ++q) {
> > +      for (q = 0; q < numAdj || ((void)(adj[numAdj++] = support[s]),0); ++q) {
> 
>    Does the (void) work to eliminate the warning?

yes.

Satish

> 
>   Barry
> 
> > 
> > 
> > And this one is perhaps for Matt..
> > 
> >>>>>>>>>>>>>>>>>>>> 
> >          CC arch-clang-cmplx/obj/src/dm/impls/composite/pack.o
> > /home/balay/petsc/src/dm/impls/composite/pack.c:657:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs]
> >  va_start(Argp,imode);
> >                ^
> > /home/balay/petsc/src/dm/impls/composite/pack.c:641:61: note: parameter of type 'InsertMode' is declared here
> > PetscErrorCode  DMCompositeGather(DM dm,Vec gvec,InsertMode imode,...)
> >                                                            ^
> > 1 warning generated.
> > <<<<<<<<<<<<<<<<<
> > 
> > 
> > 
> > Satish
> > 
> > On Mon, 12 Sep 2016, Barry Smith wrote:
> > 
> >> 
> >>  Satish,
> >> 
> >>   Interesting. We can probably get rid of most of the other warnings easily; it looks like mostly frivolous use of the , notation.
> >> 
> >>   Barry
> >> 
> >>> On Sep 12, 2016, at 11:19 PM, Satish Balay <balay at mcs.anl.gov> wrote:
> >>> 
> >>> The attached patch gets rid of most of the warnings [esp MPI usage
> >>> from PETSc code - with the logging wrappers].
> >>> 
> >>> [also added to balay/clang-Wcomma]
> >>> 
> >>> Satish
> >>> 
> >>> On Mon, 12 Sep 2016, Satish Balay wrote:
> >>> 
> >>>> ok - so you are using CFLAGS=-Wcomma on your build..
> >>>> 
> >>>> I see warnings now. Attaching make.log
> >>>> 
> >>>> Satish
> >>>> 
> >>>> On Mon, 12 Sep 2016, Eric Chamberland wrote:
> >>>> 
> >>>>> 
> >>>>> 
> >>>>> Le 2016-09-12 à 17:32, Satish Balay a écrit :
> >>>>>> Do you get these warnings with PETSc library build aswell?
> >>>>> I can't tell since I didn't tried to build PETSc with clang...
> >>>>>> 
> >>>>>> The logging code tries to log all messages in library and in
> >>>>>> application - and prints a summary with -info.
> >>>>>> 
> >>>>>> You can disable logging in your build with configure option: --with-log=0
> >>>>>> 
> >>>>>> Or you can define the PETSC_HAVE_BROKEN_RECURSIVE_MACRO in your
> >>>>>> code/compile - and the wrappers will be skipped..
> >>>>> ok, so these may be good workaround for me to keep -Wcomma activated on our
> >>>>> "push server" that filters incoming commits...
> >>>>> 
> >>>>> Thanks!!!
> >>>>> 
> >>>>> Eric
> >>>>> 
> >>>>> 
> >>>>> 
> >>>> 
> >>> <clang-Wcomma.patch><make.log>
> >> 
> 
> 


More information about the petsc-dev mailing list