[Mpi-forum] Giving up on C11 _Generic

Jed Brown jed at jedbrown.org
Mon Aug 12 22:54:20 CDT 2019

"Jeff Squyres \(jsquyres\) via mpi-forum" <mpi-forum at lists.mpi-forum.org> writes:

> Let me ask a simple question: how will users to write portable MPI programs in C with large count values?
> Answer: they will explicitly call MPI_Send_x(), and not rely on C11 _Generic.

Few packages will accept a hard dependency on MPI-4 for at least 10
years.  MS-MPI still doesn't fully support MPI-2.1, for example, and
PETSc only recently began requiring MPI-2.0.

Instead, each package that wishes to upgrade to MPI_Count args will
write configure tests (autoconf, etc.) to detect availability of
MPI_Send_x (as individual functions, not as MPI_VERSION == 4) and define
macros/wrappers OurMPI_Send() that forwards to MPI_Send_x (when
available) or MPI_Send (otherwise).  When the implementation doesn't
provide MPI_Send_x, they'll either have a smart wrapper that errors at
run-time on truncation or (likely most apps) will silently fail with an
FAQ that suggests using a compliant MPI-4 implementation.

I'm not taking a position on C11 _Generic in the standard, but it would
significantly reduce the configure complexity for apps to upgrade to
MPI_Count without dropping support for previous standards.

> Which then raises the question: what's the point of using C11
> _Generic?  Its main functionality can lead to [potentially] silent
> run-time errors, and/or require additional error checking in every
> single code path by the implementation.  That just seems like bad
> design, IMNSHO.  That's why the WG decided to bring this to the Forum
> list (especially given the compressed timeframe for MPI-4).

More information about the mpi-forum mailing list