|
[Sponsors] |
November 1, 2009, 09:45 |
MPI_barrier()
|
#1 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
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() In that case what arguments should be put in: Code:
int MPI_Barrier ( MPI_Comm comm ) Thanks ! |
|
November 3, 2009, 14:29 |
|
#2 |
Senior Member
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18 |
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>()); } Hope this helps, Francesco |
|
November 23, 2009, 12:59 |
|
#3 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
Since I am putting a lot of commands, a proper MPI_barrier might have helped, but, thank you for you advice, will use it !
|
|
|
|