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