Intel® OpenMP* Runtime Library
 All Classes Functions Variables Typedefs Enumerations Enumerator Modules Pages
kmp_version.c
1 /*
2  * kmp_version.c
3  * $Revision: 43435 $
4  * $Date: 2014-09-04 15:16:08 -0500 (Thu, 04 Sep 2014) $
5  */
6 
7 /* <copyright>
8  Copyright (c) 1997-2014 Intel Corporation. All Rights Reserved.
9 
10  Redistribution and use in source and binary forms, with or without
11  modification, are permitted provided that the following conditions
12  are met:
13 
14  * Redistributions of source code must retain the above copyright
15  notice, this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in the
18  documentation and/or other materials provided with the distribution.
19  * Neither the name of Intel Corporation nor the names of its
20  contributors may be used to endorse or promote products derived
21  from this software without specific prior written permission.
22 
23  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 
35 </copyright> */
36 
37 #include "kmp.h"
38 #include "kmp_io.h"
39 #include "kmp_version.h"
40 
41 // Replace with snapshot date YYYYMMDD for promotion build.
42 #define KMP_VERSION_BUILD 20140926
43 
44 // Helper macros to convert value of macro to string literal.
45 #define _stringer( x ) #x
46 #define stringer( x ) _stringer( x )
47 
48 // Detect compiler.
49 #if KMP_COMPILER_ICC
50  #if __INTEL_COMPILER == 1010
51  #define KMP_COMPILER "Intel C++ Compiler 10.1"
52  #elif __INTEL_COMPILER == 1100
53  #define KMP_COMPILER "Intel C++ Compiler 11.0"
54  #elif __INTEL_COMPILER == 1110
55  #define KMP_COMPILER "Intel C++ Compiler 11.1"
56  #elif __INTEL_COMPILER == 1200
57  #define KMP_COMPILER "Intel C++ Compiler 12.0"
58  #elif __INTEL_COMPILER == 1210
59  #define KMP_COMPILER "Intel C++ Compiler 12.1"
60  #elif __INTEL_COMPILER == 1300
61  #define KMP_COMPILER "Intel C++ Compiler 13.0"
62  #elif __INTEL_COMPILER == 1310
63  #define KMP_COMPILER "Intel C++ Compiler 13.1"
64  #elif __INTEL_COMPILER == 1400
65  #define KMP_COMPILER "Intel C++ Compiler 14.0"
66  #elif __INTEL_COMPILER == 1410
67  #define KMP_COMPILER "Intel C++ Compiler 14.1"
68  #elif __INTEL_COMPILER == 1500
69  #define KMP_COMPILER "Intel C++ Compiler 15.0"
70  #elif __INTEL_COMPILER == 9999
71  #define KMP_COMPILER "Intel C++ Compiler mainline"
72  #endif
73 #elif KMP_COMPILER_CLANG
74  #define KMP_COMPILER "Clang " stringer( __clang_major__ ) "." stringer( __clang_minor__ )
75 #elif KMP_COMPILER_GCC
76  #define KMP_COMPILER "GCC " stringer( __GNUC__ ) "." stringer( __GNUC_MINOR__ )
77 #elif KMP_COMPILER_MSVC
78  #define KMP_COMPILER "MSVC " stringer( _MSC_FULL_VER )
79 #endif
80 #ifndef KMP_COMPILER
81  #warning "Unknown compiler"
82  #define KMP_COMPILER "unknown compiler"
83 #endif
84 
85 // Detect librray type (perf, stub).
86 #ifdef KMP_STUB
87  #define KMP_LIB_TYPE "stub"
88 #else
89  #define KMP_LIB_TYPE "performance"
90 #endif // KMP_LIB_TYPE
91 
92 // Detect link type (static, dynamic).
93 #ifdef GUIDEDLL_EXPORTS
94  #define KMP_LINK_TYPE "dynamic"
95 #else
96  #define KMP_LINK_TYPE "static"
97 #endif // KMP_LINK_TYPE
98 
99 // Finally, define strings.
100 #define KMP_LIBRARY KMP_LIB_TYPE " library (" KMP_LINK_TYPE ")"
101 #define KMP_COPYRIGHT ""
102 
103 int const __kmp_version_major = KMP_VERSION_MAJOR;
104 int const __kmp_version_minor = KMP_VERSION_MINOR;
105 int const __kmp_version_build = KMP_VERSION_BUILD;
106 int const __kmp_openmp_version =
107  #if OMP_40_ENABLED
108  201307;
109  #else
110  201107;
111  #endif
112 
113 /* Do NOT change the format of this string! Intel(R) Thread Profiler checks for a
114  specific format some changes in the recognition routine there need to
115  be made before this is changed.
116 */
117 char const __kmp_copyright[] =
118  KMP_VERSION_PREFIX KMP_LIBRARY
119  " ver. " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR )
120  "." stringer( KMP_VERSION_BUILD ) " "
121  KMP_COPYRIGHT;
122 
123 char const __kmp_version_copyright[] = KMP_VERSION_PREFIX KMP_COPYRIGHT;
124 char const __kmp_version_lib_ver[] = KMP_VERSION_PREFIX "version: " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR ) "." stringer( KMP_VERSION_BUILD );
125 char const __kmp_version_lib_type[] = KMP_VERSION_PREFIX "library type: " KMP_LIB_TYPE;
126 char const __kmp_version_link_type[] = KMP_VERSION_PREFIX "link type: " KMP_LINK_TYPE;
127 char const __kmp_version_build_time[] = KMP_VERSION_PREFIX "build time: " _KMP_BUILD_TIME;
128 #if KMP_MIC2
129  char const __kmp_version_target_env[] = KMP_VERSION_PREFIX "target environment: MIC2";
130 #endif
131 char const __kmp_version_build_compiler[] = KMP_VERSION_PREFIX "build compiler: " KMP_COMPILER;
132 
133 //
134 // Called at serial initialization time.
135 //
136 static int __kmp_version_1_printed = FALSE;
137 
138 void
139 __kmp_print_version_1( void )
140 {
141  if ( __kmp_version_1_printed ) {
142  return;
143  }; // if
144  __kmp_version_1_printed = TRUE;
145 
146  #ifndef KMP_STUB
147  kmp_str_buf_t buffer;
148  __kmp_str_buf_init( & buffer );
149  // Print version strings skipping initial magic.
150  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_ver[ KMP_VERSION_MAGIC_LEN ] );
151  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_type[ KMP_VERSION_MAGIC_LEN ] );
152  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_link_type[ KMP_VERSION_MAGIC_LEN ] );
153  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_time[ KMP_VERSION_MAGIC_LEN ] );
154  #if KMP_MIC
155  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_target_env[ KMP_VERSION_MAGIC_LEN ] );
156  #endif
157  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_compiler[ KMP_VERSION_MAGIC_LEN ] );
158  #if defined(KMP_GOMP_COMPAT)
159  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_alt_comp[ KMP_VERSION_MAGIC_LEN ] );
160  #endif /* defined(KMP_GOMP_COMPAT) */
161  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_omp_api[ KMP_VERSION_MAGIC_LEN ] );
162  __kmp_str_buf_print( & buffer, "%sdynamic error checking: %s\n", KMP_VERSION_PREF_STR, ( __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,
167  "%s%s barrier branch bits: gather=%u, release=%u\n",
168  KMP_VERSION_PREF_STR,
169  __kmp_barrier_type_name[ i ],
170  __kmp_barrier_gather_branch_bits[ i ],
171  __kmp_barrier_release_branch_bits[ i ]
172  ); // __kmp_str_buf_print
173  }; // for i
174  for ( int i = bs_plain_barrier; i < bs_last_barrier; ++ i ) {
175  __kmp_str_buf_print(
176  & buffer,
177  "%s%s barrier pattern: gather=%s, release=%s\n",
178  KMP_VERSION_PREF_STR,
179  __kmp_barrier_type_name[ i ],
180  __kmp_barrier_pattern_name[ __kmp_barrier_gather_pattern[ i ] ],
181  __kmp_barrier_pattern_name[ __kmp_barrier_release_pattern[ i ] ]
182  ); // __kmp_str_buf_print
183  }; // for i
184  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lock[ KMP_VERSION_MAGIC_LEN ] );
185  #endif
186  __kmp_str_buf_print(
187  & buffer,
188  "%sthread affinity support: %s\n",
189  KMP_VERSION_PREF_STR,
190  #if KMP_AFFINITY_SUPPORTED
191  (
192  KMP_AFFINITY_CAPABLE()
193  ?
194  (
195  __kmp_affinity_type == affinity_none
196  ?
197  "not used"
198  :
199  "yes"
200  )
201  :
202  "no"
203  )
204  #else
205  "no"
206  #endif
207  );
208  __kmp_printf( "%s", buffer.str );
209  __kmp_str_buf_free( & buffer );
210  K_DIAG( 1, ( "KMP_VERSION is true\n" ) );
211  #endif // KMP_STUB
212 } // __kmp_print_version_1
213 
214 //
215 // Called at parallel initialization time.
216 //
217 static int __kmp_version_2_printed = FALSE;
218 
219 void
220 __kmp_print_version_2( void ) {
221  if ( __kmp_version_2_printed ) {
222  return;
223  }; // if
224  __kmp_version_2_printed = TRUE;
225 
226  #ifndef KMP_STUB
227  #endif // KMP_STUB
228 } // __kmp_print_version_2
229 
230 // end of file //