1 /* 2 * kmp_version.cpp 3 */ 4 5 //===----------------------------------------------------------------------===// 6 // 7 // The LLVM Compiler Infrastructure 8 // 9 // This file is dual licensed under the MIT and the University of Illinois Open 10 // Source Licenses. See LICENSE.txt for details. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "kmp.h" 15 #include "kmp_io.h" 16 #include "kmp_version.h" 17 18 // Replace with snapshot date YYYYMMDD for promotion build. 19 #define KMP_VERSION_BUILD 20140926 20 21 // Helper macros to convert value of macro to string literal. 22 #define _stringer(x) #x 23 #define stringer(x) _stringer(x) 24 25 // Detect compiler. 26 #if KMP_COMPILER_ICC 27 #if __INTEL_COMPILER == 1010 28 #define KMP_COMPILER "Intel C++ Compiler 10.1" 29 #elif __INTEL_COMPILER == 1100 30 #define KMP_COMPILER "Intel C++ Compiler 11.0" 31 #elif __INTEL_COMPILER == 1110 32 #define KMP_COMPILER "Intel C++ Compiler 11.1" 33 #elif __INTEL_COMPILER == 1200 34 #define KMP_COMPILER "Intel C++ Compiler 12.0" 35 #elif __INTEL_COMPILER == 1210 36 #define KMP_COMPILER "Intel C++ Compiler 12.1" 37 #elif __INTEL_COMPILER == 1300 38 #define KMP_COMPILER "Intel C++ Compiler 13.0" 39 #elif __INTEL_COMPILER == 1310 40 #define KMP_COMPILER "Intel C++ Compiler 13.1" 41 #elif __INTEL_COMPILER == 1400 42 #define KMP_COMPILER "Intel C++ Compiler 14.0" 43 #elif __INTEL_COMPILER == 1410 44 #define KMP_COMPILER "Intel C++ Compiler 14.1" 45 #elif __INTEL_COMPILER == 1500 46 #define KMP_COMPILER "Intel C++ Compiler 15.0" 47 #elif __INTEL_COMPILER == 1600 48 #define KMP_COMPILER "Intel C++ Compiler 16.0" 49 #elif __INTEL_COMPILER == 1700 50 #define KMP_COMPILER "Intel C++ Compiler 17.0" 51 #elif __INTEL_COMPILER == 9998 52 #define KMP_COMPILER "Intel C++ Compiler mainline" 53 #elif __INTEL_COMPILER == 9999 54 #define KMP_COMPILER "Intel C++ Compiler mainline" 55 #endif 56 #elif KMP_COMPILER_CLANG 57 #define KMP_COMPILER \ 58 "Clang " stringer(__clang_major__) "." stringer(__clang_minor__) 59 #elif KMP_COMPILER_GCC 60 #define KMP_COMPILER "GCC " stringer(__GNUC__) "." stringer(__GNUC_MINOR__) 61 #elif KMP_COMPILER_MSVC 62 #define KMP_COMPILER "MSVC " stringer(_MSC_FULL_VER) 63 #endif 64 #ifndef KMP_COMPILER 65 #warning "Unknown compiler" 66 #define KMP_COMPILER "unknown compiler" 67 #endif 68 69 // Detect librray type (perf, stub). 70 #ifdef KMP_STUB 71 #define KMP_LIB_TYPE "stub" 72 #else 73 #define KMP_LIB_TYPE "performance" 74 #endif // KMP_LIB_TYPE 75 76 // Detect link type (static, dynamic). 77 #ifdef KMP_DYNAMIC_LIB 78 #define KMP_LINK_TYPE "dynamic" 79 #else 80 #define KMP_LINK_TYPE "static" 81 #endif // KMP_LINK_TYPE 82 83 // Finally, define strings. 84 #define KMP_LIBRARY KMP_LIB_TYPE " library (" KMP_LINK_TYPE ")" 85 #define KMP_COPYRIGHT "" 86 87 int const __kmp_version_major = KMP_VERSION_MAJOR; 88 int const __kmp_version_minor = KMP_VERSION_MINOR; 89 int const __kmp_version_build = KMP_VERSION_BUILD; 90 int const __kmp_openmp_version = 91 #if OMP_50_ENABLED 92 201611; 93 #elif OMP_45_ENABLED 94 201511; 95 #elif OMP_40_ENABLED 96 201307; 97 #else 98 201107; 99 #endif 100 101 /* Do NOT change the format of this string! Intel(R) Thread Profiler checks for 102 a specific format some changes in the recognition routine there need to be 103 made before this is changed. */ 104 char const __kmp_copyright[] = KMP_VERSION_PREFIX KMP_LIBRARY 105 " ver. " stringer(KMP_VERSION_MAJOR) "." stringer( 106 KMP_VERSION_MINOR) "." stringer(KMP_VERSION_BUILD) " " KMP_COPYRIGHT; 107 108 char const __kmp_version_copyright[] = KMP_VERSION_PREFIX KMP_COPYRIGHT; 109 char const __kmp_version_lib_ver[] = 110 KMP_VERSION_PREFIX "version: " stringer(KMP_VERSION_MAJOR) "." stringer( 111 KMP_VERSION_MINOR) "." stringer(KMP_VERSION_BUILD); 112 char const __kmp_version_lib_type[] = 113 KMP_VERSION_PREFIX "library type: " KMP_LIB_TYPE; 114 char const __kmp_version_link_type[] = 115 KMP_VERSION_PREFIX "link type: " KMP_LINK_TYPE; 116 char const __kmp_version_build_time[] = KMP_VERSION_PREFIX "build time: " 117 "no_timestamp"; 118 #if KMP_MIC2 119 char const __kmp_version_target_env[] = 120 KMP_VERSION_PREFIX "target environment: MIC2"; 121 #endif 122 char const __kmp_version_build_compiler[] = 123 KMP_VERSION_PREFIX "build compiler: " KMP_COMPILER; 124 125 // Called at serial initialization time. 126 static int __kmp_version_1_printed = FALSE; 127 128 void __kmp_print_version_1(void) { 129 if (__kmp_version_1_printed) { 130 return; 131 } 132 __kmp_version_1_printed = TRUE; 133 134 #ifndef KMP_STUB 135 kmp_str_buf_t buffer; 136 __kmp_str_buf_init(&buffer); 137 // Print version strings skipping initial magic. 138 __kmp_str_buf_print(&buffer, "%s\n", 139 &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN]); 140 __kmp_str_buf_print(&buffer, "%s\n", 141 &__kmp_version_lib_type[KMP_VERSION_MAGIC_LEN]); 142 __kmp_str_buf_print(&buffer, "%s\n", 143 &__kmp_version_link_type[KMP_VERSION_MAGIC_LEN]); 144 __kmp_str_buf_print(&buffer, "%s\n", 145 &__kmp_version_build_time[KMP_VERSION_MAGIC_LEN]); 146 #if KMP_MIC 147 __kmp_str_buf_print(&buffer, "%s\n", 148 &__kmp_version_target_env[KMP_VERSION_MAGIC_LEN]); 149 #endif 150 __kmp_str_buf_print(&buffer, "%s\n", 151 &__kmp_version_build_compiler[KMP_VERSION_MAGIC_LEN]); 152 #if defined(KMP_GOMP_COMPAT) 153 __kmp_str_buf_print(&buffer, "%s\n", 154 &__kmp_version_alt_comp[KMP_VERSION_MAGIC_LEN]); 155 #endif /* defined(KMP_GOMP_COMPAT) */ 156 __kmp_str_buf_print(&buffer, "%s\n", 157 &__kmp_version_omp_api[KMP_VERSION_MAGIC_LEN]); 158 __kmp_str_buf_print(&buffer, "%sdynamic error checking: %s\n", 159 KMP_VERSION_PREF_STR, 160 (__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, "%s%s barrier branch bits: gather=%u, release=%u\n", 165 KMP_VERSION_PREF_STR, __kmp_barrier_type_name[i], 166 __kmp_barrier_gather_branch_bits[i], 167 __kmp_barrier_release_branch_bits[i]); // __kmp_str_buf_print 168 } 169 for (int i = bs_plain_barrier; i < bs_last_barrier; ++i) { 170 __kmp_str_buf_print( 171 &buffer, "%s%s barrier pattern: gather=%s, release=%s\n", 172 KMP_VERSION_PREF_STR, __kmp_barrier_type_name[i], 173 __kmp_barrier_pattern_name[__kmp_barrier_gather_pattern[i]], 174 __kmp_barrier_pattern_name 175 [__kmp_barrier_release_pattern[i]]); // __kmp_str_buf_print 176 } 177 __kmp_str_buf_print(&buffer, "%s\n", 178 &__kmp_version_lock[KMP_VERSION_MAGIC_LEN]); 179 #endif 180 __kmp_str_buf_print( 181 &buffer, "%sthread affinity support: %s\n", KMP_VERSION_PREF_STR, 182 #if KMP_AFFINITY_SUPPORTED 183 (KMP_AFFINITY_CAPABLE() 184 ? (__kmp_affinity_type == affinity_none ? "not used" : "yes") 185 : "no") 186 #else 187 "no" 188 #endif 189 ); 190 __kmp_printf("%s", buffer.str); 191 __kmp_str_buf_free(&buffer); 192 K_DIAG(1, ("KMP_VERSION is true\n")); 193 #endif // KMP_STUB 194 } // __kmp_print_version_1 195 196 // Called at parallel initialization time. 197 static int __kmp_version_2_printed = FALSE; 198 199 void __kmp_print_version_2(void) { 200 if (__kmp_version_2_printed) { 201 return; 202 } 203 __kmp_version_2_printed = TRUE; 204 } // __kmp_print_version_2 205 206 // end of file // 207