<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>I've fixed the wiki to better represent current thinking and cleaned up and added example code.   I think we are pretty close to having most of the issues resolved.  We still must come to terms with what to do with integer kinds.  In the wiki, I've listed four possibilities; three of them have come up in recent discussions.  I've listed them below, also see <a href="https://svn.mpi-forum.org/trac/mpi-forum-web/wiki/FtnWikiPage">https://svn.mpi-forum.org/trac/mpi-forum-web/wiki/FtnWikiPage</a></div><div><br></div><div>Please vote for one of the options.  My personal view is that we need to open up the question to the entire MPI Forum to get reaction from a larger community (not just Fortran geeks).  I'll do this at the next meeting in Portland.</div><div><br></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, 'Bitstream Vera Sans', Helvetica, sans-serif; font-size: 13px; "><ol><li>Use the default integer kind. This has the least impact on existing codes. This causes problems when the size of default integers are promoted for user code and not also in the MPI library.</li><li>Specify a named kind, e.g., MPI_INT_KIND. This provides the most specificity and the user will have a known way to code that will work under all circumstances. But this will cause problems for existing codes when compiler options are used that change the size of default integers.</li><li>Require the vendor to provide two interfaces, one for standard integers and one for long integers. This option works when integers are promoted and doesn't break existing codes.</li><li>Specify a named kind in the Fortran interface (MPI_INT_KIND) but allow the vendor a choice as to how to address integer promotion (it would become a quality of implementation issue) if users use default integers in their codes. The vendor could provide an additional interface for promoted integers (not part of the MPI standard) or could provide a separate library to link against.</li></ol><div>-----------</div><div><br></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">I vote for number 4.  I believe that a standard should provide specificity to the programmer.  If the programmer uses MPI_INT_KIND, his/her program will always work even if integers are promoted or C_INT doesn't match up with default integers.  Since users will have to change existing codes anyway (to use the new derived types, e.g., MPI_Comm) users can make the transition to specific kinds at this time.  However, I also think the standard should also leave room for vendors to provide additional integer kinds via generics or separate compilation libraries.</span></div><div><font class="Apple-style-span" face="Helvetica, Arial, 'Bitstream Vera Sans', Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: medium;"><br></span></font></div><div><font class="Apple-style-span" face="Helvetica, Arial, 'Bitstream Vera Sans', Helvetica, sans-serif"><span class="Apple-style-span" style="font-size: medium;">-craig</span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-style-span" face="Verdana, Arial, 'Bitstream Vera Sans', Helvetica, sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></span></font></div></span></div><div><div>On Sep 2, 2009, at 11:30 AM, Lionel, Steve wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Craig wrote:<br><br><blockquote type="cite">I've been back and forth on this (as well as a few others I think).   <br></blockquote><blockquote type="cite">I'm currently leaning toward using default integers.  Primarily  <br></blockquote><blockquote type="cite">because to do otherwise could potentially break countless lines of  <br></blockquote><blockquote type="cite">users code.  <br></blockquote><br>No, it won't, as long as the choice for the MPI integer kind matches C_INT, which is pretty much universal for default integer in Fortran implementations.  <br><br>Let me try an example.<br><br>module MPI<br>use, intrinsic :: ISO_C_BINDING<br>integer, parameter :: MPI_INT_KIND = C_INT<br><br>interface<br>subroutine MPI_SUB (INTARG)<br>import ! Makes the definition of MPI_INT_KIND visible here<br>integer(MPI_INT_KIND), intent(IN) :: INTARG<br>end subroutine MPI_SUB<br>end module MPI<br><br><br>User code:<br><br>program test1<br>use MPI<br>integer SOMEVAR1<br>call MPI_SUB (SOMEVAR1)<br>end<br><br>This is the "existing code" case.  The compiler will have a kind for "default integer" - the number chosen for this kind value varies by implementation (usually 4 but not always) - let's say it's 4 here.  For this combination of Fortran and a "companion C processor", C_INT is also 4, and thus so is MPI_INT_KIND.  The declaration of SOMEVAR1 does not specify a kind, so it gets "default integer" or 4.  No problem yet.<br><br>Now let's say that this user has decided to compile her Fortran code with an option that changes the default integer kind to 8 (-i8 or similar).  Now if the above code is compiled, there will be an error because the module, assuming it wasn't also compiled -i8, defines the argument as INTEGER(4) but SOMEVAR1 is now INTEGER(8).  The user may have had a reason to use -i8 for other variables and now needs to figure out what to do.  She reads the source of the MPI module, but if it just says INTEGER with no KIND value, she may be at a loss to figure out what to change. <br><br>If it had been written like this:<br><br>program test2<br>use MPI<br>integer(MPI_INT_KIND) SOMEVAR2<br>call MPI_SUB (SOMEVAR2)<br>end<br><br>The call with SOMEVAR2 is ok in either case, because the explicit kind overrides the default integer kind in effect.<br><br>Explicitly specifying the KIND value in the module helps documentation and encourages, but does not require, the programmer to specify the KIND value in their own code.  It does no harm and does not force coding changes that wouldn't be needed otherwise.  Using explicit kinds also helps make the code understandable.<br><br>Regarding functions and subroutines, I think I would need a bit more background on the earlier discussion. I'll be glad to help on this and perhaps a phone call with you and Jeff would be in order when convenient.<br><br><br>Steve Lionel<br>Intel Developer Support<br>Nashua, NH<br><br><br><br><br>_______________________________________________<br>mpi3-fortran mailing list<br><a href="mailto:mpi3-fortran@lists.mpi-forum.org">mpi3-fortran@lists.mpi-forum.org</a><br>http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran<br></div></blockquote></div><br></body></html>