Intel® OpenMP* Runtime Library
 All Classes Functions Variables Typedefs Enumerations Enumerator Groups Pages
kmp_version.c
1 /*
2  * kmp_version.c
3  * $Revision: 42594 $
4  * $Date: 2013-08-16 04:14:33 -0500 (Fri, 16 Aug 2013) $
5  */
6 
7 /* <copyright>
8  Copyright (c) 1997-2013 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 00000000
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 #ifdef __INTEL_COMPILER
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 == 9999
69  #define KMP_COMPILER "Intel C++ Compiler mainline"
70  #endif
71 #elif defined( __GNUC__ )
72  #define KMP_COMPILER "GCC " stringer( __GNUC__ ) "." stringer( __GNUC_MINOR__ )
73 #endif
74 #ifndef KMP_COMPILER
75  #warning "Unknown compiler"
76  #define KMP_COMPILER "unknown compiler"
77 #endif
78 
79 // Detect librray type (perf, stub).
80 #ifdef KMP_STUB
81  #define KMP_LIB_TYPE "stub"
82 #else
83  #define KMP_LIB_TYPE "performance"
84 #endif // KMP_LIB_TYPE
85 
86 // Detect link type (static, dynamic).
87 #ifdef GUIDEDLL_EXPORTS
88  #define KMP_LINK_TYPE "dynamic"
89 #else
90  #define KMP_LINK_TYPE "static"
91 #endif // KMP_LINK_TYPE
92 
93 // Finally, define strings.
94 #define KMP_LIBRARY KMP_LIB_TYPE " library (" KMP_LINK_TYPE ")"
95 #define KMP_COPYRIGHT "Copyright (C) 1997-2013, Intel Corporation. All Rights Reserved."
96 
97 int const __kmp_version_major = KMP_VERSION_MAJOR;
98 int const __kmp_version_minor = KMP_VERSION_MINOR;
99 int const __kmp_version_build = KMP_VERSION_BUILD;
100 int const __kmp_openmp_version =
101  #if OMP_40_ENABLED
102  201307;
103  #elif OMP_30_ENABLED
104  201107;
105  #else
106  200505;
107  #endif
108 
109 /* Do NOT change the format of this string! Intel(R) Thread Profiler checks for a
110  specific format some changes in the recognition routine there need to
111  be made before this is changed.
112 */
113 char const __kmp_copyright[] =
114  KMP_VERSION_PREFIX KMP_LIBRARY
115  " ver. " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR )
116  "." stringer( KMP_VERSION_BUILD ) " "
117  KMP_COPYRIGHT;
118 
119 char const __kmp_version_copyright[] = KMP_VERSION_PREFIX KMP_COPYRIGHT;
120 char const __kmp_version_lib_ver[] = KMP_VERSION_PREFIX "version: " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR ) "." stringer( KMP_VERSION_BUILD );
121 char const __kmp_version_lib_type[] = KMP_VERSION_PREFIX "library type: " KMP_LIB_TYPE;
122 char const __kmp_version_link_type[] = KMP_VERSION_PREFIX "link type: " KMP_LINK_TYPE;
123 char const __kmp_version_build_time[] = KMP_VERSION_PREFIX "build time: " _KMP_BUILD_TIME;
124 #if KMP_MIC2
125  char const __kmp_version_target_env[] = KMP_VERSION_PREFIX "target environment: MIC2";
126 #endif
127 char const __kmp_version_build_compiler[] = KMP_VERSION_PREFIX "build compiler: " KMP_COMPILER;
128 
129 //
130 // Called at serial initialization time.
131 //
132 static int __kmp_version_1_printed = FALSE;
133 
134 void
135 __kmp_print_version_1( void )
136 {
137  if ( __kmp_version_1_printed ) {
138  return;
139  }; // if
140  __kmp_version_1_printed = TRUE;
141 
142  #ifndef KMP_STUB
143  kmp_str_buf_t buffer;
144  __kmp_str_buf_init( & buffer );
145  // Print version strings skipping initial magic.
146  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_copyright[ KMP_VERSION_MAGIC_LEN ] );
147  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_ver[ KMP_VERSION_MAGIC_LEN ] );
148  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_type[ KMP_VERSION_MAGIC_LEN ] );
149  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_link_type[ KMP_VERSION_MAGIC_LEN ] );
150  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_time[ KMP_VERSION_MAGIC_LEN ] );
151  #if KMP_MIC
152  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_target_env[ KMP_VERSION_MAGIC_LEN ] );
153  #endif
154  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_compiler[ KMP_VERSION_MAGIC_LEN ] );
155  #if defined(KMP_GOMP_COMPAT)
156  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_alt_comp[ KMP_VERSION_MAGIC_LEN ] );
157  #endif /* defined(KMP_GOMP_COMPAT) */
158  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_omp_api[ KMP_VERSION_MAGIC_LEN ] );
159  __kmp_str_buf_print( & buffer, "%sdynamic error checking: %s\n", KMP_VERSION_PREF_STR, ( __kmp_env_consistency_check ? "yes" : "no" ) );
160  #ifdef KMP_DEBUG
161  for ( int i = bs_plain_barrier; i < bs_last_barrier; ++ i ) {
162  __kmp_str_buf_print(
163  & buffer,
164  "%s%s barrier branch bits: gather=%u, release=%u\n",
165  KMP_VERSION_PREF_STR,
166  __kmp_barrier_type_name[ i ],
167  __kmp_barrier_gather_branch_bits[ i ],
168  __kmp_barrier_release_branch_bits[ i ]
169  ); // __kmp_str_buf_print
170  }; // for i
171  for ( int i = bs_plain_barrier; i < bs_last_barrier; ++ i ) {
172  __kmp_str_buf_print(
173  & buffer,
174  "%s%s barrier pattern: gather=%s, release=%s\n",
175  KMP_VERSION_PREF_STR,
176  __kmp_barrier_type_name[ i ],
177  __kmp_barrier_pattern_name[ __kmp_barrier_gather_pattern[ i ] ],
178  __kmp_barrier_pattern_name[ __kmp_barrier_release_pattern[ i ] ]
179  ); // __kmp_str_buf_print
180  }; // for i
181  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lock[ KMP_VERSION_MAGIC_LEN ] );
182  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_perf_v19[ KMP_VERSION_MAGIC_LEN ] );
183  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_perf_v106[ KMP_VERSION_MAGIC_LEN ] );
184  #endif
185  __kmp_str_buf_print(
186  & buffer,
187  "%sthread affinity support: %s\n",
188  KMP_VERSION_PREF_STR,
189  #if KMP_OS_WINDOWS || KMP_OS_LINUX
190  (
191  KMP_AFFINITY_CAPABLE()
192  ?
193  (
194  __kmp_affinity_type == affinity_none
195  ?
196  "not used"
197  :
198  "yes"
199  )
200  :
201  "no"
202  )
203  #else
204  "no"
205  #endif
206  );
207  __kmp_printf( "%s", buffer.str );
208  __kmp_str_buf_free( & buffer );
209  K_DIAG( 1, ( "KMP_VERSION is true\n" ) );
210  #endif // KMP_STUB
211 } // __kmp_print_version_1
212 
213 //
214 // Called at parallel initialization time.
215 //
216 static int __kmp_version_2_printed = FALSE;
217 
218 void
219 __kmp_print_version_2( void ) {
220  if ( __kmp_version_2_printed ) {
221  return;
222  }; // if
223  __kmp_version_2_printed = TRUE;
224 
225  #ifndef KMP_STUB
226  #endif // KMP_STUB
227 } // __kmp_print_version_2
228 
229 // end of file //