From 76b45e874d477cebc8c4f9e11cedbf3d4352aa5a Mon Sep 17 00:00:00 2001 From: Jonathan Peyton Date: Thu, 28 Feb 2019 20:47:21 +0000 Subject: [OpenMP 5.0] Deprecate nest-var and associated features Nest-var, OMP_NESTED, omp_set_nested()., and omp_get_nested() have been deprecated in the 5.0 spec. Initial nesting info is now derived from OMP_MAX_ACTIVE_LEVELS, OMP_NUM_THREADS, and OMP_PROC_BIND. This patch deprecates the internal ICV that corresponds to nest-var, and replaces it with the max-active-levels-var ICV to determine nesting. The change still allows for use of OMP_NESTED (according to 5.0 changes), omp_get_nested, and omp_set_nested, which have had deprecation messages added to them. The change allows certain settings of OMP_NUM_THREADS, OMP_PROC_BIND, and OMP_MAX_ACTIVE_LEVELS to turn on nesting, but OMP_NESTED=0 will still force nesting to be off. The runtime now prints informative messages about deprecation of OMP_NESTED, omp_set_nested(), and omp_get_nested(), when those environment variables or routines are used. It also prints deprecated message in output for KMP_SETTINGS and OMP_DISPLAY_ENV for OMP_NESTED. This patch also fixes OMP_DISPLAY_ENV output for OMP_TARGET_OFFLOAD. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D58408 llvm-svn: 355138 --- openmp/runtime/src/kmp_runtime.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'openmp/runtime/src/kmp_runtime.cpp') diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp index 2a9e31d37c5..e6b673b425d 100644 --- a/openmp/runtime/src/kmp_runtime.cpp +++ b/openmp/runtime/src/kmp_runtime.cpp @@ -1719,11 +1719,11 @@ int __kmp_fork_call(ident_t *loc, int gtid, // parallel out of teams construct). This code moved here from // __kmp_reserve_threads() to speedup nested serialized parallels. if (nthreads > 1) { - if ((!get__nested(master_th) && (root->r.r_in_parallel + if ((get__max_active_levels(master_th) == 1 && (root->r.r_in_parallel #if OMP_40_ENABLED - && !enter_teams + && !enter_teams #endif /* OMP_40_ENABLED */ - )) || + )) || (__kmp_library == library_serial)) { KC_TRACE(10, ("__kmp_fork_call: T#%d serializing team; requested %d" " threads\n", @@ -3150,8 +3150,6 @@ static kmp_internal_control_t __kmp_get_global_icvs(void) { kmp_internal_control_t g_icvs = { 0, // int serial_nesting_level; //corresponds to value of th_team_serialized - (kmp_int8)__kmp_dflt_nested, // int nested; //internal control - // for nested parallelism (per thread) (kmp_int8)__kmp_global.g.g_dynamic, // internal control for dynamic // adjustment of threads (per thread) (kmp_int8)__kmp_env_blocktime, // int bt_set; //internal control for @@ -3207,7 +3205,6 @@ static void __kmp_initialize_root(kmp_root_t *root) { root->r.r_active = FALSE; root->r.r_in_parallel = 0; root->r.r_blocktime = __kmp_dflt_blocktime; - root->r.r_nested = __kmp_dflt_nested; /* setup the root team for this task */ /* allocate the root team structure */ @@ -3432,7 +3429,6 @@ void __kmp_print_structure(void) { __kmp_print_structure_thread(" Uber Thread: ", root->r.r_uber_thread); __kmp_printf(" Active?: %2d\n", root->r.r_active); - __kmp_printf(" Nested?: %2d\n", root->r.r_nested); __kmp_printf(" In Parallel: %2d\n", KMP_ATOMIC_LD_RLX(&root->r.r_in_parallel)); __kmp_printf("\n"); -- cgit v1.2.3