I have coded a program in C using MPI wherein the struct variable is to be sent in a ring fashion to the processes and, based on the value received from that variable, the work for that particular process is assigned.
The problem is I need to know how to to send a struct variable in the MPI_Send()
function as it is giving INVALID DATATYPE at the runtime , Consider the following example
struct info{
int ne, n, u, v, process, min, strip, mincost, b;
} stat;
MPI_Send(&stat,sizeof(stat),sizeof(struct info),1,2,MPI_COMM_WORLD);
try this
You have to do some operation before send a struct. I wrote the code for your example but to understand better you should read some documentation. Anyway, here some tips:
struct point{ int x; double y; };
Here the code: