5 //===----------------------------------------------------------------------===//
7 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
8 // See https://llvm.org/LICENSE.txt for license information.
9 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //===----------------------------------------------------------------------===//
15 #include "kmp_version.h"
17 // Replace with snapshot date YYYYMMDD for promotion build.
18 #define KMP_VERSION_BUILD 20140926
20 // Helper macros to convert value of macro to string literal.
21 #define _stringer(x) #x
22 #define stringer(x) _stringer(x)
26 #define KMP_COMPILER __VERSION__
27 #elif KMP_COMPILER_ICC
28 #if __INTEL_COMPILER == 1010
29 #define KMP_COMPILER "Intel(R) C++ Compiler 10.1"
30 #elif __INTEL_COMPILER == 1100
31 #define KMP_COMPILER "Intel(R) C++ Compiler 11.0"
32 #elif __INTEL_COMPILER == 1110
33 #define KMP_COMPILER "Intel(R) C++ Compiler 11.1"
34 #elif __INTEL_COMPILER == 1200
35 #define KMP_COMPILER "Intel(R) C++ Compiler 12.0"
36 #elif __INTEL_COMPILER == 1210
37 #define KMP_COMPILER "Intel(R) C++ Compiler 12.1"
38 #elif __INTEL_COMPILER == 1300
39 #define KMP_COMPILER "Intel(R) C++ Compiler 13.0"
40 #elif __INTEL_COMPILER == 1310
41 #define KMP_COMPILER "Intel(R) C++ Compiler 13.1"
42 #elif __INTEL_COMPILER == 1400
43 #define KMP_COMPILER "Intel(R) C++ Compiler 14.0"
44 #elif __INTEL_COMPILER == 1410
45 #define KMP_COMPILER "Intel(R) C++ Compiler 14.1"
46 #elif __INTEL_COMPILER == 1500
47 #define KMP_COMPILER "Intel(R) C++ Compiler 15.0"
48 #elif __INTEL_COMPILER == 1600
49 #define KMP_COMPILER "Intel(R) C++ Compiler 16.0"
50 #elif __INTEL_COMPILER == 1700
51 #define KMP_COMPILER "Intel(R) C++ Compiler 17.0"
52 #elif __INTEL_COMPILER == 1800
53 #define KMP_COMPILER "Intel(R) C++ Compiler 18.0"
54 #elif __INTEL_COMPILER == 1900
55 #define KMP_COMPILER "Intel(R) C++ Compiler 19.0"
56 #elif __INTEL_COMPILER == 1910
57 #define KMP_COMPILER "Intel(R) C++ Compiler 19.1"
58 #elif __INTEL_COMPILER > 1910
59 #define KMP_COMPILER \
60 "Intel(R) C++ Compiler Classic " stringer(__INTEL_COMPILER) "." stringer( \
61 __INTEL_COMPILER_UPDATE)
63 #elif KMP_COMPILER_CLANG
64 #define KMP_COMPILER \
65 "Clang " stringer(__clang_major__) "." stringer(__clang_minor__)
66 #elif KMP_COMPILER_GCC
67 #define KMP_COMPILER "GCC " stringer(__GNUC__) "." stringer(__GNUC_MINOR__)
68 #elif KMP_COMPILER_MSVC
69 #define KMP_COMPILER "MSVC " stringer(_MSC_FULL_VER)
72 #warning "Unknown compiler"
73 #define KMP_COMPILER "unknown compiler"
76 // Detect librray type (perf, stub).
78 #define KMP_LIB_TYPE "stub"
80 #define KMP_LIB_TYPE "performance"
81 #endif // KMP_LIB_TYPE
83 // Detect link type (static, dynamic).
85 #define KMP_LINK_TYPE "dynamic"
87 #define KMP_LINK_TYPE "static"
88 #endif // KMP_LINK_TYPE
90 // Finally, define strings.
91 #define KMP_LIBRARY KMP_LIB_TYPE " library (" KMP_LINK_TYPE ")"
92 #define KMP_COPYRIGHT ""
94 int const __kmp_version_major
= KMP_VERSION_MAJOR
;
95 int const __kmp_version_minor
= KMP_VERSION_MINOR
;
96 int const __kmp_version_build
= KMP_VERSION_BUILD
;
97 int const __kmp_openmp_version
= 201611;
99 /* Do NOT change the format of this string! Intel(R) Thread Profiler checks for
100 a specific format some changes in the recognition routine there need to be
101 made before this is changed. */
102 char const __kmp_copyright
[] = KMP_VERSION_PREFIX KMP_LIBRARY
103 " ver. " stringer(KMP_VERSION_MAJOR
) "." stringer(
104 KMP_VERSION_MINOR
) "." stringer(KMP_VERSION_BUILD
) " " KMP_COPYRIGHT
;
106 char const __kmp_version_copyright
[] = KMP_VERSION_PREFIX KMP_COPYRIGHT
;
107 char const __kmp_version_lib_ver
[] =
108 KMP_VERSION_PREFIX
"version: " stringer(KMP_VERSION_MAJOR
) "." stringer(
109 KMP_VERSION_MINOR
) "." stringer(KMP_VERSION_BUILD
);
110 char const __kmp_version_lib_type
[] =
111 KMP_VERSION_PREFIX
"library type: " KMP_LIB_TYPE
;
112 char const __kmp_version_link_type
[] =
113 KMP_VERSION_PREFIX
"link type: " KMP_LINK_TYPE
;
114 char const __kmp_version_build_time
[] = KMP_VERSION_PREFIX
"build time: "
117 char const __kmp_version_target_env
[] =
118 KMP_VERSION_PREFIX
"target environment: MIC2";
120 char const __kmp_version_build_compiler
[] =
121 KMP_VERSION_PREFIX
"build compiler: " KMP_COMPILER
;
123 // Called at serial initialization time.
124 static int __kmp_version_1_printed
= FALSE
;
126 void __kmp_print_version_1(void) {
127 if (__kmp_version_1_printed
) {
130 __kmp_version_1_printed
= TRUE
;
133 kmp_str_buf_t buffer
;
134 __kmp_str_buf_init(&buffer
);
135 // Print version strings skipping initial magic.
136 __kmp_str_buf_print(&buffer
, "%s\n",
137 &__kmp_version_lib_ver
[KMP_VERSION_MAGIC_LEN
]);
138 __kmp_str_buf_print(&buffer
, "%s\n",
139 &__kmp_version_lib_type
[KMP_VERSION_MAGIC_LEN
]);
140 __kmp_str_buf_print(&buffer
, "%s\n",
141 &__kmp_version_link_type
[KMP_VERSION_MAGIC_LEN
]);
142 __kmp_str_buf_print(&buffer
, "%s\n",
143 &__kmp_version_build_time
[KMP_VERSION_MAGIC_LEN
]);
145 __kmp_str_buf_print(&buffer
, "%s\n",
146 &__kmp_version_target_env
[KMP_VERSION_MAGIC_LEN
]);
148 __kmp_str_buf_print(&buffer
, "%s\n",
149 &__kmp_version_build_compiler
[KMP_VERSION_MAGIC_LEN
]);
150 #if defined(KMP_GOMP_COMPAT)
151 __kmp_str_buf_print(&buffer
, "%s\n",
152 &__kmp_version_alt_comp
[KMP_VERSION_MAGIC_LEN
]);
153 #endif /* defined(KMP_GOMP_COMPAT) */
154 __kmp_str_buf_print(&buffer
, "%s\n",
155 &__kmp_version_omp_api
[KMP_VERSION_MAGIC_LEN
]);
156 __kmp_str_buf_print(&buffer
, "%sdynamic error checking: %s\n",
157 KMP_VERSION_PREF_STR
,
158 (__kmp_env_consistency_check
? "yes" : "no"));
160 for (int i
= bs_plain_barrier
; i
< bs_last_barrier
; ++i
) {
162 &buffer
, "%s%s barrier branch bits: gather=%u, release=%u\n",
163 KMP_VERSION_PREF_STR
, __kmp_barrier_type_name
[i
],
164 __kmp_barrier_gather_branch_bits
[i
],
165 __kmp_barrier_release_branch_bits
[i
]); // __kmp_str_buf_print
167 for (int i
= bs_plain_barrier
; i
< bs_last_barrier
; ++i
) {
169 &buffer
, "%s%s barrier pattern: gather=%s, release=%s\n",
170 KMP_VERSION_PREF_STR
, __kmp_barrier_type_name
[i
],
171 __kmp_barrier_pattern_name
[__kmp_barrier_gather_pattern
[i
]],
172 __kmp_barrier_pattern_name
173 [__kmp_barrier_release_pattern
[i
]]); // __kmp_str_buf_print
175 __kmp_str_buf_print(&buffer
, "%s\n",
176 &__kmp_version_lock
[KMP_VERSION_MAGIC_LEN
]);
179 &buffer
, "%sthread affinity support: %s\n", KMP_VERSION_PREF_STR
,
180 #if KMP_AFFINITY_SUPPORTED
181 (KMP_AFFINITY_CAPABLE()
182 ? (__kmp_affinity
.type
== affinity_none
? "not used" : "yes")
188 __kmp_printf("%s", buffer
.str
);
189 __kmp_str_buf_free(&buffer
);
190 K_DIAG(1, ("KMP_VERSION is true\n"));
192 } // __kmp_print_version_1
194 // Called at parallel initialization time.
195 static int __kmp_version_2_printed
= FALSE
;
197 void __kmp_print_version_2(void) {
198 if (__kmp_version_2_printed
) {
201 __kmp_version_2_printed
= TRUE
;
202 } // __kmp_print_version_2