Skip to content

Commit 2fc1675

Browse files
committed
feat: add MPI_REAL in mpi_constants.c
1 parent f865434 commit 2fc1675

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/mpi.f90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module mpi
55
integer, parameter :: MPI_THREAD_FUNNELED = 1
66

77
integer, parameter :: MPI_INTEGER = -10002
8+
integer, parameter :: MPI_REAL = -10003
89
integer, parameter :: MPI_DOUBLE_PRECISION = -10004
910
integer, parameter :: MPI_REAL4 = -10013
1011
integer, parameter :: MPI_REAL8 = -10014
@@ -173,10 +174,12 @@ integer(kind=MPI_HANDLE_KIND) function handle_mpi_info_f2c(info_f) result(c_info
173174
end function handle_mpi_info_f2c
174175

175176
integer(kind=MPI_HANDLE_KIND) function handle_mpi_datatype_f2c(datatype_f) result(c_datatype)
176-
use mpi_c_bindings, only: c_mpi_float, c_mpi_double, c_mpi_int, c_mpi_logical, c_mpi_character
177+
use mpi_c_bindings, only: c_mpi_float, c_mpi_double, c_mpi_int, c_mpi_logical, c_mpi_character, c_mpi_real
177178
integer, intent(in) :: datatype_f
178179
if (datatype_f == MPI_REAL4) then
179180
c_datatype = c_mpi_float
181+
else if (datatype_f == MPI_REAL) then
182+
c_datatype = c_mpi_real
180183
else if (datatype_f == MPI_REAL8 .OR. datatype_f == MPI_DOUBLE_PRECISION) then
181184
c_datatype = c_mpi_double
182185
else if (datatype_f == MPI_INTEGER) then

src/mpi_c_bindings.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module mpi_c_bindings
1414
integer(kind=MPI_HANDLE_KIND), bind(C, name="c_MPI_INFO_NULL") :: c_mpi_info_null
1515
integer(kind=MPI_HANDLE_KIND), bind(C, name="c_MPI_DOUBLE") :: c_mpi_double
1616
integer(kind=MPI_HANDLE_KIND), bind(C, name="c_MPI_FLOAT") :: c_mpi_float
17+
integer(kind=MPI_HANDLE_KIND), bind(C, name="c_MPI_REAL") :: c_mpi_real
1718
integer(kind=MPI_HANDLE_KIND), bind(C, name="c_MPI_INT") :: c_mpi_int
1819
integer(kind=MPI_HANDLE_KIND), bind(C, name="c_MPI_COMM_WORLD") :: c_mpi_comm_world
1920
integer(kind=MPI_HANDLE_KIND), bind(C, name="c_MPI_SUM") :: c_mpi_sum

src/mpi_constants.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ MPI_Op c_MPI_MAX = MPI_MAX;
2020

2121
MPI_Datatype c_MPI_LOGICAL = MPI_LOGICAL;
2222

23-
MPI_Datatype c_MPI_CHARACTER = MPI_CHARACTER;
23+
MPI_Datatype c_MPI_CHARACTER = MPI_CHARACTER;
24+
25+
MPI_Datatype c_MPI_REAL = MPI_REAL;

0 commit comments

Comments
 (0)