public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42942]  New: OpenMP omp_set_max_active_levels(0) isn't resetting value
@ 2010-02-03  0:01 longb at cray dot com
  2010-03-22 12:41 ` [Bug libgomp/42942] " jakub at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: longb at cray dot com @ 2010-02-03  0:01 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libgomp/42942] OpenMP omp_set_max_active_levels(0) isn't resetting value
  2010-02-03  0:01 [Bug fortran/42942] New: OpenMP omp_set_max_active_levels(0) isn't resetting value longb at cray dot com
@ 2010-03-22 12:41 ` jakub at gcc dot gnu dot org
  2010-03-22 15:17 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-22 12:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2010-03-22 12:40 -------
Created an attachment (id=20158)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20158&action=view)
gcc45-pr42942.patch

So far untested fix.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libgomp/42942] OpenMP omp_set_max_active_levels(0) isn't resetting value
  2010-02-03  0:01 [Bug fortran/42942] New: OpenMP omp_set_max_active_levels(0) isn't resetting value longb at cray dot com
  2010-03-22 12:41 ` [Bug libgomp/42942] " jakub at gcc dot gnu dot org
@ 2010-03-22 15:17 ` jakub at gcc dot gnu dot org
  2010-03-22 15:23 ` jakub at gcc dot gnu dot org
  2010-03-22 15:28 ` jakub at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-22 15:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2010-03-22 15:17 -------
Subject: Bug 42942

Author: jakub
Date: Mon Mar 22 15:16:52 2010
New Revision: 157635

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157635
Log:
        PR libgomp/42942
        * env.c (parse_unsigned_long): Add ALLOW_ZERO argument.
        (initialize_env): Adjust callers.
        (omp_set_max_active_levels): Set gomp_max_active_levels_var even
        when the argument is 0.

        * testsuite/libgomp.c/pr42942.c: New test.

Added:
    trunk/libgomp/testsuite/libgomp.c/pr42942.c
Modified:
    trunk/libgomp/ChangeLog
    trunk/libgomp/env.c


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libgomp/42942] OpenMP omp_set_max_active_levels(0) isn't resetting value
  2010-02-03  0:01 [Bug fortran/42942] New: OpenMP omp_set_max_active_levels(0) isn't resetting value longb at cray dot com
  2010-03-22 12:41 ` [Bug libgomp/42942] " jakub at gcc dot gnu dot org
  2010-03-22 15:17 ` jakub at gcc dot gnu dot org
@ 2010-03-22 15:23 ` jakub at gcc dot gnu dot org
  2010-03-22 15:28 ` jakub at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-22 15:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-03-22 15:22 -------
Subject: Bug 42942

Author: jakub
Date: Mon Mar 22 15:22:31 2010
New Revision: 157636

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157636
Log:
        PR libgomp/42942
        * env.c (parse_unsigned_long): Add ALLOW_ZERO argument.
        (initialize_env): Adjust callers.
        (omp_set_max_active_levels): Set gomp_max_active_levels_var even
        when the argument is 0.

        * testsuite/libgomp.c/pr42942.c: New test.

Added:
    branches/gcc-4_4-branch/libgomp/testsuite/libgomp.c/pr42942.c
Modified:
    branches/gcc-4_4-branch/libgomp/ChangeLog
    branches/gcc-4_4-branch/libgomp/env.c


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libgomp/42942] OpenMP omp_set_max_active_levels(0) isn't resetting value
  2010-02-03  0:01 [Bug fortran/42942] New: OpenMP omp_set_max_active_levels(0) isn't resetting value longb at cray dot com
                   ` (2 preceding siblings ...)
  2010-03-22 15:23 ` jakub at gcc dot gnu dot org
@ 2010-03-22 15:28 ` jakub at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-03-22 15:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2010-03-22 15:27 -------
Fixed, thanks for the report.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-22 15:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-03  0:01 [Bug fortran/42942] New: OpenMP omp_set_max_active_levels(0) isn't resetting value longb at cray dot com
2010-03-22 12:41 ` [Bug libgomp/42942] " jakub at gcc dot gnu dot org
2010-03-22 15:17 ` jakub at gcc dot gnu dot org
2010-03-22 15:23 ` jakub at gcc dot gnu dot org
2010-03-22 15:28 ` jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).