/* alltoall.c * This program demonstrate the basic usage of MPI_Alltoall * MUST USE 4 processors ! * */ #include #include "mpi.h" #define N 4 int main(int argc, char *argv[]) { int rank, nproc, i; int a[N], b[N]; FILE *fp; char fn[80]; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &nproc); if (nproc != 4) MPI_Abort(MPI_COMM_WORLD,1); sprintf(fn,"data-a2a-%d",rank); fp = fopen(fn,"w"); for (i=0; i