Intel® OpenMP* Runtime Library
 All Classes Functions Variables Typedefs Enumerations Enumerator Groups Pages
kmp_version.c
1 /*
2  * kmp_version.c
3  * $Revision: 42483 $
4  * $Date: 2013-07-04 01:05:38 -0500 (Thu, 04 Jul 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_30_ENABLED
102  201107;
103  #else
104  200505;
105  #endif
106 
107 /* Do NOT change the format of this string! Intel(R) Thread Profiler checks for a
108  specific format some changes in the recognition routine there need to
109  be made before this is changed.
110 */
111 char const __kmp_copyright[] =
112  KMP_VERSION_PREFIX KMP_LIBRARY
113  " ver. " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR )
114  "." stringer( KMP_VERSION_BUILD ) " "
115  KMP_COPYRIGHT;
116 
117 char const __kmp_version_copyright[] = KMP_VERSION_PREFIX KMP_COPYRIGHT;
118 char const __kmp_version_lib_ver[] = KMP_VERSION_PREFIX "version: " stringer( KMP_VERSION_MAJOR ) "." stringer( KMP_VERSION_MINOR ) "." stringer( KMP_VERSION_BUILD );
119 char const __kmp_version_lib_type[] = KMP_VERSION_PREFIX "library type: " KMP_LIB_TYPE;
120 char const __kmp_version_link_type[] = KMP_VERSION_PREFIX "link type: " KMP_LINK_TYPE;
121 char const __kmp_version_build_time[] = KMP_VERSION_PREFIX "build time: " _KMP_BUILD_TIME;
122 #if KMP_MIC2
123  char const __kmp_version_target_env[] = KMP_VERSION_PREFIX "target environment: MIC2";
124 #endif
125 char const __kmp_version_build_compiler[] = KMP_VERSION_PREFIX "build compiler: " KMP_COMPILER;
126 
127 //
128 // Called at serial initialization time.
129 //
130 static int __kmp_version_1_printed = FALSE;
131 
132 void
133 __kmp_print_version_1( void )
134 {
135  if ( __kmp_version_1_printed ) {
136  return;
137  }; // if
138  __kmp_version_1_printed = TRUE;
139 
140  #ifndef KMP_STUB
141  kmp_str_buf_t buffer;
142  __kmp_str_buf_init( & buffer );
143  // Print version strings skipping initial magic.
144  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_copyright[ KMP_VERSION_MAGIC_LEN ] );
145  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_ver[ KMP_VERSION_MAGIC_LEN ] );
146  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lib_type[ KMP_VERSION_MAGIC_LEN ] );
147  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_link_type[ KMP_VERSION_MAGIC_LEN ] );
148  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_time[ KMP_VERSION_MAGIC_LEN ] );
149  #if KMP_MIC
150  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_target_env[ KMP_VERSION_MAGIC_LEN ] );
151  #endif
152  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_build_compiler[ KMP_VERSION_MAGIC_LEN ] );
153  #if defined(KMP_GOMP_COMPAT)
154  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_alt_comp[ KMP_VERSION_MAGIC_LEN ] );
155  #endif /* defined(KMP_GOMP_COMPAT) */
156  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_omp_api[ KMP_VERSION_MAGIC_LEN ] );
157  __kmp_str_buf_print( & buffer, "%sdynamic error checking: %s\n", KMP_VERSION_PREF_STR, ( __kmp_env_consistency_check ? "yes" : "no" ) );
158  #ifdef KMP_DEBUG
159  for ( int i = bs_plain_barrier; i < bs_last_barrier; ++ i ) {
160  __kmp_str_buf_print(
161  & buffer,
162  "%s%s barrier branch bits: gather=%u, release=%u\n",
163  KMP_VERSION_PREF_STR,
164  __kmp_barrier_type_name[ i ],
165  __kmp_barrier_gather_branch_bits[ i ],
166  __kmp_barrier_release_branch_bits[ i ]
167  ); // __kmp_str_buf_print
168  }; // for i
169  for ( int i = bs_plain_barrier; i < bs_last_barrier; ++ i ) {
170  __kmp_str_buf_print(
171  & buffer,
172  "%s%s barrier pattern: gather=%s, release=%s\n",
173  KMP_VERSION_PREF_STR,
174  __kmp_barrier_type_name[ i ],
175  __kmp_barrier_pattern_name[ __kmp_barrier_gather_pattern[ i ] ],
176  __kmp_barrier_pattern_name[ __kmp_barrier_release_pattern[ i ] ]
177  ); // __kmp_str_buf_print
178  }; // for i
179  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_lock[ KMP_VERSION_MAGIC_LEN ] );
180  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_perf_v19[ KMP_VERSION_MAGIC_LEN ] );
181  __kmp_str_buf_print( & buffer, "%s\n", & __kmp_version_perf_v106[ KMP_VERSION_MAGIC_LEN ] );
182  #endif
183  __kmp_str_buf_print(
184  & buffer,
185  "%sthread affinity support: %s\n",
186  KMP_VERSION_PREF_STR,
187  #if KMP_OS_WINDOWS || KMP_OS_LINUX
188  (
189  KMP_AFFINITY_CAPABLE()
190  ?
191  (
192  __kmp_affinity_type == affinity_none
193  ?
194  "not used"
195  :
196  "yes"
197  )
198  :
199  "no"
200  )
201  #else
202  "no"
203  #endif
204  );
205  __kmp_printf( "%s", buffer.str );
206  __kmp_str_buf_free( & buffer );
207  K_DIAG( 1, ( "KMP_VERSION is true\n" ) );
208  #endif // KMP_STUB
209 } // __kmp_print_version_1
210 
211 //
212 // Called at parallel initialization time.
213 //
214 static int __kmp_version_2_printed = FALSE;
215 
216 void
217 __kmp_print_version_2( void ) {
218  if ( __kmp_version_2_printed ) {
219  return;
220  }; // if
221  __kmp_version_2_printed = TRUE;
222 
223  #ifndef KMP_STUB
224  #endif // KMP_STUB
225 } // __kmp_print_version_2
226 
227 // end of file //