Skip to content

Commit d4fe783

Browse files
committed
Convert MPI_Neighbor_allgather* functions for Fortran
Signed-off-by: Jake Tronge <jtronge@lanl.gov>
1 parent 30e6da6 commit d4fe783

File tree

7 files changed

+33
-148
lines changed

7 files changed

+33
-148
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ mpi_api_files = \
264264
is_thread_main_f08.F90 \
265265
lookup_name_f08.F90 \
266266
mprobe_f08.F90 \
267-
neighbor_allgather_f08.F90 \
268267
neighbor_allgather_init_f08.F90 \
269-
neighbor_allgatherv_f08.F90 \
270268
neighbor_allgatherv_init_f08.F90 \
271269
neighbor_alltoall_f08.F90 \
272270
neighbor_alltoall_init_f08.F90 \

ompi/mpi/fortran/use-mpi-f08/Makefile.prototype_files

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# $(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/f_sync_reg_ts.c.in
77

88
incomplete_prototype_files = \
9-
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_ts.c.in \
10-
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_ts.c.in \
119
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_ts.c.in \
1210
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_ts.c.in \
1311
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallw_ts.c.in \
@@ -116,6 +114,8 @@ complete_prototype_files = \
116114
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/isend_ts.c.in \
117115
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/issend_ts.c.in \
118116
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/mrecv_ts.c.in \
117+
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_ts.c.in \
118+
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_ts.c.in \
119119
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/recv_ts.c.in \
120120
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/reduce_ts.c.in \
121121
$(abs_top_srcdir)/ompi/mpi/fortran/use-mpi-f08/send_ts.c.in \

ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h.in

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3172,21 +3172,6 @@ subroutine MPI_Improbe_f08(source,tag,comm,flag,message,status,ierror)
31723172
end subroutine MPI_Improbe_f08
31733173
end interface MPI_Improbe
31743174

3175-
interface MPI_Neighbor_allgather
3176-
subroutine MPI_Neighbor_allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, &
3177-
comm,ierror)
3178-
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
3179-
implicit none
3180-
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ sendbuf, recvbuf
3181-
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) :: sendbuf
3182-
@OMPI_FORTRAN_IGNORE_TKR_TYPE@ :: recvbuf
3183-
INTEGER, INTENT(IN) :: sendcount, recvcount
3184-
TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype
3185-
TYPE(MPI_Comm), INTENT(IN) :: comm
3186-
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
3187-
end subroutine MPI_Neighbor_allgather_f08
3188-
end interface MPI_Neighbor_allgather
3189-
31903175
interface MPI_Neighbor_allgather_init
31913176
subroutine MPI_Neighbor_allgather_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, &
31923177
comm,info,request,ierror)
@@ -3204,22 +3189,6 @@ subroutine MPI_Neighbor_allgather_init_f08(sendbuf,sendcount,sendtype,recvbuf,re
32043189
end subroutine MPI_Neighbor_allgather_init_f08
32053190
end interface MPI_Neighbor_allgather_init
32063191

3207-
interface MPI_Neighbor_allgatherv
3208-
subroutine MPI_Neighbor_allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs, &
3209-
recvtype,comm,ierror)
3210-
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm
3211-
implicit none
3212-
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ sendbuf, recvbuf
3213-
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, INTENT(IN) :: sendbuf
3214-
@OMPI_FORTRAN_IGNORE_TKR_TYPE@ :: recvbuf
3215-
INTEGER, INTENT(IN) :: sendcount
3216-
INTEGER, INTENT(IN) :: recvcounts(*), displs(*)
3217-
TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype
3218-
TYPE(MPI_Comm), INTENT(IN) :: comm
3219-
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
3220-
end subroutine MPI_Neighbor_allgatherv_f08
3221-
end interface MPI_Neighbor_allgatherv
3222-
32233192
interface MPI_Neighbor_allgatherv_init
32243193
subroutine MPI_Neighbor_allgatherv_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs, &
32253194
recvtype,comm,info,request,ierror)

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

Lines changed: 0 additions & 32 deletions
This file was deleted.

ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_ts.c.in

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,18 @@
2222
* $HEADER$
2323
*/
2424

25-
#include "ompi_config.h"
26-
27-
#include "ompi/communicator/communicator.h"
28-
#include "ompi/errhandler/errhandler.h"
29-
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
30-
#include "ompi/mpi/fortran/base/constants.h"
31-
32-
static const char FUNC_NAME[] = "MPI_Neighbor_allgather";
33-
34-
void ompi_neighbor_allgather_ts(CFI_cdesc_t *x1, MPI_Fint *sendcount, MPI_Fint *sendtype,
35-
CFI_cdesc_t *x2, MPI_Fint *recvcount, MPI_Fint *recvtype,
36-
MPI_Fint *comm, MPI_Fint *ierr)
25+
PROTOTYPE VOID neighbor_allgather(BUFFER x1, COUNT sendcount, DATATYPE sendtype,
26+
BUFFER_OUT x2, COUNT recvcount, DATATYPE recvtype,
27+
COMM comm)
3728
{
3829
int c_ierr;
3930
MPI_Comm c_comm = PMPI_Comm_f2c(*comm);
4031
MPI_Datatype c_senddatatype, c_sendtype = PMPI_Type_f2c(*sendtype);
4132
void *sendbuf = OMPI_CFI_BASE_ADDR(x1);
42-
int c_sendcount = OMPI_FINT_2_INT(*sendcount);
33+
@COUNT_TYPE@ c_sendcount = (@COUNT_TYPE@) *sendcount;
4334
MPI_Datatype c_recvtype = PMPI_Type_f2c(*recvtype);
4435
void *recvbuf = OMPI_CFI_BASE_ADDR(x2);
45-
int c_recvcount = OMPI_FINT_2_INT(*recvcount);
36+
@COUNT_TYPE@ c_recvcount = (@COUNT_TYPE@) *recvcount;
4637

4738
OMPI_CFI_CHECK_CONTIGUOUS(x2, c_ierr);
4839
if (MPI_SUCCESS != c_ierr) {
@@ -64,12 +55,14 @@ void ompi_neighbor_allgather_ts(CFI_cdesc_t *x1, MPI_Fint *sendcount, MPI_Fint *
6455
sendbuf = (char *) OMPI_F2C_BOTTOM(sendbuf);
6556
recvbuf = (char *) OMPI_F2C_BOTTOM(recvbuf);
6657

67-
c_ierr = PMPI_Neighbor_allgather(sendbuf,
68-
c_sendcount,
69-
c_sendtype,
70-
recvbuf,
71-
c_recvcount,
72-
c_recvtype, c_comm);
58+
c_ierr = @INNER_CALL@(sendbuf,
59+
c_sendcount,
60+
c_sendtype,
61+
recvbuf,
62+
c_recvcount,
63+
c_recvtype, c_comm);
64+
65+
/* TODO: Created type c_senddatatype is not being used above */
7366

7467
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
7568
}

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

Lines changed: 0 additions & 34 deletions
This file was deleted.

ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_ts.c.in

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,18 @@
2222
* $HEADER$
2323
*/
2424

25-
#include "ompi_config.h"
26-
27-
#include "ompi/communicator/communicator.h"
28-
#include "ompi/errhandler/errhandler.h"
29-
#include "ompi/mpi/fortran/use-mpi-f08/ts/bindings.h"
30-
#include "ompi/mpi/fortran/base/constants.h"
31-
32-
static const char FUNC_NAME[] = "MPI_Neighbor_allgatherv";
33-
34-
void ompi_neighbor_allgatherv_ts(CFI_cdesc_t *x1, MPI_Fint *sendcount, MPI_Fint *sendtype,
35-
CFI_cdesc_t *x2, MPI_Fint *recvcounts, MPI_Fint *displs,
36-
MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr)
25+
PROTOTYPE VOID neighbor_allgatherv(BUFFER x1, COUNT sendcount, DATATYPE sendtype,
26+
BUFFER_OUT x2, COUNT_ARRAY recvcounts, DISP_ARRAY displs,
27+
DATATYPE recvtype, COMM comm)
3728
{
3829
MPI_Comm c_comm = PMPI_Comm_f2c(*comm);
3930
MPI_Datatype c_senddatatype, c_sendtype = PMPI_Type_f2c(*sendtype);
4031
char *sendbuf = OMPI_CFI_BASE_ADDR(x1), *recvbuf = OMPI_CFI_BASE_ADDR(x2);
41-
int c_sendcount = OMPI_FINT_2_INT(*sendcount);
32+
@COUNT_TYPE@ c_sendcount = (@COUNT_TYPE@) *sendcount;
4233
MPI_Datatype c_recvtype = PMPI_Type_f2c(*recvtype);
4334
int size, c_ierr;
44-
OMPI_ARRAY_NAME_DECL(recvcounts);
45-
OMPI_ARRAY_NAME_DECL(displs);
35+
@COUNT_TYPE@ *tmp_recvcounts = NULL;
36+
@DISP_TYPE@ *tmp_displs = NULL;
4637

4738
OMPI_CFI_CHECK_CONTIGUOUS(x2, c_ierr);
4839
if (MPI_SUCCESS != c_ierr) {
@@ -61,25 +52,25 @@ void ompi_neighbor_allgatherv_ts(CFI_cdesc_t *x1, MPI_Fint *sendcount, MPI_Fint
6152
c_recvtype = PMPI_Type_f2c(*recvtype);
6253

6354
PMPI_Comm_size(c_comm, &size);
64-
OMPI_ARRAY_FINT_2_INT(recvcounts, size);
65-
OMPI_ARRAY_FINT_2_INT(displs, size);
55+
OMPI_FORTRAN_BIGCOUNT_ARRAY_SET(recvcounts, tmp_recvcounts, size);
56+
OMPI_FORTRAN_BIGCOUNT_ARRAY_SET(displs, tmp_displs, size);
6657

6758
sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf);
6859
sendbuf = (char *) OMPI_F2C_BOTTOM(sendbuf);
6960
recvbuf = (char *) OMPI_F2C_BOTTOM(recvbuf);
7061

71-
c_ierr = PMPI_Neighbor_allgatherv(sendbuf,
72-
c_sendcount,
73-
c_sendtype,
74-
recvbuf,
75-
OMPI_ARRAY_NAME_CONVERT(recvcounts),
76-
OMPI_ARRAY_NAME_CONVERT(displs),
77-
c_recvtype, c_comm);
62+
c_ierr = @INNER_CALL@(sendbuf,
63+
c_sendcount,
64+
c_sendtype,
65+
recvbuf,
66+
tmp_recvcounts,
67+
tmp_displs,
68+
c_recvtype, c_comm);
7869

79-
/* TODO: Free datatypes */
70+
/* TODO: Free datatypes (note: it also looks like the code above is not using the datatypes) */
8071

8172
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
8273

83-
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
84-
OMPI_ARRAY_FINT_2_INT_CLEANUP(displs);
74+
OMPI_FORTRAN_BIGCOUNT_ARRAY_CLEANUP(recvcounts, tmp_recvcounts);
75+
OMPI_FORTRAN_BIGCOUNT_ARRAY_CLEANUP(displs, tmp_displs);
8576
}

0 commit comments

Comments
 (0)