[MPI3 Fortran] Straw vote on integers kinds

Craig Rasmussen crasmussen at newmexicoconsortium.org
Tue Sep 15 10:40:08 CDT 2009


On Sep 14, 2009, at 1:25 PM, N.M. Maclaren wrote:

> On Sep 14 2009, Bill Long wrote:
>> Craig Rasmussen wrote:
>>> Please vote for one of the options.  ...
>>
>> I'm not convinced there is much real difference among these options.

In practice there is not a lot of difference.  However, in some cases,  
perhaps unusual, there are significant differences.  For example, If  
MPI_INT_KIND is specified in the interface, and the vendor choses it  
to be equivalent to C_INT and C_INT is not KIND(0), then there will be  
a big difference.  MPI_INT_KIND is meant to be opaque, the value of  
which is vendor specified.

>
> I agree, though for slightly different reasons.
>
> I think that all four are a mistake, because they are conflating all  
> MPI
> integers into one.  I would use two names, one for integers that may  
> scale
> with memory size and one where that would be overkill.

As Jeff had replied, there will be at least two integers.  One for  
integers that scale with memory size and others (like MPI tags) that  
don't.

>
> But that being said:
>
>>>   1. Use the default integer kind. ...
>>
>> This is what we have today. ...
>
> Yes.  In the absence of positive reasons to change, I vote for  
> this.  But
> see below.
>
>>>   2. Specify a named kind, e.g., MPI_INT_KIND. ...
>>
>> Option 1 is recovered with the definition MPI_INT_KIND = KIND(0).
>
> I would vote for this, too.  I.e. specify a KIND, but specify it to be
> KIND(0).  Programmers who care about serious portability over time and
> space would use the name.

The MPI spec shouldn't specify the value, if the value is specified to  
be KIND(0), then there is no difference between options 1 and 2.  The  
problem I see with option 1 is that it provides no help for -i4/-i8  
options.  At least option 2 would do this.

>
> Fortran KINDs don't necessarily help with checking, as there is no way
> to diagnose passing a default integer if MPI_INT_KIND happens to be  
> KIND(0).

In this case the compiler checks, finds that the kinds are the same  
and moves on.  But unless a programmer plays around with -i8 options,  
the compiler can't inform the user when MPI_INT_KIND is not used so  
users may be surprised at some point in time.

>
>>>   4. Specify a named kind in the Fortran interface (MPI_INT_KIND)  
>>> but
>>>      allow the vendor a choice as to how to address integer  
>>> promotion
>>>      if users use default integers in their codes. ...
>>
>> Again, I'm not really seeing the practical difference here.
>
> Why should it be promotion, anyway?  What if the default integer  
> KIND is
> 64-bit and MPI_INT_KIND is 32-bit?

Right, doesn't necessarily have to be promotion.  This could happen if  
MPI_INT_KIND=C_INT and KIND(0) is 64 bit.  Option 4 means that the  
vendor has the freedom (by the standard) to provide a generic  
interface that would also accept 64-bit integers.

>
>> I see that the wiki page proposes MPI_DOUBLE_KIND.  Is this  
>> intended to be the same as C_DOUBLE?  Why is there no corresponding  
>> MPI_FLOAT_KIND? Both might be affected (in much the same way) by a  
>> switch like -r8.
>
> Yes, indeed.  And neither might match C double.

No intent really.  It is just that the interface is not complete yet.   
I'm not sure there is a need for real kinds so perhaps MPI_DOUBLE_KIND  
should be removed.  Jeff, any place for reals except in MPI users  
defined types?

>
>> Of course, the ideal situation would be to outlaw completely the  
>> use of the -i8 and -r8  (and even worse, one and not the other)  
>> options. Perhaps this could be an MPI requirement - no program that  
>> uses MPI is allowed to use these switches.  That would be an  
>> enormous step in the right direction.

I agree with you completely, WG5 should outlaw -i8 and -r8 :-).  I'm  
only partly being facetious.  MPI really has no business saying how a  
Fortran programmer should use the language except through the  
interface, which is why I think using MPI_INT_KIND is the correct  
choice.

So to put Bill's suggestion another way, the MPI-3 standard should  
state:

"Users of the MPI-3 Fortran interface shall NOT make use of the -i8 or  
-r8 compiler options unless MPI_INT_KIND (or MPI_COUNT_KIND) has been  
specified as the integer kind for actual arguments in calls to MPI  
procedures."

Are we all in agreement then?  Can we all just get along?

-craig





More information about the mpiwg-fortran mailing list