#include #include #include #include #include int main(int argc, char* argv[]) { int rank; int nprocs; MPI_Status status; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD,&nprocs); int size = nprocs; int *send_size = new int [size]; assert(send_size!=NULL); int *recv_size = new int [size]; assert(recv_size!=NULL); int *send_pos = new int [size]; assert(send_pos!=NULL); int *recv_pos = new int [size]; assert(recv_pos!=NULL); int send_sum=0, recv_sum=0; for(int i=0;i