diff options
author | Kwok Cheung Yeung <kcy@codesourcery.com> | 2020-10-07 09:34:32 -0700 |
---|---|---|
committer | Kwok Cheung Yeung <kcy@codesourcery.com> | 2020-10-13 13:21:02 -0700 |
commit | 8949b985dbaf07d433bd57d2883e1e5414f20e75 (patch) | |
tree | 720277ee543e8dd32777b172aa37f5848a9f12fa /libgomp/icv.c | |
parent | 5204cc561a8d3c1a671969715ceb507ece8edef7 (diff) |
openmp: Add support for the omp_get_supported_active_levels runtime library routine
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.
Diffstat (limited to 'libgomp/icv.c')
-rw-r--r-- | libgomp/icv.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libgomp/icv.c b/libgomp/icv.c index 3c16abb9123..1bb46abac43 100644 --- a/libgomp/icv.c +++ b/libgomp/icv.c @@ -116,7 +116,12 @@ void omp_set_max_active_levels (int max_levels) { if (max_levels >= 0) - gomp_max_active_levels_var = max_levels; + { + if (max_levels <= gomp_supported_active_levels) + gomp_max_active_levels_var = max_levels; + else + gomp_max_active_levels_var = gomp_supported_active_levels; + } } int @@ -126,6 +131,12 @@ omp_get_max_active_levels (void) } int +omp_get_supported_active_levels (void) +{ + return gomp_supported_active_levels; +} + +int omp_get_cancellation (void) { return gomp_cancel_var; @@ -227,6 +238,7 @@ ialias (omp_get_max_threads) ialias (omp_get_thread_limit) ialias (omp_set_max_active_levels) ialias (omp_get_max_active_levels) +ialias (omp_get_supported_active_levels) ialias (omp_get_cancellation) ialias (omp_get_proc_bind) ialias (omp_get_initial_device) |