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 == 9999
52  #define KMP_COMPILER "Intel C++ Compiler mainline"
53  #endif
54 #elif KMP_COMPILER_CLANG
55  #define KMP_COMPILER "Clang " stringer( __clang_major__ ) "." stringer( __clang_minor__ )
56 #elif KMP_COMPILER_GCC
57  #define KMP_COMPILER "GCC " stringer( __GNUC__ ) "." stringer( __GNUC_MINOR__ )
58 #elif KMP_COMPILER_MSVC
59  #define KMP_COMPILER "MSVC " stringer( _MSC_FULL_VER )
60 #endif
61 #ifndef KMP_COMPILER
62  #warning "Unknown compiler"
63  #define KMP_COMPILER "unknown compiler"
64 #endif
65 
66 // Detect librray type (perf, stub).
67 #ifdef KMP_STUB
68  #define KMP_LIB_TYPE "stub"
69 #else
70  #define KMP_LIB_TYPE "performance"
71 #endif // KMP_LIB_TYPE
72 
73 // Detect link type (static, dynamic).
74 #ifdef KMP_DYNAMIC_LIB
75  #define KMP_LINK_TYPE "dynamic"
76 #else
77  #define KMP_LINK_TYPE "static"
78 #endif // KMP_LINK_TYPE
79 
80 // Finally, define strings.
81 #define KMP_LIBRARY KMP_LIB_TYPE " library (" KMP_LINK_TYPE ")"
82 #define KMP_COPYRIGHT ""
83 
84 int const __kmp_version_major = KMP_VERSION_MAJOR;
85 int const __kmp_version_minor = KMP_VERSION_MINOR;
86 int const __kmp_version_build = KMP_VERSION_BUILD;
87 int const __kmp_openmp_version =
88  #if OMP_40_ENABLED
89  201307;
90  #else
91  201107;
92  #endif
93 
94 /* Do NOT change the format of this string! Intel(R) Thread Profiler checks for a
95  specific format some changes in the recognition routine there need to
96  be made before this is changed.
97 */
98 char const __kmp_copyright[] =
99  KMP_VERSION_PREFIX KMP_LIBRARY
100  " ver. " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR )
101  "." stringer( KMP_VERSION_BUILD ) " "
102  KMP_COPYRIGHT;
103 
104 char const __kmp_version_copyright[] = KMP_VERSION_PREFIX KMP_COPYRIGHT;
105 char const __kmp_version_lib_ver[] = KMP_VERSION_PREFIX "version: " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR ) "." stringer( KMP_VERSION_BUILD );
106 char const __kmp_version_lib_type[] = KMP_VERSION_PREFIX "library type: " KMP_LIB_TYPE;
107 char const __kmp_version_link_type[] = KMP_VERSION_PREFIX "link type: " KMP_LINK_TYPE;
108 char const __kmp_version_build_time[] = KMP_VERSION_PREFIX "build time: " "no_timestamp";
109 #if KMP_MIC2
110  char const __kmp_version_target_env[] = KMP_VERSION_PREFIX "target environment: MIC2";
111 #endif
112 char const __kmp_version_build_compiler[] = KMP_VERSION_PREFIX "build compiler: " KMP_COMPILER;
113 
114 //
115 // Called at serial initialization time.
116 //
117 static int __kmp_version_1_printed = FALSE;
118 
119 void
120 __kmp_print_version_1( void )
121 {
122  if ( __kmp_version_1_printed ) {
123  return;
124  }; // if
125  __kmp_version_1_printed = TRUE;
126 
127  #ifndef KMP_STUB
128  kmp_str_buf_t buffer;
129  __kmp_str_buf_init( & buffer );
130  // Print version strings skipping initial magic.
131  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_ver[ KMP_VERSION_MAGIC_LEN ] );
132  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_type[ KMP_VERSION_MAGIC_LEN ] );
133  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_link_type[ KMP_VERSION_MAGIC_LEN ] );
134  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_time[ KMP_VERSION_MAGIC_LEN ] );
135  #if KMP_MIC
136  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_target_env[ KMP_VERSION_MAGIC_LEN ] );
137  #endif
138  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_compiler[ KMP_VERSION_MAGIC_LEN ] );
139  #if defined(KMP_GOMP_COMPAT)
140  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_alt_comp[ KMP_VERSION_MAGIC_LEN ] );
141  #endif /* defined(KMP_GOMP_COMPAT) */
142  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_omp_api[ KMP_VERSION_MAGIC_LEN ] );
143  __kmp_str_buf_print( & buffer, "%sdynamic error checking: %s\n", KMP_VERSION_PREF_STR, ( __kmp_env_consistency_check ? "yes" : "no" ) );
144  #ifdef KMP_DEBUG
145  for ( int i = bs_plain_barrier; i < bs_last_barrier; ++ i ) {
146  __kmp_str_buf_print(
147  & buffer,
148  "%s%s barrier branch bits: gather=%u, release=%u\n",
149  KMP_VERSION_PREF_STR,
150  __kmp_barrier_type_name[ i ],
151  __kmp_barrier_gather_branch_bits[ i ],
152  __kmp_barrier_release_branch_bits[ i ]
153  ); // __kmp_str_buf_print
154  }; // for i
155  for ( int i = bs_plain_barrier; i < bs_last_barrier; ++ i ) {
156  __kmp_str_buf_print(
157  & buffer,
158  "%s%s barrier pattern: gather=%s, release=%s\n",
159  KMP_VERSION_PREF_STR,
160  __kmp_barrier_type_name[ i ],
161  __kmp_barrier_pattern_name[ __kmp_barrier_gather_pattern[ i ] ],
162  __kmp_barrier_pattern_name[ __kmp_barrier_release_pattern[ i ] ]
163  ); // __kmp_str_buf_print
164  }; // for i
165  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lock[ KMP_VERSION_MAGIC_LEN ] );
166  #endif
167  __kmp_str_buf_print(
168  & buffer,
169  "%sthread affinity support: %s\n",
170  KMP_VERSION_PREF_STR,
171  #if KMP_AFFINITY_SUPPORTED
172  (
173  KMP_AFFINITY_CAPABLE()
174  ?
175  (
176  __kmp_affinity_type == affinity_none
177  ?
178  "not used"
179  :
180  "yes"
181  )
182  :
183  "no"
184  )
185  #else
186  "no"
187  #endif
188  );
189  __kmp_printf( "%s", buffer.str );
190  __kmp_str_buf_free( & buffer );
191  K_DIAG( 1, ( "KMP_VERSION is true\n" ) );
192  #endif // KMP_STUB
193 } // __kmp_print_version_1
194 
195 //
196 // Called at parallel initialization time.
197 //
198 static int __kmp_version_2_printed = FALSE;
199 
200 void
201 __kmp_print_version_2( void ) {
202  if ( __kmp_version_2_printed ) {
203  return;
204  }; // if
205  __kmp_version_2_printed = TRUE;
206 
207  #ifndef KMP_STUB
208  #endif // KMP_STUB
209 } // __kmp_print_version_2
210 
211 // end of file //