Skip to content

New quad precision predefined data types #3

@jeffhammond

Description

@jeffhammond

This was https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/318.

Description

GCC has added the __float128 data type (using libquadmath) and Intel defines _Quad, both of which implement IEEE-754 2008 binary128 "quad precision". These types complement the MPI_REAL16 and MPI_COMPLEX32 Fortran types (added to MPI-2.2 by ticket #64). These quad precision types can already be used (on homogeneous architectures) with point-to-point operations by users defining datatypes and custom MPI_Ops, but one-sided operations such as MPI_Accumulate require predefined types. This proposal would add the following optional quad precision types.

MPI Datatype C type
MPI_QUAD __float128 / _Quad
MPI_C_QUAD_COMPLEX __float128 _Complex / _Quad _Complex
MPI_QUAD_INT struct {__float128 var; int loc;}

This is a correction to the standard, because the MPI standard should define
predefined datatype names that correspond to the current set of
standardized and used types in the accompanying compiler (e.g., gcc).

Because other optional datatypes are not available for MPI_MAXLOC and MPI_MINLOC,
the proposal of MPI_QUAD_INT is directly implied.
The big difference is, that in Fortran, there is a standardized way via '''selected_real_kind''' to specify 16 byte REAL.
In C, this standardized method is missing, and users have to use optionally provided methods like {{{__}}}float128 and _Quad. Therefore, Part 2 provides the needed datatypes MPI_QUAD_INT and MPI_FLOAT128_INT.

History

Extended Scope

None.

Proposed Solution, Part 1

'''MPI-2.2 Annex A.1.1, page 517, lines 25-29 read'''

| Optional datatypes (Fortran) | Fortran types |
|C type: MPI_Datatype | C++ type: MPI::Datatype | |
|Fortran type: INTEGER | | |
|MPI_DOUBLE_COMPLEX | MPI::F_DOUBLE_COMPLEX | DOUBLE COMPLEX |
|MPI_INTEGER1 | MPI::INTEGER1 | INTEGER*1 |
| ... | ... | ... |

'''but should read'''

||||= Optional datatypes (C/C++) =||= C/C++ types =||
||C type: MPI_Datatype ||C++ type: MPI::Datatype || ||
||Fortran type: INTEGER || || ||
||MPI_QUAD ||(use C datatype handle) || _Quad ||
||MPI_C_QUAD_COMPLEX ||(use C datatype handle) || _Quad _Complex ||
||MPI_FLOAT128 ||(use C datatype handle) || {{{}}}float128 ||
||__MPI_C_FLOAT128_COMPLEX
||(use C datatype handle) || {{{__}}}float128 _Complex ||

||||= Optional datatypes (Fortran) =||= Fortran types =||
||C type: MPI_Datatype ||C++ type: MPI::Datatype || ||
||Fortran type: INTEGER || || ||
||MPI_DOUBLE_COMPLEX ||MPI::F_DOUBLE_COMPLEX ||DOUBLE COMPLEX ||
||MPI_INTEGER1 ||MPI::INTEGER1 ||INTEGER*1 ||
||... ||... ||... ||

'''MPI-2.2 Section 3.2.2, page 27, lines 33-39 read'''

MPI requires support of these datatypes, which match the basic datatypes of Fortran
and ISO C. Additional MPI datatypes should be provided if the host language has additional
data types: MPI_DOUBLE_COMPLEX for double precision complex in Fortran declared to
be of type DOUBLE COMPLEX; MPI_REAL2, MPI_REAL4 and MPI_REAL8 for Fortran reals,
declared to be of type REAL_2, REAL_4 and REAL_8, respectively; MPI_INTEGER1
MPI_INTEGER2 and MPI_INTEGER4 for Fortran integers, declared to be of type INTEGER_1,
INTEGER_2 and INTEGER_4, respectively; etc.

'''but should read'''

MPI requires support of these datatypes, which match the basic datatypes of Fortran
and ISO C. Additional MPI datatypes should be provided if the host language has additional
data types: MPI_DOUBLE_COMPLEX for double precision complex in Fortran declared to
be of type DOUBLE COMPLEX; MPI_REAL2, MPI_REAL4 and MPI_REAL8 for Fortran reals,
declared to be of type REAL_2, REAL_4 and REAL_8, respectively; MPI_INTEGER1
MPI_INTEGER2 and MPI_INTEGER4 for Fortran integers, declared to be of type INTEGER_1,
INTEGER_2 and INTEGER_4, respectively; etc.
A complete list of such MPI datatypes corresponding to optional datatypes in the
hosting languages is provided in Annex A.1.1 in the tables starting on page 517.

'''MPI-2.2 Section 5.9.2, page 165, lines 39-45 read'''

||Floating point: ||MPI_FLOAT, MPI_DOUBLE, MPI_REAL, ||
|| ||MPI_DOUBLE_PRECISION ||
|| ||MPI_LONG_DOUBLE ||
|| ||and handles returned from ||
|| ||MPI_TYPE_CREATE_F90_REAL, ||
|| ||and if available: MPI_REAL2, ||
|| ||MPI_REAL4, MPI_REAL8, MPI_REAL16 ||

'''but should read'''

||Floating point: ||MPI_FLOAT, MPI_DOUBLE, MPI_REAL, ||
|| ||MPI_DOUBLE_PRECISION ||
|| ||MPI_LONG_DOUBLE ||
|| ||and handles returned from ||
|| ||MPI_TYPE_CREATE_F90_REAL, ||
|| ||and if available: MPI_REAL2, ||
|| ||MPI_REAL4, MPI_REAL8, MPI_REAL16__,__ ||
|| ||MPI_QUAD, MPI_FLOAT128 ||

'''MPI-2.2 Section 5.9.2, page 165, lines 47 - page 166, line 7 read'''

||Complex: ||MPI_COMPLEX, ||
|| ||MPI_C_FLOAT_COMPLEX, ||
|| ||MPI_C_DOUBLE_COMPLEX, ||
|| ||MPI_C_LONG_DOUBLE_COMPLEX, ||
|| ||and handles returned from ||
|| ||MPI_TYPE_CREATE_F90_COMPLEX, ||
|| ||and if available: MPI_DOUBLE_COMPLEX, ||
|| ||MPI_COMPLEX4, MPI_COMPLEX8, ||
|| ||MPI_COMPLEX16, MPI_COMPLEX32 ||

'''but should read'''

||Complex: ||MPI_COMPLEX, ||
|| ||MPI_C_FLOAT_COMPLEX, ||
|| ||MPI_C_DOUBLE_COMPLEX, ||
|| ||MPI_C_LONG_DOUBLE_COMPLEX, ||
|| ||and handles returned from ||
|| ||MPI_TYPE_CREATE_F90_COMPLEX, ||
|| ||and if available: MPI_DOUBLE_COMPLEX, ||
|| ||MPI_COMPLEX4, MPI_COMPLEX8, ||
|| ||MPI_COMPLEX16, MPI_COMPLEX32__,__ ||
|| ||MPI_C_QUAD_COMPLEX, ||
|| ||MPI_C_FLOAT128_COMPLEX ||

'''MPI-2.2 Section 13.5.2, page 433, in the right column, the following optional types should be added:'''

|| || ||
||MPI_QUAD || 16||
||MPI_FLOAT128 || 16||
||MPI_C_QUAD_COMPLEX || 2_16||
||MPI_C_FLOAT128_COMPLEX || 2_16||

Proposed Solution, Part 2

'''MPI-2.2 Section 3.2.2, page 27, lines 33-35 read and are not changed[[BR]](it is here cited because it is reused for the new sentence in Section 5.9.4):'''

MPI requires support of these datatypes, which match the basic datatypes
of Fortran and ISO C.
'''Additional MPI datatypes should be provided if the host language
has additional data types''':
MPI_DOUBLE_COMPLEX for double precision complex in
Fortran declared to be of type DOUBLE COMPLEX;

'''MPI-2.2 Section 5.9.4, page 168, lines 29-32 read'''

In order to use MPI_MINLOC and MPI_MAXLOC in a reduce operation, one must
provide a datatype argument that represents a pair (value and index).
MPI provides nine such predefined datatypes.
The operations MPI_MAXLOC and MPI_MINLOC can be used with
each of the following datatypes.

'''but should read'''

In order to use MPI_MINLOC and MPI_MAXLOC in a reduce operation, one must
provide a datatype argument that represents a pair (value and index).
For this, MPI provides nine such predefined datatypes.
The operations MPI_MAXLOC and MPI_MINLOC can be used with
each of the following datatypes.

'''MPI-2.2 Section 5.9.4, page 168, line 48 reads'''

||MPI_LONG_DOUBLE_INT ||{{{long double}}} and {{{int}}} ||

'''but should read (based on sentence page 27)'''

||MPI_LONG_DOUBLE_INT ||{{{long double}}} and {{{int}}} ||
||MPI_QUAD_INT (optional) ||{{{_Quad}}} and {{{int}}} ||
||MPI_FLOAT128_INT (optional) ||{{{float128}}} __and {{{int}}} ||

The optional predefined datatypes should be provided if the
host language supports the corresponding data type.

'''MPI-2.2 Annex A.1.1, page 518, lines 1-10 read'''

||||= Datatypes for reduction functions (C and C++) =||
||C type: MPI_Datatype ||C++ type: MPI::Datatype ||
||Fortran type: INTEGER || ||
||MPI_FLOAT_INT ||MPI::FLOAT_INT ||
||... ||... ||
||MPI_LONG_DOUBLE_INT ||MPI::LONG_DOUBLE_INT ||

'''but should read'''

||||= Datatypes for reduction functions (C and C++) =||
||C type: MPI_Datatype ||C++ type: MPI::Datatype ||
||Fortran type: INTEGER || ||
||MPI_FLOAT_INT ||MPI::FLOAT_INT ||
||... ||... ||
||MPI_LONG_DOUBLE_INT ||MPI::LONG_DOUBLE_INT ||
||MPI_QUAD_INT (optional) ||(use C datatype handle) ||
||MPI_FLOAT128_INT (optional) ||(use C datatype handle) ||

Alternative Solutions

None.

Impact on Implementations

Part 1: The new optional C dataypes MPI_QUAD, MPI_FLOAT128, MPI_C_QUAD_COMPLEX,
MPI_C_FLOAT128_COMPLEX must be implemented,
if available by the C compiler.
Part 2: The new optional datatypes for MPI_MAXLOC and MPI_MINLOC must be implemented:
MPI_QUAD_INT and MPI_FLOAT128_INT.

Impact on Applications / Users

None.

Entry for the Change Log

Sections 3.2.2, 5.9.2, 5.9.4, 13.5.2 Table 13.2, and Annex A.1.1 on pages 27, 164, 167, 433, and 513.[[BR]]
New named optional predefined datatypes MPI_QUAD, MPI_C_QUAD_COMPLEX,
MPI_FLOAT128, and MPI_C_FLOAT128_COMPLEX
for the C types {{{_Quad}}}, {{{__float128}}}, {{{_Quad}}} {{{_Complex}}}, and {{{__float128}}} {{{_Complex}}},
and MPI_QUAD_INT and MPI_FLOAT128_INT for the reduction operations MPI_MAXLOC and MPI_MINLOC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions