The job of the server process is simple: receive a request from any
worker within the world = MPI_COMM_WORLD
communicator, and
return an array of CHUNKSIZE
random numbers to that process if
the request > 0
. Otherwise, exit:
do { MPI_Recv(&request, 1, MPI_INT, MPI_ANY_SOURCE, REQUEST, world, &status); if (request) { for (i = 0; i < CHUNKSIZE; i++) rands[i] = random(); MPI_Send(rands, CHUNKSIZE, MPI_INT, status.MPI_SOURCE, REPLY, world); } } while ( request > 0 );