[Openmp-commits] [openmp] r354368 - [OpenMP 5.0] Add omp_get_supported_active_levels()

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 19 10:51:11 PST 2019


Author: jlpeyton
Date: Tue Feb 19 10:51:11 2019
New Revision: 354368

URL: http://llvm.org/viewvc/llvm-project?rev=354368&view=rev
Log:
[OpenMP 5.0] Add omp_get_supported_active_levels()

This patch adds the new 5.0 API function omp_get_supported_active_levels().

Patch by Terry Wilmarth

Differential Revision: https://reviews.llvm.org/D58211

Modified:
    openmp/trunk/runtime/src/dllexports
    openmp/trunk/runtime/src/include/50/omp.h.var
    openmp/trunk/runtime/src/include/50/omp_lib.f.var
    openmp/trunk/runtime/src/include/50/omp_lib.f90.var
    openmp/trunk/runtime/src/include/50/omp_lib.h.var
    openmp/trunk/runtime/src/kmp_ftn_entry.h
    openmp/trunk/runtime/src/kmp_ftn_os.h
    openmp/trunk/runtime/test/parallel/omp_nested.c

Modified: openmp/trunk/runtime/src/dllexports
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/dllexports?rev=354368&r1=354367&r2=354368&view=diff
==============================================================================
--- openmp/trunk/runtime/src/dllexports (original)
+++ openmp/trunk/runtime/src/dllexports Tue Feb 19 10:51:11 2019
@@ -556,6 +556,7 @@ kmp_set_disp_num_buffers
     ompc_capture_affinity                   755
     omp_pause_resource                      756
     omp_pause_resource_all                  757
+    omp_get_supported_active_levels         758
 
     OMP_NULL_ALLOCATOR                     DATA
     omp_default_mem_alloc                  DATA

Modified: openmp/trunk/runtime/src/include/50/omp.h.var
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/include/50/omp.h.var?rev=354368&r1=354367&r2=354368&view=diff
==============================================================================
--- openmp/trunk/runtime/src/include/50/omp.h.var (original)
+++ openmp/trunk/runtime/src/include/50/omp.h.var Tue Feb 19 10:51:11 2019
@@ -257,6 +257,8 @@
     extern int __KAI_KMPC_CONVENTION omp_pause_resource(omp_pause_resource_t, int);
     extern int __KAI_KMPC_CONVENTION omp_pause_resource_all(omp_pause_resource_t);
 
+    extern int __KAI_KMPC_CONVENTION omp_get_supported_active_levels(void);
+
 #   undef __KAI_KMPC_CONVENTION
 #   undef __KMP_IMP
 

Modified: openmp/trunk/runtime/src/include/50/omp_lib.f.var
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/include/50/omp_lib.f.var?rev=354368&r1=354367&r2=354368&view=diff
==============================================================================
--- openmp/trunk/runtime/src/include/50/omp_lib.f.var (original)
+++ openmp/trunk/runtime/src/include/50/omp_lib.f.var Tue Feb 19 10:51:11 2019
@@ -301,6 +301,11 @@
             integer (kind=omp_integer_kind) omp_pause_resource_all
           end function omp_pause_resource_all
 
+          function omp_get_supported_active_levels()
+            use omp_lib_kinds
+            integer (kind=omp_integer_kind) omp_get_supported_active_levels
+          end function omp_get_supported_active_levels
+
           subroutine omp_init_lock(svar)
 !DIR$ IF(__INTEL_COMPILER.GE.1400)
 !DIR$ attributes known_intrinsic :: omp_init_lock
@@ -641,6 +646,7 @@
 !dec$ attributes alias:'OMP_GET_DEVICE_NUM' :: omp_get_device_num
 !dec$ attributes alias:'OMP_PAUSE_RESOURCE' :: omp_pause_resource
 !dec$ attributes alias:'OMP_PAUSE_RESOURCE_ALL' :: omp_pause_resource_all
+!dec$ attributes alias:'OMP_GET_SUPPORTED_ACTIVE_LEVELS' :: omp_get_supported_active_levels
 
 !dec$ attributes alias:'OMP_CONTROL_TOOL' :: omp_control_tool
 !dec$ attributes alias:'OMP_SET_AFFINITY_FORMAT' :: omp_set_affinity_format
@@ -731,6 +737,7 @@
 !dec$ attributes alias:'_OMP_GET_DEVICE_NUM' :: omp_get_device_num
 !dec$ attributes alias:'_OMP_PAUSE_RESOURCE' :: omp_pause_resource
 !dec$ attributes alias:'_OMP_PAUSE_RESOURCE_ALL' :: omp_pause_resource_all
+!dec$ attributes alias:'_OMP_GET_SUPPORTED_ACTIVE_LEVELS' :: omp_get_supported_active_levels
 
 !dec$ attributes alias:'_OMP_CONTROL_TOOL' :: omp_control_tool
 !dec$ attributes alias:'_OMP_SET_AFFINITY_FORMAT' :: omp_set_affinity_format
@@ -824,6 +831,7 @@
 !dec$ attributes alias:'omp_get_device_num_'::omp_get_device_num
 !dec$ attributes alias:'omp_pause_resource_' :: omp_pause_resource
 !dec$ attributes alias:'omp_pause_resource_all_' :: omp_pause_resource_all
+!dec$ attributes alias:'omp_get_supported_active_levels_' :: omp_get_supported_active_levels
 
 !dec$ attributes alias:'omp_set_affinity_format_' :: omp_set_affinity_format
 !dec$ attributes alias:'omp_get_affinity_format_' :: omp_get_affinity_format
@@ -916,6 +924,7 @@
 !dec$ attributes alias:'_omp_get_device_num_'::omp_get_device_num
 !dec$ attributes alias:'_omp_pause_resource_' :: omp_pause_resource
 !dec$ attributes alias:'_omp_pause_resource_all_' :: omp_pause_resource_all
+!dec$ attributes alias:'_omp_get_supported_active_levels_' :: omp_get_supported_active_levels
 
 !dec$ attributes alias:'_omp_init_lock_'::omp_init_lock
 !dec$ attributes alias:'_omp_init_lock_with_hint_'::omp_init_lock_with_hint

Modified: openmp/trunk/runtime/src/include/50/omp_lib.f90.var
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/include/50/omp_lib.f90.var?rev=354368&r1=354367&r2=354368&view=diff
==============================================================================
--- openmp/trunk/runtime/src/include/50/omp_lib.f90.var (original)
+++ openmp/trunk/runtime/src/include/50/omp_lib.f90.var Tue Feb 19 10:51:11 2019
@@ -317,6 +317,11 @@
             integer (kind=omp_integer_kind) omp_pause_resource_all
           end function omp_pause_resource_all
 
+          function omp_get_supported_active_levels() bind(c)
+            use omp_lib_kinds
+            integer (kind=omp_integer_kind) omp_get_supported_active_levels
+          end function omp_get_supported_active_levels
+
           subroutine omp_init_lock(svar) bind(c)
 !DIR$ IF(__INTEL_COMPILER.GE.1400)
 !DIR$ attributes known_intrinsic :: omp_init_lock

Modified: openmp/trunk/runtime/src/include/50/omp_lib.h.var
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/include/50/omp_lib.h.var?rev=354368&r1=354367&r2=354368&view=diff
==============================================================================
--- openmp/trunk/runtime/src/include/50/omp_lib.h.var (original)
+++ openmp/trunk/runtime/src/include/50/omp_lib.h.var Tue Feb 19 10:51:11 2019
@@ -352,6 +352,11 @@
           integer (kind=omp_integer_kind) omp_pause_resource_all
         end function omp_pause_resource_all
 
+        function omp_get_supported_active_levels() bind(c)
+          import
+          integer (kind=omp_integer_kind) omp_get_supported_active_levels
+        end function omp_get_supported_active_levels
+
         subroutine omp_init_lock(svar) bind(c)
 !DIR$ IF(__INTEL_COMPILER.GE.1400)
 !DIR$ attributes known_intrinsic :: omp_init_lock
@@ -674,6 +679,7 @@
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_device_num
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource_all
+!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_supported_active_levels
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_teams
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_team_num
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_lock
@@ -755,6 +761,7 @@
 !$omp declare target(omp_get_device_num )
 !$omp declare target(omp_pause_resource )
 !$omp declare target(omp_pause_resource_all )
+!$omp declare target(omp_get_supported_active_levels )
 !$omp declare target(omp_get_num_teams )
 !$omp declare target(omp_get_team_num )
 !$omp declare target(omp_init_lock )

Modified: openmp/trunk/runtime/src/kmp_ftn_entry.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_ftn_entry.h?rev=354368&r1=354367&r2=354368&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_ftn_entry.h (original)
+++ openmp/trunk/runtime/src/kmp_ftn_entry.h Tue Feb 19 10:51:11 2019
@@ -1371,6 +1371,15 @@ int FTN_STDCALL FTN_PAUSE_RESOURCE_ALL(k
 #endif
 }
 
+// Returns the maximum number of nesting levels supported by implementation
+int FTN_STDCALL FTN_GET_SUPPORTED_ACTIVE_LEVELS(void) {
+#ifdef KMP_STUB
+  return 1;
+#else
+  return KMP_MAX_ACTIVE_LEVELS_LIMIT;
+#endif
+}
+
 #endif // OMP_50_ENABLED
 
 // GCC compatibility (versioned symbols)
@@ -1476,6 +1485,7 @@ KMP_VERSION_SYMBOL(FTN_GET_PARTITION_PLA
 // KMP_VERSION_SYMBOL(FTN_GET_DEVICE_NUM, 50, "OMP_5.0");
 // KMP_VERSION_SYMBOL(FTN_PAUSE_RESOURCE, 50, "OMP_5.0");
 // KMP_VERSION_SYMBOL(FTN_PAUSE_RESOURCE_ALL, 50, "OMP_5.0");
+// KMP_VERSION_SYMBOL(FTN_GET_SUPPORTED_ACTIVE_LEVELS, 50, "OMP_5.0");
 #endif
 
 #endif // KMP_USE_VERSION_SYMBOLS

Modified: openmp/trunk/runtime/src/kmp_ftn_os.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_ftn_os.h?rev=354368&r1=354367&r2=354368&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_ftn_os.h (original)
+++ openmp/trunk/runtime/src/kmp_ftn_os.h Tue Feb 19 10:51:11 2019
@@ -143,6 +143,7 @@
 #define FTN_CAPTURE_AFFINITY omp_capture_affinity
 #define FTN_PAUSE_RESOURCE omp_pause_resource
 #define FTN_PAUSE_RESOURCE_ALL omp_pause_resource_all
+#define FTN_GET_SUPPORTED_ACTIVE_LEVELS omp_get_supported_active_levels
 #endif
 
 #endif /* KMP_FTN_PLAIN */
@@ -274,6 +275,7 @@
 #define FTN_CAPTURE_AFFINITY omp_capture_affinity_
 #define FTN_PAUSE_RESOURCE omp_pause_resource_
 #define FTN_PAUSE_RESOURCE_ALL omp_pause_resource_all_
+#define FTN_GET_SUPPORTED_ACTIVE_LEVELS omp_get_supported_active_levels_
 #endif
 
 #endif /* KMP_FTN_APPEND */
@@ -405,6 +407,7 @@
 #define FTN_CAPTURE_AFFINITY OMP_CAPTURE_AFFINITY
 #define FTN_PAUSE_RESOURCE OMP_PAUSE_RESOURCE
 #define FTN_PAUSE_RESOURCE_ALL OMP_PAUSE_RESOURCE_ALL
+#define FTN_GET_SUPPORTED_ACTIVE_LEVELS OMP_GET_SUPPORTED_ACTIVE_LEVELS
 #endif
 
 #endif /* KMP_FTN_UPPER */
@@ -536,6 +539,7 @@
 #define FTN_CAPTURE_AFFINITY OMP_CAPTURE_AFFINITY_
 #define FTN_PAUSE_RESOURCE OMP_PAUSE_RESOURCE_
 #define FTN_PAUSE_RESOURCE_ALL OMP_PAUSE_RESOURCE_ALL_
+#define FTN_GET_SUPPORTED_ACTIVE_LEVELS OMP_GET_SUPPORTED_ACTIVE_LEVELS_
 #endif
 
 #endif /* KMP_FTN_UAPPEND */

Modified: openmp/trunk/runtime/test/parallel/omp_nested.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/parallel/omp_nested.c?rev=354368&r1=354367&r2=354368&view=diff
==============================================================================
--- openmp/trunk/runtime/test/parallel/omp_nested.c (original)
+++ openmp/trunk/runtime/test/parallel/omp_nested.c Tue Feb 19 10:51:11 2019
@@ -19,6 +19,7 @@ int test_omp_nested()
   int counter = 0;
 #ifdef _OPENMP
   omp_set_nested(1);
+  omp_set_max_active_levels(omp_get_supported_active_levels());
 #endif
 
   #pragma omp parallel shared(counter)




More information about the Openmp-commits mailing list