Skip to content

Commit e1134af

Browse files
committed
pcomm:fix fortran interface for precv/psend
The Fortran interfaces were using INTEGER for count argument. The MPI-4 standard states that this argument should be INTEGER(KIND=MPI_COUNT_KIND). related to #11982 Signed-off-by: Howard Pritchard <[email protected]>
1 parent a1b02c6 commit e1134af

File tree

8 files changed

+43
-25
lines changed

8 files changed

+43
-25
lines changed

ompi/mpi/fortran/mpif-h/precv_init_f.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2020 Sandia National Laboratories. All rights reserved.
1616
* Copyright (c) 2021 Bull S.A.S. All rights reserved.
17+
* Copyright (c) 2023 Triad National Security, LLC. All rights
18+
* reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -41,7 +43,7 @@ OMPI_GENERATE_F77_BINDINGS (PMPI_PRECV_INIT,
4143
pmpi_precv_init_,
4244
pmpi_precv_init__,
4345
pompi_precv_init_f,
44-
(char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr),
46+
(char *buf, MPI_Fint *partitions, MPI_Count *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr),
4547
(buf, partitions, count, datatype, dest, tag, comm, info, request, ierr) )
4648
#endif
4749
#endif
@@ -61,15 +63,15 @@ OMPI_GENERATE_F77_BINDINGS (MPI_PRECV_INIT,
6163
mpi_precv_init_,
6264
mpi_precv_init__,
6365
ompi_precv_init_f,
64-
(char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr),
66+
(char *buf, MPI_Fint *partitions, MPI_Count *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr),
6567
(buf, partitions, count, datatype, dest, tag, comm, info, request, ierr) )
6668
#else
6769
#define ompi_precv_init_f pompi_precv_init_f
6870
#endif
6971
#endif
7072

7173

72-
void ompi_precv_init_f(char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)
74+
void ompi_precv_init_f(char *buf, MPI_Fint *partitions, MPI_Count *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)
7375
{
7476
int c_ierr;
7577
MPI_Info c_info;
@@ -82,7 +84,7 @@ void ompi_precv_init_f(char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fin
8284

8385
c_ierr = PMPI_Precv_init(OMPI_F2C_BOTTOM(buf),
8486
OMPI_FINT_2_INT(*partitions),
85-
OMPI_FINT_2_INT(*count),
87+
*count,
8688
c_type, OMPI_FINT_2_INT(*dest),
8789
OMPI_FINT_2_INT(*tag),
8890
c_comm, c_info, &c_req);

ompi/mpi/fortran/mpif-h/prototypes_mpi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* reserved.
1717
* Copyright (c) 2016-2023 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
19-
* Copyright (c) 2019-2022 Triad National Security, LLC. All rights
19+
* Copyright (c) 2019-2023 Triad National Security, LLC. All rights
2020
* reserved.
2121
* Copyright (c) 2021 Bull S.A.S. All rights reserved.
2222
* $COPYRIGHT$
@@ -355,8 +355,8 @@ PN2(void, MPI_Pcontrol, mpi_pcontrol, MPI_PCONTROL, (MPI_Fint *level));
355355
PN2(void, MPI_Pready, mpi_pready, MPI_PREADY, (MPI_Fint *partition, MPI_Fint *request, MPI_Fint *ierr));
356356
PN2(void, MPI_Pready_list, mpi_pready_list, MPI_PREADY_LIST, (MPI_Fint *length, MPI_Fint *partition, MPI_Fint *request, MPI_Fint *ierr));
357357
PN2(void, MPI_Pready_range, mpi_pready_range, MPI_PREADY_RANGE, (MPI_Fint *partition_low, MPI_Fint *partition_high, MPI_Fint *request, MPI_Fint *ierr));
358-
PN2(void, MPI_Precv_init, mpi_precv_init, MPI_PRECV_INIT, (char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *src, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr));
359-
PN2(void, MPI_Psend_init, mpi_psend_init, MPI_PSEND_INIT, (char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr));
358+
PN2(void, MPI_Precv_init, mpi_precv_init, MPI_PRECV_INIT, (char *buf, MPI_Fint *partitions, MPI_Count *count, MPI_Fint *datatype, MPI_Fint *src, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr));
359+
PN2(void, MPI_Psend_init, mpi_psend_init, MPI_PSEND_INIT, (char *buf, MPI_Fint *partitions, MPI_Count *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr));
360360
PN2(void, MPI_Probe, mpi_probe, MPI_PROBE, (MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *status, MPI_Fint *ierr));
361361
PN2(void, MPI_Publish_name, mpi_publish_name, MPI_PUBLISH_NAME, (char *service_name, MPI_Fint *info, char *port_name, MPI_Fint *ierr, int service_name_len, int port_name_len));
362362
PN2(void, MPI_Put, mpi_put, MPI_PUT, (char *origin_addr, 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));

ompi/mpi/fortran/mpif-h/psend_init_f.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2020 Sandia National Laboratories. All rights reserved.
1616
* Copyright (c) 2021 Bull S.A.S. All rights reserved.
17+
* Copyright (c) 2023 Triad National Security, LLC. All rights
18+
* reserved.
1719
* $COPYRIGHT$
1820
*
1921
* Additional copyrights may follow
@@ -41,7 +43,7 @@ OMPI_GENERATE_F77_BINDINGS (PMPI_PSEND_INIT,
4143
pmpi_psend_init_,
4244
pmpi_psend_init__,
4345
pompi_psend_init_f,
44-
(char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr),
46+
(char *buf, MPI_Fint *partitions, MPI_Count *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr),
4547
(buf, partitions, count, datatype, dest, tag, comm, info, request, ierr) )
4648
#endif
4749
#endif
@@ -61,15 +63,15 @@ OMPI_GENERATE_F77_BINDINGS (MPI_PSEND_INIT,
6163
mpi_psend_init_,
6264
mpi_psend_init__,
6365
ompi_psend_init_f,
64-
(char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr),
66+
(char *buf, MPI_Fint *partitions, MPI_Count *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr),
6567
(buf, partitions, count, datatype, dest, tag, comm, info, request, ierr) )
6668
#else
6769
#define ompi_psend_init_f pompi_psend_init_f
6870
#endif
6971
#endif
7072

7173

72-
void ompi_psend_init_f(char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)
74+
void ompi_psend_init_f(char *buf, MPI_Fint *partitions, MPI_Count *count, MPI_Fint *datatype, MPI_Fint *dest, MPI_Fint *tag, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)
7375
{
7476
int c_ierr;
7577
MPI_Info c_info;
@@ -82,7 +84,7 @@ void ompi_psend_init_f(char *buf, MPI_Fint *partitions, MPI_Fint *count, MPI_Fin
8284

8385
c_ierr = PMPI_Psend_init(OMPI_F2C_BOTTOM(buf),
8486
OMPI_FINT_2_INT(*partitions),
85-
OMPI_FINT_2_INT(*count),
87+
*count,
8688
c_type, OMPI_FINT_2_INT(*dest),
8789
OMPI_FINT_2_INT(*tag),
8890
c_comm, c_info, &c_req);

ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,11 @@ end subroutine ompi_issend_f
310310

311311
subroutine ompi_psend_init_f(buf,partitions,count,datatype,dest,tag,comm,info,request,ierror) &
312312
BIND(C, name="ompi_psend_init_f")
313+
use :: mpi_f08_types, only : MPI_COUNT_KIND
313314
implicit none
314315
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
315-
INTEGER, INTENT(IN) :: partitions, count, dest, tag
316+
INTEGER, INTENT(IN) :: partitions, dest, tag
317+
INTEGER(KIND=MPI_COUNT_KIND), INTENT(IN):: count
316318
INTEGER, INTENT(IN) :: datatype
317319
INTEGER, INTENT(IN) :: comm
318320
INTEGER, INTENT(IN) :: info
@@ -322,9 +324,11 @@ end subroutine ompi_psend_init_f
322324

323325
subroutine ompi_precv_init_f(buf,partitions,count,datatype,dest,tag,comm,info,request,ierror) &
324326
BIND(C, name="ompi_precv_init_f")
327+
use :: mpi_f08_types, only : MPI_COUNT_KIND
325328
implicit none
326329
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
327-
INTEGER, INTENT(IN) :: partitions, count, dest, tag
330+
INTEGER, INTENT(IN) :: partitions, dest, tag
331+
INTEGER(KIND=MPI_COUNT_KIND), INTENT(IN):: count
328332
INTEGER, INTENT(IN) :: datatype
329333
INTEGER, INTENT(IN) :: comm
330334
INTEGER, INTENT(IN) :: info

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
! Copyright (c) 2015-2020 Research Organization for Information Science
1111
! and Technology (RIST). All rights reserved.
1212
! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved.
13-
! Copyright (c) 2021-2022 Triad National Security, LLC. All rights
13+
! Copyright (c) 2021-2023 Triad National Security, LLC. All rights
1414
! reserved.
1515
! $COPYRIGHT$
1616
!
@@ -201,15 +201,16 @@ end interface MPI_Issend
201201

202202
interface MPI_Precv_init
203203
subroutine MPI_Precv_init_f08(buf,partitions,count,datatype,dest,tag,comm,request,ierror)
204-
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
204+
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_COUNT_KIND
205205
implicit none
206206
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
207207
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
208208
!$PRAGMA IGNORE_TKR buf
209209
!DIR$ IGNORE_TKR buf
210210
!IBM* IGNORE_TKR buf
211211
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
212-
INTEGER, INTENT(IN) :: partitions, count, dest, tag
212+
INTEGER, INTENT(IN) :: partitions, dest, tag
213+
INTEGER(MPI_COUNT_KIND), INTENT(IN) :: count
213214
TYPE(MPI_Datatype), INTENT(IN) :: datatype
214215
TYPE(MPI_Comm), INTENT(IN) :: comm
215216
TYPE(MPI_Request), INTENT(OUT) :: request
@@ -219,15 +220,16 @@ end interface MPI_Precv_init
219220

220221
interface MPI_Psend_init
221222
subroutine MPI_Psend_init_f08(buf,partitions,count,datatype,dest,tag,comm,request,ierror)
222-
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request
223+
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_COUNT_KIND
223224
implicit none
224225
!DEC$ ATTRIBUTES NO_ARG_CHECK :: buf
225226
!GCC$ ATTRIBUTES NO_ARG_CHECK :: buf
226227
!$PRAGMA IGNORE_TKR buf
227228
!DIR$ IGNORE_TKR buf
228229
!IBM* IGNORE_TKR buf
229230
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
230-
INTEGER, INTENT(IN) :: partitions, count, dest, tag
231+
INTEGER, INTENT(IN) :: partitions, dest, tag
232+
INTEGER(MPI_COUNT_KIND), INTENT(IN) :: count
231233
TYPE(MPI_Datatype), INTENT(IN) :: datatype
232234
TYPE(MPI_Comm), INTENT(IN) :: comm
233235
TYPE(MPI_Request), INTENT(OUT) :: request

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77
! and Technology (RIST). All rights reserved.
88
! Copyright (c) 2020 Sandia National Laboratories. All rights reserved.
99
! Copyright (c) 2021 Bull S.A.S. All rights reserved.
10+
! Copyright (c) 2023 Triad National Security, LLC. All rights
11+
! reserved.
1012
! $COPYRIGHT$
1113

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

1416
#include "mpi-f08-rename.h"
1517

1618
subroutine MPI_Precv_init_f08(buf,partitions,count,datatype,dest,tag,comm,info,request,ierror)
17-
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request
19+
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request, MPI_COUNT_KIND
1820
use :: ompi_mpifh_bindings, only : ompi_precv_init_f
1921
implicit none
2022
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
21-
INTEGER, INTENT(IN) :: partitions,count, dest, tag
23+
INTEGER, INTENT(IN) :: partitions, dest, tag
24+
INTEGER(KIND=MPI_COUNT_KIND), INTENT(IN) :: count
2225
TYPE(MPI_Datatype), INTENT(IN) :: datatype
2326
TYPE(MPI_Comm), INTENT(IN) :: comm
2427
TYPE(MPI_Info), INTENT(IN) :: info

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
! and Technology (RIST). All rights reserved.
88
! Copyright (c) 2020 Sandia National Laboratories. All rights reserved.
99
! Copyright (c) 2021 Bull S.A.S. All rights reserved.
10+
! Copyright (c) 2023 Triad National Security, LLC. All rights
11+
! reserved.
1012
! $COPYRIGHT$
1113

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

1416
subroutine MPI_Psend_init_f08(buf,partitions,count,datatype,dest,tag,comm,info,request,ierror)
15-
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request
17+
use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request, MPI_COUNT_KIND
1618
use :: ompi_mpifh_bindings, only : ompi_psend_init_f
1719
implicit none
1820
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
19-
INTEGER, INTENT(IN) :: partitions,count, dest, tag
21+
INTEGER, INTENT(IN) :: partitions, dest, tag
22+
INTEGER(KIND=MPI_COUNT_KIND), INTENT(IN) :: count
2023
TYPE(MPI_Datatype), INTENT(IN) :: datatype
2124
TYPE(MPI_Comm), INTENT(IN) :: comm
2225
TYPE(MPI_Info), INTENT(IN) :: info

ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-interfaces.h.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
! reserved.
1212
! Copyright (c) 2015-2023 Research Organization for Information Science
1313
! and Technology (RIST). All rights reserved.
14-
! Copyright (c) 2019-2022 Triad National Security, LLC. All rights
14+
! Copyright (c) 2019-2023 Triad National Security, LLC. All rights
1515
! reserved.
1616
! Copyright (c) 2021 Bull S.A.S. All rights reserved.
1717
! Copyright (c) 2021 IBM Corporation. All rights reserved.
@@ -2619,10 +2619,11 @@ interface
26192619

26202620
subroutine MPI_Psend_init(buf, partitions, count, datatype, dest, tag, &
26212621
comm, info, request, ierror)
2622+
include 'mpif-config.h'
26222623
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ buf
26232624
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, intent(in) :: buf
26242625
integer, intent(in) :: partitions
2625-
integer, intent(in) :: count
2626+
integer(KIND=MPI_COUNT_KIND), intent(in) :: count
26262627
integer, intent(in) :: datatype
26272628
integer, intent(in) :: dest
26282629
integer, intent(in) :: tag
@@ -2639,10 +2640,11 @@ interface
26392640

26402641
subroutine MPI_Precv_init(buf, partitions, count, datatype, dest, tag, &
26412642
comm, info, request, ierror)
2643+
include 'mpif-config.h'
26422644
@OMPI_FORTRAN_IGNORE_TKR_PREDECL@ buf
26432645
@OMPI_FORTRAN_IGNORE_TKR_TYPE@, intent(in) :: buf
26442646
integer, intent(in) :: partitions
2645-
integer, intent(in) :: count
2647+
integer(KIND=MPI_COUNT_KIND), intent(in) :: count
26462648
integer, intent(in) :: datatype
26472649
integer, intent(in) :: dest
26482650
integer, intent(in) :: tag

0 commit comments

Comments
 (0)