Skip to content

Commit 67d1411

Browse files
committed
fortran/use-mpi-f08 isend/recv
Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent 12d5e04 commit 67d1411

File tree

11 files changed

+153
-20
lines changed

11 files changed

+153
-20
lines changed

ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ subroutine ompi_ibsend_f(buf,count,datatype,dest,tag,comm,request,ierror) &
233233
end subroutine ompi_ibsend_f
234234

235235
subroutine ompi_irecv_f(buf,count,datatype,source,tag,comm,request,ierror) &
236-
BIND(C, name="ompi_irecv_f")
236+
BIND(C, name="ompi_irecv_@OMPI_F08_BINDINGS_EXTENSION@")
237237
implicit none
238-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
238+
OMPI_F08_IGNORE_TKR_TYPE :: buf
239239
INTEGER, INTENT(IN) :: count, source, tag
240240
INTEGER, INTENT(IN) :: datatype
241241
INTEGER, INTENT(IN) :: comm
@@ -255,9 +255,9 @@ subroutine ompi_irsend_f(buf,count,datatype,dest,tag,comm,request,ierror) &
255255
end subroutine ompi_irsend_f
256256

257257
subroutine ompi_isend_f(buf,count,datatype,dest,tag,comm,request,ierror) &
258-
BIND(C, name="ompi_isend_f")
258+
BIND(C, name="ompi_isend_@OMPI_F08_BINDINGS_EXTENSION@")
259259
implicit none
260-
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
260+
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
261261
INTEGER, INTENT(IN) :: count, dest, tag
262262
INTEGER, INTENT(IN) :: datatype
263263
INTEGER, INTENT(IN) :: comm

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ libforce_usempif08_internal_cdesc_to_be_built_la_SOURCES = \
4242
bindings.h \
4343
cdesc.h \
4444
cdesc.c \
45+
irecv_cdesc.c \
46+
isend_cdesc.c \
4547
recv_cdesc.c \
4648
send_cdesc.c
4749

ompi/mpi/fortran/use-mpi-f08/cdesc/bindings.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717

1818
#include "mpi.h"
1919

20+
void ompi_irecv_cdesc(CFI_cdesc_t *x, MPI_Fint *count, MPI_Fint *datatype,
21+
MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
22+
MPI_Fint *request, MPI_Fint *ierr);
23+
24+
void ompi_isend_cdesc(CFI_cdesc_t *x, MPI_Fint *count, MPI_Fint *datatype,
25+
MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm,
26+
MPI_Fint *request, MPI_Fint *ierr);
27+
2028
void ompi_recv_cdesc(CFI_cdesc_t *x, MPI_Fint *count, MPI_Fint *datatype,
2129
MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
2230
MPI_Fint *status, MPI_Fint *ierr);
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015-2019 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
#include "ompi_config.h"
23+
24+
#include "ompi/mpi/fortran/mpif-h/bindings.h"
25+
#include "ompi/mpi/fortran/use-mpi-f08/cdesc/bindings.h"
26+
#include "ompi/mpi/fortran/base/constants.h"
27+
28+
void ompi_irecv_cdesc(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype,
29+
MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
30+
MPI_Fint *request, MPI_Fint *ierr)
31+
{
32+
int c_ierr;
33+
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
34+
MPI_Request c_req;
35+
MPI_Comm c_comm;
36+
void *buf = x->base_addr;
37+
int c_count = OMPI_FINT_2_INT(*count);
38+
39+
c_datatype = c_type;
40+
if (x->rank != 0 && !CFI_is_contiguous(x)) {
41+
c_ierr = cdesc_create_datatype(x, c_count, c_type, &c_datatype);
42+
if (MPI_SUCCESS != c_ierr) {
43+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
44+
return;
45+
}
46+
c_count = 1;
47+
}
48+
49+
c_comm = PMPI_Comm_f2c (*comm);
50+
51+
c_ierr = PMPI_Irecv(OMPI_F2C_BOTTOM(buf), c_count,
52+
c_datatype, OMPI_FINT_2_INT(*source),
53+
OMPI_FINT_2_INT(*tag), c_comm, &c_req);
54+
if (c_datatype != c_type) {
55+
ompi_datatype_destroy(&c_datatype);
56+
}
57+
58+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
59+
60+
if (MPI_SUCCESS == c_ierr) {
61+
*request = PMPI_Request_c2f(c_req);
62+
}
63+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2015-2019 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
15+
* $COPYRIGHT$
16+
*
17+
* Additional copyrights may follow
18+
*
19+
* $HEADER$
20+
*/
21+
22+
#include "ompi_config.h"
23+
24+
#include "ompi/mpi/fortran/mpif-h/bindings.h"
25+
#include "ompi/mpi/fortran/use-mpi-f08/cdesc/bindings.h"
26+
#include "ompi/mpi/fortran/base/constants.h"
27+
28+
void ompi_isend_cdesc(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)
29+
{
30+
int c_ierr;
31+
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
32+
MPI_Request c_req;
33+
MPI_Comm c_comm;
34+
void *buf = x->base_addr;
35+
int c_count = OMPI_FINT_2_INT(*count);
36+
37+
c_comm = PMPI_Comm_f2c (*comm);
38+
39+
c_datatype = c_type;
40+
if (x->rank != 0 && !CFI_is_contiguous(x)) {
41+
c_ierr = cdesc_create_datatype(x, c_count, c_type, &c_datatype);
42+
if (MPI_SUCCESS != c_ierr) {
43+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
44+
return;
45+
}
46+
c_count = 1;
47+
}
48+
c_ierr = PMPI_Isend(OMPI_F2C_BOTTOM(buf), c_count,
49+
c_datatype, OMPI_FINT_2_INT(*dest),
50+
OMPI_FINT_2_INT(*tag),
51+
c_comm, &c_req);
52+
if (c_datatype != c_type) {
53+
ompi_datatype_destroy(&c_datatype);
54+
}
55+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
56+
57+
if (MPI_SUCCESS == c_ierr) {
58+
*request = PMPI_Request_c2f(c_req);
59+
}
60+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
6-
! Copyright (c) 2018 Research Organization for Information Science
6+
! Copyright (c) 2018-2019 Research Organization for Information Science
77
! and Technology (RIST). All rights reserved.
88
! $COPYRIGHT$
99

@@ -13,7 +13,7 @@ subroutine MPI_Irecv_f08(buf,count,datatype,source,tag,comm,request,ierror)
1313
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
1414
use :: ompi_mpifh_bindings, only : ompi_irecv_f
1515
implicit none
16-
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
16+
OMPI_F08_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
1717
INTEGER, INTENT(IN) :: count, source, tag
1818
TYPE(MPI_Datatype), INTENT(IN) :: datatype
1919
TYPE(MPI_Comm), INTENT(IN) :: comm

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
6-
! Copyright (c) 2018 Research Organization for Information Science
6+
! Copyright (c) 2018-2019 Research Organization for Information Science
77
! and Technology (RIST). All rights reserved.
88
! $COPYRIGHT$
99

@@ -13,7 +13,7 @@ subroutine MPI_Isend_f08(buf,count,datatype,dest,tag,comm,request,ierror)
1313
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
1414
use :: ompi_mpifh_bindings, only : ompi_isend_f
1515
implicit none
16-
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
16+
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
1717
INTEGER, INTENT(IN) :: count, dest, tag
1818
TYPE(MPI_Datatype), INTENT(IN) :: datatype
1919
TYPE(MPI_Comm), INTENT(IN) :: comm

ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ subroutine MPI_Irecv_f08(buf,count,datatype,source,tag,comm,request,ierror)
135135
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
136136
implicit none
137137
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
138-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
138+
OMPI_F08_GCC_ATTRIBUTES(buf)
139139
!$PRAGMA IGNORE_TKR buf
140140
!DIR$ IGNORE_TKR buf
141141
!IBM* IGNORE_TKR buf
142-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
142+
OMPI_F08_IGNORE_TKR_TYPE :: buf
143143
INTEGER, INTENT(IN) :: count, source, tag
144144
TYPE(MPI_Datatype), INTENT(IN) :: datatype
145145
TYPE(MPI_Comm), INTENT(IN) :: comm
@@ -171,11 +171,11 @@ subroutine MPI_Isend_f08(buf,count,datatype,dest,tag,comm,request,ierror)
171171
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
172172
implicit none
173173
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
174-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
174+
OMPI_F08_GCC_ATTRIBUTES(buf)
175175
!$PRAGMA IGNORE_TKR buf
176176
!DIR$ IGNORE_TKR buf
177177
!IBM* IGNORE_TKR buf
178-
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
178+
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
179179
INTEGER, INTENT(IN) :: count, dest, tag
180180
TYPE(MPI_Datatype), INTENT(IN) :: datatype
181181
TYPE(MPI_Comm), INTENT(IN) :: comm

ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ subroutine PMPI_Irecv_f08(buf,count,datatype,source,tag,comm,request,ierror)
135135
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
136136
implicit none
137137
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
138-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
138+
OMPI_F08_GCC_ATTRIBUTES(buf)
139139
!$PRAGMA IGNORE_TKR buf
140140
!DIR$ IGNORE_TKR buf
141141
!IBM* IGNORE_TKR buf
142-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
142+
OMPI_F08_IGNORE_TKR_TYPE :: buf
143143
INTEGER, INTENT(IN) :: count, source, tag
144144
TYPE(MPI_Datatype), INTENT(IN) :: datatype
145145
TYPE(MPI_Comm), INTENT(IN) :: comm
@@ -171,11 +171,11 @@ subroutine PMPI_Isend_f08(buf,count,datatype,dest,tag,comm,request,ierror)
171171
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
172172
implicit none
173173
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
174-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
174+
OMPI_F08_GCC_ATTRIBUTES(buf)
175175
!$PRAGMA IGNORE_TKR buf
176176
!DIR$ IGNORE_TKR buf
177177
!IBM* IGNORE_TKR buf
178-
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
178+
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
179179
INTEGER, INTENT(IN) :: count, dest, tag
180180
TYPE(MPI_Datatype), INTENT(IN) :: datatype
181181
TYPE(MPI_Comm), INTENT(IN) :: comm

ompi/mpi/fortran/use-mpi-f08/profile/pirecv_f08.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
44
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
55
! All rights reserved.
6-
! Copyright (c) 2018 Research Organization for Information Science
6+
! Copyright (c) 2018-2019 Research Organization for Information Science
77
! and Technology (RIST). All rights reserved.
88
! $COPYRIGHT$
99

@@ -13,7 +13,7 @@ subroutine PMPI_Irecv_f08(buf,count,datatype,source,tag,comm,request,ierror)
1313
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
1414
use :: ompi_mpifh_bindings, only : ompi_irecv_f
1515
implicit none
16-
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
16+
OMPI_F08_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
1717
INTEGER, INTENT(IN) :: count, source, tag
1818
TYPE(MPI_Datatype), INTENT(IN) :: datatype
1919
TYPE(MPI_Comm), INTENT(IN) :: comm

0 commit comments

Comments
 (0)