[Openmp-commits] [openmp] r343137 - [OpenMP][OMPT] A few improvements
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Wed Sep 26 13:19:44 PDT 2018
Author: jlpeyton
Date: Wed Sep 26 13:19:44 2018
New Revision: 343137
URL: http://llvm.org/viewvc/llvm-project?rev=343137&view=rev
Log:
[OpenMP][OMPT] A few improvements
This change includes miscellaneous improvements as follows:
1) Added ompt_get_proc_id() implementation for Windows
2) Added parser and print tool for omp-tool-var, just in case it needs
to be printed (OMP_DISPLAY_ENV)
3) omp_control_tool is exported on Windows
Patch by Hansang Bae
Differential Revision: https://reviews.llvm.org/D50538
Modified:
openmp/trunk/runtime/src/dllexports
openmp/trunk/runtime/src/kmp_dispatch.cpp
openmp/trunk/runtime/src/kmp_dispatch.h
openmp/trunk/runtime/src/kmp_settings.cpp
openmp/trunk/runtime/src/kmp_settings.h
openmp/trunk/runtime/src/kmp_str.cpp
openmp/trunk/runtime/src/ompt-general.cpp
Modified: openmp/trunk/runtime/src/dllexports
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/dllexports?rev=343137&r1=343136&r2=343137&view=diff
==============================================================================
--- openmp/trunk/runtime/src/dllexports (original)
+++ openmp/trunk/runtime/src/dllexports Wed Sep 26 13:19:44 2018
@@ -557,6 +557,9 @@ kmp_set_disp_num_buffers
omp_thread_mem_alloc DATA
%endif # OMP_50
+%ifdef OMP_50
+ omp_control_tool 891
+%endif # OMP_50
%ifndef stub
# Ordinals between 900 and 999 are reserved
Modified: openmp/trunk/runtime/src/kmp_dispatch.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_dispatch.cpp?rev=343137&r1=343136&r2=343137&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_dispatch.cpp (original)
+++ openmp/trunk/runtime/src/kmp_dispatch.cpp Wed Sep 26 13:19:44 2018
@@ -18,13 +18,6 @@
* is the largest value __kmp_nth may take, 1 is the smallest.
*/
-// Need to raise Win version from XP to Vista here for support of
-// InterlockedExchange64
-#if defined(_WIN32_WINNT) && defined(_M_IX86)
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0502
-#endif
-
#include "kmp.h"
#include "kmp_error.h"
#include "kmp_i18n.h"
Modified: openmp/trunk/runtime/src/kmp_dispatch.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_dispatch.h?rev=343137&r1=343136&r2=343137&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_dispatch.h (original)
+++ openmp/trunk/runtime/src/kmp_dispatch.h Wed Sep 26 13:19:44 2018
@@ -17,13 +17,6 @@
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
-// Need to raise Win version from XP to Vista here for support of
-// InterlockedExchange64
-#if defined(_WIN32_WINNT) && defined(_M_IX86)
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0502
-#endif
-
#include "kmp.h"
#include "kmp_error.h"
#include "kmp_i18n.h"
Modified: openmp/trunk/runtime/src/kmp_settings.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.cpp?rev=343137&r1=343136&r2=343137&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.cpp (original)
+++ openmp/trunk/runtime/src/kmp_settings.cpp Wed Sep 26 13:19:44 2018
@@ -4658,6 +4658,22 @@ static void __kmp_stg_print_omp_cancella
#endif
#if OMP_50_ENABLED && OMPT_SUPPORT
+static int __kmp_tool = 1;
+
+static void __kmp_stg_parse_omp_tool(char const *name, char const *value,
+ void *data) {
+ __kmp_stg_parse_bool(name, value, &__kmp_tool);
+} // __kmp_stg_parse_omp_tool
+
+static void __kmp_stg_print_omp_tool(kmp_str_buf_t *buffer, char const *name,
+ void *data) {
+ if (__kmp_env_format) {
+ KMP_STR_BUF_PRINT_BOOL_EX(name, __kmp_tool, "enabled", "disabled");
+ } else {
+ __kmp_str_buf_print(buffer, " %s=%s\n", name,
+ __kmp_tool ? "enabled" : "disabled");
+ }
+} // __kmp_stg_print_omp_tool
static char *__kmp_tool_libraries = NULL;
@@ -4939,6 +4955,8 @@ static kmp_setting_t __kmp_stg_table[] =
#endif
#if OMP_50_ENABLED && OMPT_SUPPORT
+ {"OMP_TOOL", __kmp_stg_parse_omp_tool, __kmp_stg_print_omp_tool, NULL, 0,
+ 0},
{"OMP_TOOL_LIBRARIES", __kmp_stg_parse_omp_tool_libraries,
__kmp_stg_print_omp_tool_libraries, NULL, 0, 0},
#endif
Modified: openmp/trunk/runtime/src/kmp_settings.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.h?rev=343137&r1=343136&r2=343137&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.h (original)
+++ openmp/trunk/runtime/src/kmp_settings.h Wed Sep 26 13:19:44 2018
@@ -31,9 +31,11 @@ int __kmp_default_tp_capacity(int, int,
__kmp_str_buf_print(buffer, " %s %s", KMP_I18N_STR(Device), name)
#define KMP_STR_BUF_PRINT_NAME_EX(x) \
__kmp_str_buf_print(buffer, " %s %s='", KMP_I18N_STR(Device), x)
+#define KMP_STR_BUF_PRINT_BOOL_EX(n, v, t, f) \
+ __kmp_str_buf_print(buffer, " %s %s='%s'\n", KMP_I18N_STR(Device), n, \
+ (v) ? t : f)
#define KMP_STR_BUF_PRINT_BOOL \
- __kmp_str_buf_print(buffer, " %s %s='%s'\n", KMP_I18N_STR(Device), name, \
- value ? "TRUE" : "FALSE");
+ KMP_STR_BUF_PRINT_BOOL_EX(name, value, "TRUE", "FALSE")
#define KMP_STR_BUF_PRINT_INT \
__kmp_str_buf_print(buffer, " %s %s='%d'\n", KMP_I18N_STR(Device), name, \
value)
@@ -48,9 +50,11 @@ int __kmp_default_tp_capacity(int, int,
__kmp_str_buf_print(buffer, " %s %s", KMP_I18N_STR(Host), name)
#define KMP_STR_BUF_PRINT_NAME_EX(x) \
__kmp_str_buf_print(buffer, " %s %s='", KMP_I18N_STR(Host), x)
+#define KMP_STR_BUF_PRINT_BOOL_EX(n, v, t, f) \
+ __kmp_str_buf_print(buffer, " %s %s='%s'\n", KMP_I18N_STR(Host), n, \
+ (v) ? t : f)
#define KMP_STR_BUF_PRINT_BOOL \
- __kmp_str_buf_print(buffer, " %s %s='%s'\n", KMP_I18N_STR(Host), name, \
- value ? "TRUE" : "FALSE");
+ KMP_STR_BUF_PRINT_BOOL_EX(name, value, "TRUE", "FALSE")
#define KMP_STR_BUF_PRINT_INT \
__kmp_str_buf_print(buffer, " %s %s='%d'\n", KMP_I18N_STR(Host), name, value)
#define KMP_STR_BUF_PRINT_UINT64 \
Modified: openmp/trunk/runtime/src/kmp_str.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_str.cpp?rev=343137&r1=343136&r2=343137&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_str.cpp (original)
+++ openmp/trunk/runtime/src/kmp_str.cpp Wed Sep 26 13:19:44 2018
@@ -452,7 +452,8 @@ int __kmp_str_match_false(char const *da
int result =
__kmp_str_match("false", 1, data) || __kmp_str_match("off", 2, data) ||
__kmp_str_match("0", 1, data) || __kmp_str_match(".false.", 2, data) ||
- __kmp_str_match(".f.", 2, data) || __kmp_str_match("no", 1, data);
+ __kmp_str_match(".f.", 2, data) || __kmp_str_match("no", 1, data) ||
+ __kmp_str_match("disabled", 0, data);
return result;
} // __kmp_str_match_false
@@ -460,7 +461,8 @@ int __kmp_str_match_true(char const *dat
int result =
__kmp_str_match("true", 1, data) || __kmp_str_match("on", 2, data) ||
__kmp_str_match("1", 1, data) || __kmp_str_match(".true.", 2, data) ||
- __kmp_str_match(".t.", 2, data) || __kmp_str_match("yes", 1, data);
+ __kmp_str_match(".t.", 2, data) || __kmp_str_match("yes", 1, data) ||
+ __kmp_str_match("enabled", 0, data);
return result;
} // __kmp_str_match_true
Modified: openmp/trunk/runtime/src/ompt-general.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/ompt-general.cpp?rev=343137&r1=343136&r2=343137&view=diff
==============================================================================
--- openmp/trunk/runtime/src/ompt-general.cpp (original)
+++ openmp/trunk/runtime/src/ompt-general.cpp Wed Sep 26 13:19:44 2018
@@ -635,11 +635,14 @@ OMPT_API_ROUTINE int ompt_get_partition_
****************************************************************************/
OMPT_API_ROUTINE int ompt_get_proc_id(void) {
-#if KMP_OS_LINUX
if (__kmp_get_gtid() < 0)
return -1;
-
+#if KMP_OS_LINUX
return sched_getcpu();
+#elif KMP_OS_WINDOWS
+ PROCESSOR_NUMBER pn;
+ GetCurrentProcessorNumberEx(&pn);
+ return 64 * pn.Group + pn.Number;
#else
return -1;
#endif
More information about the Openmp-commits
mailing list