1 /*
2 * kmp_version.cpp
3 */
4
5 //===----------------------------------------------------------------------===//
6 //
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
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "kmp.h"
14 #include "kmp_io.h"
15 #include "kmp_version.h"
16
17 // Replace with snapshot date YYYYMMDD for promotion build.
18 #define KMP_VERSION_BUILD 20140926
19
20 // Helper macros to convert value of macro to string literal.
21 #define _stringer(x) #x
22 #define stringer(x) _stringer(x)
23
24 // Detect compiler.
25 #if KMP_COMPILER_ICC
26 #if __INTEL_COMPILER == 1010
27 #define KMP_COMPILER "Intel(R) C++ Compiler 10.1"
28 #elif __INTEL_COMPILER == 1100
29 #define KMP_COMPILER "Intel(R) C++ Compiler 11.0"
30 #elif __INTEL_COMPILER == 1110
31 #define KMP_COMPILER "Intel(R) C++ Compiler 11.1"
32 #elif __INTEL_COMPILER == 1200
33 #define KMP_COMPILER "Intel(R) C++ Compiler 12.0"
34 #elif __INTEL_COMPILER == 1210
35 #define KMP_COMPILER "Intel(R) C++ Compiler 12.1"
36 #elif __INTEL_COMPILER == 1300
37 #define KMP_COMPILER "Intel(R) C++ Compiler 13.0"
38 #elif __INTEL_COMPILER == 1310
39 #define KMP_COMPILER "Intel(R) C++ Compiler 13.1"
40 #elif __INTEL_COMPILER == 1400
41 #define KMP_COMPILER "Intel(R) C++ Compiler 14.0"
42 #elif __INTEL_COMPILER == 1410
43 #define KMP_COMPILER "Intel(R) C++ Compiler 14.1"
44 #elif __INTEL_COMPILER == 1500
45 #define KMP_COMPILER "Intel(R) C++ Compiler 15.0"
46 #elif __INTEL_COMPILER == 1600
47 #define KMP_COMPILER "Intel(R) C++ Compiler 16.0"
48 #elif __INTEL_COMPILER == 1700
49 #define KMP_COMPILER "Intel(R) C++ Compiler 17.0"
50 #elif __INTEL_COMPILER == 1800
51 #define KMP_COMPILER "Intel(R) C++ Compiler 18.0"
52 #elif __INTEL_COMPILER == 1900
53 #define KMP_COMPILER "Intel(R) C++ Compiler 19.0"
54 #elif __INTEL_COMPILER >= 9900
55 #define KMP_COMPILER "Intel(R) C++ Compiler mainline"
56 #endif
57 #elif KMP_COMPILER_CLANG
58 #define KMP_COMPILER \
59 "Clang " stringer(__clang_major__) "." stringer(__clang_minor__)
60 #elif KMP_COMPILER_GCC
61 #define KMP_COMPILER "GCC " stringer(__GNUC__) "." stringer(__GNUC_MINOR__)
62 #elif KMP_COMPILER_MSVC
63 #define KMP_COMPILER "MSVC " stringer(_MSC_FULL_VER)
64 #endif
65 #ifndef KMP_COMPILER
66 #warning "Unknown compiler"
67 #define KMP_COMPILER "unknown compiler"
68 #endif
69
70 // Detect librray type (perf, stub).
71 #ifdef KMP_STUB
72 #define KMP_LIB_TYPE "stub"
73 #else
74 #define KMP_LIB_TYPE "performance"
75 #endif // KMP_LIB_TYPE
76
77 // Detect link type (static, dynamic).
78 #if KMP_DYNAMIC_LIB
79 #define KMP_LINK_TYPE "dynamic"
80 #else
81 #define KMP_LINK_TYPE "static"
82 #endif // KMP_LINK_TYPE
83
84 // Finally, define strings.
85 #define KMP_LIBRARY KMP_LIB_TYPE " library (" KMP_LINK_TYPE ")"
86 #define KMP_COPYRIGHT ""
87
88 int const __kmp_version_major = KMP_VERSION_MAJOR;
89 int const __kmp_version_minor = KMP_VERSION_MINOR;
90 int const __kmp_version_build = KMP_VERSION_BUILD;
91 int const __kmp_openmp_version = 201611;
92
93 /* Do NOT change the format of this string! Intel(R) Thread Profiler checks for
94 a specific format some changes in the recognition routine there need to be
95 made before this is changed. */
96 char const __kmp_copyright[] = KMP_VERSION_PREFIX KMP_LIBRARY
97 " ver. " stringer(KMP_VERSION_MAJOR) "." stringer(
98 KMP_VERSION_MINOR) "." stringer(KMP_VERSION_BUILD) " " KMP_COPYRIGHT;
99
100 char const __kmp_version_copyright[] = KMP_VERSION_PREFIX KMP_COPYRIGHT;
101 char const __kmp_version_lib_ver[] =
102 KMP_VERSION_PREFIX "version: " stringer(KMP_VERSION_MAJOR) "." stringer(
103 KMP_VERSION_MINOR) "." stringer(KMP_VERSION_BUILD);
104 char const __kmp_version_lib_type[] =
105 KMP_VERSION_PREFIX "library type: " KMP_LIB_TYPE;
106 char const __kmp_version_link_type[] =
107 KMP_VERSION_PREFIX "link type: " KMP_LINK_TYPE;
108 char const __kmp_version_build_time[] = KMP_VERSION_PREFIX "build time: "
109 "no_timestamp";
110 #if KMP_MIC2
111 char const __kmp_version_target_env[] =
112 KMP_VERSION_PREFIX "target environment: MIC2";
113 #endif
114 char const __kmp_version_build_compiler[] =
115 KMP_VERSION_PREFIX "build compiler: " KMP_COMPILER;
116
117 // Called at serial initialization time.
118 static int __kmp_version_1_printed = FALSE;
119
__kmp_print_version_1(void)120 void __kmp_print_version_1(void) {
121 if (__kmp_version_1_printed) {
122 return;
123 }
124 __kmp_version_1_printed = TRUE;
125
126 #ifndef KMP_STUB
127 kmp_str_buf_t buffer;
128 __kmp_str_buf_init(&buffer);
129 // Print version strings skipping initial magic.
130 __kmp_str_buf_print(&buffer, "%s\n",
131 &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN]);
132 __kmp_str_buf_print(&buffer, "%s\n",
133 &__kmp_version_lib_type[KMP_VERSION_MAGIC_LEN]);
134 __kmp_str_buf_print(&buffer, "%s\n",
135 &__kmp_version_link_type[KMP_VERSION_MAGIC_LEN]);
136 __kmp_str_buf_print(&buffer, "%s\n",
137 &__kmp_version_build_time[KMP_VERSION_MAGIC_LEN]);
138 #if KMP_MIC
139 __kmp_str_buf_print(&buffer, "%s\n",
140 &__kmp_version_target_env[KMP_VERSION_MAGIC_LEN]);
141 #endif
142 __kmp_str_buf_print(&buffer, "%s\n",
143 &__kmp_version_build_compiler[KMP_VERSION_MAGIC_LEN]);
144 #if defined(KMP_GOMP_COMPAT)
145 __kmp_str_buf_print(&buffer, "%s\n",
146 &__kmp_version_alt_comp[KMP_VERSION_MAGIC_LEN]);
147 #endif /* defined(KMP_GOMP_COMPAT) */
148 __kmp_str_buf_print(&buffer, "%s\n",
149 &__kmp_version_omp_api[KMP_VERSION_MAGIC_LEN]);
150 __kmp_str_buf_print(&buffer, "%sdynamic error checking: %s\n",
151 KMP_VERSION_PREF_STR,
152 (__kmp_env_consistency_check ? "yes" : "no"));
153 #ifdef KMP_DEBUG
154 for (int i = bs_plain_barrier; i < bs_last_barrier; ++i) {
155 __kmp_str_buf_print(
156 &buffer, "%s%s barrier branch bits: gather=%u, release=%u\n",
157 KMP_VERSION_PREF_STR, __kmp_barrier_type_name[i],
158 __kmp_barrier_gather_branch_bits[i],
159 __kmp_barrier_release_branch_bits[i]); // __kmp_str_buf_print
160 }
161 for (int i = bs_plain_barrier; i < bs_last_barrier; ++i) {
162 __kmp_str_buf_print(
163 &buffer, "%s%s barrier pattern: gather=%s, release=%s\n",
164 KMP_VERSION_PREF_STR, __kmp_barrier_type_name[i],
165 __kmp_barrier_pattern_name[__kmp_barrier_gather_pattern[i]],
166 __kmp_barrier_pattern_name
167 [__kmp_barrier_release_pattern[i]]); // __kmp_str_buf_print
168 }
169 __kmp_str_buf_print(&buffer, "%s\n",
170 &__kmp_version_lock[KMP_VERSION_MAGIC_LEN]);
171 #endif
172 __kmp_str_buf_print(
173 &buffer, "%sthread affinity support: %s\n", KMP_VERSION_PREF_STR,
174 #if KMP_AFFINITY_SUPPORTED
175 (KMP_AFFINITY_CAPABLE()
176 ? (__kmp_affinity_type == affinity_none ? "not used" : "yes")
177 : "no")
178 #else
179 "no"
180 #endif
181 );
182 __kmp_printf("%s", buffer.str);
183 __kmp_str_buf_free(&buffer);
184 K_DIAG(1, ("KMP_VERSION is true\n"));
185 #endif // KMP_STUB
186 } // __kmp_print_version_1
187
188 // Called at parallel initialization time.
189 static int __kmp_version_2_printed = FALSE;
190
__kmp_print_version_2(void)191 void __kmp_print_version_2(void) {
192 if (__kmp_version_2_printed) {
193 return;
194 }
195 __kmp_version_2_printed = TRUE;
196 } // __kmp_print_version_2
197
198 // end of file //
199