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