diff options
author | Kwok Cheung Yeung <kcy@codesourcery.com> | 2020-10-07 09:34:32 -0700 |
---|---|---|
committer | Kwok Cheung Yeung <kcy@codesourcery.com> | 2020-11-11 12:57:43 -0800 |
commit | 28c4af5f39bbceba04c67acdf6c771f5375ad52c (patch) | |
tree | 56dc261757e38ac587d750577cb95ace685841b1 /libgomp/env.c | |
parent | 3a857fecdc2cb784cd14caa488b1cf6c886bb037 (diff) | |
download | gcc-28c4af5f39bbceba04c67acdf6c771f5375ad52c.tar.gz |
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.
This is a backport from mainline (commits
8949b985dbaf07d433bd57d2883e1e5414f20e75 and
445567b22a3c535be0b1861b393e9a0b050f2b1e).
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_max_active_levels): Modify description.
(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/env.c')
-rw-r--r-- | libgomp/env.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libgomp/env.c b/libgomp/env.c index c0c4730d47c..d730c483d7f 100644 --- a/libgomp/env.c +++ b/libgomp/env.c @@ -73,7 +73,7 @@ struct gomp_task_icv gomp_global_icv = { .target_data = NULL }; -unsigned long gomp_max_active_levels_var = INT_MAX; +unsigned long gomp_max_active_levels_var = gomp_supported_active_levels; bool gomp_cancel_var = false; int gomp_max_task_priority_var = 0; #ifndef HAVE_SYNC_BUILTINS @@ -1369,6 +1369,8 @@ initialize_env (void) parse_int ("OMP_MAX_TASK_PRIORITY", &gomp_max_task_priority_var, true); parse_unsigned_long ("OMP_MAX_ACTIVE_LEVELS", &gomp_max_active_levels_var, true); + if (gomp_max_active_levels_var > gomp_supported_active_levels) + gomp_max_active_levels_var = gomp_supported_active_levels; gomp_def_allocator = parse_allocator (); if (parse_unsigned_long ("OMP_THREAD_LIMIT", &thread_limit_var, false)) { |