Skip to content

Commit

Permalink
fortran/use-mpi-tkr: revamp PMPI_* declarations
Browse files Browse the repository at this point in the history
only declare MPI_* bindings and use macros to deduce the PMPI_* bindings

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
  • Loading branch information
ggouaillardet committed Aug 25, 2019
1 parent 488cc11 commit 1ad0710
Show file tree
Hide file tree
Showing 5 changed files with 261 additions and 3,035 deletions.
12 changes: 6 additions & 6 deletions ompi/mpi/fortran/use-mpi-tkr/mpi.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ module mpi
! This file is generated, and is *huge*. Its size is directly related
! to the --with-f90-max-array-dim configure parameter.

include "mpi-f90-interfaces.h"
include "pmpi-f90-interfaces.h"
# include "mpi-f90-interfaces.h"
# include "pmpi-f90-interfaces.h"
#if OMPI_PROVIDE_MPI_FILE_INTEFACE
include "mpi-f90-file-interfaces.h"
include "pmpi-f90-file-interfaces.h"
# include "mpi-f90-file-interfaces.h"
# include "pmpi-f90-file-interfaces.h"
#endif

#if OMPI_FORTRAN_BUILD_SIZEOF
Expand All @@ -65,8 +65,8 @@ module mpi
#error "Remove MPI-1 compat code"

#elif OMPI_ENABLE_MPI1_COMPAT
include "mpi-f90-removed-interfaces.h"
include "pmpi-f90-removed-interfaces.h"
# include "mpi-f90-removed-interfaces.h"
# include "pmpi-f90-removed-interfaces.h"
#endif

end module mpi
108 changes: 9 additions & 99 deletions ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-cptr-interfaces.h
Original file line number Diff line number Diff line change
@@ -1,108 +1,18 @@
! -*- fortran -*-
!
! Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
! Copyright (c) 2016 Research Organization for Information Science
! and Technology (RIST). All rights reserved.
! Copyright (c) 2019 Research Organization for Information Science
! and Technology (RIST). All rights reserved.
! $COPYRIGHT$
!
! Additional copyrights may follow
!
! $HEADER$
!
! This file contains interfaces that use the ISO_C_BINDING module and
! the TYPE(C_PTR) type, which not all Fortran compilers support (e.g.,
! gfortran on RHEL 5 does not support this module/type). So we use a
! preprocessor macro to protect the problematic declarations.
!
! This file is included via a preprocessor include directorive in
! mpi.F90, which allows us to use the preprocessor "if" directive,
! below.
!

interface PMPI_Win_allocate

subroutine PMPI_Win_allocate(size, disp_unit, info, comm, &
baseptr, win, ierror)
include 'mpif-config.h'
integer(KIND=MPI_ADDRESS_KIND), intent(in) :: size
integer, intent(in) :: disp_unit
integer, intent(in) :: info
integer, intent(in) :: comm
integer(KIND=MPI_ADDRESS_KIND), intent(out) :: baseptr
integer, intent(out) :: win
integer, intent(out) :: ierror
end subroutine PMPI_Win_allocate

! Only include the 2nd interface if we have ISO_C_BINDING / TYPE(C_PTR)
#if OMPI_FORTRAN_HAVE_ISO_C_BINDING
subroutine PMPI_Win_allocate_cptr(size, disp_unit, info, comm, &
baseptr, win, ierror)
use, intrinsic :: iso_c_binding, only : c_ptr
include 'mpif-config.h'
integer :: disp_unit, info, comm, win, ierror
integer(KIND=MPI_ADDRESS_KIND) :: size
type(C_PTR) :: baseptr
end subroutine PMPI_Win_allocate_cptr
#endif

end interface


interface PMPI_Win_allocate_shared

subroutine PMPI_Win_allocate_shared(size, disp_unit, info, comm, &
baseptr, win, ierror)
include 'mpif-config.h'
integer(KIND=MPI_ADDRESS_KIND), intent(in) :: size
integer, intent(in) :: disp_unit
integer, intent(in) :: info
integer, intent(in) :: comm
integer(KIND=MPI_ADDRESS_KIND), intent(out) :: baseptr
integer, intent(out) :: win
integer, intent(out) :: ierror
end subroutine PMPI_Win_allocate_shared

! Only include the 2nd interface if we have ISO_C_BINDING / TYPE(C_PTR)
#if OMPI_FORTRAN_HAVE_ISO_C_BINDING
subroutine PMPI_Win_allocate_shared_cptr(size, disp_unit, info, comm, &
baseptr, win, ierror)
use, intrinsic :: iso_c_binding, only : c_ptr
include 'mpif-config.h'
integer :: disp_unit, info, comm, win, ierror
integer(KIND=MPI_ADDRESS_KIND) :: size
type(C_PTR) :: baseptr
end subroutine PMPI_Win_allocate_shared_cptr
#endif

end interface


interface PMPI_Win_shared_query

subroutine PMPI_Win_shared_query(win, rank, size, disp_unit, baseptr,&
ierror)
include 'mpif-config.h'
integer, intent(in) :: win
integer, intent(in) :: rank
integer(KIND=MPI_ADDRESS_KIND), intent(out) :: size
integer, intent(out) :: disp_unit
integer(KIND=MPI_ADDRESS_KIND), intent(out) :: baseptr
integer, intent(out) :: ierror
end subroutine PMPI_Win_shared_query

! Only include the 2nd interface if we have ISO_C_BINDING / TYPE(C_PTR)
#if OMPI_FORTRAN_HAVE_ISO_C_BINDING
subroutine PMPI_Win_shared_query_cptr(win, rank, size, disp_unit, baseptr,&
ierror)
use, intrinsic :: iso_c_binding, only : c_ptr
include 'mpif-config.h'
integer, intent(in) :: win
integer, intent(in) :: rank
integer(KIND=MPI_ADDRESS_KIND), intent(out) :: size
integer, intent(out) :: disp_unit
type(C_PTR), intent(out) :: baseptr
integer, intent(out) :: ierror
end subroutine PMPI_Win_shared_query_cptr
#endif
#define MPI_Win_allocate PMPI_Win_allocate
#define MPI_Win_allocate_cptr PMPI_Win_allocate_cptr
#define MPI_Win_allocate_shared PMPI_Win_allocate_shared
#define MPI_Win_allocate_shared_cptr PMPI_Win_allocate_shared_cptr
#define MPI_Win_shared_query PMPI_Win_shared_query
#define MPI_Win_shared_query_cptr PMPI_Win_shared_query_cptr

end interface
#include "ompi/mpi/fortran/use-mpi-tkr/mpi-f90-cptr-interfaces.h"
Loading

0 comments on commit 1ad0710

Please sign in to comment.