Regarding OpenMP implementation

Regarding OpenMP implementation

by Laxmi Srinivas Vellala -
Number of replies: 1

Dear PTfS team,

1. I understand that using NOWAIT clause removes implicit barriers and the threads once free can go forward with the program, i.e. the next statements in the program.

Should the next statement be independent of the data being modified in the previous do loop? 

2.  Can we include a break or cycle statement in serial regions such as atomic or critical?

3. In page 24 of 20th June slides, in openMP overheads, what is the difference between "OpenMP parallel for" and "Opemp for"(isn't it "#pragma omp for" in a parallel region) ? 


Regards

Srinivas

In reply to Laxmi Srinivas Vellala

Re: Regarding OpenMP implementation

by Georg Hager -

HI Srinivas,

  1. Of course, removing the barrier bears the potential of race conditions. If you do it you have to make sure that the program is still correct. This includes not using data that is still being modified in the loop.
  2. Atomic always refers to single statements, so there is not even the possibility to break out of it. In a critical region, break makes no sense since it is not a loop. Of course you can get a similar effect using a simple conditional.
  3. "omp parallel for" is a loop that uses the combined "parallel for" directive to parallelize the loop. Before and after the loop, execution is sequential. With "omp for", a loop is distributed among threads that are already running (i.e., in a parallel region). After the loop, threads continue executing whatever comes next, in parallel.
Hope this helps,
Georg.