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

Incorrect variable value in debugger in OpenMP parallel region

jirina
New Contributor I
176 Views

I am debugging a code in an OpenMP parallel region, and I am experiencing a problem with an incorrect value of variable added to Watch. My (simplified) code is:

!$omp parallel if ( omp_body_forces ) num_threads ( threads ) default ( shared )
!$omp&  private ( k )
!$omp do schedule(auto)
    do k=k2,k1,-1
	...
!$omp end do
!$omp end parallel

omp_body_forces is logical*1, value is .true., thread is integer*4, value is 1, k is integer*4, k1 and k2 ar local variables initialized outside the parallel region.

An incorrect value is shown for k added to Watch. If I comment out the parallelization, k in Watch has a correct value.

I can see k listed twice in Locals, once with an incorrect value, once with the expected value.

jirina_0-1762595044496.png

Is this an expected behavior of the debugger and Watch for variables inside an OpenMP parallel region, with number of threads set to 1?

0 Kudos
0 Replies
Reply