<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18783"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=210452422-24072009><FONT color=#0000ff
size=2 face=Arial>This attribute stuff in MPI is too complicated. One should
check that any change does not violate any of the cases outlined in the
clarifying examples being added to MPI 2.2. See ticket 55:
</FONT></SPAN><SPAN class=210452422-24072009><FONT color=#0000ff size=2
face=Arial><A
href="https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/55">https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/55</A></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=210452422-24072009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=210452422-24072009><FONT color=#0000ff
size=2 face=Arial>Rajeev</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=210452422-24072009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> mpich2-dev-bounces@mcs.anl.gov
[mailto:mpich2-dev-bounces@mcs.anl.gov] <B>On Behalf Of </B>Joe
Ratterman<BR><B>Sent:</B> Tuesday, July 21, 2009 9:59 AM<BR><B>To:</B>
mpich2-dev@mcs.anl.gov<BR><B>Subject:</B> Re: [mpich2-dev] fandcattrf90 test
on BGP<BR></FONT><BR></DIV>
<DIV></DIV>I think I agree that the the third would be a Fint, but I don't
understand this stuff either. There are three types of attributes.
<DIV>
<DIV>MPIR_ATTR_AINT</DIV>
<DIV>MPIR_ATTR_PTR</DIV>
<DIV>
<DIV>MPIR_ATTR_INT</DIV>
<DIV>An attribute created in C is a PTR, in Fortran it is an AINT, and the
depricated put/get interface in Fortran sets the type to INT. I thought
it was in put/get for C, but I don't see it now.</DIV></DIV>
<DIV><BR></DIV>
<DIV><A
href="https://svn.mcs.anl.gov/repos/mpi/mpich2/trunk/src/mpi/attr/comm_get_attr.c">https://svn.mcs.anl.gov/repos/mpi/mpich2/trunk/src/mpi/attr/comm_get_attr.c</A></DIV>
<DIV>MPI_Comm_get_attr has a small pile of code to select the correct version
and handle it correctly:</DIV>
<DIV><BR></DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>
if (p->keyval->handle == comm_keyval) {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>*flag
= 1;</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>if
(outAttrType == MPIR_ATTR_PTR) {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>
if (p->attrType == MPIR_ATTR_INT) {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>/* This is the
tricky case: if the system is</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>bigendian, and
we have to return a pointer to</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>an int, then
we may need to point to the </DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>correct
location in the word. */</DIV>
<DIV>#if defined(WORDS_LITTLEENDIAN) || (SIZEOF_VOID_P == SIZEOF_INT)</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>*(void**)attribute_val = &(p->value);</DIV>
<DIV>#else</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>int *p_loc =
(int *)&(p->value);</DIV>
<DIV>#if SIZEOF_VOID_P == 2 * SIZEOF_INT</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>p_loc++;</DIV>
<DIV>#else </DIV>
<DIV>#error Expected sizeof(void*) to be either sizeof(int) or
2*sizeof(int)</DIV>
<DIV>#endif</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>*(void
**)attribute_val = p_loc;</DIV>
<DIV>#endif</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>
}</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>
else if (p->attrType == MPIR_ATTR_AINT) {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>*(void**)attribute_val = &(p->value);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>
}</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>
else {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>*(void**)attribute_val = (p->value);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>
}</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>}</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>else</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>
*(void**)attribute_val = (p->value);</DIV>
<DIV><BR></DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>break;</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>
}</DIV>
<DIV><BR></DIV></DIV>
<DIV>The part that handles a larger void* than int, and especially the
endian-ness part, would be easier with a union. Since the Aint and the
void* are different on our system, it would help that too.</DIV>
<DIV><BR></DIV>
<DIV class=gmail_quote><BR>Joe Ratterman<BR><A
href="mailto:jratt@us.ibm.com">jratt@us.ibm.com</A></DIV>
<DIV class=gmail_quote><BR></DIV>
<DIV class=gmail_quote><BR>On Mon, Jul 20, 2009 at 5:37 PM, Dave Goodell <SPAN
dir=ltr><<A href="mailto:goodell@mcs.anl.gov"
target=_blank>goodell@mcs.anl.gov</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
<DIV>On Jul 16, 2009, at 4:55 PM, Joe Ratterman wrote:<BR><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>(This is a re-send; I got a pile of python errors on the
last try)<BR></BLOCKQUOTE><BR></DIV>Sorry about that. The IT
department here upgraded both Trac and SVN last week and it didn't go as
smoothly as it could have. Those problems should all be resolved at
this point.
<DIV><BR><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><A
href="https://svn.mcs.anl.gov/repos/mpi/mpich2/trunk/test/mpi/f90/attr/fandcattrf90.f90"
target=_blank>https://svn.mcs.anl.gov/repos/mpi/mpich2/trunk/test/mpi/f90/attr/fandcattrf90.f90</A><BR><A
href="https://svn.mcs.anl.gov/repos/mpi/mpich2/trunk/test/mpi/f90/attr/fandcattrc.c"
target=_blank>https://svn.mcs.anl.gov/repos/mpi/mpich2/trunk/test/mpi/f90/attr/fandcattrc.c</A><BR><BR>This
test creates an attribute in F90, sets it in F90, and then reads it back
in C. It was getting the wrong answer:<BR>Expected:
5555 (0x15b3)<BR>Actual: 23858543329280
(0x15b300000000)<BR></BLOCKQUOTE></DIV>...
<DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>One idea that strikes me as really good is to change the
"value" field in the MPID_Attribute structure to be a union of int, void*,
and MPI_Aint types with three different names. That would get rid of
the interesting work that is required to handle 8-byte void* and 4-byte
ints. It would also make it easier to add MPI_Aint changes.
You wouldn't have to worry about the strangeness of storing an
integer type in a pointer type, and it would automatically handle any
differences in the sizes of the elements. You already track the data
type, so you would know into which element the attribute should be
stored.<BR><BR>Comments or questions?<BR></BLOCKQUOTE><BR></DIV>Sorry for
the delayed response, I was hoping that someone else who knows and likes
attributes better than I do would jump in here. Unfortunately, that
doesn't seem to be happening, so I'll take a stab at this.<BR><BR>Do you
really mean that the value union should be
this?<BR>--------8<---------<BR>union {<BR> MPI_Fint f_int; /*
instead of int */<BR> void *void_p;<BR> MPI_Aint
a_int;<BR>} value;<BR>--------8<---------<BR><BR>This seems
reasonable to me on its face, but I would feel better if someone who was
more active in MPI Forum ticket #55 [1] thought so too (Rajeev?). This
is a really complicated section of the standard that always confuses me on
at least one or two issues every time I look at it.<BR><BR>-Dave<BR><BR>[1]
<A href="https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/55"
target=_blank>https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/55</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE></BODY></HTML>