Skip to content

Commit

Permalink
fortran/use-mpi-f08: add CFI support for point-to-point communications
Browse files Browse the repository at this point in the history
Signed-off-by: Gilles Gouaillardet <[email protected]>
  • Loading branch information
ggouaillardet authored and jtronge committed Jul 30, 2024
1 parent 5bf3286 commit 2935f92
Show file tree
Hide file tree
Showing 48 changed files with 1,430 additions and 23 deletions.
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/bsend_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Bsend_f08(buf,count,datatype,dest,tag,comm,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
use :: ompi_mpifh_bindings, only : ompi_bsend_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/bsend_init_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ subroutine MPI_Bsend_init_f08(buf,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_bsend_init_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
subroutine MPI_Buffer_attach_f08(buffer,size,ierror)
use :: ompi_mpifh_bindings, only : ompi_buffer_attach_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS:: buffer
OMPI_F08_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buffer
INTEGER, INTENT(IN) :: size
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
integer :: c_ierror
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/f_sync_reg_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
subroutine MPI_F_sync_reg_f08(buf)
use :: ompi_mpifh_bindings, only : ompi_f_sync_reg_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS:: buf
OMPI_F08_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf

call ompi_f_sync_reg_f(buf)

Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/free_mem_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
subroutine MPI_Free_mem_f08(base,ierror)
use :: ompi_mpifh_bindings, only : ompi_free_mem_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: base
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
integer :: c_ierror

Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/get_address_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Get_address_f08(location,address,ierror)
use :: mpi_f08_types, only : MPI_ADDRESS_KIND
use :: ompi_mpifh_bindings, only : ompi_get_address_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: location
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: location
INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: address
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
integer :: c_ierror
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/ibsend_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Ibsend_f08(buf,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_ibsend_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/imrecv_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Imrecv_f08(buf,count,datatype,message,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Message, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_imrecv_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
OMPI_F08_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Message), INTENT(INOUT) :: message
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/irecv_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Irecv_f08(buf,count,datatype,source,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_irecv_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
OMPI_F08_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, source, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/irsend_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Irsend_f08(buf,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_irsend_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/isend_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Isend_f08(buf,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_isend_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/issend_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Issend_f08(buf,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_issend_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/mrecv_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Mrecv_f08(buf,count,datatype,message,status,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Message, MPI_Status
use :: ompi_mpifh_bindings, only : ompi_mrecv_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
OMPI_F08_IGNORE_TKR_TYPE :: buf
INTEGER, INTENT(IN) :: count
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Message), INTENT(INOUT) :: message
Expand Down
29 changes: 29 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/recv_f08.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
! -*- f90 -*-
!
! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
! All rights reserved.
! Copyright (c) 2018-2020 Research Organization for Information Science
! and Technology (RIST). All rights reserved.
! $COPYRIGHT$

#include "ompi/mpi/fortran/configure-fortran-output.h"

#include "mpi-f08-rename.h"

subroutine MPI_Recv_f08(buf,count,datatype,source,tag,comm,status,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status
use :: ompi_mpifh_bindings, only : ompi_recv_f
implicit none
OMPI_F08_IGNORE_TKR_TYPE :: buf
INTEGER, INTENT(IN) :: count, source, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
TYPE(MPI_Status), INTENT(OUT) :: status
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
integer :: c_ierror

call ompi_recv_f(buf,count,datatype%MPI_VAL,source,tag,comm%MPI_VAL,status,c_ierror)
if (present(ierror)) ierror = c_ierror

end subroutine MPI_Recv_f08
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ subroutine MPI_Recv_init_f08(buf,count,datatype,source,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_recv_init_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
OMPI_F08_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, source, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/rsend_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Rsend_f08(buf,count,datatype,dest,tag,comm,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
use :: ompi_mpifh_bindings, only : ompi_rsend_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/rsend_init_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Rsend_init_f08(buf,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_rsend_init_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS, INTENT(IN) :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
28 changes: 28 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/send_f08.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
! -*- f90 -*-
!
! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
! All rights reserved.
! Copyright (c) 2018-2020 Research Organization for Information Science
! and Technology (RIST). All rights reserved.
! $COPYRIGHT$

#include "ompi/mpi/fortran/configure-fortran-output.h"

#include "mpi-f08-rename.h"

subroutine MPI_Send_f08(buf,count,datatype,dest,tag,comm,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
use :: ompi_mpifh_bindings, only : ompi_send_f
implicit none
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
integer :: c_ierror

call ompi_send_f(buf,count,datatype%MPI_VAL,dest,tag,comm%MPI_VAL,c_ierror)
if (present(ierror)) ierror = c_ierror

end subroutine MPI_Send_f08
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/send_init_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Send_init_f08(buf,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_send_init_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS, INTENT(IN) :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
6 changes: 3 additions & 3 deletions ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#include "mpi-f08-rename.h"

subroutine MPI_Sendrecv_f08(sendbuf,sendcount,sendtype,dest,sendtag,recvbuf, &
recvcount,recvtype,source,recvtag,comm,status,ierror)
recvcount,recvtype,source,recvtag,comm,status,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status
use :: ompi_mpifh_bindings, only : ompi_sendrecv_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf
OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf
OMPI_F08_IGNORE_TKR_TYPE :: recvbuf
INTEGER, INTENT(IN) :: sendcount, dest, sendtag, recvcount, source, recvtag
TYPE(MPI_Datatype), INTENT(IN) :: sendtype
TYPE(MPI_Datatype), INTENT(IN) :: recvtype
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ subroutine MPI_Sendrecv_replace_f08(buf,count,datatype,dest,sendtag,source, &
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status
use :: ompi_mpifh_bindings, only : ompi_sendrecv_replace_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf
OMPI_F08_IGNORE_TKR_TYPE :: buf
INTEGER, INTENT(IN) :: count, dest, sendtag, source, recvtag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/ssend_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Ssend_f08(buf,count,datatype,dest,tag,comm,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
use :: ompi_mpifh_bindings, only : ompi_ssend_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/ssend_init_f08.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine MPI_Ssend_init_f08(buf,count,datatype,dest,tag,comm,request,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
use :: ompi_mpifh_bindings, only : ompi_ssend_init_f
implicit none
OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS, INTENT(IN) :: buf
OMPI_F08_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf
INTEGER, INTENT(IN) :: count, dest, tag
TYPE(MPI_Datatype), INTENT(IN) :: datatype
TYPE(MPI_Comm), INTENT(IN) :: comm
Expand Down
17 changes: 17 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/ts/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,23 @@ libusempif08_ts_la_SOURCES = \
scan_ts.c \
scatter_ts.c \
scatterv_ts.c \
bsend_ts.c \
bsend_init_ts.c \
buffer_attach_ts.c \
f_sync_reg_ts.c \
free_mem_ts.c \
get_address_ts.c \
ibsend_ts.c \
imrecv_ts.c \
irecv_ts.c \
irsend_ts.c \
isend_ts.c \
issend_ts.c \
mrecv_ts.c \
recv_ts.c \
recv_init_ts.c \
rsend_ts.c \
rsend_init_ts.c \
send_ts.c \
send_init_ts.c \
sendrecv_ts.c \
Expand Down
1 change: 1 addition & 0 deletions ompi/mpi/fortran/use-mpi-f08/ts/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void ompi_ssend_init_ts(CFI_cdesc_t* x, MPI_Fint *count, MPI_Fint *datatype,

void ompi_get_address_ts(CFI_cdesc_t *x, MPI_Aint *address, MPI_Fint *ierr);

<<<<<<< HEAD
void ompi_pack_ts(CFI_cdesc_t* x1, MPI_Fint *incount, MPI_Fint *datatype,
CFI_cdesc_t* x2, MPI_Fint *outsize, MPI_Fint *position,
MPI_Fint *comm, MPI_Fint *ierr);
Expand Down
61 changes: 61 additions & 0 deletions ompi/mpi/fortran/use-mpi-f08/ts/bsend_init_ts.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/

#include "ompi_config.h"

#include "ompi/communicator/communicator.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
#include "ompi/mpi/fortran/base/constants.h"

static const char FUNC_NAME[] = "MPI_Bsend_init";

void ompi_bsend_init_ts(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)
{
int c_ierr;
MPI_Datatype c_datatype, c_type = PMPI_Type_f2c(*datatype);
MPI_Request c_req;
MPI_Comm c_comm = PMPI_Comm_f2c (*comm);

void *buf = x->base_addr;
int c_count = OMPI_FINT_2_INT(*count);

OMPI_CFI_2_C(x, c_count, c_type, c_datatype, c_ierr);
if (MPI_SUCCESS != c_ierr) {
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
OMPI_ERRHANDLER_INVOKE(c_comm, c_ierr, FUNC_NAME);
return;
}

c_ierr = PMPI_Bsend_init(OMPI_F2C_BOTTOM(buf), c_count,
c_datatype,
OMPI_FINT_2_INT(*dest),
OMPI_FINT_2_INT(*tag),
c_comm, &c_req);
if (c_datatype != c_type) {
ompi_datatype_destroy(&c_datatype);
}
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);

if (MPI_SUCCESS == c_ierr) {
*request = PMPI_Request_c2f(c_req);
}
}
Loading

0 comments on commit 2935f92

Please sign in to comment.