Skip to content

Add a script for quick profile analysis#13423

Merged
abudup merged 8 commits into
mainfrom
abudup/profile_explorer
Oct 26, 2022
Merged

Add a script for quick profile analysis#13423
abudup merged 8 commits into
mainfrom
abudup/profile_explorer

Conversation

@abudup
Copy link
Copy Markdown
Contributor

@abudup abudup commented Oct 24, 2022

Description

Implements a Python script for quick analysis of a generated JSON profile from ORT.

Motivation and Context

This PR implements a script that lists kernels that take up the most time in a JSON profile, from both the CPU and GPU points-of-view. The script also supports various options for CSV output, grouping of kernels wrt shape of input tensors and wrt kernel dimensions.

@abudup abudup requested a review from zhangyaobit October 24, 2022 22:59
Comment thread onnxruntime/python/tools/profile_explorer/profile_explorer.py Fixed
@lgtm-com

This comment was marked as outdated.

@lgtm-com

This comment was marked as outdated.

@lgtm-com
Copy link
Copy Markdown

lgtm-com Bot commented Oct 25, 2022

This pull request introduces 1 alert when merging 9c00c29 into 24818cf - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

@cloudhan
Copy link
Copy Markdown
Contributor

I think an example should be pasted.

Comment thread onnxruntime/python/tools/profile_explorer/profile_explorer.py Outdated
@cloudhan
Copy link
Copy Markdown
Contributor

Also, you will need to format your code with black, otherwise, ci linter will spam your PR.

Comment thread onnxruntime/python/tools/profile_explorer/profile_explorer.py Outdated
zhangyaobit
zhangyaobit previously approved these changes Oct 25, 2022
Comment thread onnxruntime/python/tools/profile_explorer/profile_explorer.py
@cloudhan
Copy link
Copy Markdown
Contributor

@mindest FYI

@abudup
Copy link
Copy Markdown
Contributor Author

abudup commented Oct 25, 2022

Also, you will need to format your code with black, otherwise, ci linter will spam your PR.

Done! Thanks!

@abudup abudup closed this Oct 25, 2022
@abudup abudup reopened this Oct 25, 2022
with sp.Popen([demangler, name], stdin=sp.PIPE, stdout=sp.PIPE) as proc:
out, _ = proc.communicate()
return out.decode("utf-8").strip()
except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException'

Except block directly handles BaseException.
@abudup
Copy link
Copy Markdown
Contributor Author

abudup commented Oct 25, 2022

I think an example should be pasted.

Done, I've added an example of a run to the README.

@lgtm-com
Copy link
Copy Markdown

lgtm-com Bot commented Oct 25, 2022

This pull request introduces 1 alert when merging 22086e3 into d80212d - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

@abudup abudup merged commit 8fbdc6c into main Oct 26, 2022
@abudup abudup deleted the abudup/profile_explorer branch October 26, 2022 14:43
linnealovespie pushed a commit that referenced this pull request Oct 28, 2022
### Description
Implements a Python script for quick analysis of a generated JSON
profile from ORT.


### Motivation and Context
This PR implements a script that lists kernels that take up the most
time in a JSON profile, from both the CPU and GPU points-of-view. The
script also supports various options for CSV output, grouping of kernels
wrt shape of input tensors and wrt kernel dimensions.

Co-authored-by: Abhishek Udupa <abhishek.udupa@microsoft.com>
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.

4 participants