<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">The following code reproduces the problem. I think you maybe able to reproduce the error on</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Linux, but I am not sure.</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">It is best to run :</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">mpiexec -n 8 a.out</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">to reproduce the problem. You will need a machine with 8CPU/cores. SOmetime you will need to</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">run the code multiple time to see the error.</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">there will be files fast_mpi_?.dmp created, where ? is the rank of the related 'rank'. When MPI get stuck,</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">you should look at the last line of fast_mpi_0.dmp. If it says:</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR> read from child 7<BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">then you should look at the last line of fast_mpi_7.dmp, it will say:</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> read from master<BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">hope this help to debug the error.</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">thanks</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">tan</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR>---------------------</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">#include "stdlib.h"<BR>#include "stdio.h"<BR>#include "mpi.h"</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">#define LOOP_COUNT 1000000<BR>#define DATA_SIZE 4<BR>#define MP_TAG 999</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">main()<BR>{<BR> int nProc, rank ;<BR> int argc = 0 ;<BR> int i, j, status ;<BR> char buf[ 128 ] ;<BR> FILE *pf ;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> MPI_Init( &argc, NULL ) ;<BR> MPI_Comm_size( MPI_COMM_WORLD, &nProc ) ;<BR> MPI_Comm_rank( MPI_COMM_WORLD, &rank ) ;<BR> sprintf( buf, "fast_mpi_%d.dmp", rank ) ;<BR> pf = fopen( buf, "w" ) ;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> if( !rank ) {<BR> int **psend ;<BR> int **precv ;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> psend = (int**)calloc( nProc, sizeof( int *) ) ;<BR> precv = (int**)calloc( nProc, sizeof( int *) ) ;<BR> for( i = 0 ; i < nProc ; i++ ) {<BR> psend[ i ] = (int*)calloc( DATA_SIZE, sizeof( int ) ) ;<BR> precv[ i ] = (int*)calloc( DATA_SIZE, sizeof( int ) ) ;<BR> }<BR> for( i = 0 ; i < LOOP_COUNT ; i++ ) {<BR> fprintf( pf, "Master : loop %d\n", i ) ;<BR> fflush( pf ) ;<BR> for( j = 1 ; j < nProc ; j++ )
{<BR> fprintf( pf, " read from child %d\n", j ) ;<BR> fflush( pf ) ;<BR> status = MPI_Recv( precv[ j ], DATA_SIZE, MPI_LONG, j, MP_TAG, MPI_COMM_WORLD, MP<BR>I_STATUS_IGNORE ) ;<BR> fprintf( pf, " read from child %d done, status = %d\n", j, status ) ;<BR> fflush( pf ) ;<BR> }<BR> for( j = 1 ; j < nProc ; j++ ) {<BR> fprintf( pf, " send to child %d\n", j )
;<BR> fflush( pf ) ;<BR> status = MPI_Send( psend[ j ], DATA_SIZE - 1, MPI_LONG, j, MP_TAG, MPI_COMM_WORLD<BR> ) ;<BR> fprintf( pf, " send to child %d done, status = %d\n", j, status ) ;<BR> fflush( pf ) ;<BR> }<BR> }<BR> } else {<BR> int *psend ;<BR> int *precv ;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> psend = (int*)calloc( DATA_SIZE, sizeof( int ) ) ;<BR> precv = (int*)calloc( DATA_SIZE, sizeof( int ) ) ;<BR> for( i = 0 ; i < LOOP_COUNT ; i++ ) {<BR> fprintf( pf, " send to master\n" ) ;<BR> fflush( pf ) ;<BR> status = MPI_Send( psend, DATA_SIZE - 1, MPI_LONG, 0, MP_TAG, MPI_COMM_WORLD ) ;<BR> fprintf( pf, " send to master done, status = %d\n", status ) ;<BR> fflush( pf )
;<BR> fprintf( pf, " read from master\n" ) ;<BR> fflush( pf ) ;<BR> status = MPI_Recv( precv, DATA_SIZE, MPI_LONG, 0, MP_TAG, MPI_COMM_WORLD, MPI_STATUS_IGNORE ) ;<BR> fprintf( pf, " read from master done, status = %d\n", status ) ;<BR> fflush( pf ) ;<BR> }<BR> }<BR> fclose( pf ) ;<BR> MPI_Finalize() ;<BR>}<BR></DIV></div><br>
<hr size=1>Ahhh...imagining that irresistible "new car" smell?<br> Check out
<a href="http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM-">new cars at Yahoo! Autos.</a>
</body></html>