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