This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/42942] New: OpenMP omp_set_max_active_levels(0) isn't resetting value


For this test code:

> cat test.f90
!  derived from OpenMP test omp3f/F03_3_2_6_1a.f90
!               also        omp3c/c03_3_2_6_1a.c
!               and         omp3C/c03_3_2_6_1a.cpp
! REFERENCES
!     OpenMP 2.5, p. 97, lines 13-15
!     OpenMP 3.0, p. 116, lines 18-20
program F03_3_2_6_1a
   use omp_lib
   implicit none

   call omp_set_dynamic(.false.)
   call omp_set_nested(.true.) ! not strictly necessary

   print *, "omp_get_max_active_levels()=",omp_get_max_active_levels()
   call omp_set_max_active_levels(1) ! check that we can set the variable
   print *, "omp_get_max_active_levels()=",omp_get_max_active_levels()

   !$omp parallel num_threads(2)
   if (.not. omp_in_parallel()) then
      print *, "FAIL - omp_in_parallel == .false. (expected .true.)"
   end if
   !$omp end parallel

   call omp_set_max_active_levels(0) ! make next parallel region inactive
   print *, "omp_get_max_active_levels()=",omp_get_max_active_levels()

   !$omp parallel num_threads(2)
   if (omp_in_parallel()) then
      print *, "FAIL - omp_in_parallel == .true. (expected .false.)"
   end if
   !$omp end parallel

end program F03_3_2_6_1a


> gfortran -o x -fopenmp test.f90
> ./x
 omp_get_max_active_levels()=  2147483647
 omp_get_max_active_levels()=           1
 omp_get_max_active_levels()=           1
 FAIL - omp_in_parallel == .true. (expected .false.)
 FAIL - omp_in_parallel == .true. (expected .false.)

Expected output is:

>  ./x
 omp_get_max_active_levels()= 1
 omp_get_max_active_levels()= 1
 omp_get_max_active_levels()= 0
>

OpenMP Citations:

Since an execution environment routine is involved, C and C++ versions
of the same test should work when this problem is fixed.

The following appears in the OpenMP API Ver 3 (May 2008) Section 3.2.14
on p. 126 lines 6-7, and lines 20-21:

"The omp_set_max_active_levels routine limits the number of nested active
parallel regions by setting the max-active-levels-var ICV."
"The value of the argument passed to this routine must evaluate to a
non-negative integer, or else the behavior of this routine is implementation
defined."

Section 3.2.15 p. 128 lines 17-18 state:

"The omp_get_max_active_levels routine returns the value of the 
max-active-levels-var ICG, which determines the maximum number of nested
active parallel regions."

Currently a call to omp_set_max_active_levels(0) appears to not be setting
the ICV, since a subsequent call to omp_get_max_active_levels remains
unchanged.

A similar problem exists for invoking the C/C++ routine.


-- 
           Summary: OpenMP omp_set_max_active_levels(0) isn't resetting
                    value
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: longb at cray dot com
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42942


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]