Skip to content

Commit

Permalink
f08: move MPI_F08_STATUS[ES]_IGNORE into fortran bindings
Browse files Browse the repository at this point in the history
Both MPI_F08_STATUS_IGNORE and MPI_F08_STATUSES_IGNORE don't need live
in the C Binding since application is not suppose to use them unless the
fortran binding is linked. Move them to the fortran binding avoids the
linkage dependency on dynamic linker, which appears very fragile and
currently does not work on osx.

Both symbols are C symbols, thus there is no need to declare them in
mpi_f08_link_constants.f90.

The original comment -- "Although ..., they are not used in ..." is
misleading. The two symbols are for application use, regardless whether
implementation use it or not.

Define the symbols in mpi.h as external is safe. User is not supposed to
use it unless they link with fortran binding, i.e. libmpifort.so, which
will resolve the symbol.
  • Loading branch information
hzhou committed Dec 1, 2021
1 parent 3dfd3ac commit 52e67e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
4 changes: 0 additions & 4 deletions src/binding/fortran/use_mpi_f08/mpi_f08_link_constants.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ module mpi_f08_link_constants
type(MPI_Status), bind(C, name="MPIR_F08_MPI_STATUS_IGNORE_OBJ"), target :: MPI_STATUS_IGNORE
type(MPI_Status), dimension(1), bind(C, name="MPIR_F08_MPI_STATUSES_IGNORE_OBJ"), target :: MPI_STATUSES_IGNORE

! Though these two variables are required by MPI-3 Standard, they are not used in MPICH
type(c_ptr), bind(C, name="MPI_F08_STATUS_IGNORE") :: MPI_F08_STATUS_IGNORE ! Point to MPI_STATUS_IGNORE
type(c_ptr), bind(C, name="MPI_F08_STATUSES_IGNORE") :: MPI_F08_STATUSES_IGNORE ! Point to MPI_STATUSES_IGNORE


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
Expand Down
9 changes: 9 additions & 0 deletions src/binding/fortran/use_mpi_f08/wrappers_c/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
int MPIR_F08_MPI_IN_PLACE;
int MPIR_F08_MPI_BOTTOM;

/* MPI_F08_STATUS_IGNORE and MPI_F08_STATUSES_IGNORE are required by MPI-3.0.
* the obj variables are linked in mpi_f08_link_constants module via bind(c).
*/
MPI_F08_status MPIR_F08_MPI_STATUS_IGNORE_OBJ;
MPI_F08_status MPIR_F08_MPI_STATUSES_IGNORE_OBJ[1];

MPI_F08_status *MPI_F08_STATUS_IGNORE = &MPIR_F08_MPI_STATUS_IGNORE_OBJ;
MPI_F08_status *MPI_F08_STATUSES_IGNORE = &MPIR_F08_MPI_STATUSES_IGNORE_OBJ[0];

/*
Convert an array of strings in Fortran Format to an array of strings in C format (i.e., char* a[]).
Expand Down
11 changes: 0 additions & 11 deletions src/mpi/init/init_bindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,3 @@ void MPII_init_binding_cxx(void)
MPIR_Process.cxx_call_op_fn = 0;
#endif
}

/* ** F08 binding **************/
#ifdef HAVE_F08_BINDING
MPI_F08_status MPIR_F08_MPI_STATUS_IGNORE_OBJ;
MPI_F08_status MPIR_F08_MPI_STATUSES_IGNORE_OBJ[1];

/* Although the two STATUS pointers are required but the MPI3.0, they are not used in MPICH F08 binding */
MPI_F08_status *MPI_F08_STATUS_IGNORE = &MPIR_F08_MPI_STATUS_IGNORE_OBJ;
MPI_F08_status *MPI_F08_STATUSES_IGNORE = &MPIR_F08_MPI_STATUSES_IGNORE_OBJ[0];

#endif

0 comments on commit 52e67e4

Please sign in to comment.