[mpich-discuss] error in use recv
姚远志
yaoyuanzhi at qq.com
Fri Aug 17 04:30:10 CDT 2012
Hi
There are some queer errors exist in my program.
I spawn some children processes:
MPI_Comm_spawn(command,Conf, NumOfChild ,MPI_INFO_NULL, 0 , MPI_COMM_SELF ,&children , MPI_ERRCODES_IGNORE);
and after calculating I want to send the data back to the mater processes
In the children processes:
MPI_Send(outBuf,NumofPixPrc,MPI_FLOAT,0,5,parent);
and in the the master processes, the corresspond code is:
//the collection of the data from all the other children proc.
for(int i=1; i<NumOfProc; i++)
{
int index=0;
int scale2=0;
int RecStart = i * end ;
int RecEnd ;
if(i<NumOfChild){
RecEnd = (i+1) * end;
scale2 = RecEnd - RecStart + 2 * ncol;
}
else{
RecEnd = nrow*ncol;
scale2 = RecEnd - RecStart + ncol;
}
//receive the buffer
if(i<NumOfProc-1){
MPI_Recv(WaterDir1,scale2,MPI_FLOAT,i-1,5,children,&status);
int recIndex=ncol;
for(int n=RecStart; n<=RecEnd; n++)
{
outBuf[n] = WaterDir1[recIndex];
recIndex++;
}
}
else{
MPI_Recv(WaterDir2,scale2,MPI_FLOAT,i-1,5,children,&status);
int recIndex=ncol;
for(int n=RecStart; n<=RecEnd; n++)
{
outBuf[n] = WaterDir2[recIndex];
recIndex++;
}
}
when the Number Of Processes is 2, the program will be OK, But when I change the number of the processes to 3 or 4.. the program will shut down in MPI_Recv . I check the parameter, all the parameter are correct, but the program still shut down at that place....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20120817/79e4a418/attachment.html>
More information about the mpich-discuss
mailing list