[MPI3 Fortran] Start discussing new Fortran binding

Craig E. Rasmussen rasmussn at lanl.gov
Thu Feb 14 20:01:50 CST 2008


> On Feb 13, 2008, at 5:07 PM, Craig E. Rasmussen wrote:
>
>> ! I think we should provide better interfaces to command line
>> arguments.
>> ! It can be done through GET_COMMAND and GET_COMMAND_ARGUMENT.
>> ! MPI_Init should be able to pass back something like modified C
>> argc and
>> argv arguments.
>>
>>    err = MPI_Init()
>
> What do you mean?

Pretty much what you do (see below).

>
> I think that if an MPI implementation needs the argv, it can have its
> own implementation of MPI_Init in Fortran that calls GET_COMMAND and
> GET_COMMAND_ARGUMENT; the argc/argv arguments to MPI_INIT in C are
> allowed be NULL,NULL.

Right.  I'm thinking that we can wrap MPI_Init so that the functionality
is to pass back essentially the argc, argv list that C users get.

>
>> ! We need to figure out the type of MPI handles.
>> ! Currently I'm leaning toward TYPE(C_PTR) rather than
>> ! the INTEGER(MPI_HANDLE_KIND) Jeff and I used in our paper.
>
> Will this be able to handle MPI implementations that use integers as
> MPI handles in C?

So are we talking about global constants like MPI_COMM_WORLD?  If so it
looks like we can use the same global integers that are used in C.  We
would just initialize MPI_COMM_WORLD in Fortran MPI_Init to the address of
the global C integer.  If you can grok the Fortran, I've included the code
snippets:

! the global integer in OMPI
  integer, bind(C) :: ompi_mpi_comm_world

! the declaration of the handle in Fortran
  type(C_PTR) :: MPI_COMM_WORLD

! the initialization in MPI_Init()
 MPI_COMM_WORLD = C_LOC(ompi_mpi_comm_world)

Cheers,
Craig





More information about the mpiwg-fortran mailing list