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

Reply via email to