LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Wa-Kun Lam (rexchaos_at_[hidden])
Date: 2003-09-25 01:04:34


Hi all,
  I have a question about the loop in parallel code.

for (i=0; i<MAX; i++)
{
  // some sequential code
  // parallel code
  // some sequential code
}

In the above code, I want the outer loop to be dominated only by rank-0
process. For that purpose, I add a condition like

if (rank==0)
{
  for (i=0; i<MAX; i++)
  {
    // some sequential code A
    // parallel code B
    // some sequential code C
  }
}
However, the above code will keep other process outside the loop so the
parallel code B will not run parallelly. Anyone have idea for that issue?

Thanks in advance.