[Omp] clarification of directive nesting
Johnny Chang
johnny at nas.nasa.gov
Mon Sep 26 16:28:22 PDT 2005
The Fortran OpenMP spec v.2.0 Section 2.8 (Directive Nesting) and spec v.2.5
Section 2.9 (Nesting of Regions) do not formally forbid a OMP PARALLEL DO
nested inside a OMP MASTER ...OMP END MASTER. Yet, the Intel compiler
(v. 9.0.026) gives the following complaint:
fortcom: Error: omp_nest.f, line 12: An OpenMP PARALLEL DO directive is not permitted in the dynamic extent of a CRITICAL, MASTER or
ORDERED directive.
!$OMP PARALLEL DO PRIVATE(iam_,nthr_)
------^
compilation aborted for omp_nest.f (code 1)
for the following code:
program omp_nest
use omp_lib
!$OMP PARALLEL DEFAULT(shared) PRIVATE(iam, nthr,i)
iam = omp_get_thread_num()
nthr = omp_get_num_threads()
print *, 'iam = ', iam,' of ', nthr, ' threads'
!$OMP MASTER
do iter = 1,10
! serial work
iam = omp_get_thread_num()
print *, 'iam = ', iam, ' is in the MASTER segment'
!$OMP PARALLEL DO PRIVATE(iam_,nthr_)
do i = 1,4
iam_ = omp_get_thread_num()
nthr_ = omp_get_num_threads()
write(300+iam_,*) 'iam = ', iam,' of ', nthr, ' threads in nested loop'
end do
!$OMP END PARALLEL DO
print *, 'finished iteration, iter = ', iter
end do
!$OMP END MASTER
!$OMP END PARALLEL
end
Is the compiler complaint a mis-interpretation of the OpenMP 2.0/2.5 specs?
Johnny
--
Johnny Chang
650-604-4356
More information about the Omp
mailing list