Skip to content

Adding onetrace_enabled #903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 13, 2022

Conversation

oleksandr-pavlyk
Copy link
Contributor

This PR adds implementation of onetrace_enabled context manager to dpctl.utils namespace.

Example of usage:

(dev_dpctl) opavlyk@opavlyk-mobl:~/repos/dpctl$ ~/pti-gpu/tools/onetrace/build/onetrace --conditional-collection -v -t --demangle ipython
Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207284739877222
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207284790110055
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686020459161393
Python 3.9.12 (main, Jun  1 2022, 11:38:51)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import dpctl.tensor as dpt, dpctl, numpy as np
Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207294358012969
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207294408245381
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686030077296715

Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207294447416361
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207294497648642
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686030166699977

Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207294522074685
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207294572308151
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686030241359487

Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207294602756763
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207294652988740
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686030322040075

In [2]: from dpctl.utils import onetrace_enabled

In [3]: with onetrace_enabled():
   ...:     dpt.linspace(0, 1, num=1000, dtype='f4')
   ...:     dpt.arange(0, 20, dtype='i4')
   ...:
Device Timeline (queue: 0x56315e00e720): linear_sequence_affine_kernel<float, float>[SIMD32 {5; 1; 1} {200; 1; 1}]<1.1> [ns] = 49099144803 (append) 49099446053 (submit) 49101192928 (start) 49101202303 (end)
Device Timeline (queue: 0x56315e00e720): linear_sequence_step_kernel<int>[SIMD32 {1; 1; 1} {20; 1; 1}]<2.1> [ns] = 49154332484 (append) 49154668024 (submit) 49155196149 (start) 49155213440 (end)

In [4]: quit

Segmentation fault

The segmenation fault at the exit is a known issue with ZE-tracer module.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • If this PR is a work in progress, are you filing the PR as a draft?

Example of usage:

```
(dev_dpctl) opavlyk@opavlyk-mobl:~/repos/dpctl$ ~/pti-gpu/tools/onetrace/build/onetrace --conditional-collection -v -t --demangle ipython
Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207284739877222
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207284790110055
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686020459161393
Python 3.9.12 (main, Jun  1 2022, 11:38:51)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import dpctl.tensor as dpt, dpctl, numpy as np
Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207294358012969
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207294408245381
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686030077296715

Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207294447416361
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207294497648642
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686030166699977

Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207294522074685
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207294572308151
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686030241359487

Device Timeline: start time (CLOCK_MONOTONIC_RAW) [ns] = 207294602756763
Device Timeline: start time (CLOCK_MONOTONIC) [ns] = 207294652988740
Device Timeline: start time (CLOCK_REALTIME) [ns] = 1662686030322040075

In [2]: from dpctl.utils import onetrace_enabled

In [3]: with onetrace_enabled():
   ...:     dpt.linspace(0, 1, num=1000, dtype='f4')
   ...:     dpt.arange(0, 20, dtype='i4')
   ...:
Device Timeline (queue: 0x56315e00e720): linear_sequence_affine_kernel<float, float>[SIMD32 {5; 1; 1} {200; 1; 1}]<1.1> [ns] = 49099144803 (append) 49099446053 (submit) 49101192928 (start) 49101202303 (end)
Device Timeline (queue: 0x56315e00e720): linear_sequence_step_kernel<int>[SIMD32 {1; 1; 1} {20; 1; 1}]<2.1> [ns] = 49154332484 (append) 49154668024 (submit) 49155196149 (start) 49155213440 (end)

In [4]: quit

Segmentation fault
```

The segmenation fault at the exit is a known issue with ZE-tracer module.
@github-actions
Copy link

github-actions bot commented Sep 9, 2022

@coveralls
Copy link
Collaborator

coveralls commented Sep 9, 2022

Coverage Status

Coverage increased (+0.01%) to 81.883% when pulling d03f085 on feature/contextmanager-onetrace_enabled into a7dde5a on master.

@oleksandr-pavlyk oleksandr-pavlyk force-pushed the feature/contextmanager-onetrace_enabled branch from b5fc478 to 5993fb1 Compare September 9, 2022 13:36
@oleksandr-pavlyk oleksandr-pavlyk force-pushed the feature/contextmanager-onetrace_enabled branch from 5993fb1 to 22f2df5 Compare September 9, 2022 13:58
@github-actions
Copy link

github-actions bot commented Sep 9, 2022

Array API standard conformance tests failed to run.

@oleksandr-pavlyk oleksandr-pavlyk marked this pull request as ready for review September 9, 2022 15:44
@IntelPython IntelPython deleted a comment from github-actions bot Sep 10, 2022
@IntelPython IntelPython deleted a comment from github-actions bot Sep 10, 2022
@IntelPython IntelPython deleted a comment from github-actions bot Sep 10, 2022
onetrace tool on linux uses execvp to start the application to trace.
It sets LD_PRELOAD and PTI_ENABLE environment variables

https://github.com/intel/pti-gpu/blob/master/loader/loader.cc#L216-L217

The check is added, on Linux, to confirm once that environment does
contain expected variables, and emit a warning otherwise.
@github-actions
Copy link

Array API standard conformance tests failed to run for dpctl=0.14.0dev0=py310h8c27c75_83.

@oleksandr-pavlyk
Copy link
Contributor Author

@diptorupd This PR is now ready. I have added checks on Linux that the interpreter has been launched by onetrace.

@oleksandr-pavlyk oleksandr-pavlyk merged commit 1e70439 into master Sep 13, 2022
@oleksandr-pavlyk oleksandr-pavlyk deleted the feature/contextmanager-onetrace_enabled branch September 13, 2022 13:55
@github-actions
Copy link

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

@github-actions
Copy link

Array API standard conformance tests failed to run for dpctl=0.14.0dev0=py310h8c27c75_90.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants