1
1
openmpi/ompi/mpi
KAWASHIMA Takahiro 8eb90ae9aa mpi/c: Fix MPI_TYPE_CREATE_F90_{REAL,COMPLEX}
This commit fixes edge cases of `r = 38` and `r = 308`.

As defined in the MPI standard, `TYPE_CREATE_F90_REAL` and
`TYPE_CREATE_F90_COMPLEX` must be consistent with the Fortran
`SELECTED_REAL_KIND` function. The `SELECTED_REAL_KIND` function is
defined based on the `RANGE` function. The `RANGE` function returns
`INT(MIN(LOG10(HUGE(X)), -LOG10(TINY(X))))` for a real value `X`.

The old code considers only `INT(LOG10(HUGE(X)))` using `*_MAX_10_EXP`.
This commit adds `INT(-LOG10(TINY(X)))` part using `*_MIN_10_EXP`.

This bug affected the following `p`-`r` combinations.

| p             | r   | expected  | returned  | expected  | returned  |
| :------------ | --: | :-------- | :-------- | :-------  | :-------- |
| MPI_UNDEFINED |  38 | REAL8     | REAL4     | COMPLEX16 | COMPLEX8  |
| 0 <= p <= 6   |  38 | REAL8     | REAL4     | COMPLEX16 | COMPLEX8  |
| MPI_UNDEFINED | 308 | REAL16    | REAL8     | COMPLEX32 | COMPLEX16 |
| 0 <= p <= 15  | 308 | REAL16    | REAL8     | COMPLEX32 | COMPLEX16 |

MPICH returns the same result as Open MPI with this fix.

Signed-off-by: KAWASHIMA Takahiro <t-kawashima@jp.fujitsu.com>
(cherry picked from commit 6fb01f64fe)
2018-12-13 16:01:56 +09:00
..
c mpi/c: Fix MPI_TYPE_CREATE_F90_{REAL,COMPLEX} 2018-12-13 16:01:56 +09:00
cxx mpi: make C++ bindings compile when MPI-1 compat is disabled 2018-05-31 09:44:19 -06:00
fortran fortran: add CHARACTER and LOGICAL support to MPI_Sizeof() 2018-10-12 14:10:45 +09:00
java java: Fix javadoc build failure with OpenJDK 11 2018-10-09 21:48:10 +09:00
man/man3 MPI_Type_get_envelope: remove MPI-1 deleted names 2018-11-06 10:07:05 -08:00
tool mpi/finalized: revamp INITIALIZED/FINALIZED 2018-06-01 13:36:29 -07:00
help-mpi-api.txt fix info-subscribe to use snprintf() and warn on long key 2018-06-01 18:31:32 -04:00
Makefile.am Fix script abstraction break: mv make_manpage.pl to config 2018-09-22 15:11:06 -05:00