[Openmp-commits] [PATCH] D95263: [OpenMP] Add environment variable to force monotonic dynamic scheduling
Terry Wilmarth via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jan 28 09:36:49 PST 2021
tlwilmar updated this revision to Diff 319903.
tlwilmar added a comment.
Addressed Nawrin's comment fixes.
Repository:
rOMP OpenMP
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95263/new/
https://reviews.llvm.org/D95263
Files:
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_dispatch.cpp
openmp/runtime/src/kmp_global.cpp
openmp/runtime/src/kmp_settings.cpp
Index: openmp/runtime/src/kmp_settings.cpp
===================================================================
--- openmp/runtime/src/kmp_settings.cpp
+++ openmp/runtime/src/kmp_settings.cpp
@@ -3823,6 +3823,18 @@
#endif
// -----------------------------------------------------------------------------
+// KMP_FORCE_MONOTONIC_DYNAMIC_SCHEDULE
+static void __kmp_stg_parse_kmp_force_monotonic(char const *name,
+ char const *value, void *data) {
+ __kmp_stg_parse_bool(name, value, &(__kmp_force_monotonic));
+} // __kmp_stg_parse_kmp_force_monotonic
+
+static void __kmp_stg_print_kmp_force_monotonic(kmp_str_buf_t *buffer,
+ char const *name, void *data) {
+ __kmp_stg_print_bool(buffer, name, __kmp_force_monotonic);
+} // __kmp_stg_print_kmp_force_monotonic
+
+// -----------------------------------------------------------------------------
// KMP_ATOMIC_MODE
static void __kmp_stg_parse_atomic_mode(char const *name, char const *value,
@@ -4898,6 +4910,9 @@
{"KMP_DISP_HAND_THREAD", __kmp_stg_parse_kmp_hand_thread,
__kmp_stg_print_kmp_hand_thread, NULL, 0, 0},
#endif
+ {"KMP_FORCE_MONOTONIC_DYNAMIC_SCHEDULE",
+ __kmp_stg_parse_kmp_force_monotonic, __kmp_stg_print_kmp_force_monotonic,
+ NULL, 0, 0},
{"KMP_ATOMIC_MODE", __kmp_stg_parse_atomic_mode,
__kmp_stg_print_atomic_mode, NULL, 0, 0},
{"KMP_CONSISTENCY_CHECK", __kmp_stg_parse_consistency_check,
Index: openmp/runtime/src/kmp_global.cpp
===================================================================
--- openmp/runtime/src/kmp_global.cpp
+++ openmp/runtime/src/kmp_global.cpp
@@ -163,6 +163,7 @@
int __kmp_ncores = 0;
#endif
int __kmp_chunk = 0;
+int __kmp_force_monotonic = 0;
int __kmp_abort_delay = 0;
#if KMP_OS_LINUX && defined(KMP_TDATA_GTID)
int __kmp_gtid_mode = 3; /* use __declspec(thread) TLS to store gtid */
Index: openmp/runtime/src/kmp_dispatch.cpp
===================================================================
--- openmp/runtime/src/kmp_dispatch.cpp
+++ openmp/runtime/src/kmp_dispatch.cpp
@@ -80,7 +80,7 @@
if (loc->get_openmp_version() < 50)
monotonicity = SCHEDULE_MONOTONIC;
- if (use_hier)
+ if (use_hier || __kmp_force_monotonic)
monotonicity = SCHEDULE_MONOTONIC;
else if (SCHEDULE_HAS_NONMONOTONIC(schedule))
monotonicity = SCHEDULE_NONMONOTONIC;
Index: openmp/runtime/src/kmp.h
===================================================================
--- openmp/runtime/src/kmp.h
+++ openmp/runtime/src/kmp.h
@@ -2963,6 +2963,7 @@
extern enum sched_type __kmp_guided; /* default guided scheduling method */
extern enum sched_type __kmp_auto; /* default auto scheduling method */
extern int __kmp_chunk; /* default runtime chunk size */
+extern int __kmp_force_monotonic; /* whether monotonic scheduling forced */
extern size_t __kmp_stksize; /* stack size per thread */
#if KMP_USE_MONITOR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95263.319903.patch
Type: text/x-patch
Size: 2974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210128/3f2cd27b/attachment.bin>
More information about the Openmp-commits
mailing list