(j3.2006) (SC22WG5.3692) Comment on N1761
Reinhold Bader
Reinhold.Bader
Sat Nov 29 15:51:53 EST 2008
Hello,
The TR 29113 draft contains the following example code:
interface MPI_send
subroutine MPI_send_old (buffer, n) bind(c,name="MPI_send")
type(*), dimension(*) :: buffer ! Passed by simple address
integer(c_int),value :: n
end subroutine
subroutine MPI_send_new (buffer) bind(c,name="MPI_send_new")
type(*), dimension(..), contiguous :: buffer
! Passed by descriptor including the shape and type
end subroutine
end interface
real :: x(100), y(10,10)
! These will invoke MPI_send_old
call MPI_send(x,size(x)) ! Passed by address
call MPI_send(y,size(y)) ! Sequence association
<----non-conforming?
call MPI_send(y(:,1),size(y,dim=1)) ! Pass first column of y
call MPI_send(y(1,5),size(y,dim=1)) ! Pass fifth column of y
! These will invoke MPI_send_new
call MPI_send(x) ! Pass a rank-1 descriptor
call MPI_send(y) ! Pass a rank-0 descriptor
<---Typo? ("rank-2")
call MPI_send(y(:,1)) ! Passed by descriptor without copy
call MPI_send(y(1,5)) ! Illegal: No sequence association
In my opinion, the marked line would be non-conforming even under the
additional rules specified by TR29113, since it contravenes p290, para 13
of the F2008 draft standard 08-007r2, which disallows matching of actual
arguments of arbitrary ranks to the assumed size dummy of rank one *for
a generic interface*.
If my critique is correct, there are the following choices:
* Give up having a generic interface, or use the assumed size only
for 1-d arrays. This would only require correcting the above example.
* Add an exception to the above-mentioned rule, applying for TYPE(*)
arguments
of assumed size. One possibility would be to allow a match with the
specific
with the largest rank smaller or equal to the actual arguments'; this
might be
reasonable not only for TYPE(*), but is probably not feasible due to
backward incompatibility.
I'm also pointing out a typo in the use of the assumed rank part.
Best Regards
--
Dr. Reinhold Bader
Leibniz-Rechenzentrum, Abt. Hochleistungssysteme | Tel. +49 89 35831 8825
Boltzmannstr. 1, 85748 Garching | Fax +49 89 35831 9700
More information about the J3
mailing list