[MPI3 Fortran] [Mpi-comments] MPI 3.0: Fortran 2008 interface - issue with the LOGICAL kind

Bill Long longb at cray.com
Tue Feb 26 18:08:31 CST 2013



On 2/26/13 5:10 PM, Craig Rasmussen wrote:
> For some reason Jeff deleted me from this email list :-)   (or perhaps I
> removed myself one day when the mood moved me)  so I haven't seen this
> thread until today.
>
> Basically I agree with Tobias that there is a problem (from a standards
> perspective) and with Nick that MPI-3 made the right choice with default
> logical (following past standards as to not break existing code).  I
> also agree with Nick that an implementation of the MPI-3 standard can
> finesse the issue a bit.

I would note that this problem only exists for these call-back routines 
where only an interface is specified.  For the routines that are 
actually called and supplied as part of the library, all of these 
'type/kind conversion' issues can be resolved with wrappers that could 
be inlined away.
>
> I don't know what Bill will think of this but I think the problem should
> be resolved in the Fortran standard in the end so that
>
>        LOGICAL(C_INT)

I have a feeling this is not what Nick had in mind.  Visually jarring, 
at a minimum.

There is no standard requirement that this is legal, even though in most 
cases it would as a practical matter.   Most implementations will work 
since C_INT is just a KIND value (often = 4) that is probably legal for 
LOGICAL since vendors tend to use the same KIND values for LOGICAL and 
INTEGER of the same storage size.  If C_INT is not a legal KIND value 
for INTEGER in your implementation, you are going to have more problems 
than just this issue.

For an implementation that has C_INT > 0, I would be interested to know 
if there were ANY for which LOGICAL(C_INT) was not a legal declaration.

Default LOGICAL and default INTEGER normally have the same storage size, 
and since MPI seems to like the idea of default INTEGER being the same 
as C int (even though that is not always true), it would seem to make 
just as much sense to leave it as default LOGICAL.

>
> is a legal type.  This would allow mapping Fortran logical variables to
> C integers which is the type most C programmers use for logical
> variables anyway.

Hence my earlier comment that this might have better been INTEGER in the 
first place.  Too late now.
>
> Does anyone know what size a default logical is in existing compilers?

Usually 32 bits, sometimes 64.

>   I assume it is the same size as a default integer.

That is a requirement for variables in a "storage association context". 
Default integer, logical, and real all occupy a "numeric storage unit". 
  Having the storage size for default integer and logical different 
would be extremely unusual.

Cheers,
Bill


>
> Craig Rasmussen
> CAS Scientific Programmer
> rasmus at cas.uoregon.edu <mailto:rasmus at cas.uoregon.edu>
>
>
>
>
> On Feb 26, 2013, at 2:05 PM, Rolf Rabenseifner wrote:
>
>> Is TS 29113 changing something in this case?
>> I.e., does TS 29113 allow LOGICAL dummy arguments in BIND(C) subroutines?
>>
>> Rolf
>>
>> ----- Original Message -----
>>> From: "Jeff Squyres (jsquyres)" <jsquyres at cisco.com
>>> <mailto:jsquyres at cisco.com>>
>>> To: "<longb at cray.com <mailto:longb at cray.com>>" <longb at cray.com
>>> <mailto:longb at cray.com>>, "MPI-3 Fortran working group"
>>> <mpi3-fortran at lists.mpi-forum.org
>>> <mailto:mpi3-fortran at lists.mpi-forum.org>>
>>> Sent: Tuesday, February 26, 2013 7:04:09 PM
>>> Subject: Re: [MPI3 Fortran] [Mpi-comments] MPI 3.0: Fortran 2008
>>> interface - issue with the LOGICAL kind
>>> On Feb 26, 2013, at 11:27 AM, Bill Long <longb at cray.com
>>> <mailto:longb at cray.com>> wrote:
>>>
>>>> In particular, the C function is not using _Bool. It would seem to
>>>> be more consistent for the Fortran interface to specify the argument
>>>> as
>>>>
>>>> INTEGER :: FLAG
>>>>
>>>> or, better
>>>>
>>>> INTEGER(c_int) :: FLAG.
>>>
>>>
>>> FWIW, the MPI Fortran interfaces have always used LOGICAL for boolean
>>> values, not INTEGER. It would be weird to change them now.
>>>
>>> --
>>> Jeff Squyres
>>> jsquyres at cisco.com <mailto:jsquyres at cisco.com>
>>> For corporate legal information go to:
>>> http://www.cisco.com/web/about/doing_business/legal/cri/
>>>
>>>
>>> _______________________________________________
>>> mpi3-fortran mailing list
>>> mpi3-fortran at lists.mpi-forum.org
>>> <mailto:mpi3-fortran at lists.mpi-forum.org>
>>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran
>>
>> --
>> Dr. Rolf Rabenseifner . . . . . . . . . .. email rabenseifner at hlrs.de
>> <mailto:rabenseifner at hlrs.de>
>> High Performance Computing Center (HLRS) . phone ++49(0)711/685-65530
>> University of Stuttgart . . . . . . . . .. fax ++49(0)711 / 685-65832
>> Head of Dpmt Parallel Computing . . . www.hlrs.de/people/rabenseifner
>> <http://www.hlrs.de/people/rabenseifner>
>> Nobelstr. 19, D-70550 Stuttgart, Germany . . . . (Office: Room 1.307)
>> _______________________________________________
>> mpi3-fortran mailing list
>> mpi3-fortran at lists.mpi-forum.org <mailto:mpi3-fortran at lists.mpi-forum.org>
>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran
>
>
>
> _______________________________________________
> mpi3-fortran mailing list
> mpi3-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran
>

-- 
Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101





More information about the mpiwg-fortran mailing list