[MPI3 Fortran] Start discussing new Fortran binding
Jeff Squyres
jsquyres at cisco.com
Thu Feb 21 18:53:38 CST 2008
On Feb 19, 2008, at 10:27 AM, Craig Rasmussen wrote:
> Don't know if there are implementations where the MPI handle is not
> an integer of size of an address. Would your suggestion work if it
> were?
Actually, does it matter?
In the MPI spec, we can just mandate this part:
type, BIND(C) :: MPI_HANDLE_TYPE
private
....something....
end type MPI_HANDLE_TYPE
So that MPI_HANDLE_TYPE is required to be available in Fortran. What
exactly it contains and how it is implemented is up to each MPI
implementation. They can make it an equivalent of a C pointer, or a C
int, or whatever they need.
Let's take two obvious concrete examples:
1. Open MPI defines C MPI communicators as
typedef struct ompi_comm_t * MPI_Comm;
As such, Open MPI's F03 interface for communicators would be:
type, BIND(C) :: MPI_COMMUNICATOR
private
type(C_PTR) :: handle
end type MPI_COMMUNICATOR
2. MPICH2 defines C MPI communicators as ints. Hence, MPICH2's F03
interface for communicators would be:
type, BIND(C) :: MPI_COMMUNICATOR
private
type(C_INT) :: handle
end type MPI_COMMUNICATOR
Is that right?
If so, my only concern is that the compiler can automatically
translate between the F03 and C values without the need for a
translation layer provided by the MPI implementation. That is, a
Fortran function of MPI_SEND that takes an MPI_COMMUNICATOR type
parameter (as described above) can be automatically translated to the
appropriate MPI_Comm type in C. That is one of the goals of this
interface, after all.
The reason that I mention this is because I'm a C guy, not a Fortran
guy, and the above "type, BIND(C)..." stuff looks analogous to a
struct to me. If it is, and if that binding contains more than one
member, are we ok on the "compiler will automatically translate it"
front as long as there is only one member in the binding?
An excellent topic for the teleconference! :-)
--
Jeff Squyres
Cisco Systems
More information about the mpiwg-fortran
mailing list