[Omp] Ask the barrier again

Shengyan Hong shhong at cse.psu.edu
Fri Mar 9 17:07:11 PST 2007


Every openmp member,
       I check the spec25. It says that 
"A barrier region may not be closely nested inside a work-sharing, 
critical,ordered, or master region. " But it does not say "can not". 
My code passes the compiler on Unix. So can you give me further advice?
       I use 8 processors with different frequencies. The frequencies are 
between  1G and 1.1 G.
       I test the idle time in the barrier again and find that 
each one has 6 cycles. The execution time is different. But not too much. 
For example, 1.7821*10^5 and 1.78345*10^5. Besides, I delete the barrier 
in the code and keep the break point in the code.  I find that the idle 
time keeps 6 cycles. Besides, the sum of the execution time and the idle 
time for each processor is not the same. I do not know why for these 
questions.
       I guess that I have not used the barrier correctly. How can I use 
it? Another explanation is that the task is divided quite well.
       The code is as follows:
!$omp parallel do default(shared) private(i,j,k)
       do k = 1, d3
C       TID = OMP_GET_THREAD_NUM()
C       PRINT *, 'thread = ', TID
C       print *, "March 9"
        CALL MAGIC_BRK_SIM_START()
          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
C       print *, "Before barrier"
        CALL MAGIC_BRK_SIM_MIDDLE()
C       !$OMP BARRIER
C       print *, "After barrier"
        CALL MAGIC_BRK_SIM_STOP()
        end do


                                              Shengyan Hong



More information about the Omp mailing list