That case should not have the implicit type conversion issue that Joseph
raised and should be fine without the extra macro when _Generic is
unsupported.

On Wed, Aug 7, 2019, 5:43 PM Jeff Hammond <jeff.scie...@gmail.com> wrote:

> You can't do that forwarding for vectors of counts.
>
> On Wed, Aug 7, 2019 at 2:10 PM Jim Dinan via mpi-forum <
> mpi-forum@lists.mpi-forum.org> wrote:
>
>> 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)
>> _______________________________________________
>> mpi-forum mailing list
>> mpi-forum@lists.mpi-forum.org
>> https://lists.mpi-forum.org/mailman/listinfo/mpi-forum
>>
>
>
> --
> Jeff Hammond
> jeff.scie...@gmail.com
> http://jeffhammond.github.io/
>
_______________________________________________
mpi-forum mailing list
mpi-forum@lists.mpi-forum.org
https://lists.mpi-forum.org/mailman/listinfo/mpi-forum

Reply via email to