Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit c210833

Browse files
committed
fortran: Add missing predefined datatype named constants.
This commit add the following Fortran named constants which are defined in the MPI standard but are missing in Open MPI. - `MPI_LONG_LONG` (defined as a synonym of `MPI_LONG_LONG_INT`) - `MPI_CXX_FLOAT_COMPLEX` - `MPI_C_BOOL` Each needs a different solution described below. For `MPI_LONG_LONG`: The value of `MPI_LONG_LONG` is defined to have a same value as `MPI_LONG_LONG_INT` because of the following reasons. 1. It is defined as a synonym of `MPI_LONG_LONG_INT` in the MPI standard. 2. `MPI_LONG_LONG_INT` and `MPI_LONG_LONG` has a same value for C in `mpi.h`. 3. `ompi_mpi_long_long` is not defined in `ompi/datatype/ompi_datatype_module.c`. For `MPI_CXX_FLOAT_COMPLEX`: Existing `MPI_CXX_COMPLEX` is replaced with `MPI_CXX_FLOAT_COMPLEX` bacause `MPI_CXX_FLOAT_COMPLEX` is the right name defined in MPI-3.1 and `MPI_CXX_COMPLEX` is not defined in MPI-3.1 (nor older). But for compatibility, `MPI_CXX_COMPLEX` is treated as a synonym of `MPI_CXX_FLOAT_COMPLEX` on Open MPI. For `MPI_C_BOOL`: `MPI_C_BOOL` is newly added. Though the best postion of it is the line between `MPI_OFFSET` and `MPI_C_COMPLEX`, it is put in the last line to keep the binary compatibility of Fortran `MPI_C_COMPLEX` between v2.0.0 and v2.0.x. This is the difference between master and v2.x. In addition, `MPI_CXX_COMPLEX`, which was defined only in the Open MPI Fortran binding, is added to `mpi.h` for the C binding. (back-ported from commit open-mpi/ompi@5383003) (change regarding `MPI_C_COMPLEX` is excluded for the binary compatibility)
1 parent 240838d commit c210833

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

ompi/datatype/ompi_datatype_module.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ int32_t ompi_datatype_init( void )
536536
}
537537

538538
/*
539-
* This MUST match the order of ompi/include/mpif-common.h
539+
* This MUST match the order of ompi/include/mpif-values.pl
540540
* Any change will break binary compatibility of Fortran programs.
541541
*/
542542
MOOG(datatype_null, 0);
@@ -625,6 +625,9 @@ int32_t ompi_datatype_init( void )
625625
/* MPI 3.0 types */
626626
MOOG(count, 72);
627627

628+
/* MPI 2.2 types (again) */
629+
MOOG(c_bool, 73);
630+
628631
/**
629632
* Now make sure all non-contiguous types are marked as such.
630633
*/

ompi/include/mpi.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,7 @@ OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE;
11631163
#define MPI_C_LONG_DOUBLE_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_c_long_double_complex)
11641164
#endif
11651165
#define MPI_CXX_BOOL OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_bool)
1166+
#define MPI_CXX_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_cplex)
11661167
#define MPI_CXX_FLOAT_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_cplex)
11671168
#define MPI_CXX_DOUBLE_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_dblcplex)
11681169
#define MPI_CXX_LONG_DOUBLE_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_ldblcplex)

ompi/include/mpif-values.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ sub write_file {
162162
$handles->{MPI_LONG} = 41;
163163
$handles->{MPI_UNSIGNED_LONG} = 42;
164164
$handles->{MPI_LONG_LONG_INT} = 43;
165+
$handles->{MPI_LONG_LONG} = $handles->{MPI_LONG_LONG_INT};
165166
$handles->{MPI_UNSIGNED_LONG_LONG} = 44;
166167
$handles->{MPI_FLOAT} = 45;
167168
$handles->{MPI_DOUBLE} = 46;
@@ -173,7 +174,8 @@ sub write_file {
173174
$handles->{MPI_2INT} = 52;
174175
$handles->{MPI_SHORT_INT} = 53;
175176
$handles->{MPI_CXX_BOOL} = 54;
176-
$handles->{MPI_CXX_COMPLEX} = 55;
177+
$handles->{MPI_CXX_FLOAT_COMPLEX} = 55;
178+
$handles->{MPI_CXX_COMPLEX} = $handles->{MPI_CXX_FLOAT_COMPLEX};
177179
$handles->{MPI_CXX_DOUBLE_COMPLEX} = 56;
178180
$handles->{MPI_CXX_LONG_DOUBLE_COMPLEX} = 57;
179181
$handles->{MPI_INT8_T} = 58;
@@ -191,6 +193,7 @@ sub write_file {
191193
$handles->{MPI_C_DOUBLE_COMPLEX} = 70;
192194
$handles->{MPI_C_LONG_DOUBLE_COMPLEX} = 71;
193195
$handles->{MPI_COUNT} = 72;
196+
$handles->{MPI_C_BOOL} = 73;
194197

195198
$handles->{MPI_MESSAGE_NO_PROC} = 1;
196199

0 commit comments

Comments
 (0)