Jeff, I don't think we all agree 100% to abandon C11 _Generic, and let me
feedback to you what you write below for further argumentation;
I am a bit surprised this is in front of the whole forum just one day after
WG discussions, when more WG discussions are still in order weeks before
the finalization of our proposals for Zurich.

This statement alone

"But if either the MPI implementation or the compiler do not support C11
_Generic, ***the "count" value will be silently truncated at run time***."

is not a sufficient reason for abandoning C11 _Generic.
1) MPI Implementations have to either support MPI-4 or not; it would not be
optional.  Therefore the MPI implementation is incomplete.
Therefore this is not a reason to abandon C11.

2) If the compiler environment doesn't support C11 _Generic, then the build
process for MPI would have to warn the user or that kind of platform would
be impossible to use with MPI-4.   Seems harsh for non-compliant compilers.

These are not sufficient conditions alone for abandoning C11 _Generic.

Conclusion: You can't use non-compliant MPI-4 with C11 compilers that are
non-compliant with C11, except maybe with a special flag???
Is there more that I am missing?

Do you have other reasons that I've missed or you don't cite below besides
a) non-compliant MPI implementation, b) non-compliant C11 compiler for
abandoning this feature?  These are both reasons that an MPI program would
not do what it should.  But you also write

"If the user's MPI implementation and compiler both support C11 _Generic,
everything is great."

I realize that I was not on the full meetings recently, but this major
change of heart, although shared by others on the phone yesterday, is not
unanimous (and not everyone spoke up).    Maybe I am missing deeper
arguments, because you yourself say that correct implementation with a
correct compiler produces valid outcomes.

Notice how this kind of problem with Long vs. int exists in the C interface
currently; whenever you have a long long int argument, and you pass this to
a current C API that takes an int (for a count), this truncation occurs.
Do you agree?

Help me to understand better why we should overthrow this approach.

Regards,
Tony


On Wed, Aug 7, 2019 at 9:59 AM Jeff Squyres (jsquyres) via mpi-forum <
mpi-forum@lists.mpi-forum.org> wrote:

> SHORT VERSION
> =============
>
> Due to the possibility of silently introducing errors into user
> applications, the BigCount WG no longer thinks that C11 _Generic is a good
> idea.  We are therefore dropping that from our proposal.  The new proposal
> will therefore essentially just be the addition of a bunch of
> MPI_Count-enabled "_x" functions in C, combined with the addition of a
> bunch of polymorphic MPI_Count-enabled interfaces in Fortran.
>
> MORE DETAIL
> ===========
>
> Joseph Schuchart raised a very important point in a recent mailing thread:
> the following C/C++ code does not raise a compiler warning:
>
> -----
> #include <stdio.h>
>
> static void foo(int j) {
>     printf("foo(j) = %d\n", j);
> }
>
> int main(int argc, char *argv[]) {
>     /* 8589934592LL == 2^33 */
>     long long i = 8589934592LL + 11;
>     foo(i);
>     return 0;
> }
> -----
>
> If you compile and run this program on a commodity x86-64 platform, a) you
> won't get a warning from the compiler, and b) you'll see "11" printed out.
> I tried with gcc 9 and clang 8 -- both with the C and C++ compilers.  I
> even tried with "-Wall -pedantic".  No warnings.
>
> This is because casting from a larger int type to a smaller int type is
> perfectly valid C/C++.
>
> Because of this, there is a possibility that we could be silently
> introducing errors into user applications.  Consider:
>
> 1. An application upgrades its "count" parameters to type MPI_Count for
> all calls to MPI_Send.
>    --> Recall that "MPI_Count" already exists in MPI-3.1, and is likely of
> type (long long) on commodity x86-64 platforms
> 2. The application then uses values in that "count" parameter that are
> greater than 2^32.
>
> If the user's MPI implementation and compiler both support C11 _Generic,
> everything is great.
>
> But if either the MPI implementation or the compiler do not support C11
> _Generic, ***the "count" value will be silently truncated at run time***.
>
> This seems like a very bad idea, from a design standpoint.
>
> We have therefore come full circle: we are back to adding a bunch of "_x"
> functions for C, and there will be no polymorphism (in C).  Sorry, folks.
>
> Note that Fortran does not have similar problems:
>
> 1. Fortran compilers have supported polymorphism for 20+ years
> 2. Fortran does not automatically cast between INTEGER values of different
> sizes
>
> After much debate, the BigCount WG has decided that C11 _Generic just
> isn't worth it.  That's no reason to penalize Fortran, though.
>
> --
> Jeff Squyres
> jsquy...@cisco.com
>
> _______________________________________________
> mpi-forum mailing list
> mpi-forum@lists.mpi-forum.org
> https://lists.mpi-forum.org/mailman/listinfo/mpi-forum
>


-- 
Tony Skjellum, PhD
RunTime Computing Solutions, LLC
t...@runtimecomputing.com
direct: +1-423-713-9337
cell: +1-205-807-4968
_______________________________________________
mpi-forum mailing list
mpi-forum@lists.mpi-forum.org
https://lists.mpi-forum.org/mailman/listinfo/mpi-forum

Reply via email to