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

前端 未结 2 1170
北荒
北荒 2021-01-24 18:28

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

2条回答
  •  醉酒成梦
    2021-01-24 19:11

    try this

    MPI_Send(&stat,sizeof(struct info),MPI_CHAR,1,2,MPI_COMM_WORLD);
    MPI_Recv(&data,sizeof(struct info), MPI_CHAR, 0, DEFAULT_TAG, MPI_COMM_WORLD, &status);
    stat = (struct info *) data;
    

提交回复
热议问题