Skip to content

Commit 1a1d560

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

File tree

11 files changed

+149
-21
lines changed

11 files changed

+149
-21
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
@@ -299,9 +299,9 @@ subroutine ompi_recv_f(buf,count,datatype,source,tag,comm,status,ierror) &
299299
end subroutine ompi_recv_f
300300

301301
subroutine ompi_recv_init_f(buf,count,datatype,source,tag,comm,request,ierror) &
302-
BIND(C, name="ompi_recv_init_f")
302+
BIND(C, name="ompi_recv_init_@OMPI_F08_BINDINGS_EXTENSION@")
303303
implicit none
304-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
304+
OMPI_F08_IGNORE_TKR_TYPE :: buf
305305
INTEGER, INTENT(IN) :: count, source, tag
306306
INTEGER, INTENT(IN) :: datatype
307307
INTEGER, INTENT(IN) :: comm
@@ -376,9 +376,9 @@ subroutine ompi_sendrecv_replace_f(buf,count,datatype,dest,sendtag,source, &
376376
end subroutine ompi_sendrecv_replace_f
377377

378378
subroutine ompi_send_init_f(buf,count,datatype,dest,tag,comm,request,ierror) &
379-
BIND(C, name="ompi_send_init_f")
379+
BIND(C, name="ompi_send_init_@OMPI_F08_BINDINGS_EXTENSION@")
380380
implicit none
381-
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
381+
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
382382
INTEGER, INTENT(IN) :: count, dest, tag
383383
INTEGER, INTENT(IN) :: datatype
384384
INTEGER, INTENT(IN) :: comm

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ libforce_usempif08_internal_cdesc_to_be_built_la_SOURCES = \
4545
irecv_cdesc.c \
4646
isend_cdesc.c \
4747
recv_cdesc.c \
48-
send_cdesc.c
48+
send_cdesc.c \
49+
send_init_cdesc.c
4950

5051
endif

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,8 @@ void ompi_recv_cdesc(CFI_cdesc_t *x, MPI_Fint *count, MPI_Fint *datatype,
3232
void ompi_send_cdesc(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype,
3333
MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *ierr);
3434

35+
void ompi_send_init_cdesc(CFI_cdesc_t *x, MPI_Fint *count, MPI_Fint *datatype,
36+
MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm,
37+
MPI_Fint *request, MPI_Fint *ierr);
3538

3639
#endif /* OMPI_CDESC_BINDINGS_H */
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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_recv_init_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_comm = PMPI_Comm_f2c (*comm);
40+
41+
c_datatype = c_type;
42+
if (x->rank != 0 && !CFI_is_contiguous(x)) {
43+
c_ierr = cdesc_create_datatype(x, c_count, c_type, &c_datatype);
44+
if (MPI_SUCCESS != c_ierr) {
45+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
46+
return;
47+
}
48+
c_count = 1;
49+
}
50+
c_ierr = PMPI_Recv_init(OMPI_F2C_BOTTOM(buf), c_count,
51+
c_datatype, OMPI_FINT_2_INT(*source),
52+
OMPI_INT_2_FINT(*tag), c_comm,
53+
&c_req);
54+
if (c_datatype != c_type) {
55+
ompi_datatype_destroy(&c_datatype);
56+
}
57+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
58+
59+
if (MPI_SUCCESS == c_ierr) {
60+
*request = PMPI_Request_c2f(c_req);
61+
}
62+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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_send_init_cdesc(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype,
29+
MPI_Fint *dest, 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_comm = PMPI_Comm_f2c (*comm);
40+
c_datatype = c_type;
41+
if (x->rank != 0 && !CFI_is_contiguous(x)) {
42+
c_ierr = cdesc_create_datatype(x, c_count, c_type, &c_datatype);
43+
if (MPI_SUCCESS != c_ierr) {
44+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
45+
return;
46+
}
47+
c_count = 1;
48+
}
49+
50+
c_ierr = PMPI_Send_init(OMPI_F2C_BOTTOM(buf), c_count,
51+
c_datatype, OMPI_FINT_2_INT(*dest),
52+
OMPI_FINT_2_INT(*tag),
53+
c_comm, &c_req);
54+
if (c_datatype != c_type) {
55+
ompi_datatype_destroy(&c_datatype);
56+
}
57+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
58+
59+
if (MPI_SUCCESS == c_ierr) {
60+
*request = PMPI_Request_c2f(c_req);
61+
}
62+
}

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
@@ -236,11 +236,11 @@ subroutine MPI_Recv_init_f08(buf,count,datatype,source,tag,comm,request,ierror)
236236
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
237237
implicit none
238238
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
239-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
239+
OMPI_F08_GCC_ATTRIBUTES(buf)
240240
!$PRAGMA IGNORE_TKR buf
241241
!DIR$ IGNORE_TKR buf
242242
!IBM* IGNORE_TKR buf
243-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
243+
OMPI_F08_IGNORE_TKR_TYPE :: buf
244244
INTEGER, INTENT(IN) :: count, source, tag
245245
TYPE(MPI_Datatype), INTENT(IN) :: datatype
246246
TYPE(MPI_Comm), INTENT(IN) :: comm
@@ -365,11 +365,11 @@ subroutine MPI_Send_init_f08(buf,count,datatype,dest,tag,comm,request,ierror)
365365
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
366366
implicit none
367367
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
368-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
368+
OMPI_F08_GCC_ATTRIBUTES(buf)
369369
!$PRAGMA IGNORE_TKR buf
370370
!DIR$ IGNORE_TKR buf
371371
!IBM* IGNORE_TKR buf
372-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
372+
OMPI_F08_IGNORE_TKR_TYPE :: buf
373373
INTEGER, INTENT(IN) :: count, dest, tag
374374
TYPE(MPI_Datatype), INTENT(IN) :: datatype
375375
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
@@ -236,11 +236,11 @@ subroutine PMPI_Recv_init_f08(buf,count,datatype,source,tag,comm,request,ierror)
236236
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
237237
implicit none
238238
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
239-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
239+
OMPI_F08_GCC_ATTRIBUTES(buf)
240240
!$PRAGMA IGNORE_TKR buf
241241
!DIR$ IGNORE_TKR buf
242242
!IBM* IGNORE_TKR buf
243-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
243+
OMPI_F08_IGNORE_TKR_TYPE :: buf
244244
INTEGER, INTENT(IN) :: count, source, tag
245245
TYPE(MPI_Datatype), INTENT(IN) :: datatype
246246
TYPE(MPI_Comm), INTENT(IN) :: comm
@@ -365,11 +365,11 @@ subroutine PMPI_Send_init_f08(buf,count,datatype,dest,tag,comm,request,ierror)
365365
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
366366
implicit none
367367
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
368-
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
368+
OMPI_F08_GCC_ATTRIBUTES(buf)
369369
!$PRAGMA IGNORE_TKR buf
370370
!DIR$ IGNORE_TKR buf
371371
!IBM* IGNORE_TKR buf
372-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
372+
OMPI_F08_IGNORE_TKR_TYPE :: buf
373373
INTEGER, INTENT(IN) :: count, dest, tag
374374
TYPE(MPI_Datatype), INTENT(IN) :: datatype
375375
TYPE(MPI_Comm), INTENT(IN) :: comm

ompi/mpi/fortran/use-mpi-f08/profile/precv_init_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 (c) 2018 FUJITSU LIMITED. All rights reserved.
99
! $COPYRIGHT$
@@ -14,7 +14,7 @@ subroutine PMPI_Recv_init_f08(buf,count,datatype,source,tag,comm,request,ierror)
1414
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
1515
use :: ompi_mpifh_bindings, only : ompi_recv_init_f
1616
implicit none
17-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
17+
OMPI_F08_IGNORE_TKR_TYPE :: buf
1818
INTEGER, INTENT(IN) :: count, source, tag
1919
TYPE(MPI_Datatype), INTENT(IN) :: datatype
2020
TYPE(MPI_Comm), INTENT(IN) :: comm

ompi/mpi/fortran/use-mpi-f08/profile/psend_init_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_init_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_send_init_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_init_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 (c) 2018 FUJITSU LIMITED. All rights reserved.
99
! $COPYRIGHT$
@@ -14,7 +14,7 @@ subroutine MPI_Recv_init_f08(buf,count,datatype,source,tag,comm,request,ierror)
1414
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
1515
use :: ompi_mpifh_bindings, only : ompi_recv_init_f
1616
implicit none
17-
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
17+
OMPI_F08_IGNORE_TKR_TYPE :: buf
1818
INTEGER, INTENT(IN) :: count, source, tag
1919
TYPE(MPI_Datatype), INTENT(IN) :: datatype
2020
TYPE(MPI_Comm), INTENT(IN) :: comm

0 commit comments

Comments
 (0)