[Mpi-forum] Giving up on C11 _Generic
Jim Dinan
james.dinan at gmail.com
Wed Aug 7 16:00:11 CDT 2019
Even simpler than this, we could just forward all calls to the MPI_Count
interface (see below). The int count argument should type convert to
MPI_Count without issue. Note that it still needs to be a function-like
macro so that function pointers work.
Don't give up yet! :D
~Jim.
#include <stdio.h>
typedef int MPI_Datatype;
typedef int MPI_Comm;
int MPI_Send(const void* buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm)
{
printf("MPI_Send(count = %d)\n", count);
return 0;
}
int MPI_Send_x(const void* buf, long long count, MPI_Datatype datatype, int
dest,
int tag, MPI_Comm comm)
{
printf("MPI_Send_x(count = %lld)\n", count);
return 0;
}
#define MPI_Send(buf, count, datatype, dest, tag, comm) MPI_Send_x(buf,
count, datatype, dest, tag, comm)
int main(int argc, char *argv[]) {
/* 8589934592LL == 2^33 */
long long i = 8589934592LL + 11;
int ret;
int (*snd_ptr)(const void*, int, MPI_Datatype, int, int, MPI_Comm) =
&MPI_Send;
ret = MPI_Send(NULL, i, 0, 0, 0, 0);
ret = MPI_Send(NULL, 5, 0, 0, 0, 0);
ret = (*snd_ptr)(NULL, i, 0, 0, 0, 0);
ret = (*snd_ptr)(NULL, 5, 0, 0, 0, 0);
return 0;
}
MPI_Send_x(count = 8589934603)
MPI_Send_x(count = 5)
MPI_Send(count = 11)
MPI_Send(count = 5)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpi-forum/attachments/20190807/fb8b236e/attachment-0001.html>
More information about the mpi-forum
mailing list