Hi Jim,

Are we sure the function pointer “worked" in your example? It silently 
truncated the large value, because the function pointer bypasses the 
redirection macro.

Cheers,
Dan.
—
Dr Daniel Holmes PhD
Architect (HPC Research)
d.hol...@epcc.ed.ac.uk<mailto:d.hol...@epcc.ed.ac.uk>
Phone: +44 (0) 131 651 3465
Mobile: +44 (0) 7940 524 088
Address: Room 2.09, Bayes Centre, 47 Potterrow, Central Area, Edinburgh, EH8 9BT
—
The University of Edinburgh is a charitable body, registered in Scotland, with 
registration number SC005336.
—

On 7 Aug 2019, at 22:00, Jim Dinan via mpi-forum 
<mpi-forum@lists.mpi-forum.org<mailto: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<mailto:mpi-forum@lists.mpi-forum.org>
https://lists.mpi-forum.org/mailman/listinfo/mpi-forum

_______________________________________________
mpi-forum mailing list
mpi-forum@lists.mpi-forum.org
https://lists.mpi-forum.org/mailman/listinfo/mpi-forum

Reply via email to