The issue is that they use a void * argument as a void ** (using void * is a C idiom to avoid casting) but since this is a void *, if all you need is an int's worth of data, rather than allocating an int and setting the attribute to a pointer to that int, you might decide just to use the pointer as an int.  That is, if I want to store the integer "3" on the communicator, rather than

p = (int *)malloc(sizeof(int));
*p = 3;
MPI_Comm_set_attr( ..., p );

I might do

MPI_Aint pv=3;
MPI_Comm_set_attr( ..., (void *)pv );

Later, I can do

MPI_Aint v;
MPI_Comm_get_attr( ..., (void *)&v );

But now I have a problem, because MPI_Comm_get_attr only sets a pointer's worth of data, and MPI_Aint is longer than a pointer's worth of data, so I don't get my data (actually, I lost it in the Comm_set_attr step for the same reason).

Yes, this is a little sketchy, but its the sort of thing that you expect to work when you have an integer type for pointers.  Basically, if sizeof(MPI_Aint) != sizeof(void *), some assumptions break, even in user code (it was this assumption that Rajeev mentioned that we overlooked originally).  Exactly this sort of code is in the test suite; see mpich2/test/mpi/attr/attrt.c .  Note that IBM had to change the test suite (in ways that I don't think are correct) to handle this.  In particular, think about what happens on a system with 32 bit ints and 64 bit pointers in mpich2/test/mpi/attr/attrerr.c ...

Bill

On May 5, 2008, at 2:32 PM, Rajeev Thakur wrote:

What exactly is the issue with the attribute routines?



William Gropp
Paul and Cynthia Saylor Professor of Computer Science
University of Illinois Urbana-Champaign