[MPICH] I 'm trying to use threads in my MPI programs but....
Thati Ravi
thati.ravi at gmail.com
Tue Nov 14 06:28:38 CST 2006
Hi all,
Our cluster is an AIX5.1 and configured with mpich-1.2.4 .
I am trying to execute a program in which each process creates one thread.
And task of the thread is that it will also be invoking the MPI routines as
same as the main thread.
The sample code of the program is like this :
main()
{
MPI_Init(&argc,&argv);
if(rank==0)
{
MPI_Send(&sendbuf,1,MPI_INT,1,111,MPI_COMM_WORLD);
pthread_create(&pth,NULL,&recv_thread,void *params);
................ rest of the program calls some other MPI routines.
}
else
{
some mpi calls from other processes and threads for them similar to the root
processs.
.......
}
return 0;
}
And the thread code is like this for the root process and is similar with
other process also.
void * recv_thread(void *info)
{
int rank;
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
MPI_Irecv(&recvbuf,1,MPI_INT,1,222,MPI_COMM_WORLD,&req);
...... and executes some MPI routines like MPI_test, MPI_Wait
}
This way each process will have its thread to execute the MPI routines.
My problem is that, the program is successfully executing for the
communicator size as two, I mean with two processes.
But it is faiing for processes>2. Some of the mpi routines are not getting
completed like MPI_Test() even though the correspoding operation has got
finished.
I have read somewhere that the MPICH library should be thread-safe. I don't
understand what is it mean by thread-safe.
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?
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
Any help is appreciated.
Ravi.Thati
Our Attempts may fail but we should not fail to attempt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20061114/298eb212/attachment.htm>
More information about the mpich-discuss
mailing list