Hi all,<br><br>&nbsp;Our cluster is an AIX5.1 and configured with mpich-1.2.4 .<br>I am trying to execute a program in which each process creates one thread.<br>And task of the thread is that it will also be invoking the MPI routines as same as the main thread.
<br>The sample code of the program is like this :<br><br>main()<br>{<br>MPI_Init(&amp;argc,&amp;argv);<br>if(rank==0)<br>{<br>MPI_Send(&amp;sendbuf,1,MPI_INT,1,111,MPI_COMM_WORLD);<br>pthread_create(&amp;pth,NULL,&amp;recv_thread,void *params);
<br>................ rest of the program calls some other MPI routines.<br>}<br>else<br>{<br>some mpi calls from other processes and threads for them similar to the root processs.<br>.......<br>}<br>return 0;<br>}<br>&nbsp;<br>
And the thread code is like this for the root process and is similar with other process also.<br><br><br>void * recv_thread(void *info)<br>{<br>int rank;<br>MPI_Comm_rank(MPI_COMM_WORLD,&amp;rank);<br>MPI_Irecv(&amp;recvbuf,1,MPI_INT,1,222,MPI_COMM_WORLD,&amp;req);
<br>...... and executes some MPI routines like MPI_test, MPI_Wait<br>}<br>This way each process will have its thread to execute the MPI routines.<br><br>My&nbsp; problem is that, the program is successfully executing for the communicator size as two, I mean with two processes.
<br>But it is faiing for processes&gt;2. Some of the mpi routines are not getting completed like MPI_Test() even though the correspoding operation has got finished.<br><br><br>I have read somewhere that the MPICH library should be thread-safe. I don't understand what is it mean by thread-safe.
<br>If at all the mpich is to be configured as thread-safe inorder to execute MPI routines in threads of the programs, how can I know whether my mpich is thread-safe or not?<br>How many threads can be created and allowed to use MPI routines for a single process in a application ? any such conditions ? how to know if they are there
<br><br>Any help is appreciated.<br><br clear="all"><br>Ravi.Thati<br>Our Attempts may fail but we should not fail to attempt.