[Mpi-forum] "BigCount" rendering in PDF

Jed Brown jed at jedbrown.org
Wed Jul 31 13:29:56 CDT 2019


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

> On Jul 31, 2019, at 12:59 PM, Jeff Hammond <jeff.science at gmail.com> wrote:
>> 
>> “C++ compilers shall produce the same result as C11 generic.” Why does this need to say anything different for profiling and tools? Is this impossible?
>
> Is there a way to have C++ overloading call the same symbols that we'll dispatch to from C11 _Generic?  (i.e., not-symbol-munged MPI_Send and MPI_Send_x)

You have MPI_Send and MPI_Send_x declared extern "C", so why not:

#ifdef __cplusplus
static inline int MPI_Send(const void *buf, MPI_Count count,
  MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
{
  return MPI_Send_x(buf, count, datatype, dest, tag, comm);
}
#endif

When compiled with any optimization, this yields a direct call to
MPI_Send_x.  In any case, it doesn't add any mangled symbols to libmpi.

Note that you can't have an overload of the extern "C" symbol MPI_Send
taking "int count", but the extern "C" version works just fine for that.

  C++14 §7.5.5: If two declarations declare functions with the same name
  and parameter-type-list (8.3.5) to be members of the same namespace or
  declare objects with the same name to be members of the same namespace
  and the declarations give the names different language linkages, the
  program is ill-formed


More information about the mpi-forum mailing list