Skip to content

Commit

Permalink
Convert MPI_Put and MPI_Raccumulate for Fortran
Browse files Browse the repository at this point in the history
  • Loading branch information
jtronge committed Sep 24, 2024
1 parent 89ed3e5 commit bd592ca
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 152 deletions.
2 changes: 0 additions & 2 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,7 @@ mpi_api_files = \
probe_f08.F90 \
psend_init_f08.F90 \
publish_name_f08.F90 \
put_f08.F90 \
query_thread_f08.F90 \
raccumulate_f08.F90 \
recv_init_f08.F90 \
reduce_init_f08.F90 \
reduce_local_f08.F90 \
Expand Down
4 changes: 2 additions & 2 deletions ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# $(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/f_sync_reg_ts.c.in

incomplete_prototype_files = \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/put_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/raccumulate_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/recv_init_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/reduce_local_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_ts.c.in \
Expand Down Expand Up @@ -133,6 +131,8 @@ complete_prototype_files = \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/pack_size.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/pack_external_size.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/pack_external_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/put_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/raccumulate_ts.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_vector.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_size.c.in \
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/type_indexed.c.in \
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/fortran/use-mpi-f08/get_ts.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

PROTOTYPE VOID get(BUFFER_ASYNC x, COUNT origin_count,
DATATYPE origin_datatype, RANK target_rank,
DISP target_disp, COUNT target_count,
AINT target_disp, COUNT target_count,
DATATYPE target_datatype, WIN win)
{
int c_ierr;
Expand Down
35 changes: 0 additions & 35 deletions ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2464,25 +2464,6 @@ subroutine MPI_Unpublish_name_f08(service_name,info,port_name,ierror)
end subroutine MPI_Unpublish_name_f08
end interface MPI_Unpublish_name

interface MPI_Raccumulate
subroutine MPI_Raccumulate_f08(origin_addr,origin_count,origin_datatype,target_rank, &
target_disp,target_count,target_datatype,op,win,request, &
ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_Request, MPI_ADDRESS_KIND
implicit none
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ origin_addr
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) OMPI_ASYNCHRONOUS :: origin_addr
INTEGER, INTENT(IN) :: origin_count, target_rank, target_count
TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype
INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp
TYPE(MPI_Datatype), INTENT(IN) :: target_datatype
TYPE(MPI_Op), INTENT(IN) :: op
TYPE(MPI_Win), INTENT(IN) :: win
TYPE(MPI_Request), INTENT(OUT) :: request
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Raccumulate_f08
end interface MPI_Raccumulate

interface MPI_Rget
subroutine MPI_Rget_f08(origin_addr,origin_count,origin_datatype,target_rank, &
target_disp,target_count,target_datatype,win,request,ierror)
Expand Down Expand Up @@ -2521,22 +2502,6 @@ subroutine MPI_Rget_accumulate_f08(origin_addr,origin_count,origin_datatype,resu
end subroutine MPI_Rget_accumulate_f08
end interface MPI_Rget_accumulate

interface MPI_Put
subroutine MPI_Put_f08(origin_addr,origin_count,origin_datatype,target_rank, &
target_disp,target_count,target_datatype,win,ierror)
use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND
implicit none
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ origin_addr
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) OMPI_ASYNCHRONOUS :: origin_addr
INTEGER, INTENT(IN) :: origin_count, target_rank, target_count
TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype
INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp
TYPE(MPI_Datatype), INTENT(IN) :: target_datatype
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
end subroutine MPI_Put_f08
end interface MPI_Put

interface MPI_Rput
subroutine MPI_Rput_f08(origin_addr,origin_count,origin_datatype,target_rank, &
target_disp,target_count,target_datatype,win,request,ierror)
Expand Down
32 changes: 0 additions & 32 deletions ompi/mpi/fortran/use-mpi-f08/put_f08.F90

This file was deleted.

33 changes: 12 additions & 21 deletions ompi/mpi/fortran/use-mpi-f08/put_ts.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,31 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "ompi/win/win.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_Put";

void ompi_put_ts(CFI_cdesc_t *x, MPI_Fint *origin_count,
MPI_Fint *origin_datatype, MPI_Fint *target_rank,
MPI_Aint *target_disp, MPI_Fint *target_count,
MPI_Fint *target_datatype, MPI_Fint *win, MPI_Fint *ierr)
PROTOTYPE VOID put(BUFFER x, COUNT origin_count,
DATATYPE origin_datatype, RANK target_rank,
AINT target_disp, COUNT target_count,
DATATYPE target_datatype, WIN win)
{
int c_ierr;
MPI_Datatype c_origin_datatype, c_origin_type = PMPI_Type_f2c(*origin_datatype);
MPI_Datatype c_target_datatype = PMPI_Type_f2c(*target_datatype);
MPI_Win c_win = PMPI_Win_f2c(*win);
char *origin_addr = OMPI_CFI_BASE_ADDR(x);
int c_origin_count = OMPI_INT_2_FINT(*origin_count);
@COUNT_TYPE@ c_origin_count = (@COUNT_TYPE@)*origin_count;

OMPI_CFI_2_C(x, c_origin_count, c_origin_type, c_origin_datatype, c_ierr);
if (MPI_SUCCESS != c_ierr) {
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
OMPI_ERRHANDLER_INVOKE(c_win, c_ierr, FUNC_NAME)
return;
}
c_ierr = PMPI_Put(OMPI_F2C_BOTTOM(origin_addr),
c_origin_count,
c_origin_datatype,
OMPI_FINT_2_INT(*target_rank),
*target_disp,
OMPI_FINT_2_INT(*target_count),
c_target_datatype, c_win);
c_ierr = @INNER_CALL@(OMPI_F2C_BOTTOM(origin_addr),
c_origin_count,
c_origin_datatype,
OMPI_FINT_2_INT(*target_rank),
*target_disp,
(@COUNT_TYPE@) *target_count,
c_target_datatype, c_win);
if (c_origin_datatype != c_origin_type) {
ompi_datatype_destroy(&c_origin_datatype);
}
Expand Down
36 changes: 0 additions & 36 deletions ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90

This file was deleted.

37 changes: 14 additions & 23 deletions ompi/mpi/fortran/use-mpi-f08/raccumulate_ts.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,11 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "ompi/win/win.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_Raccumulate";

void ompi_raccumulate_ts(CFI_cdesc_t *x, MPI_Fint *origin_count,
MPI_Fint *origin_datatype, MPI_Fint *target_rank,
MPI_Aint *target_disp, MPI_Fint *target_count,
MPI_Fint *target_datatype, MPI_Fint *op, MPI_Fint *win,
MPI_Fint *request, MPI_Fint *ierr)
PROTOTYPE VOID raccumulate(BUFFER x, COUNT origin_count,
DATATYPE origin_datatype, RANK target_rank,
AINT target_disp, COUNT target_count,
DATATYPE target_datatype, OP op, WIN win,
REQUEST_OUT request)
{
int c_ierr;

Expand All @@ -45,22 +36,22 @@ void ompi_raccumulate_ts(CFI_cdesc_t *x, MPI_Fint *origin_count,
MPI_Op c_op = PMPI_Op_f2c(*op);
MPI_Request c_req;
char *origin_addr = OMPI_CFI_BASE_ADDR(x);
int c_origin_count = OMPI_INT_2_FINT(*origin_count);
@COUNT_TYPE@ c_origin_count = (@COUNT_TYPE@) *origin_count;

OMPI_CFI_2_C(x, c_origin_count, c_origin_type, c_origin_datatype, c_ierr);
if (MPI_SUCCESS != c_ierr) {
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
OMPI_ERRHANDLER_INVOKE(c_win, c_ierr, FUNC_NAME)
return;
}
c_ierr = PMPI_Raccumulate(OMPI_F2C_BOTTOM(origin_addr),
c_origin_count,
c_origin_datatype,
OMPI_FINT_2_INT(*target_rank),
*target_disp,
OMPI_FINT_2_INT(*target_count),
c_target_datatype, c_op, c_win,
&c_req);
c_ierr = @INNER_CALL@(OMPI_F2C_BOTTOM(origin_addr),
c_origin_count,
c_origin_datatype,
OMPI_FINT_2_INT(*target_rank),
*target_disp,
(@COUNT_TYPE@) *target_count,
c_target_datatype, c_op, c_win,
&c_req);
if (c_origin_datatype != c_origin_type) {
ompi_datatype_destroy(&c_origin_datatype);
}
Expand Down

0 comments on commit bd592ca

Please sign in to comment.