Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29245 Discussions

OpenMP not obeying implied or explicit barriers

Andrew_Smith
Valued Contributor I
431 Views
I am changing to using parallel throughout and using a single high level parallel block with several OMP DO loops in subroutines called from the parallel region.

Like this (1000 x simplified from the real code)

[fortran]Subroutine Top
   !$omp parallel
   call firstSub
   !$omp barrier
   call secondSub
   !$omp end parallel
end subroutine

subroutine firstSub
   !$OMP DO
   do i = 1, n
     ...
   end do
end subroutine

subroutine secondSub
   !$OMP DO
   do i = 1, n
     ...
   end do
end subroutine[/fortran]

But I find the threads seam to ignore all barriers and in one case (which you could say was secondSub above) when the the threads hit the OMP DO, they all execute every loop iteration, ie. do not share the iterations.

It seams like the thread team forgets it is team and starts to behave like indepenant threads. After that my application freezes or crashes.

My software uses IVF 12 update 4 with all dynamic libraries. It runs as a dll under VSE Smalltalk exe. I am wondering if that or something else is corupting the thread manager?
0 Kudos
3 Replies
Anonymous66
Valued Contributor I
431 Views

Hi Andrew,

I made a simple test case using the code you provided and it runs as expected. Could you attach your program so we can investigate this issue?

Regards,
Annalee

0 Kudos
Andrew_Smith
Valued Contributor I
431 Views
Thanks for trying that.

It is not practical to attach my code or even submit it to support as it is half a million lines and it wont run without a dozen more dll's and our Smalltalk Image and repository.

It was running before with simple OMP DO PARALLEL standalone loops.

After some loops we make callbacks to the exe. With the new parallel structure I ensured these are only done by the master thread, but I will see if dissabling them makes a difference.



0 Kudos
Andrew_Smith
Valued Contributor I
431 Views
I located my problem.

I had left a second $OMP PARALLEL directive in a subroutine and having passed through this the threads began thier strange behaviour.

Having removed this all is now well.
0 Kudos
Reply