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