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