Skip to content

Commit

Permalink
Merged in nathanweeks/ulfm2/feature/mpi_f08 (pull request open-mpi#6)
Browse files Browse the repository at this point in the history
Add mpi_f08 bindings for ULFM routines

Approved-by: George Bosilca <[email protected]>
  • Loading branch information
nathanweeks authored and abouteiller committed Dec 21, 2018
2 parents dbcfc7a + 14eec9a commit ec5675f
Show file tree
Hide file tree
Showing 18 changed files with 310 additions and 73 deletions.
2 changes: 1 addition & 1 deletion ompi/mpiext/ftmpi/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
# $HEADER$
#

SUBDIRS = c mpif-h use-mpi
SUBDIRS = c mpif-h use-mpi use-mpi-f08

1 change: 1 addition & 0 deletions ompi/mpiext/ftmpi/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ AC_DEFUN([OMPI_MPIEXT_ftmpi_CONFIG],[
AC_CONFIG_FILES([ompi/mpiext/ftmpi/mpif-h/Makefile])
AC_CONFIG_FILES([ompi/mpiext/ftmpi/mpif-h/profile/Makefile])
AC_CONFIG_FILES([ompi/mpiext/ftmpi/use-mpi/Makefile])
AC_CONFIG_FILES([ompi/mpiext/ftmpi/use-mpi-f08/Makefile])

# If we don't want FT, don't compile this component
AS_IF([test "$opal_want_ft_mpi" = "1"],
Expand Down
13 changes: 8 additions & 5 deletions ompi/mpiext/ftmpi/mpif-h/comm_agree_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
#include "ompi/communicator/communicator.h"
#include "ompi/mpi/fortran/base/fint_2_int.h"

#if OMPI_PROFILE_LAYER
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPIX_Comm_agree_f = PMPIX_Comm_agree_f
#endif
#define MPIX_Comm_agree_f PMPIX_Comm_agree_f
#endif

#include "ompi/mpiext/ftmpi/mpif-h/f77_mangle.h"
F77_STAMP_FN(MPIX_Comm_agree_f,
mpix_comm_agree,
Expand All @@ -26,13 +33,9 @@ F77_STAMP_FN(MPIX_Comm_agree_f,
(MPI_Fint *comm, ompi_fortran_logical_t *flag, MPI_Fint *ierr),
(comm, flag, ierr))

#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
#include "ompi/mpiext/ftmpi/mpif-h/profile/defines.h"
#endif

#include "ompi/mpiext/ftmpi/c/mpiext_ftmpi_c.h"

static void MPIX_Comm_agree_f(MPI_Fint *comm, ompi_fortran_logical_t *flag, MPI_Fint *ierr)
void MPIX_Comm_agree_f(MPI_Fint *comm, ompi_fortran_logical_t *flag, MPI_Fint *ierr)
{
MPI_Comm c_comm = MPI_Comm_f2c(*comm);
OMPI_LOGICAL_NAME_DECL(flag)
Expand Down
13 changes: 8 additions & 5 deletions ompi/mpiext/ftmpi/mpif-h/comm_failure_ack_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
#include "ompi/communicator/communicator.h"
#include "ompi/mpi/fortran/base/fint_2_int.h"

#if OMPI_PROFILE_LAYER
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPIX_Comm_failure_ack_f = PMPIX_Comm_failure_ack_f
#endif
#define MPIX_Comm_failure_ack_f PMPIX_Comm_failure_ack_f
#endif

#include "ompi/mpiext/ftmpi/mpif-h/f77_mangle.h"
F77_STAMP_FN(MPIX_Comm_failure_ack_f,
mpix_comm_failure_ack,
Expand All @@ -26,13 +33,9 @@ F77_STAMP_FN(MPIX_Comm_failure_ack_f,
(MPI_Fint *comm, MPI_Fint *ierr),
(comm, ierr))

#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
#include "ompi/mpiext/ftmpi/mpif-h/profile/defines.h"
#endif

#include "ompi/mpiext/ftmpi/c/mpiext_ftmpi_c.h"

static void MPIX_Comm_failure_ack_f(MPI_Fint *comm, MPI_Fint *ierr)
void MPIX_Comm_failure_ack_f(MPI_Fint *comm, MPI_Fint *ierr)
{
MPI_Comm c_comm = MPI_Comm_f2c(*comm);

Expand Down
13 changes: 8 additions & 5 deletions ompi/mpiext/ftmpi/mpif-h/comm_failure_get_acked_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
#include "ompi/communicator/communicator.h"
#include "ompi/mpi/fortran/base/fint_2_int.h"

#if OMPI_PROFILE_LAYER
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPIX_Comm_failure_get_acked_f = PMPIX_Comm_failure_get_acked_f
#endif
#define MPIX_Comm_failure_get_acked_f PMPIX_Comm_failure_get_acked_f
#endif

#include "ompi/mpiext/ftmpi/mpif-h/f77_mangle.h"
F77_STAMP_FN(MPIX_Comm_failure_get_acked_f,
mpix_comm_failure_get_acked,
Expand All @@ -26,13 +33,9 @@ F77_STAMP_FN(MPIX_Comm_failure_get_acked_f,
(MPI_Fint *comm, MPI_Fint *group, MPI_Fint *ierr),
(comm, group, ierr))

#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
#include "ompi/mpiext/ftmpi/mpif-h/profile/defines.h"
#endif

#include "ompi/mpiext/ftmpi/c/mpiext_ftmpi_c.h"

static void MPIX_Comm_failure_get_acked_f(MPI_Fint *comm, MPI_Fint *group, MPI_Fint *ierr)
void MPIX_Comm_failure_get_acked_f(MPI_Fint *comm, MPI_Fint *group, MPI_Fint *ierr)
{
MPI_Group c_group;
MPI_Comm c_comm = MPI_Comm_f2c(*comm);
Expand Down
13 changes: 8 additions & 5 deletions ompi/mpiext/ftmpi/mpif-h/comm_iagree_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
#include "ompi/request/request.h"
#include "ompi/mpi/fortran/base/fint_2_int.h"

#if OMPI_PROFILE_LAYER
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPIX_Comm_iagree_f = PMPIX_Comm_iagree_f
#endif
#define MPIX_Comm_iagree_f PMPIX_Comm_iagree_f
#endif

#include "ompi/mpiext/ftmpi/mpif-h/f77_mangle.h"
F77_STAMP_FN(MPIX_Comm_iagree_f,
mpix_comm_iagree,
Expand All @@ -27,13 +34,9 @@ F77_STAMP_FN(MPIX_Comm_iagree_f,
(MPI_Fint *comm, ompi_fortran_logical_t *flag, MPI_Fint *request, MPI_Fint *ierr),
(comm, flag, request, ierr))

#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
#include "ompi/mpiext/ftmpi/mpif-h/profile/defines.h"
#endif

#include "ompi/mpiext/ftmpi/c/mpiext_ftmpi_c.h"

static void MPIX_Comm_iagree_f(MPI_Fint *comm, ompi_fortran_logical_t *flag, MPI_Fint *request, MPI_Fint *ierr)
void MPIX_Comm_iagree_f(MPI_Fint *comm, ompi_fortran_logical_t *flag, MPI_Fint *request, MPI_Fint *ierr)
{
MPI_Comm c_comm = MPI_Comm_f2c(*comm);
MPI_Request c_req;
Expand Down
13 changes: 8 additions & 5 deletions ompi/mpiext/ftmpi/mpif-h/comm_revoke_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
#include "ompi/communicator/communicator.h"
#include "ompi/mpi/fortran/base/fint_2_int.h"

#if OMPI_PROFILE_LAYER
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPIX_Comm_revoke_f = PMPIX_Comm_revoke_f
#endif
#define MPIX_Comm_revoke_f PMPIX_Comm_revoke_f
#endif

#include "ompi/mpiext/ftmpi/mpif-h/f77_mangle.h"
F77_STAMP_FN(MPIX_Comm_revoke_f,
mpix_comm_revoke,
Expand All @@ -26,13 +33,9 @@ F77_STAMP_FN(MPIX_Comm_revoke_f,
(MPI_Fint *comm, MPI_Fint *ierr),
(comm, ierr))

#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
#include "ompi/mpiext/ftmpi/mpif-h/profile/defines.h"
#endif

#include "ompi/mpiext/ftmpi/c/mpiext_ftmpi_c.h"

static void MPIX_Comm_revoke_f(MPI_Fint *comm, MPI_Fint *ierr)
void MPIX_Comm_revoke_f(MPI_Fint *comm, MPI_Fint *ierr)
{
MPI_Comm c_comm = MPI_Comm_f2c(*comm);

Expand Down
13 changes: 8 additions & 5 deletions ompi/mpiext/ftmpi/mpif-h/comm_shrink_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
#include "ompi/communicator/communicator.h"
#include "ompi/mpi/fortran/base/fint_2_int.h"

#if OMPI_PROFILE_LAYER
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPIX_Comm_shrink_f = PMPIX_Comm_shrink_f
#endif
#define MPIX_Comm_shrink_f PMPIX_Comm_shrink_f
#endif

#include "ompi/mpiext/ftmpi/mpif-h/f77_mangle.h"
F77_STAMP_FN(MPIX_Comm_shrink_f,
mpix_comm_shrink,
Expand All @@ -26,13 +33,9 @@ F77_STAMP_FN(MPIX_Comm_shrink_f,
(MPI_Fint *comm, MPI_Fint *newcomm, MPI_Fint *ierr),
(comm, newcomm, ierr))

#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
#include "ompi/mpiext/ftmpi/mpif-h/profile/defines.h"
#endif

#include "ompi/mpiext/ftmpi/c/mpiext_ftmpi_c.h"

static void MPIX_Comm_shrink_f(MPI_Fint *comm, MPI_Fint *newcomm, MPI_Fint *ierr)
void MPIX_Comm_shrink_f(MPI_Fint *comm, MPI_Fint *newcomm, MPI_Fint *ierr)
{
MPI_Comm c_newcomm;
MPI_Comm c_comm = MPI_Comm_f2c(*comm);
Expand Down
4 changes: 2 additions & 2 deletions ompi/mpiext/ftmpi/mpif-h/f77_mangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
#if OMPI_PROFILE_LAYER
#define F77_STAMP_PROFILE_FN(fn_name_core, fn_name_lower, fn_name_upper, fn_args, pass_args) \
static void fn_name_core fn_args; \
void fn_name_core fn_args; \
\
OMPI_DECLSPEC void P##fn_name_upper fn_args; \
OMPI_DECLSPEC void p##fn_name_lower fn_args; \
Expand All @@ -35,7 +35,7 @@

#else
#define F77_STAMP_FN(fn_name_core, fn_name_lower, fn_name_upper, fn_args, pass_args) \
static void fn_name_core fn_args; \
void fn_name_core fn_args; \
\
OMPI_DECLSPEC void fn_name_upper fn_args; \
OMPI_DECLSPEC void fn_name_lower fn_args; \
Expand Down
40 changes: 0 additions & 40 deletions ompi/mpiext/ftmpi/mpif-h/profile/defines.h

This file was deleted.

33 changes: 33 additions & 0 deletions ompi/mpiext/ftmpi/use-mpi-f08/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

AM_FCFLAGS = $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \
-I$(top_srcdir) $(FCFLAGS_f90)

noinst_LTLIBRARIES =

if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS

# If we are, build the convenience libtool library that will be
# slurped up into libmpi_usempif08.la.
noinst_LTLIBRARIES += libmpiext_ftmpi_usempif08.la

noinst_HEADERS = mpiext_ftmpi_usempif08.h

# Sources for the convenience libtool library.
libmpiext_ftmpi_usempif08_la_SOURCES = comm_agree_f08.F90 \
comm_failure_ack_f08.F90 \
comm_failure_get_acked_f08.F90 \
comm_iagree_f08.F90 \
comm_revoke_f08.F90 \
comm_shrink_f08.F90
libmpiext_ftmpi_usempif08_la_LDFLAGS = -module -avoid-version
endif
26 changes: 26 additions & 0 deletions ompi/mpiext/ftmpi/use-mpi-f08/comm_agree_f08.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
! -*- f90 -*-
!
! $COPYRIGHT$
!

subroutine MPIX_Comm_agree_f08(comm, flag, ierror)
use :: mpi_f08_types, only : MPI_Comm
implicit none
interface
subroutine MPIX_Comm_agree_f(comm, flag, ierror) &
BIND(C, name="MPIX_Comm_agree_f")
implicit none
INTEGER, INTENT(IN) :: comm
INTEGER, INTENT(INOUT) :: flag
INTEGER, INTENT(OUT) :: ierror
end subroutine MPIX_Comm_agree_f
end interface
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, INTENT(INOUT) :: flag
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
integer :: c_ierror

call MPIX_Comm_agree_f(comm%MPI_VAL, flag, c_ierror)
if (present(ierror)) ierror = c_ierror

end subroutine MPIX_Comm_agree_f08
27 changes: 27 additions & 0 deletions ompi/mpiext/ftmpi/use-mpi-f08/comm_failure_ack_f08.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
! -*- f90 -*-
!
! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
! All rights reserved.
! $COPYRIGHT$
!

subroutine MPIX_Comm_failure_ack_f08(comm, ierror)
use :: mpi_f08_types, only : MPI_Comm
implicit none
interface
subroutine MPIX_Comm_failure_ack_f(comm, ierror) &
BIND(C, name="MPIX_Comm_failure_ack_f")
implicit none
INTEGER, INTENT(IN) :: comm
INTEGER, INTENT(OUT) :: ierror
end subroutine MPIX_Comm_failure_ack_f
end interface
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
integer :: c_ierror

call MPIX_Comm_failure_ack_f(comm%MPI_VAL, c_ierror)
if (present(ierror)) ierror = c_ierror

end subroutine MPIX_Comm_failure_ack_f08
28 changes: 28 additions & 0 deletions ompi/mpiext/ftmpi/use-mpi-f08/comm_failure_get_acked_f08.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
! -*- f90 -*-
!
! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
! All rights reserved.
! $COPYRIGHT$
!

subroutine MPIX_Comm_failure_get_acked_f08(comm, failedgrp, ierror)
use :: mpi_f08_types, only : MPI_Comm, MPI_Group
implicit none
interface
subroutine MPIX_Comm_failure_get_acked_f(comm, failedgrp, ierror) &
BIND(C, name="MPIX_Comm_failure_get_acked_f")
implicit none
INTEGER, INTENT(IN) :: comm
INTEGER, INTENT(OUT) :: failedgrp, ierror
end subroutine MPIX_Comm_failure_get_acked_f
end interface
TYPE(MPI_Comm), INTENT(IN) :: comm
TYPE(MPI_Group), INTENT(OUT) :: failedgrp
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
integer :: c_ierror

call MPIX_Comm_failure_get_acked_f(comm%MPI_VAL, failedgrp%MPI_VAL, c_ierror)
if (present(ierror)) ierror = c_ierror

end subroutine MPIX_Comm_failure_get_acked_f08
30 changes: 30 additions & 0 deletions ompi/mpiext/ftmpi/use-mpi-f08/comm_iagree_f08.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
! -*- f90 -*-
!
! $COPYRIGHT$
!

#include "ompi/mpi/fortran/configure-fortran-output.h"

subroutine MPIX_Comm_iagree_f08(comm, flag, request, ierror)
use :: mpi_f08_types, only : MPI_Comm, MPI_Request
implicit none
interface
subroutine MPIX_Comm_iagree_f(comm, flag, request, ierror) &
BIND(C, name="MPIX_Comm_iagree_f")
implicit none
INTEGER, INTENT(IN) :: comm
INTEGER, INTENT(INOUT) :: flag
INTEGER, INTENT(OUT) :: request
INTEGER, INTENT(OUT) :: ierror
end subroutine MPIX_Comm_iagree_f
end interface
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, INTENT(INOUT) OMPI_ASYNCHRONOUS :: flag
TYPE(MPI_Request), INTENT(OUT) :: request
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
integer :: c_ierror

call MPIX_Comm_iagree_f(comm%MPI_VAL, flag, request%MPI_VAL, c_ierror)
if (present(ierror)) ierror = c_ierror

end subroutine MPIX_Comm_iagree_f08
Loading

0 comments on commit ec5675f

Please sign in to comment.