Skip to content

Commit 12d5e04

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

File tree

11 files changed

+155
-25
lines changed

11 files changed

+155
-25
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
@@ -287,10 +287,10 @@ subroutine ompi_probe_f(source,tag,comm,status,ierror) &
287287
end subroutine ompi_probe_f
288288

289289
subroutine ompi_recv_f(buf,count,datatype,source,tag,comm,status,ierror) &
290-
BIND(C, name="ompi_recv_f")
290+
BIND(C, name="ompi_recv_@OMPI_F08_BINDINGS_EXTENSION@")
291291
use :: mpi_f08_types, only : MPI_Status
292292
implicit none
293-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
293+
OMPI_F08_IGNORE_TKR_TYPE :: buf
294294
INTEGER, INTENT(IN) :: count, source, tag
295295
INTEGER, INTENT(IN) :: datatype
296296
INTEGER, INTENT(IN) :: comm
@@ -338,9 +338,9 @@ subroutine ompi_rsend_init_f(buf,count,datatype,dest,tag,comm,request,ierror) &
338338
end subroutine ompi_rsend_init_f
339339

340340
subroutine ompi_send_f(buf,count,datatype,dest,tag,comm,ierror) &
341-
BIND(C, name="ompi_send_f")
341+
BIND(C, name="ompi_send_@OMPI_F08_BINDINGS_EXTENSION@")
342342
implicit none
343-
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
343+
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
344344
INTEGER, INTENT(IN) :: count, dest, tag
345345
INTEGER, INTENT(IN) :: datatype
346346
INTEGER, INTENT(IN) :: comm

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ noinst_LTLIBRARIES = $(module_sentinel_file)
4141
libforce_usempif08_internal_cdesc_to_be_built_la_SOURCES = \
4242
bindings.h \
4343
cdesc.h \
44-
cdesc.c
44+
cdesc.c \
45+
recv_cdesc.c \
46+
send_cdesc.c
4547

4648
endif

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

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

1818
#include "mpi.h"
1919

20+
void ompi_recv_cdesc(CFI_cdesc_t *x, MPI_Fint *count, MPI_Fint *datatype,
21+
MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
22+
MPI_Fint *status, MPI_Fint *ierr);
23+
24+
void ompi_send_cdesc(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype,
25+
MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr);
26+
27+
2028
#endif /* OMPI_CDESC_BINDINGS_H */
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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) 2012 Oracle and/or its affiliates. All rights reserved.
14+
* Copyright (c) 2015 Research Organization for Information Science
15+
* and Technology (RIST). All rights reserved.
16+
* $COPYRIGHT$
17+
*
18+
* Additional copyrights may follow
19+
*
20+
* $HEADER$
21+
*/
22+
23+
#include "ompi_config.h"
24+
25+
#include "ompi/mpi/fortran/mpif-h/bindings.h"
26+
#include "ompi/mpi/fortran/use-mpi-f08/cdesc/bindings.h"
27+
#include "ompi/mpi/fortran/mpif-h/status-conversion.h"
28+
#include "ompi/mpi/fortran/base/constants.h"
29+
#include "ompi/communicator/communicator.h"
30+
31+
void ompi_recv_cdesc(CFI_cdesc_t *x, MPI_Fint *count, MPI_Fint *datatype,
32+
MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
33+
MPI_Fint *status, MPI_Fint *ierr)
34+
{
35+
OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2)
36+
MPI_Comm c_comm = PMPI_Comm_f2c(*comm);
37+
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
38+
int c_ierr;
39+
void *buf = x->base_addr;
40+
int c_count = OMPI_FINT_2_INT(*count);
41+
42+
c_datatype = c_type;
43+
if (x->rank != 0 && !CFI_is_contiguous(x)) {
44+
c_ierr = cdesc_create_datatype(x, c_count, c_type, &c_datatype);
45+
if (MPI_SUCCESS != c_ierr) {
46+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
47+
return;
48+
}
49+
c_count = 1;
50+
}
51+
OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status)
52+
53+
/* Call the C function */
54+
c_ierr = PMPI_Recv(OMPI_F2C_BOTTOM(buf), c_count,
55+
c_datatype, OMPI_FINT_2_INT(*source),
56+
OMPI_FINT_2_INT(*tag), c_comm,
57+
c_status);
58+
59+
if (c_datatype != c_type) {
60+
ompi_datatype_destroy(&c_datatype);
61+
}
62+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
63+
64+
OMPI_FORTRAN_STATUS_RETURN(c_status,c_status2,status,c_ierr)
65+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
29+
void ompi_send_cdesc(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype,
30+
MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr)
31+
{
32+
int c_ierr;
33+
34+
MPI_Comm c_comm = PMPI_Comm_f2c(*comm);
35+
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
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+
c_ierr = PMPI_Send(OMPI_F2C_BOTTOM(buf), c_count,
49+
c_datatype, OMPI_FINT_2_INT(*dest),
50+
OMPI_FINT_2_INT(*tag), c_comm);
51+
if (c_datatype != c_type) {
52+
ompi_datatype_destroy(&c_datatype);
53+
}
54+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
55+
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
! of Tennessee Research Foundation. All rights
88
! reserved.
99
! Copyright (c) 2012 Inria. All rights reserved.
10-
! Copyright (c) 2015-2017 Research Organization for Information Science
11-
! and Technology (RIST). All rights reserved.
10+
! Copyright (c) 2015-2019 Research Organization for Information Science
11+
! and Technology (RIST). All rights reserved.
1212
! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved.
1313
! $COPYRIGHT$
1414
!
@@ -218,11 +218,11 @@ subroutine MPI_Recv_f08(buf,count,datatype,source,tag,comm,status,ierror)
218218
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status
219219
implicit none
220220
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
221-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
221+
OMPI_F08_GCC_ATTRIBUTES(buf)
222222
!$PRAGMA IGNORE_TKR buf
223223
!DIR$ IGNORE_TKR buf
224224
!IBM* IGNORE_TKR buf
225-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
225+
OMPI_F08_IGNORE_TKR_TYPE :: buf
226226
INTEGER, INTENT(IN) :: count, source, tag
227227
TYPE(MPI_Datatype), INTENT(IN) :: datatype
228228
TYPE(MPI_Comm), INTENT(IN) :: comm
@@ -309,11 +309,11 @@ subroutine MPI_Send_f08(buf,count,datatype,dest,tag,comm,ierror)
309309
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
310310
implicit none
311311
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
312-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
312+
OMPI_F08_GCC_ATTRIBUTES(buf)
313313
!$PRAGMA IGNORE_TKR buf
314314
!DIR$ IGNORE_TKR buf
315315
!IBM* IGNORE_TKR buf
316-
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
316+
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
317317
INTEGER, INTENT(IN) :: count, dest, tag
318318
TYPE(MPI_Datatype), INTENT(IN) :: datatype
319319
TYPE(MPI_Comm), INTENT(IN) :: comm

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
! of Tennessee Research Foundation. All rights
88
! reserved.
99
! Copyright (c) 2012 Inria. All rights reserved.
10-
! Copyright (c) 2015-2017 Research Organization for Information Science
11-
! and Technology (RIST). All rights reserved.
10+
! Copyright (c) 2015-2019 Research Organization for Information Science
11+
! and Technology (RIST). All rights reserved.
1212
! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved.
1313
! $COPYRIGHT$
1414
!
@@ -218,11 +218,11 @@ subroutine PMPI_Recv_f08(buf,count,datatype,source,tag,comm,status,ierror)
218218
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status
219219
implicit none
220220
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
221-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
221+
OMPI_F08_GCC_ATTRIBUTES(buf)
222222
!$PRAGMA IGNORE_TKR buf
223223
!DIR$ IGNORE_TKR buf
224224
!IBM* IGNORE_TKR buf
225-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
225+
OMPI_F08_IGNORE_TKR_TYPE :: buf
226226
INTEGER, INTENT(IN) :: count, source, tag
227227
TYPE(MPI_Datatype), INTENT(IN) :: datatype
228228
TYPE(MPI_Comm), INTENT(IN) :: comm
@@ -309,11 +309,11 @@ subroutine PMPI_Send_f08(buf,count,datatype,dest,tag,comm,ierror)
309309
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
310310
implicit none
311311
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
312-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
312+
OMPI_F08_GCC_ATTRIBUTES(buf)
313313
!$PRAGMA IGNORE_TKR buf
314314
!DIR$ IGNORE_TKR buf
315315
!IBM* IGNORE_TKR buf
316-
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
316+
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
317317
INTEGER, INTENT(IN) :: count, dest, tag
318318
TYPE(MPI_Datatype), INTENT(IN) :: datatype
319319
TYPE(MPI_Comm), INTENT(IN) :: comm

ompi/mpi/fortran/use-mpi-f08/profile/precv_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_Recv_f08(buf,count,datatype,source,tag,comm,status,ierror)
1313
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status
1414
use :: ompi_mpifh_bindings, only : ompi_recv_f
1515
implicit none
16-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
16+
OMPI_F08_IGNORE_TKR_TYPE :: 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/profile/psend_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_Send_f08(buf,count,datatype,dest,tag,comm,ierror)
1313
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
1414
use :: ompi_mpifh_bindings, only : ompi_send_f
1515
implicit none
16-
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
16+
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: 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/recv_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_Recv_f08(buf,count,datatype,source,tag,comm,status,ierror)
1313
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status
1414
use :: ompi_mpifh_bindings, only : ompi_recv_f
1515
implicit none
16-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
16+
OMPI_F08_IGNORE_TKR_TYPE :: 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)