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_ICX
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)
62#endif
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)
70#endif
71#ifndef KMP_COMPILER
72#warning "Unknown compiler"
73#define KMP_COMPILER "unknown compiler"
74#endif
75
76// Detect librray type (perf, stub).
77#ifdef KMP_STUB
78#define KMP_LIB_TYPE "stub"
79#else
80#define KMP_LIB_TYPE "performance"
81#endif // KMP_LIB_TYPE
82
83// Detect link type (static, dynamic).
84#if KMP_DYNAMIC_LIB
85#define KMP_LINK_TYPE "dynamic"
86#else
87#define KMP_LINK_TYPE "static"
88#endif // KMP_LINK_TYPE
89
90// Finally, define strings.
91#define KMP_LIBRARY KMP_LIB_TYPE " library (" KMP_LINK_TYPE ")"
92#define KMP_COPYRIGHT ""
93
94int const __kmp_version_major = KMP_VERSION_MAJOR;
95int const __kmp_version_minor = KMP_VERSION_MINOR;
96int const __kmp_version_build = KMP_VERSION_BUILD;
97int const __kmp_openmp_version = 201611;
98
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. */
102char 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;
105
106char const __kmp_version_copyright[] = KMP_VERSION_PREFIX KMP_COPYRIGHT;
107char const __kmp_version_lib_ver[] =
108 KMP_VERSION_PREFIX "version: " stringer(KMP_VERSION_MAJOR) "." stringer(
109 KMP_VERSION_MINOR) "." stringer(KMP_VERSION_BUILD);
110char const __kmp_version_lib_type[] =
111 KMP_VERSION_PREFIX "library type: " KMP_LIB_TYPE;
112char const __kmp_version_link_type[] =
113 KMP_VERSION_PREFIX "link type: " KMP_LINK_TYPE;
114char const __kmp_version_build_time[] = KMP_VERSION_PREFIX "build time: "
115 "no_timestamp";
116#if KMP_MIC2
117char const __kmp_version_target_env[] =
118 KMP_VERSION_PREFIX "target environment: MIC2";
119#endif
120char const __kmp_version_build_compiler[] =
121 KMP_VERSION_PREFIX "build compiler: " KMP_COMPILER;
122
123// Called at serial initialization time.
124static int __kmp_version_1_printed = FALSE;
125
126void __kmp_print_version_1(void) {
127 if (__kmp_version_1_printed) {
128 return;
129 }
130 __kmp_version_1_printed = TRUE;
131
132#ifndef KMP_STUB
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: &buffer, format: "%s\n",
137 &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN]);
138 __kmp_str_buf_print(buffer: &buffer, format: "%s\n",
139 &__kmp_version_lib_type[KMP_VERSION_MAGIC_LEN]);
140 __kmp_str_buf_print(buffer: &buffer, format: "%s\n",
141 &__kmp_version_link_type[KMP_VERSION_MAGIC_LEN]);
142 __kmp_str_buf_print(buffer: &buffer, format: "%s\n",
143 &__kmp_version_build_time[KMP_VERSION_MAGIC_LEN]);
144#if KMP_MIC
145 __kmp_str_buf_print(&buffer, "%s\n",
146 &__kmp_version_target_env[KMP_VERSION_MAGIC_LEN]);
147#endif
148 __kmp_str_buf_print(buffer: &buffer, format: "%s\n",
149 &__kmp_version_build_compiler[KMP_VERSION_MAGIC_LEN]);
150#if defined(KMP_GOMP_COMPAT)
151 __kmp_str_buf_print(buffer: &buffer, format: "%s\n",
152 &__kmp_version_alt_comp[KMP_VERSION_MAGIC_LEN]);
153#endif /* defined(KMP_GOMP_COMPAT) */
154 __kmp_str_buf_print(buffer: &buffer, format: "%s\n",
155 &__kmp_version_omp_api[KMP_VERSION_MAGIC_LEN]);
156 __kmp_str_buf_print(buffer: &buffer, format: "%sdynamic error checking: %s\n",
157 KMP_VERSION_PREF_STR,
158 (__kmp_env_consistency_check ? "yes" : "no"));
159#ifdef KMP_DEBUG
160 for (int i = bs_plain_barrier; i < bs_last_barrier; ++i) {
161 __kmp_str_buf_print(
162 buffer: &buffer, format: "%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
166 }
167 for (int i = bs_plain_barrier; i < bs_last_barrier; ++i) {
168 __kmp_str_buf_print(
169 buffer: &buffer, format: "%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
174 }
175 __kmp_str_buf_print(buffer: &buffer, format: "%s\n",
176 &__kmp_version_lock[KMP_VERSION_MAGIC_LEN]);
177#endif
178 __kmp_str_buf_print(
179 buffer: &buffer, format: "%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")
183 : "no")
184#else
185 "no"
186#endif
187 );
188 __kmp_printf(format: "%s", buffer.str);
189 __kmp_str_buf_free(buffer: &buffer);
190 K_DIAG(1, ("KMP_VERSION is true\n"));
191#endif // KMP_STUB
192} // __kmp_print_version_1
193
194// Called at parallel initialization time.
195static int __kmp_version_2_printed = FALSE;
196
197void __kmp_print_version_2(void) {
198 if (__kmp_version_2_printed) {
199 return;
200 }
201 __kmp_version_2_printed = TRUE;
202} // __kmp_print_version_2
203
204// end of file //
205

source code of openmp/runtime/src/kmp_version.cpp