/** * This program has an error because not all processes * execute MPI_Barrier and MPI_Scatter in the same order. */ #include #include #include int main(int argc, char* argv[]){ int rank; int procs; int* sendbuf, *rcvbuf; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD, &procs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); sendbuf = (int*)malloc(sizeof(int)*procs); rcvbuf = (int*)malloc(sizeof(int)); if(rank == 0) { for(int i=0; i