forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitt_wrapper.cpp
More file actions
26 lines (21 loc) · 736 Bytes
/
itt_wrapper.cpp
File metadata and controls
26 lines (21 loc) · 736 Bytes
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
#include <ittnotify.h>
#include <torch/csrc/itt_wrapper.h>
#include <torch/csrc/profiler/stubs/base.h>
namespace torch::profiler {
static __itt_domain* _itt_domain = __itt_domain_create("PyTorch");
bool itt_is_available() {
return torch::profiler::impl::ittStubs()->enabled();
}
void itt_range_push(const char* msg) {
__itt_string_handle* hsMsg = __itt_string_handle_create(msg);
__itt_task_begin(_itt_domain, __itt_null, __itt_null, hsMsg);
}
void itt_range_pop() {
__itt_task_end(_itt_domain);
}
void itt_mark(const char* msg) {
__itt_string_handle* hsMsg = __itt_string_handle_create(msg);
__itt_task_begin(_itt_domain, __itt_null, __itt_null, hsMsg);
__itt_task_end(_itt_domain);
}
} // namespace torch::profiler