Karolski
2008-11-14 14:07:39 UTC
Hello All
I've got small problem here with posix threads and MPI. Let me explain
you the situation.
Let's say I've got 4 nodes. My application is starting 4 POSIX
threads. Each thread is waiting for messages to come from other node.
It's like this:
thread0 is waiting for messages form node 0
thread1 is waiting for messages form node 1
thread2 is waiting for messages form node 2
thread3 is waiting for messages form node 3
By "waiting" I mean code like below:
MPI::COMM_WORLD.Barrier(); // sync all threads here
while(1)
{
MPI::COMM_WORLD.Recv(&msg, 1, MPI::INT, listen_rank, tag);
// do something
}
Of course listen_rank in each thread is correctly set.
But every time I'm starting up my application, some threads throws
MPI::Exceptions, assertion failed or some other errors. So it looks
like it's not good way to receive messages from other nodes. Can
anyone explain me, what's wrong in this approach to the parallel
communication?
The thing is that cannot say where and when any of nodes will send the
message and who will be the receiver. So I thought that if I create n-
threads in each node, each thread would receive messages from one
node, I would got the situation that every node has a set of threads
able to receive messages from anybody else in the group. What do you
think about this?
Many thanks in advance for any suggestions,
Regards
I've got small problem here with posix threads and MPI. Let me explain
you the situation.
Let's say I've got 4 nodes. My application is starting 4 POSIX
threads. Each thread is waiting for messages to come from other node.
It's like this:
thread0 is waiting for messages form node 0
thread1 is waiting for messages form node 1
thread2 is waiting for messages form node 2
thread3 is waiting for messages form node 3
By "waiting" I mean code like below:
MPI::COMM_WORLD.Barrier(); // sync all threads here
while(1)
{
MPI::COMM_WORLD.Recv(&msg, 1, MPI::INT, listen_rank, tag);
// do something
}
Of course listen_rank in each thread is correctly set.
But every time I'm starting up my application, some threads throws
MPI::Exceptions, assertion failed or some other errors. So it looks
like it's not good way to receive messages from other nodes. Can
anyone explain me, what's wrong in this approach to the parallel
communication?
The thing is that cannot say where and when any of nodes will send the
message and who will be the receiver. So I thought that if I create n-
threads in each node, each thread would receive messages from one
node, I would got the situation that every node has a set of threads
able to receive messages from anybody else in the group. What do you
think about this?
Many thanks in advance for any suggestions,
Regards