MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
MPl_Comm_size(MPI_COMM_WORLD, &size);
message=myrank; if((myrank%2)-0)
{
If((myrank+1)1-size)
MPI
{
if((myrank+ 1)1- size)
MPI_Send(&message, 1, MPI_INT, myrank+1, TAG,
MPI_COMM_WORLD); else {if (myrank !- 0)
{ MPI__Recv(&message, 1, MPI_INT, myrank-1,
TAG, MPI_COMM_WORLD, &status);
printf("I am %i received :%i \n", rank, message);
return 0;
}
Достарыңызбен бөлісу: