On Wed, Oct 31, 2012 at 4:25 AM, Jeff Squyres <jsquy...@cisco.com> wrote: > On Oct 28, 2012, at 10:28 AM, Dmitri Gribenko wrote: > >> Thank you for the feedback! Hopefully the attached patch fixes both of >> these. >> >> 1. There are two helper structs with complex numbers. I predicated >> the struct declarations and use to appear only in C99. >> >> 2. These macros were indeed missing. > > I did a few tests and this now looks good; no more warnings. > > I brought up this functionality on the weekly OMPI dev telecon today and got > an important piece of feedback: apparently there are a large class of apps > that wrap their messages as transparent blobs, and then use either > non-blob-like or derived MPI datatypes. (I said something similar to this > earlier in the thread, but I didn't know that there was a large class of apps > that actually did it) > > A very simple example is: > > char *foo = malloc(...); > // ...fill foo... > MPI_Send(foo, x, MPI_INT, ...); > > Another not-uncommon example is: > > char *foo = malloc(...); > // Receive some INTEGERs from a Fortran sender > MPI_Recv(foo, x, MPI_INTEGER, ...); > > With this patch, they'd get warnings about these uses, even though they are > completely valid according to MPI. > > A suggestion was that this functionality could be disabled by default, and > enabled with a magic macro. Perhaps something like: > > mpicc -DOMPI_DDT_CHECKING ... > > or something like that. > > Thoughts?
This is a vaild concern and a good idea for a FAQ entry. Q: How to silence warnings about buffer type/type tag mismatch? A: There are multiple ways for an MPI application to silence these warnings. To silence a particular warning, change the type of the buffer to 'void *' or explicitly cast it to 'void *': void *foo = malloc(...); // ...fill foo... MPI_Send(foo, x, MPI_INT, ...); or: char *foo = malloc(...); // ...fill foo... MPI_Send((void *) foo, x, MPI_INT, ...); To turn off all warnings of this kind in clang, use the -Wno-type-safety command line option. It is also possible to completely remove annotations from mpi.h by defining a macro OMPI_NO_ATTR_TYPE_TAGS in the source code or on the compiler's command line. Dmitri -- main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if (j){printf("%d\n",i);}}} /*Dmitri Gribenko <griboz...@gmail.com>*/