Skip to content

Commit c08f97b

Browse files
committed
Fix problems with calling back-end BIND(C) ompi_*_f() functions.
BIND(C) doesn't let us have LOGICAL parameters, so we have to be creative in how we invoke back-end ompi_*_f() C functions. Additionally, the mpi_f08 type for MPI_Status presented some difficulties, too. See the large comment in ompi/mpi/fortran/use-mpi-f08/mpi-f-interfaces-bind.h that explains this in much more detail. This commit was SVN r29384.
1 parent f23d3bc commit c08f97b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+677
-883
lines changed

ompi/mpi/fortran/use-mpi-f08/Makefile.am

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- makefile -*-
22
#
3-
# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
3+
# Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved.
44
# Copyright (c) 2012 The University of Tennessee and The University
55
# of Tennessee Research Foundation. All rights
66
# reserved.
@@ -21,7 +21,9 @@ if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS
2121

2222
AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \
2323
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/base \
24-
$(OMPI_FC_MODULE_FLAG). -I$(top_srcdir) $(FCFLAGS_f90)
24+
$(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \
25+
$(OMPI_FC_MODULE_FLAG). \
26+
-I$(top_srcdir) $(FCFLAGS_f90)
2527

2628
lib_LTLIBRARIES = libmpi_usempif08.la
2729

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
! -*- f90 -*-
22
!
3-
! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
3+
! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
66
! $COPYRIGHT$
77

88
subroutine MPI_Cart_create_f08(comm_old,ndims,dims,periods,reorder,comm_cart,ierror)
99
use :: mpi_f08_types, only : MPI_Comm
10-
use :: mpi_f08, only : ompi_cart_create_f
10+
! See note in mpi-f-interfaces-bind.h for why we "use mpi" here and
11+
! call a PMPI_* subroutine below.
12+
use :: mpi, only : PMPI_Cart_create
1113
implicit none
1214
TYPE(MPI_Comm), INTENT(IN) :: comm_old
1315
INTEGER, INTENT(IN) :: ndims
@@ -17,8 +19,7 @@ subroutine MPI_Cart_create_f08(comm_old,ndims,dims,periods,reorder,comm_cart,ier
1719
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
1820
integer :: c_ierror
1921

20-
call ompi_cart_create_f(comm_old%MPI_VAL,ndims,dims,periods,&
22+
call PMPI_Cart_create(comm_old%MPI_VAL,ndims,dims,periods,&
2123
reorder,comm_cart%MPI_VAL,c_ierror)
2224
if (present(ierror)) ierror = c_ierror
23-
2425
end subroutine MPI_Cart_create_f08
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
! -*- f90 -*-
22
!
3-
! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
3+
! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
66
! $COPYRIGHT$
77

88
subroutine MPI_Cart_get_f08(comm,maxdims,dims,periods,coords,ierror)
99
use :: mpi_f08_types, only : MPI_Comm
10-
use :: mpi_f08, only : ompi_cart_get_f
10+
! See note in mpi-f-interfaces-bind.h for why we "use mpi" here and
11+
! call a PMPI_* subroutine below.
12+
use :: mpi, only : PMPI_Cart_get
1113
implicit none
1214
TYPE(MPI_Comm), INTENT(IN) :: comm
1315
INTEGER, INTENT(IN) :: maxdims
@@ -16,7 +18,6 @@ subroutine MPI_Cart_get_f08(comm,maxdims,dims,periods,coords,ierror)
1618
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
1719
integer :: c_ierror
1820

19-
call ompi_cart_get_f(comm%MPI_VAL,maxdims,dims,periods,coords,c_ierror)
21+
call PMPI_Cart_get(comm%MPI_VAL,maxdims,dims,periods,coords,c_ierror)
2022
if (present(ierror)) ierror = c_ierror
21-
2223
end subroutine MPI_Cart_get_f08
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
! -*- f90 -*-
22
!
3-
! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
3+
! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
66
! $COPYRIGHT$
77

88
subroutine MPI_Cart_map_f08(comm,ndims,dims,periods,newrank,ierror)
99
use :: mpi_f08_types, only : MPI_Comm
10-
use :: mpi_f08, only : ompi_cart_map_f
10+
! See note in mpi-f-interfaces-bind.h for why we "use mpi" here and
11+
! call a PMPI_* subroutine below.
12+
use :: mpi, only : PMPI_Cart_map
1113
implicit none
1214
TYPE(MPI_Comm), INTENT(IN) :: comm
1315
INTEGER, INTENT(IN) :: ndims, dims(ndims)
@@ -16,7 +18,6 @@ subroutine MPI_Cart_map_f08(comm,ndims,dims,periods,newrank,ierror)
1618
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
1719
integer :: c_ierror
1820

19-
call ompi_cart_map_f(comm%MPI_VAL,ndims,dims,periods,newrank,c_ierror)
21+
call PMPI_Cart_map(comm%MPI_VAL,ndims,dims,periods,newrank,c_ierror)
2022
if (present(ierror)) ierror = c_ierror
21-
2223
end subroutine MPI_Cart_map_f08
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
! -*- f90 -*-
22
!
3-
! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
3+
! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
66
! $COPYRIGHT$
77

88
subroutine MPI_Cart_sub_f08(comm,remain_dims,newcomm,ierror)
99
use :: mpi_f08_types, only : MPI_Comm
10-
use :: mpi_f08, only : ompi_cart_sub_f
10+
! See note in mpi-f-interfaces-bind.h for why we "use mpi" here and
11+
! call a PMPI_* subroutine below.
12+
use :: mpi, only : PMPI_Cart_sub
1113
implicit none
1214
TYPE(MPI_Comm), INTENT(IN) :: comm
1315
LOGICAL, INTENT(IN) :: remain_dims(*)
1416
TYPE(MPI_Comm), INTENT(OUT) :: newcomm
1517
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
1618
integer :: c_ierror
1719

18-
call ompi_cart_sub_f(comm%MPI_VAL,remain_dims,newcomm%MPI_VAL,c_ierror)
20+
call PMPI_Cart_sub(comm%MPI_VAL,remain_dims,newcomm%MPI_VAL,c_ierror)
1921
if (present(ierror)) ierror = c_ierror
20-
2122
end subroutine MPI_Cart_sub_f08
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
! -*- f90 -*-
22
!
3-
! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
3+
! Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
66
! $COPYRIGHT$
77

88
subroutine MPI_Comm_get_attr_f08(comm,comm_keyval,attribute_val,flag,ierror)
99
use :: mpi_f08_types, only : MPI_Comm, MPI_ADDRESS_KIND
10-
use :: mpi_f08, only : ompi_comm_get_attr_f
10+
! See note in mpi-f-interfaces-bind.h for why we "use mpi" here and
11+
! call a PMPI_* subroutine below.
12+
use :: mpi, only : PMPI_Comm_get_attr
1113
implicit none
1214
TYPE(MPI_Comm), INTENT(IN) :: comm
1315
INTEGER, INTENT(IN) :: comm_keyval
@@ -16,7 +18,6 @@ subroutine MPI_Comm_get_attr_f08(comm,comm_keyval,attribute_val,flag,ierror)
1618
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
1719
integer :: c_ierror
1820

19-
call ompi_comm_get_attr_f(comm%MPI_VAL,comm_keyval,attribute_val,flag,c_ierror)
21+
call PMPI_Comm_get_attr(comm%MPI_VAL,comm_keyval,attribute_val,flag,c_ierror)
2022
if (present(ierror)) ierror = c_ierror
21-
2223
end subroutine MPI_Comm_get_attr_f08
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
! -*- f90 -*-
22
!
3-
! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
3+
! Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
66
! $COPYRIGHT$
77

88
subroutine MPI_Comm_test_inter_f08(comm,flag,ierror)
99
use :: mpi_f08_types, only : MPI_Comm
10-
use :: mpi_f08, only : ompi_comm_test_inter_f
10+
! See note in mpi-f-interfaces-bind.h for why we "use mpi" here and
11+
! call a PMPI_* subroutine below.
12+
use :: mpi, only : PMPI_Comm_test_inter
1113
implicit none
1214
TYPE(MPI_Comm), INTENT(IN) :: comm
1315
LOGICAL, INTENT(OUT) :: flag
1416
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
1517
integer :: c_ierror
1618

17-
call ompi_comm_test_inter_f(comm%MPI_VAL,flag,c_ierror)
19+
call PMPI_Comm_test_inter(comm%MPI_VAL,flag,c_ierror)
1820
if (present(ierror)) ierror = c_ierror
19-
2021
end subroutine MPI_Comm_test_inter_f08
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
! -*- f90 -*-
22
!
3-
! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
3+
! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
66
! $COPYRIGHT$
@@ -9,7 +9,9 @@ subroutine MPI_Dist_graph_create_adjacent_f08(comm_old,indegree,sources,sourcewe
99
outdegree,destinations,destweights,info,&
1010
reorder,comm_dist_graph,ierror)
1111
use :: mpi_f08_types, only : MPI_Comm, MPI_Info
12-
use :: mpi_f08, only : ompi_dist_graph_create_adjacent_f
12+
! See note in mpi-f-interfaces-bind.h for why we "use mpi" here and
13+
! call a PMPI_* subroutine below.
14+
use :: mpi, only : PMPI_Dist_graph_create_adjacent
1315
implicit none
1416
TYPE(MPI_Comm), INTENT(IN) :: comm_old
1517
INTEGER, INTENT(IN) :: indegree, outdegree
@@ -20,10 +22,9 @@ subroutine MPI_Dist_graph_create_adjacent_f08(comm_old,indegree,sources,sourcewe
2022
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
2123
integer :: c_ierror
2224

23-
call ompi_dist_graph_create_adjacent_f(comm_old%MPI_VAL,indegree,sources,&
25+
call PMPI_Dist_graph_create_adjacent(comm_old%MPI_VAL,indegree,sources,&
2426
sourceweights,outdegree,destinations,&
2527
destweights,info%MPI_VAL,&
2628
reorder,comm_dist_graph%MPI_VAL,ierror)
2729
if (present(ierror)) ierror = c_ierror
28-
2930
end subroutine MPI_Dist_graph_create_adjacent_f08

ompi/mpi/fortran/use-mpi-f08/dist_graph_create_f08.F90

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
! -*- f90 -*-
22
!
3-
! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
3+
! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
66
! $COPYRIGHT$
77

88
subroutine MPI_Dist_graph_create_f08(comm_old,n,sources,degrees,destinations,&
99
weights,info,reorder,comm_dist_graph,ierror)
1010
use :: mpi_f08_types, only : MPI_Comm, MPI_Info
11-
use :: mpi_f08, only : ompi_dist_graph_create_f
11+
! See note in ompi/mpi/fortran/use-mpi-f08/iprobe_f08.F90 about why
12+
! we "use mpi" here.
13+
use :: mpi, only : PMPI_Dist_graph_create
1214
implicit none
1315
TYPE(MPI_Comm), INTENT(IN) :: comm_old
1416
INTEGER, INTENT(IN) :: n
@@ -19,7 +21,9 @@ subroutine MPI_Dist_graph_create_f08(comm_old,n,sources,degrees,destinations,&
1921
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
2022
integer :: c_ierror
2123

22-
call ompi_dist_graph_create_f(comm_old%MPI_VAL,n,sources,degrees,destinations,&
24+
! See note in ompi/mpi/fortran/use-mpi-f08/iprobe_f08.F90 about why
25+
! we call a PMPI_* subroutine here
26+
call PMPI_Dist_graph_create(comm_old%MPI_VAL,n,sources,degrees,destinations,&
2327
weights,info%MPI_VAL,reorder,comm_dist_graph%MPI_VAL,&
2428
c_ierror)
2529
if (present(ierror)) ierror = c_ierror
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
! -*- f90 -*-
22
!
3-
! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
3+
! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
66
! $COPYRIGHT$
77

88
subroutine MPI_Dist_graph_neighbors_count_f08(comm,indegree,outdegree,weighted,ierror)
99
use :: mpi_f08_types, only : MPI_Comm
10-
use :: mpi_f08, only : ompi_dist_graph_neighbors_count_f
10+
! See note in mpi-f-interfaces-bind.h for why we "use mpi" here and
11+
! call a PMPI_* subroutine below.
12+
use :: mpi, only : PMPI_Dist_graph_neighbors_count
1113
implicit none
1214
TYPE(MPI_Comm), INTENT(IN) :: comm
1315
INTEGER, INTENT(OUT) :: indegree, outdegree
1416
LOGICAL, INTENT(OUT) :: weighted
1517
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
1618
integer :: c_ierror
1719

18-
call ompi_dist_graph_neighbors_count_f(comm%MPI_VAL,indegree,outdegree,weighted,c_ierror)
20+
call PMPI_Dist_graph_neighbors_count(comm%MPI_VAL,indegree,outdegree,weighted,c_ierror)
1921
if (present(ierror)) ierror = c_ierror
20-
2122
end subroutine MPI_Dist_graph_neighbors_count_f08

0 commit comments

Comments
 (0)