[MPI3 Fortran] (j3.2006) (SC22WG5.3823) Please tell me I'm wrong
Jim Xia
jimxia at ca.ibm.com
Wed Dec 17 10:56:20 CST 2008
Craig
If your message is a contiguous assumed-shape, then you can solve the
problem without Fortran committee's help by using a conversion function as
follows
function convertToRank1 (x, n) result (res)
real, target, intent(inout) :: x(n)
integer, intent(in) :: n
real, pointer :: res(:)
res => x
end function
The your subroutine can be rewritten as follows
subroutine test_recv (message)
real, target :: message(:,:) !<-- assume it is contiguous
real, pointer :: remappedArray(:)
remappedArray => convertToRank1(message, size(message))
call MP_Recv (remappedArray, 2, MPI_INTEGER, 1, 1, MPI_COMM_WORLD,
MPI_STATUS_IGNORE)
end subroutine
That only solves the problem if the assumed-shape is contiguous. In F03
we have bounds-remapping for pointers that converts (maps) rank one target
to multi-dimension arrays. I think that can be used if your test_recv()
always expects a rank-one array assumed-shape dummy. You can map that
array into a rank-n array using data pointer assignment to match the
interface of MPI_Recv_wrapper, then you don't have the problems with
generic resolution issues.
Cheers,
Jim Xia
RL Fortran Compiler Test
IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
Phone (905) 413-3444 Tie-line 313-3444
email: jimxia at ca.ibm.com
D2/YF7/8200 /MKM
From:
Craig Rasmussen <crasmussen at lanl.gov>
To:
MPI-3 Fortran working group <mpi3-fortran at lists.mpi-forum.org>
Cc:
WG5 <sc22wg5 at open-std.org>
Date:
12/17/2008 10:45 AM
Subject:
(j3.2006) (SC22WG5.3823) Please tell me I'm wrong
Without help from the Fortran standard, I don't think there is anyway to
avoid a combinatorial explosion of interfaces (made worse by the F2008
with 15 dimensions). Consider the simple example code snippet:
---------
subroutine test_recv(message)
real :: message(:,:)
call MPI_Recv(message, 2, MPI_INTEGER, 1, 1, MPI_COMM_WORLD,
MPI_STATUS_IGNORE)
end subroutine
---------
For interface declaration:
subroutine MPI_Recv_wrapper(buf, count, datatype, source, tag, comm,
status, err)
real, dimension(*), intent(out) :: buf
or:
subroutine MPI_Recv_wrapper(buf, count, datatype, source, tag, comm,
status, err)
real, dimension(1,1,1,1,1,1,*), intent(out) :: buf
This give the following error with the Intel compiler:
fortcom: Error: test_recv_call.f90, line 15: There is no matching specific
subroutine for this generic subroutine call. [MPI_RECV]
call MPI_Recv(message, 2, MPI_INTEGER, dest, 1, MPI_COMM_WORLD,
MPI_STATUS_IGNORE)
--------^
On the other hand, if we use the interface:
subroutine MPI_Recv_wrapper(buf, count, datatype, source, tag, comm,
status, err)
type(C_PTR) :: buf
There is still a problem as assumed shape arrays are not interoperable.
>From gfortran:
call MPI_Recv(C_LOC(message), 2, MPI_INTEGER, dest, 1, MPI_COMM_WORLD,
requ
1
Error: Assumed-shape array 'message' at (1) cannot be an argument to the
procedure 'c_loc because it is not C interoperable
So there doesn't seem to be anyway to currently do multi-dimensional
interfaces for assumed-shape actuals without a combinatorial explosion of
interfaces. This also seems to be the case for assumed-size actuals as
well.
Comments?
Cheers,
Craig
_______________________________________________
J3 mailing list
J3 at j3-fortran.org
http://j3-fortran.org/mailman/listinfo/j3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpiwg-fortran/attachments/20081217/8b2acbec/attachment.html>
More information about the mpiwg-fortran
mailing list