21.4.1. Fortran Type Registration

PreviousUpNext
Up: The Fortran Application Binary Interface Next: The MPI ABI Fortran Modules and Shared Library Previous: The Fortran Application Binary Interface

In order to decouple MPI Fortran support from the rest of the implementation, there must be a way to inform the implementation of the properties of MPI Fortran datatypes. With this, it is possible to implement MPI Fortran support on top of the MPI C implementation, without the latter having to know the properties of the Fortran environment.

MPI_ABI_SET_FORTRAN_INFO(info)
IN infoFortran ABI details info object (handle)
C binding
int MPI_Abi_set_fortran_info(MPI_Info info)
Fortran 2008 binding
MPI_Abi_set_fortran_info(info, ierror)
TYPE(MPI_Info), INTENT(IN) :: info
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_ABI_SET_FORTRAN_INFO(INFO, IERROR)

INTEGER INFO, IERROR

MPI_ABI_GET_FORTRAN_INFO(info)
OUT infoFortran ABI details info object (handle)
C binding
int MPI_Abi_get_fortran_info(MPI_Info *info)
Fortran 2008 binding
MPI_Abi_get_fortran_info(info, ierror)
TYPE(MPI_Info), INTENT(OUT) :: info
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_ABI_GET_FORTRAN_INFO(INFO, IERROR)

INTEGER INFO, IERROR

MPI_ABI_SET_FORTRAN_INFO allows the application to inform the implementation of the sizes of Fortran types and whether or not optional types are supported by the Fortran compiler. Before setting this information, the application should get this info object using MPI_ABI_GET_FORTRAN_INFO. When MPI_INFO_NULL is returned, the implementation does not know the properties of the Fortran compiler and they must be set by the application. Only the first call to MPI_ABI_SET_FORTRAN_INFO affects the state of the MPI library; all subsequent calls will return the error code MPI_ERR_ABI. If a call to MPI_ABI_SET_FORTRAN_INFO is not successful, the user should call MPI_ABI_GET_FORTRAN_INFO to determine what Fortran compiler properties were set.

The following keys are predefined for this object:

"mpi_logical_size":
The size in bytes of the Fortran default LOGICAL kind.
"mpi_integer_size":
The size in bytes of the Fortran default INTEGER kind.
"mpi_real_size":
The size in bytes of the Fortran default REAL kind.
"mpi_double_precision_size":
The size in bytes of the Fortran DOUBLE PRECISION kind.
"mpi_logical1_supported":
(boolean) MPI_LOGICAL1 is supported.
"mpi_logical2_supported":
(boolean) MPI_LOGICAL2 is supported.
"mpi_logical4_supported":
(boolean) MPI_LOGICAL4 is supported.
"mpi_logical8_supported":
(boolean) MPI_LOGICAL8 is supported.
"mpi_logical16_supported":
(boolean) MPI_LOGICAL16 is supported.
"mpi_integer1_supported":
(boolean) MPI_INTEGER1 is supported.
"mpi_integer2_supported":
(boolean) MPI_INTEGER2 is supported.
"mpi_integer4_supported":
(boolean) MPI_INTEGER4 is supported.
"mpi_integer8_supported":
(boolean) MPI_INTEGER8 is supported.
"mpi_integer16_supported":
(boolean) MPI_INTEGER16 is supported.
"mpi_real2_supported":
(boolean) MPI_REAL2 is supported.
"mpi_real4_supported":
(boolean) MPI_REAL4 is supported.
"mpi_real8_supported":
(boolean) MPI_REAL8 is supported.
"mpi_real16_supported":
(boolean) MPI_REAL16 is supported.
"mpi_complex4_supported":
(boolean) MPI_COMPLEX4 is supported.
"mpi_complex8_supported":
(boolean) MPI_COMPLEX8 is supported.
"mpi_complex16_supported":
(boolean) MPI_COMPLEX16 is supported.
"mpi_complex32_supported":
(boolean) MPI_COMPLEX32 is supported.
"mpi_double_complex_supported":
(boolean) MPI_DOUBLE_COMPLEX is supported.

MPI_ABI_SET_FORTRAN_BOOLEANS(logical_size, logical_true, logical_false)
IN logical_sizethe size of Fortran LOGICAL in bytes (integer)
IN logical_truethe Fortran literal value .TRUE. (logical)
IN logical_falsethe Fortran literal value .FALSE. (logical)
C binding
int MPI_Abi_set_fortran_booleans(int logical_size, void *logical_true, void *logical_false)
Fortran 2008 binding
MPI_Abi_set_fortran_booleans(logical_size, logical_true, logical_false, ierror)
INTEGER, INTENT(IN) :: logical_size
LOGICAL, INTENT(IN) :: logical_true, logical_false
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_ABI_SET_FORTRAN_BOOLEANS(LOGICAL_SIZE, LOGICAL_TRUE, LOGICAL_FALSE, IERROR)
INTEGER LOGICAL_SIZE, IERROR
LOGICAL LOGICAL_TRUE, LOGICAL_FALSE

MPI_ABI_GET_FORTRAN_BOOLEANS(logical_size, logical_true, logical_false, is_set)
IN logical_sizethe size of Fortran LOGICAL in bytes (integer)
OUT logical_truethe Fortran literal value .TRUE. (logical)
OUT logical_falsethe Fortran literal value .FALSE. (logical)
OUT is_setflag to indicate whether the logical boolean values were set previously (logical)
C binding
int MPI_Abi_get_fortran_booleans(int logical_size, void *logical_true, void *logical_false, int *is_set)
Fortran 2008 binding
MPI_Abi_get_fortran_booleans(logical_size, logical_true, logical_false, is_set, ierror)
INTEGER, INTENT(IN) :: logical_size
LOGICAL, INTENT(OUT) :: logical_true, logical_false, is_set
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_ABI_GET_FORTRAN_BOOLEANS(LOGICAL_SIZE, LOGICAL_TRUE, LOGICAL_FALSE, IS_SET, IERROR)
INTEGER LOGICAL_SIZE, IERROR
LOGICAL LOGICAL_TRUE, LOGICAL_FALSE, IS_SET

MPI_ABI_SET_FORTRAN_BOOLEANS allows the application to inform the implementation of the literal values of the Fortran booleans. Boolean literals must be passed directly so that they can be observed by the implementation, since it may not be possible to obtain their literal values directly. This function has a size argument to allow it to be called before MPI_ABI_SET_FORTRAN_INFO. Before setting this information, the application should check if the logical values are already set using MPI_ABI_GET_FORTRAN_BOOLEANS. When is_set = false, the implementation does not know the properties of the Fortran compiler and they must be set by the application. When is_set = true, the implementation already knows the literal values of the Fortran booleans and they cannot be set. As with MPI_ABI_SET_FORTRAN_INFO, only the first call to this function affects the state of the MPI library; subsequent calls will return the error code MPI_ERR_ABI.


Rationale.

MPI does not assume that Fortran boolean literals follow the C convention (zero is false and non-zero is true). ( End of rationale.)


PreviousUpNext
Up: The Fortran Application Binary Interface Next: The MPI ABI Fortran Modules and Shared Library Previous: The Fortran Application Binary Interface


Return to MPI-5.0 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-5.0 of June 9, 2025
HTML Generated on March 2, 2025