- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code:
program test implicit none call foo end program subroutine foo implicit none !$OMP CRITICAL(foo) print *,'foo' !$OMP END CRITICAL(foo) return end subroutine
... produces the compile-time error:
test.f90(11): error #6468: Invalid OpenMP* CRITICAL directive section name. [FOO] !$OMP CRITICAL(foo) ---------------^ test.f90(13): error #6413: This global name is invalid in this context. [FOO] !$OMP END CRITICAL(foo) -------------------^ compilation aborted for test.f90 (code 1)
It appears that you cannot name OpenMP CRITICAL sections with the same name as the subroutine in (at least) Intel Fortran 16, 17 or 18.
Both GFortran and the PGI Fortran compile this code without errors.
I can't find anything about subroutine names being invalid CRITICAL section names in the OpenMP standard.
John.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The name of an openmp critical construct is a global entity (openmp 4.5 p150 line 14) - if it conflicts with other global entities then behaviour is unspecified. External procedures are global entites too (F2008 16.2).
(Technically I think the openmp standard should be talking about conflicting global identifiers.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My preference is to append "_critical"
#pragma omp critical(foo_critical)
...
#pragma omp end critical(foo_critical)
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page