Saturday, 10 August 2013

How to send a variable of type struct in MPI_Send()?

How to send a variable of type struct in MPI_Send()?

basically i have coded a program in C using MPI where in the struc
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 MPI_Send() function as it is giving INVALID DATATYPE at the runtime ,
Consider the follwing EG
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);

No comments:

Post a Comment