www.pudn.com > MPI.rar > mpi.cpp
#include#include #include #define totalsize 256 #define mysize (totalsize/4) void main(int argc,char *argv[]) { int steps=13; int myid,numprocs,i,j,n; float a[mysize+2][totalsize]; float b[mysize+2][totalsize]; int begin_row; int end_row; int top,down; int tag1,tag2; MPI_Status status; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD,&myid); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); cout<< "Process "<<' '< 0) { top=myid-1; } else { top=MPI_PROC_NULL; } if(myid<3) { down=myid+1; } else { down=MPI_PROC_NULL; } for(n=0;n