>>WB> for (iSlave = 1; iSlave < iSize; iSlave++)
>>WB> {
>>WB> // build handles for the receipt of results
>
>
>>Shouldn't this be "for (iSlave = 0;... " ?
>
> the number '0' is the rank of the process. my master process is rank 0, so i
> wanna initiate receives from the slave processes which start from 1.
William, I realized that. But you're using the counter "iSlave" for filling up
the requests array:
for (iSlave = 1; iSlave < iSize; iSlave++)
{
// build handles for the receipt of results
MPI_Recv_init(&recvResult[iSlave],
1,
MPI_ResultType,
iSlave,
RESULTTAG,
MPI_COMM_WORLD,
&mastersRequests[iSlave]);
(see the last line?)
This means mastersRequests[0] is undefined. Use "&mastersRequests[iSlave-1]);"
instead. Good luck!
Mihai
|