1
1
openmpi/ompi
Fangrui Song 5609268e90 Make C and Fortran types for MPI sentinels agree in size
Fix the C types for the following:

* MPI_UNWEIGHTED
* MPI_WEIGHTS_EMPTY
* MPI_ARGV_NULL
* MPI_ARGVS_NULL
* MPI_ERRCODES_IGNORE

There is lengthy discussion on
https://github.com/open-mpi/ompi/pull/7210 describing the issue; the
gist of it is that the C and Fortran types for several MPI global
sentenial values should agree (specifically: their sizes must(**)
agree).  We erroneously had several of these array-like sentinel
values be "array-like" values in C.  E.g., MPI_ERRCODES_IGNORE was an
(int *) in C while its corresponding Fortran type was "integer,
dimension(1)".  On a 64 bit platform, this resulted in C expecting the
symbol size to be sizeof(int*)==8 while Fortran expected the symbol
size to be sizeof(INTEGER, DIMENSION(1))==4.

That is incorrect -- the corresponding C type needed to be (int).
Then both C and Fortran expect the size of the symbol to be the same.

(**) NOTE: This code has been wrong for years.  This mismatch of types
typically worked because, due to Fortran's call-by-reference
semantics, Open MPI was comparing the *addresses* of these instances,
not their *types* (or sizes) -- so even if C expected the size of the
symbol to be X and Fortran expected the size of the symbol to be Y
(where X!=Y), all we really checked at run time was that the addresses
of the symbols were the same.  But it caused linker warning messages,
and even caused errors in some cases.

Specifically: due to a GNU ld bug
(https://sourceware.org/bugzilla/show_bug.cgi?id=25236), the 5 common
symbols are incorrectly versioned VER_NDX_LOCAL because their
definitions in Fortran sources have smaller st_size than those in
libmpi.so.

This makes the Fortran library not linkable with lld in distributions
that ship openmpi built with -Wl,--version-script
(https://bugs.llvm.org/show_bug.cgi?id=43748):

  % mpifort -fuse-ld=lld /dev/null
  ld.lld: error: corrupt input file: version definition index 0 for symbol
  mpi_fortran_argv_null_ is out of bounds
  >>> defined in /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_usempif08.so
  ...

If we fix the C and Fortran symbols to actually be the same size, the
problem goes away and the GNU ld bug does not come into play.

This commit also fixes a minor issue that MPI_UNWEIGHTED and
MPI_WEIGHTS_EMPTY were not declared as Fortran arrays (not fully fixed
by commit 107c0073dd).

Fixes open-mpi/ompi#7209

Signed-off-by: Fangrui Song <i@maskray.me>
Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
2020-02-02 04:20:39 -08:00
..
attribute Remove some IMPI attributes that were never implemented. 2018-12-20 10:12:32 -08:00
class Revert "Update to sync with OMPI master and cleanup to build" 2016-11-22 15:03:20 -08:00
communicator Fix some compiler warnings. 2020-01-10 13:10:53 -05:00
contrib ompitrace: MPI_Address -> MPI_Get_address 2018-05-01 15:20:02 -06:00
datatype Mark predefined empty datatype contiguous. 2019-09-07 14:40:21 +10:00
debuggers Handle asprintf errors with opal_asprintf wrapper 2018-10-08 16:43:53 -07:00
dpm ompi/dpm/dpm.c: Fix uninititalized variable 2019-12-08 14:03:48 -05:00
errhandler Merge pull request #6087 from ICLDisco/export/errors_cid 2018-12-31 15:01:55 -05:00
etc Revert "Update to sync with OMPI master and cleanup to build" 2016-11-22 15:03:20 -08:00
file ompi/file: rename ompi_file_t's f_mutex into f_lock 2017-12-01 16:06:22 +09:00
group opal: add types for atomic variables 2018-09-14 10:48:55 -06:00
include fortran/use-mpi-f08: remove bind(C) constants. 2019-10-28 10:28:17 +09:00
info Created opal_gethostname() as safer gethostname substitute. 2020-01-13 08:52:17 -08:00
interlib Update the interlib example to show an alternative method for model declaration. Add a missing range value to the OPAL layer. Make it easier to see OMPI model callbacks 2017-10-23 11:27:42 -07:00
mca Merge pull request #7113 from devreal/osc_rdma_cas 2020-01-28 10:59:17 -05:00
message predefined MPI object padding: set to fixed number of bytes (#3634) 2017-06-01 15:28:23 -04:00
mpi Make C and Fortran types for MPI sentinels agree in size 2020-02-02 04:20:39 -08:00
mpiext configury: fix a typo in mpiext/shortfloat 2019-11-29 11:09:54 +09:00
op Move from the use of regex to compression 2019-02-08 11:11:14 -08:00
patterns scripted symbol name change (ompi_ prefix) 2017-07-11 02:13:23 -04:00
peruse mpi/finalized: revamp INITIALIZED/FINALIZED 2018-06-01 13:36:29 -07:00
proc ompi: Avoid unnecessary PMIx lookups when adding procs (step 2). 2017-03-16 07:47:27 +07:00
request Ensure that grequestx continuously make progress 2019-09-18 18:55:11 +02:00
runtime Created opal_gethostname() as safer gethostname substitute. 2020-01-13 08:52:17 -08:00
tools Created opal_gethostname() as safer gethostname substitute. 2020-01-13 08:52:17 -08:00
util timings: added new timing points 2018-03-21 05:16:25 +02:00
win ompi: cleanup various string operations 2018-10-14 16:10:20 -07:00
Makefile.am fortran/use-mpi-f08: fix [p]ompi_FOO_f symbols handling 2018-09-19 14:12:55 +09:00