single directional message transmit in parallel model
I am new to parallel programming. Mybe my problem is easy for you. Would you mind giving me some suggestion?
I want to transmit some data from processor A to B, but B doesn't know there will some message coming from A. How can B received the message from A?
B may not transmit message to A. I mean the massage transmission is single directional.
I figured out a possible solution. In my question, once the message passages are established, they won't change at later time. Thus I think it better to construct the connection between A and B firstly, and transmit the message continuously at later time. To construct such a message passage beforehand, the connection of the current processor with interacting processors is broadcast, and in the destination processor the connection was constructed based on the message received.
In this method, all the processors will broadcast the connection once. How can I achieve this with OpenFOAM?
Mybe my method is a little awkward, would you mind giving me some good soultion or suggestions to this problem.
A critical problem is I don't knew how to broad a message to all the processors with current processors. Scatter? CombineScatter? combineScatterList?
Best Regards, Junwei.
You have to implement both, sending and recieving. The orders you need are:
For sending a scalar named "value" to processor n:
OPstream::write(Pstream::scheduled, n, reinterpret_cast<const char*>(&value), sizeof(scalar));
and for recieving a scalar from processor n, that should be stored in "value":
IPstream::read(Pstream::scheduled, n, reinterpret_cast<char*>(&value), sizeof(scalar));
Of course, these commands are to be executed by special processors, so first check the processor number using Pstream::myProcNo().
Hope this was helpfull
|All times are GMT -4. The time now is 06:02.|