File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -111,3 +111,13 @@ def validate_usm_type_arg():
111
111
dpctl .utils .validate_usm_type ("inv" , allow_none = True )
112
112
with pytest .raises (ValueError ):
113
113
dpctl .utils .validate_usm_type ("inv" , allow_none = False )
114
+
115
+
116
+ def test_onetrace_enabled ():
117
+ import os
118
+
119
+ v_name = "PTI_ENABLE_COLLECTION"
120
+ v_v = os .getenv (v_name , None )
121
+ with dpctl .utils .onetrace_enabled ():
122
+ assert os .getenv (v_name , None ) == "1"
123
+ assert os .getenv (v_name , None ) == v_v
Original file line number Diff line number Diff line change 20
20
21
21
@contextmanager
22
22
def onetrace_enabled ():
23
- """ Enable `onetrace` collection for kernels executed in this context.
23
+ """Enable `onetrace` collection for kernels executed in this context.
24
24
25
25
N.B.: Proper working of this utility assumes that Python interpreter
26
26
has been launched by `onetrace` tool from intel/pti-gpu project.
27
27
28
- .. Example:: bash
28
+ :Example:
29
+ Launch the Python interpreter using `onetrace` tool: ::
29
30
30
- $ onetrace --conditional-collection -v -t --demangle \
31
- python script.py
31
+ $ onetrace --conditional-collection -v -t --demangle python app.py
32
32
33
- .. Example:: bash
33
+ Now using the context manager in the Python sessions enables
34
+ data collection and its output for every offloaded kernel ::
34
35
35
36
import dpctl.tensor as dpt
36
37
from dpctl.utils import onetrace_enabled
You can’t perform that action at this time.
0 commit comments