CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

MPI_barrier()

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By fra76

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 1, 2009, 08:45
Default MPI_barrier()
  #1
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
johndeas is on a distinguished road
Hi,

I need my master processor to carry out some operations on some files. I would like all the other processors to pause while this is going on, as their behaviour might be affected by the non completion of the task on the master proc.

I have read about MPI_barrier() which seems to be what I need:

Code:
if not on the masterProc:
    MPI_barrier()
else:
    carry out operation
    MPI_barrier()
Is it possible to do this directly using OpenFOAM commands and if not, is it possible to use the vanilla MPI_barrier() ?

In that case what arguments should be put in:
Code:
int MPI_Barrier ( MPI_Comm comm )
?

Thanks !
johndeas is offline   Reply With Quote

Old   November 3, 2009, 13:29
Default
  #2
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
When I need this, I usually do a reduction, as MPI_barrier is not exposed by Pstream, as far as I know.

I.e.:

Code:
if (Pstream.master())
{
   carry out operation
}
{
    label tmp = Pstream.myProcNo();
    reduce(tmp,sumOp<label>());
}
At the reduce statement, all the processors must pass together, so the effect is like MPI_barrier even if with a very low unnecessary traffic.

Hope this helps,
Francesco
pm11dt and scleakey like this.
fra76 is offline   Reply With Quote

Old   November 23, 2009, 11:59
Default
  #3
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
johndeas is on a distinguished road
Since I am putting a lot of commands, a proper MPI_barrier might have helped, but, thank you for you advice, will use it !
johndeas is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 03:52.