public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98699] New: Reset OMP_NESTED to true if OMP_MAX_ACTIVE_LEVELS is > 1.
@ 2021-01-15 16:26 longb at cray dot com
  2021-01-15 20:48 ` [Bug libgomp/98699] " anlauf at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: longb at cray dot com @ 2021-01-15 16:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98699

            Bug ID: 98699
           Summary: Reset OMP_NESTED to true if OMP_MAX_ACTIVE_LEVELS is >
                    1.
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: longb at cray dot com
  Target Milestone: ---

The user's desire is that, for an OpenMP code, if the maximum number
of active levels (OMP_MAX_ACTIVE_LEVELS) has a value greater than 1
then the internal variable for nesting (OMP_NESTING) automatically be
reset to .true. .  The Cray and Intel compilers appear to do this (and
issue a message about OMP_NESTING being deprecated) while gfortran
does not. If NESTING is disabled, having the maximum number of active
levels greater than 1 does not seem to make sense.

Simple test code:

> cat test.f90
program list_omp_internan_vars
  use omp_lib
  integer active
  logical nested

  nested = omp_get_nested()
  print *, "Internal value for omp_nested is ", nested

  active = omp_get_max_active_levels()
  print *, "Internal value for omp_max_active_levels is ", active

end program list_omp_internan_vars


For gfortran:

> gfortran -fopenmp test.f90
> export OMP_MAX_ACTIVE_LEVELS=1
> srun -n1 -c4 ./a.out
Internal value for omp_nested is F
Internal value for omp_max_active_levels is 1
> export OMP_MAX_ACTIVE_LEVELS=4
> srun -n1 -c4 ./a.out
Internal value for omp_nested is F
Internal value for omp_max_active_levels is 4
> gfortran --version
GNU Fortran (GCC) 10.2.0 20200723 (Cray Inc.)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Same example with CCE:

> ftn -homp test.f90
> export OMP_MAX_ACTIVE_LEVELS=1
> srun -n1 -c4 ./a.out
WARNING: omp_get_nested has been deprecated in OpenMP 5.0.
Internal value for omp_nested is F
Internal value for omp_max_active_levels is 1
> export OMP_MAX_ACTIVE_LEVELS=4
 srun -n1 -c4 ./a.out
WARNING: omp_get_nested has been deprecated in OpenMP 5.0.
Internal value for omp_nested is T
Internal value for omp_max_active_levels is 4


Same example with Intel ( same convention as the Cray compiler):

> export OMP_MAX_ACTIVE_LEVELS=1
> ifort -qopenmp test.f90
> srun -n1 -c4 ./a.out
OMP: Info #274: omp_get_nested routine deprecated, please use
omp_get_max_active_levels instead.
Internal value for omp_nested is F
Internal value for omp_max_active_levels is 1
> export OMP_MAX_ACTIVE_LEVELS=4
> srun -n1 -c4 ./a.out
OMP: Info #274: omp_get_nested routine deprecated, please use
omp_get_max_active_levels instead.
Internal value for omp_nested is T
Internal value for omp_max_active_levels is 4

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

* [Bug libgomp/98699] Reset OMP_NESTED to true if OMP_MAX_ACTIVE_LEVELS is > 1.
  2021-01-15 16:26 [Bug fortran/98699] New: Reset OMP_NESTED to true if OMP_MAX_ACTIVE_LEVELS is > 1 longb at cray dot com
@ 2021-01-15 20:48 ` anlauf at gcc dot gnu.org
  2021-01-19 10:38 ` burnus at gcc dot gnu.org
  2021-01-19 15:10 ` longb at cray dot com
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-15 20:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98699

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |libgomp
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
           Keywords|                            |openmp
                 CC|                            |jakub at gcc dot gnu.org
   Last reconfirmed|                            |2021-01-15

--- Comment #1 from anlauf at gcc dot gnu.org ---
Isn't this a general OpenMP issue rather than Fortran?

It would help to provide a C testcase too to resolve this.

I've moved this to libgomp.

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

* [Bug libgomp/98699] Reset OMP_NESTED to true if OMP_MAX_ACTIVE_LEVELS is > 1.
  2021-01-15 16:26 [Bug fortran/98699] New: Reset OMP_NESTED to true if OMP_MAX_ACTIVE_LEVELS is > 1 longb at cray dot com
  2021-01-15 20:48 ` [Bug libgomp/98699] " anlauf at gcc dot gnu.org
@ 2021-01-19 10:38 ` burnus at gcc dot gnu.org
  2021-01-19 15:10 ` longb at cray dot com
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-01-19 10:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98699

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|WAITING                     |RESOLVED
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Hi Bill – thanks for the report. However, in upcoming GCC 11 this has improved:

(default) F 1
OMP_MAX_ACTIVE_LEVELS=1 F 1
OMP_MAX_ACTIVE_LEVELS=4 T 4

That's in line with your CCE and Intel examples.

The documentation mentions this also – kind of. (It states what GCC does and
the new functions but does not spell out the deprecation:
https://gcc.gnu.org/onlinedocs/libgomp/omp_005fget_005fnested.html and
https://gcc.gnu.org/onlinedocs/libgomp/OMP_005fNESTED.html )



Regarding the deprecation warning, the source files contain the following.
Note that in order not to promise too much, _OPENMP is set to 201511 (= OpenMP
4.5).

For C/C++, 'omp.h.in':

#if defined(__GNUC__) && _OPENMP >= 201811
# define __GOMP_DEPRECATED_5_0 __attribute__((__deprecated__))
#else
# define __GOMP_DEPRECATED_5_0
#endif
...
extern void omp_set_nested (int) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0;
extern int omp_get_nested (void) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0;

And for Fortran (only 'omp_lib' module):

#if _OPENMP >= 201811
!GCC$ ATTRIBUTES DEPRECATED :: omp_get_nested, omp_set_nested
#endif

Thus, currently no deprecation warnings – but once the version is bumped, there
will be compile-time warnings.

See also: https://gcc.gnu.org/g:6fae7eda968db658c280ad6f94fe6906a15af0c9


Thus, I think it can be closed as FIXED. Feel free to reopen (or fill a new
bug) is more issues come up.

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

* [Bug libgomp/98699] Reset OMP_NESTED to true if OMP_MAX_ACTIVE_LEVELS is > 1.
  2021-01-15 16:26 [Bug fortran/98699] New: Reset OMP_NESTED to true if OMP_MAX_ACTIVE_LEVELS is > 1 longb at cray dot com
  2021-01-15 20:48 ` [Bug libgomp/98699] " anlauf at gcc dot gnu.org
  2021-01-19 10:38 ` burnus at gcc dot gnu.org
@ 2021-01-19 15:10 ` longb at cray dot com
  2 siblings, 0 replies; 4+ messages in thread
From: longb at cray dot com @ 2021-01-19 15:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98699

--- Comment #3 from Bill Long <longb at cray dot com> ---
Thanks, Tobias.  GCC 11 should be fine. Great to see you back.

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

end of thread, other threads:[~2021-01-19 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 16:26 [Bug fortran/98699] New: Reset OMP_NESTED to true if OMP_MAX_ACTIVE_LEVELS is > 1 longb at cray dot com
2021-01-15 20:48 ` [Bug libgomp/98699] " anlauf at gcc dot gnu.org
2021-01-19 10:38 ` burnus at gcc dot gnu.org
2021-01-19 15:10 ` longb at cray dot com

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).