[Omp] On the implicit barrier

Eugene Loh Eugene.Loh at Sun.COM
Sun Mar 18 08:40:47 PDT 2007


Shengyan Hong wrote:

>Every Openmp member,
>         In the parallel loop of Fortran, there is an implicit barrier.
>         !$omp parallel do default(shared) private(i,j,k)
> 	do k = 1, d3
>           do j = 1, d2
>             do i = 1, d1
>                u1(i,j,k) = u0(i,j,k)*ex(t*indexmap(i,j,k))
>             end do
>           end do
>         end do
>
>         return
>         end
>
>         How can I test the idle time in the implicit barrier?
>  
>
It depends on what tools you have available.  For example, with the Sun 
Studio software suite, you can use the Sun Performance Analyzer.  Set 
the environment variable "SUNW_MP_THR_IDLE" to "SPIN" before you execute 
your program.  Then execute the program and look at the performance 
profile.  You should see "<OMP-implicit_barrier>" time.  Specifically, 
you can see the breakdown of this implicit-barrier time by loop and by 
thread.  Alternatively, the time-line viewer will give you a graphical 
picture of all this.  You can write me off-line if you'd like some help 
with this.

If you want to insert some timers or other instrumentation into the 
source code, I guess you have to insert them right before and after that 
last "END DO" statement.  I forget:  did you have one thread per "DO 
K=1,D3" iteration?  If so, I think you could capture one timestamp per 
"K" iteration right before the last "END DO" statement and one timestamp 
for all threads right after that "END DO".

On Mar 12, Henry Jin showed another way in this email thread of 
capturing barrier time by converting the implicit barrier to an explicit 
one.


More information about the Omp mailing list