summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openmp/runtime/src/i18n/en_US.txt4
-rw-r--r--openmp/runtime/src/kmp.h1
-rw-r--r--openmp/runtime/src/kmp_global.cpp1
-rw-r--r--openmp/runtime/src/kmp_runtime.cpp20
-rw-r--r--openmp/runtime/src/kmp_settings.cpp14
5 files changed, 30 insertions, 10 deletions
diff --git a/openmp/runtime/src/i18n/en_US.txt b/openmp/runtime/src/i18n/en_US.txt
index 4c9b511d3da..3878f1e1450 100644
--- a/openmp/runtime/src/i18n/en_US.txt
+++ b/openmp/runtime/src/i18n/en_US.txt
@@ -38,7 +38,7 @@ Language "English"
Country "USA"
LangId "1033"
Version "2"
-Revision "20161216"
+Revision "20170327"
@@ -433,7 +433,7 @@ SubmitBugReport "Please submit a bug report with this message, comp
OBSOLETE "Check NLSPATH environment variable, its value is \"%1$s\"."
ChangeStackLimit "Please try changing the shell stack limit or adjusting the "
"OMP_STACKSIZE environment variable."
-Unset_ALL_THREADS "Consider unsetting KMP_DEVICE_THREAD_LIMIT (KMP_ALL_THREADS) and OMP_THREAD_LIMIT (if either is set)."
+Unset_ALL_THREADS "Consider unsetting KMP_DEVICE_THREAD_LIMIT (KMP_ALL_THREADS), KMP_TEAMS_THREAD_LIMIT, and OMP_THREAD_LIMIT (if any are set)."
Set_ALL_THREADPRIVATE "Consider setting KMP_ALL_THREADPRIVATE to a value larger than %1$d."
PossibleSystemLimitOnThreads "This could also be due to a system-related limit on the number of threads."
DuplicateLibrary "This means that multiple copies of the OpenMP runtime have been "
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 35a13ece34d..d97846f770d 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -2868,6 +2868,7 @@ extern int __kmp_sys_max_nth; /* system-imposed maximum number of threads */
extern int __kmp_max_nth;
// maximum total number of concurrently-existing threads in a contention group
extern int __kmp_cg_max_nth;
+extern int __kmp_teams_max_nth; // max threads used in a teams construct
extern int __kmp_threads_capacity; /* capacity of the arrays __kmp_threads and
__kmp_root */
extern int __kmp_dflt_team_nth; /* default number of threads in a parallel
diff --git a/openmp/runtime/src/kmp_global.cpp b/openmp/runtime/src/kmp_global.cpp
index 5591ca71513..755efa921c8 100644
--- a/openmp/runtime/src/kmp_global.cpp
+++ b/openmp/runtime/src/kmp_global.cpp
@@ -136,6 +136,7 @@ size_t __kmp_sys_min_stksize = KMP_MIN_STKSIZE;
int __kmp_sys_max_nth = KMP_MAX_NTH;
int __kmp_max_nth = 0;
int __kmp_cg_max_nth = 0;
+int __kmp_teams_max_nth = 0;
int __kmp_threads_capacity = 0;
int __kmp_dflt_team_nth = 0;
int __kmp_dflt_team_nth_ub = 0;
diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp
index bed1407269f..0736ca25c40 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -6413,6 +6413,10 @@ static void __kmp_do_serial_initialize(void) {
}
__kmp_max_nth = __kmp_sys_max_nth;
__kmp_cg_max_nth = __kmp_sys_max_nth;
+ __kmp_teams_max_nth = __kmp_xproc; // set a "reasonable" default
+ if (__kmp_teams_max_nth > __kmp_sys_max_nth) {
+ __kmp_teams_max_nth = __kmp_sys_max_nth;
+ }
// Three vars below moved here from __kmp_env_initialize() "KMP_BLOCKTIME"
// part
@@ -6989,14 +6993,14 @@ void __kmp_push_num_teams(ident_t *id, int gtid, int num_teams,
if (num_teams == 0)
num_teams = 1; // default number of teams is 1.
- if (num_teams > __kmp_max_nth) { // if too many teams requested?
+ if (num_teams > __kmp_teams_max_nth) { // if too many teams requested?
if (!__kmp_reserve_warn) {
__kmp_reserve_warn = 1;
__kmp_msg(kmp_ms_warning,
- KMP_MSG(CantFormThrTeam, num_teams, __kmp_max_nth),
+ KMP_MSG(CantFormThrTeam, num_teams, __kmp_teams_max_nth),
KMP_HNT(Unset_ALL_THREADS), __kmp_msg_null);
}
- num_teams = __kmp_max_nth;
+ num_teams = __kmp_teams_max_nth;
}
// Set number of teams (number of threads in the outer "parallel" of the
// teams)
@@ -7007,15 +7011,15 @@ void __kmp_push_num_teams(ident_t *id, int gtid, int num_teams,
if (!TCR_4(__kmp_init_middle))
__kmp_middle_initialize(); // get __kmp_avail_proc calculated
num_threads = __kmp_avail_proc / num_teams;
- if (num_teams * num_threads > __kmp_max_nth) {
+ if (num_teams * num_threads > __kmp_teams_max_nth) {
// adjust num_threads w/o warning as it is not user setting
- num_threads = __kmp_max_nth / num_teams;
+ num_threads = __kmp_teams_max_nth / num_teams;
}
} else {
- if (num_teams * num_threads > __kmp_max_nth) {
- int new_threads = __kmp_max_nth / num_teams;
+ if (num_teams * num_threads > __kmp_teams_max_nth) {
+ int new_threads = __kmp_teams_max_nth / num_teams;
if (!__kmp_reserve_warn) { // user asked for too many threads
- __kmp_reserve_warn = 1; // that conflicts with KMP_DEVICE_THREAD_LIMIT
+ __kmp_reserve_warn = 1; // that conflicts with KMP_TEAMS_THREAD_LIMIT
__kmp_msg(kmp_ms_warning,
KMP_MSG(CantFormThrTeam, num_threads, new_threads),
KMP_HNT(Unset_ALL_THREADS), __kmp_msg_null);
diff --git a/openmp/runtime/src/kmp_settings.cpp b/openmp/runtime/src/kmp_settings.cpp
index 28f18a6bcbc..51d9529b9b0 100644
--- a/openmp/runtime/src/kmp_settings.cpp
+++ b/openmp/runtime/src/kmp_settings.cpp
@@ -613,6 +613,18 @@ static void __kmp_stg_print_thread_limit(kmp_str_buf_t *buffer,
} // __kmp_stg_print_thread_limit
// -----------------------------------------------------------------------------
+// KMP_TEAMS_THREAD_LIMIT
+static void __kmp_stg_parse_teams_thread_limit(char const *name,
+ char const *value, void *data) {
+ __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth, &__kmp_teams_max_nth);
+} // __kmp_stg_teams_thread_limit
+
+static void __kmp_stg_print_teams_thread_limit(kmp_str_buf_t *buffer,
+ char const *name, void *data) {
+ __kmp_stg_print_int(buffer, name, __kmp_teams_max_nth);
+} // __kmp_stg_print_teams_thread_limit
+
+// -----------------------------------------------------------------------------
// KMP_BLOCKTIME
static void __kmp_stg_parse_blocktime(char const *name, char const *value,
@@ -4402,6 +4414,8 @@ static kmp_setting_t __kmp_stg_table[] = {
#endif
{"OMP_THREAD_LIMIT", __kmp_stg_parse_thread_limit,
__kmp_stg_print_thread_limit, NULL, 0, 0},
+ {"KMP_TEAMS_THREAD_LIMIT", __kmp_stg_parse_teams_thread_limit,
+ __kmp_stg_print_teams_thread_limit, NULL, 0, 0},
{"OMP_WAIT_POLICY", __kmp_stg_parse_wait_policy,
__kmp_stg_print_wait_policy, NULL, 0, 0},
{"KMP_DISP_NUM_BUFFERS", __kmp_stg_parse_disp_buffers,
OpenPOWER on IntegriCloud