An integer is given in each process. Using MPI_Send and MPI_Recv functions, perform a cyclic shift of data for all processes in increments of 1, transfer the number from process 0 to process 1, from process 1 to process 2, ..., from the last process to process 0. In each process, output the resulting number.
int flag; MPI_Initialized(&flag); if (flag == 0) return; int rank, size; MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Status s; int n; pt >> n; for (int i = 0; i < size; ++i) { MPI_Send(&n,1,MPI_INT,i,0,MPI_COMM_WORLD); }