I'm not sure how many ppl know about mpi, but ill ask anyway...
Ive written a piece of code below where im receiving messages from the master processor ie. 0, and i want to stop receiving when i get the stoprecievemsg. Its pretty simple and it works but is there a way to speed this up? I think my program is lagging because of the way im recieving
Code:
/* Retrieve a digit from master */
MPI_Recv(&token, 1, MPI_INT, 0, DEFAULT_TAG, MPI_COMM_WORLD, &status);
/* Until we recieve a stop msg, keep recieving and summing the recieved digits */
while (token != stopRecieveMsg) {
recieveSum = recieveSum + token;
MPI_Recv(&token, 1, MPI_INT, 0, DEFAULT_TAG, MPI_COMM_WORLD, &status);
}