1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
#include "kmp_config.h"
#if USE_ITT_BUILD
/*
* kmp_itt.c -- ITT Notify interface.
*/
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.txt for details.
//
//===----------------------------------------------------------------------===//
#include "kmp_itt.h"
#if KMP_DEBUG
#include "kmp_itt.inl"
#endif
#if USE_ITT_NOTIFY
kmp_int32 __kmp_barrier_domain_count;
kmp_int32 __kmp_region_domain_count;
__itt_domain* __kmp_itt_barrier_domains[KMP_MAX_FRAME_DOMAINS];
__itt_domain* __kmp_itt_region_domains[KMP_MAX_FRAME_DOMAINS];
__itt_domain* __kmp_itt_imbalance_domains[KMP_MAX_FRAME_DOMAINS];
kmp_int32 __kmp_itt_region_team_size[KMP_MAX_FRAME_DOMAINS];
__itt_domain * metadata_domain = NULL;
#include "kmp_version.h"
#include "kmp_i18n.h"
#include "kmp_str.h"
KMP_BUILD_ASSERT( sizeof( kmp_itt_mark_t ) == sizeof( __itt_mark_type ) );
/*
Previously used warnings:
KMP_WARNING( IttAllNotifDisabled );
KMP_WARNING( IttObjNotifDisabled );
KMP_WARNING( IttMarkNotifDisabled );
KMP_WARNING( IttUnloadLibFailed, libittnotify );
*/
kmp_int32 __kmp_itt_prepare_delay = 0;
kmp_bootstrap_lock_t __kmp_itt_debug_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_itt_debug_lock );
#endif // USE_ITT_NOTIFY
void __kmp_itt_initialize() {
// ITTNotify library is loaded and initialized at first call to any ittnotify function,
// so we do not need to explicitly load it any more.
// Jusr report OMP RTL version to ITTNotify.
#if USE_ITT_NOTIFY
// Report OpenMP RTL version.
kmp_str_buf_t buf;
__itt_mark_type version;
__kmp_str_buf_init( & buf );
__kmp_str_buf_print(
& buf,
"OMP RTL Version %d.%d.%d",
__kmp_version_major,
__kmp_version_minor,
__kmp_version_build
);
if ( __itt_api_version_ptr != NULL ) {
__kmp_str_buf_print( & buf, ":%s", __itt_api_version() );
}; // if
version = __itt_mark_create( buf.str );
__itt_mark( version, NULL );
__kmp_str_buf_free( & buf );
#endif
} // __kmp_itt_initialize
void __kmp_itt_destroy() {
#if USE_ITT_NOTIFY
__kmp_itt_fini_ittlib();
#endif
} // __kmp_itt_destroy
extern "C"
void
__itt_error_handler(
__itt_error_code err,
va_list args
) {
switch ( err ) {
case __itt_error_no_module : {
char const * library = va_arg( args, char const * );
#if KMP_OS_WINDOWS
int sys_err = va_arg( args, int );
__kmp_msg( kmp_ms_warning, KMP_MSG( IttLoadLibFailed, library ), KMP_SYSERRCODE( sys_err ), __kmp_msg_null );
#else
char const * sys_err = va_arg( args, char const * );
__kmp_msg( kmp_ms_warning, KMP_MSG( IttLoadLibFailed, library ), KMP_SYSERRMESG( sys_err ), __kmp_msg_null );
#endif
} break;
case __itt_error_no_symbol : {
char const * library = va_arg( args, char const * );
char const * symbol = va_arg( args, char const * );
KMP_WARNING( IttLookupFailed, symbol, library );
} break;
case __itt_error_unknown_group : {
char const * var = va_arg( args, char const * );
char const * group = va_arg( args, char const * );
KMP_WARNING( IttUnknownGroup, var, group );
} break;
case __itt_error_env_too_long : {
char const * var = va_arg( args, char const * );
size_t act_len = va_arg( args, size_t );
size_t max_len = va_arg( args, size_t );
KMP_WARNING( IttEnvVarTooLong, var, (unsigned long) act_len, (unsigned long) max_len );
} break;
case __itt_error_cant_read_env : {
char const * var = va_arg( args, char const * );
int sys_err = va_arg( args, int );
__kmp_msg( kmp_ms_warning, KMP_MSG( CantGetEnvVar, var ), KMP_ERR( sys_err ), __kmp_msg_null );
} break;
case __itt_error_system : {
char const * func = va_arg( args, char const * );
int sys_err = va_arg( args, int );
__kmp_msg( kmp_ms_warning, KMP_MSG( IttFunctionError, func ), KMP_SYSERRCODE( sys_err ), __kmp_msg_null );
} break;
default : {
KMP_WARNING( IttUnknownError, err );
};
}; // switch
} // __itt_error_handler
#endif /* USE_ITT_BUILD */
|