8949b985db
This patch implements the omp_get_supported_active_levels runtime routine from the OpenMP 5.0 specification, which returns the maximum number of active nested parallel regions supported by this implementation. The current maximum (set using the omp_set_max_active_levels routine or the OMP_MAX_ACTIVE_LEVELS environment variable) cannot exceed this number. 2020-10-13 Kwok Cheung Yeung <kcy@codesourcery.com> libgomp/ * env.c (gomp_max_active_levels_var): Initialize to gomp_supported_active_levels. (initialize_env): Limit gomp_max_active_levels_var to be at most equal to gomp_supported_active_levels. * fortran.c (omp_get_supported_active_levels): Add ialias_redirect. (omp_get_supported_active_levels_): New. * icv.c (omp_set_max_active_levels): Limit gomp_max_active_levels_var to at most equal to gomp_supported_active_levels. (omp_get_supported_active_levels): New. * libgomp.h (gomp_supported_active_levels): New. * libgomp.map (OMP_5.0.1): Add omp_get_supported_active_levels and omp_get_supported_active_levels_. * libgomp.texi (omp_get_supported_active_levels): New. (omp_set_max_active_levels): Update. Add reference to omp_get_supported_active_levels. * omp.h.in (omp_get_supported_active_levels): New. * omp_lib.f90.in (omp_get_supported_active_levels): New. * omp_lib.h.in (omp_get_supported_active_levels): New. * testsuite/libgomp.c/lib-2.c (main): Check omp_get_max_active_levels against omp_get_supported_active_levels. * testsuite/libgomp.fortran/lib4.f90 (lib4): Likewise.
19 lines
626 B
Fortran
19 lines
626 B
Fortran
! { dg-do run }
|
|
|
|
program lib4
|
|
use omp_lib
|
|
integer (omp_sched_kind) :: kind
|
|
integer :: modifier
|
|
call omp_set_schedule (omp_sched_static, 32)
|
|
call omp_get_schedule (kind, modifier)
|
|
if (kind.ne.omp_sched_static.or.modifier.ne.32) stop 1
|
|
call omp_set_schedule (omp_sched_dynamic, 4)
|
|
call omp_get_schedule (kind, modifier)
|
|
if (kind.ne.omp_sched_dynamic.or.modifier.ne.4) stop 2
|
|
if (omp_get_thread_limit ().lt.0) stop 3
|
|
call omp_set_max_active_levels (6)
|
|
if (omp_get_max_active_levels ().ne.6) stop 4
|
|
if (omp_get_max_active_levels () &
|
|
.gt.omp_get_supported_active_levels ()) stop 5
|
|
end program lib4
|