Date: Fri, 26 Mar 1999 09:31:15 -0500 (EST) From: Nicholas Nevin - Sun HPC High Performance Computing Reply-To: Nicholas Nevin - Sun HPC High Performance Computing Subject: Re: clarification on inter-language interoperability of attributes To: gropp@XXXXXXXXXXX Cc: mpi-core@XXXXXXXXXXX MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Content-MD5: SnVfQtdUlxzACsd6XLHBTg== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc X-UIDL: 13b6da43a7a30fbc2941e59029b26225 > X-Sender: gropp@localhost > Date: Fri, 26 Mar 1999 07:47:53 -0600 > To: Nicholas Nevin - Sun HPC High Performance Computing > From: William Gropp > Subject: Re: clarification on inter-language interoperability of attributes > Cc: mpi-core@XXXXXXXXXXX > > At 04:37 PM 3/25/99 -0500, Nicholas Nevin - Sun HPC High Performance > Computing wrote: > > > >Hi, All. I need some clarification on the behaviour of MPI_Comm_get_attr > >in the case of an architecture with 32 bit ints and 64 bit pointers. > > > >Section 4.12.7 of the MPI-2 standard states that MPI will store > >internally *address* sized attributes. It also states that an integer > >valued attribute when accessed from C via MPI_Comm_get_attr will return > >the address of a pointer to the integer valued attribute. > > > >This seems to imply that MPI_Comm_get_attr will return a pointer to > >a 64 bit quantity. This hoWhen an integer valued attribute is accessed from C or C++, then MPI_xxx_get_attr will return the address of (a pointer to) the integer valued attribute.wever will break codes which do this. > > No, it means that the attribute is stored as the address itself. The thing This might work for predefined attributes where the address can point to the integer value in static storage, but won't work for attributes set by the user in Fortran code. If you store a pointer to the integer as the attribute it may point to a temporary which might no longer exist when you try and access it later. > that the attribute points to may be an int, a long long, or a structure. > That's why an MPI_TAG_UB is returned as the address of an int. We've been > doing this for a long time with MPICH on many architectures with 32 bit C > ints and 64 bit pointers (it is one of the reasons why Get_attr returns a > pointer to the integer containing the tag UB, rather than the value of the > UB itself). > Unfortunately I left out some parentheses in my paraphrase of the standard, it actually reads "When an integer valued attribute is accessed from C or C++, then MPI_xxx_get_attr will return the address of (a pointer to) the integer valued attribute." This is what I had meant to say. So my question still stands. Assuming Fortran INTEGER is 32 bits and MPI_ADDRESS_KIND is 8, do I get back from MPI_xxx_get_attr a pointer to a 32 bit integer or a 64 bit integer? I see three cases and the answer may not be the same for all of them. 1. predefined attributes. The answer may vary according to the attribute (window size is of type MPI_ADDRESS_KIND in Fortran). 2. attributes set in Fortran with MPI_ATTR_PUT 3. attributes set in Fortran with MPI_COMM_SET_ATTR Of course it would be nice if the answer was the same for all the above cases which would require that a pointer to a 64 bit integer be returned in order to avoid possible data truncation. -nick.