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

Is there a compiler option to check the OpenMP data scope

xman_hawkeye
Beginner
985 Views

I'm having some problem with an openmpparallel region in my code.When the data scope is explicily specified, the code works fine. However, when I use the default data scoping, the code doesn't give correct results. Is there a way to check the default data scoping? Thanks.

0 Kudos
5 Replies
TimP
Honored Contributor III
985 Views
Quoting - xman.hawkeye

I'm having some problem with an openmpparallel region in my code.When the data scope is explicily specified, the code works fine. However, when I use the default data scoping, the code doesn't give correct results. Is there a way to check the default data scoping? Thanks.

I don't know of such a thing. However, when you have
!$omp parallel
it must be closed by
!$omp end parallel
but when you have the common combination
!$omp parallel do
the parallel scope ends automatically at end do. Many others require an explicit end parallel in Fortran.
0 Kudos
Steven_L_Intel1
Employee
985 Views
You might try the Source Verifier (Source Checker in 11.1) feature. It is likely to produce a lot of noise, but it does claim to detect certain OpenMP usage errors. Please read about it in the documentation - it's not just "throw a switch".
0 Kudos
xman_hawkeye
Beginner
985 Views
Quoting - tim18
I don't know of such a thing. However, when you have
!$omp parallel
it must be closed by
!$omp end parallel
but when you have the common combination
!$omp parallel do
the parallel scope ends automatically at end do. Many others require an explicit end parallel in Fortran.
Tim18, thanks for your reply. My question is about the data scope, e.g. how to check a variable ina parallel regionis private or shared by default. The problem I'm having is that with a parallel region as below the code works fine if I explicity specify the data scope attribute for all the variables in the parallel region. HOwever, if I don't, the results are incorrect. I'm wondering if there is a diagnostic option to check the default data scope attribute for each variable.

!$OMP PARALLEL
!$OMP SECTIONS
C... DO SOMETHING

!$OMP SECTION
C... DO SOMETHING ELSE

!$OMP END SECTIONS
!$OMP END PARALLEL

0 Kudos
TimP
Honored Contributor III
985 Views
If you set default(none), the compiler will report error on any data used in the parallel region which haven't been designated as shared or some variety of private.
0 Kudos
xman_hawkeye
Beginner
985 Views
Quoting - tim18
If you set default(none), the compiler will report error on any data used in the parallel region which haven't been designated as shared or some variety of private.

Tim18, thanks for the suggestion. Yes, it is much safer to use default(none).
0 Kudos
Reply